Subversion Repositories SmartDukaan

Rev

Rev 30087 | Rev 30330 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21716 ashik.ali 1
package com.spice.profitmandi.dao.entity.transaction;
21552 ashik.ali 2
 
29990 amit.gupta 3
import javax.persistence.*;
21552 ashik.ali 4
 
5
@Entity
28521 amit.gupta 6
@Table(name = "transaction.userwallet", schema = "transaction")
7
@NamedQueries({
29990 amit.gupta 8
		@NamedQuery(name = "UserWallet.getSummary", query = "select new com.spice.profitmandi.dao.model.AccountStatementModel(uwh.referenceType, sum(case when uwh.amount>0 then amount else 0 end), sum(case when uwh.amount<0 then -amount else 0 end))\tfrom UserWalletHistory uwh where uwh.walletId=:walletId \tand uwh.timestamp between :startDate and :endDate group by uwh.referenceType"),
30077 tejbeer 9
		@NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount)) FROM FofoStore fs"
10
				+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id "
11
				+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
12
				+ "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId"),
13
 
30087 tejbeer 14
		@NamedQuery(name = "UserWallet.getPartnerWiseTargetCollections", query = "SELECT new com.spice.profitmandi.dao.model.PartnerCollectionPlanModel(fs.id,case when pcp.collectionPlan is not null then cast(pcp.collectionPlan As long) else 0 end,"
30137 tejbeer 15
				+ " sum(cast(uwh.amount AS int)),pcp.authId,pcp.commitedTimestamp) FROM FofoStore fs"
30087 tejbeer 16
				+ " left join UserWallet uw on uw.userId = fs.id "
17
				+ " left join UserWalletHistory uwh on (uwh.walletId = uw.id and"
18
				+ " uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY')"
30137 tejbeer 19
				+ "	and uwh.timestamp >= :startDate )"
20
				+ " left join PartnerCollectionPlan pcp on (pcp.fofoId = fs.id and pcp.commitedTimestamp >= :startDate"
21
				+ "  and pcp.active = 1)" + " where  fs.id in :fofoIds and fs.internal=0 group by fs.id"), })
28521 amit.gupta 22
public class UserWallet {
23
 
21552 ashik.ali 24
	@Id
28521 amit.gupta 25
	@GeneratedValue(strategy = GenerationType.IDENTITY)
21552 ashik.ali 26
	private int id;
27
	private int userId;
28
	private int amount;
28521 amit.gupta 29
 
22550 ashik.ali 30
	@Column(name = "refundable_amount")
31
	private int refundableAmount;
28521 amit.gupta 32
 
21552 ashik.ali 33
	public int getId() {
34
		return id;
35
	}
28521 amit.gupta 36
 
21552 ashik.ali 37
	public void setId(int id) {
38
		this.id = id;
39
	}
28521 amit.gupta 40
 
21552 ashik.ali 41
	public int getUserId() {
42
		return userId;
43
	}
25546 amit.gupta 44
 
21552 ashik.ali 45
	public void setUserId(int userId) {
46
		this.userId = userId;
47
	}
28521 amit.gupta 48
 
21552 ashik.ali 49
	public int getAmount() {
25546 amit.gupta 50
		return amount;
21552 ashik.ali 51
	}
28521 amit.gupta 52
 
21552 ashik.ali 53
	public void setAmount(int amount) {
54
		this.amount = amount;
55
	}
28521 amit.gupta 56
 
22550 ashik.ali 57
	public int getRefundableAmount() {
58
		return refundableAmount;
21552 ashik.ali 59
	}
28521 amit.gupta 60
 
22550 ashik.ali 61
	public void setRefundableAmount(int refundableAmount) {
62
		this.refundableAmount = refundableAmount;
21552 ashik.ali 63
	}
28521 amit.gupta 64
 
21602 ashik.ali 65
	@Override
21924 ashik.ali 66
	public int hashCode() {
67
		final int prime = 31;
68
		int result = 1;
69
		result = prime * result + id;
70
		return result;
71
	}
28521 amit.gupta 72
 
21924 ashik.ali 73
	@Override
74
	public boolean equals(Object obj) {
75
		if (this == obj)
76
			return true;
77
		if (obj == null)
78
			return false;
79
		if (getClass() != obj.getClass())
80
			return false;
81
		UserWallet other = (UserWallet) obj;
82
		if (id != other.id)
83
			return false;
84
		return true;
85
	}
28521 amit.gupta 86
 
21924 ashik.ali 87
	@Override
21602 ashik.ali 88
	public String toString() {
22550 ashik.ali 89
		return "UserWallet [id=" + id + ", userId=" + userId + ", amount=" + amount + ", refundableAmount="
90
				+ refundableAmount + "]";
21602 ashik.ali 91
	}
28521 amit.gupta 92
 
22653 ashik.ali 93
}