Subversion Repositories SmartDukaan

Rev

Rev 29990 | Rev 30087 | 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
 
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,sum(cast(uwh.amount AS int))) FROM FofoStore fs"
15
				+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id"
16
				+ " left join PartnerCollectionPlan pcp on (pcp.fofoId = fs.id and pcp.createTimestamp > :startDate)"
17
				+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
18
				+ "and uwh.timestamp > :startDate and fs.id in :fofoIds and fs.internal=0 group by fs.id"), })
28521 amit.gupta 19
public class UserWallet {
20
 
21552 ashik.ali 21
	@Id
28521 amit.gupta 22
	@GeneratedValue(strategy = GenerationType.IDENTITY)
21552 ashik.ali 23
	private int id;
24
	private int userId;
25
	private int amount;
28521 amit.gupta 26
 
22550 ashik.ali 27
	@Column(name = "refundable_amount")
28
	private int refundableAmount;
28521 amit.gupta 29
 
21552 ashik.ali 30
	public int getId() {
31
		return id;
32
	}
28521 amit.gupta 33
 
21552 ashik.ali 34
	public void setId(int id) {
35
		this.id = id;
36
	}
28521 amit.gupta 37
 
21552 ashik.ali 38
	public int getUserId() {
39
		return userId;
40
	}
25546 amit.gupta 41
 
21552 ashik.ali 42
	public void setUserId(int userId) {
43
		this.userId = userId;
44
	}
28521 amit.gupta 45
 
21552 ashik.ali 46
	public int getAmount() {
25546 amit.gupta 47
		return amount;
21552 ashik.ali 48
	}
28521 amit.gupta 49
 
21552 ashik.ali 50
	public void setAmount(int amount) {
51
		this.amount = amount;
52
	}
28521 amit.gupta 53
 
22550 ashik.ali 54
	public int getRefundableAmount() {
55
		return refundableAmount;
21552 ashik.ali 56
	}
28521 amit.gupta 57
 
22550 ashik.ali 58
	public void setRefundableAmount(int refundableAmount) {
59
		this.refundableAmount = refundableAmount;
21552 ashik.ali 60
	}
28521 amit.gupta 61
 
21602 ashik.ali 62
	@Override
21924 ashik.ali 63
	public int hashCode() {
64
		final int prime = 31;
65
		int result = 1;
66
		result = prime * result + id;
67
		return result;
68
	}
28521 amit.gupta 69
 
21924 ashik.ali 70
	@Override
71
	public boolean equals(Object obj) {
72
		if (this == obj)
73
			return true;
74
		if (obj == null)
75
			return false;
76
		if (getClass() != obj.getClass())
77
			return false;
78
		UserWallet other = (UserWallet) obj;
79
		if (id != other.id)
80
			return false;
81
		return true;
82
	}
28521 amit.gupta 83
 
21924 ashik.ali 84
	@Override
21602 ashik.ali 85
	public String toString() {
22550 ashik.ali 86
		return "UserWallet [id=" + id + ", userId=" + userId + ", amount=" + amount + ", refundableAmount="
87
				+ refundableAmount + "]";
21602 ashik.ali 88
	}
28521 amit.gupta 89
 
22653 ashik.ali 90
}