| 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
|
| 31860 |
tejbeer |
6 |
@Table(name = "transaction.userwallet")
|
|
|
7 |
@NamedQueries({@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"), @NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount), uwh.referenceType) FROM FofoStore fs" + " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id " + "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') " + "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId, uwh.referenceType"),
|
| 30077 |
tejbeer |
8 |
|
| 31860 |
tejbeer |
9 |
@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)),pcp.authId,pcp.createTimestamp, pcp.commitedTimestamp) FROM FofoStore fs" + " left join UserWallet uw on uw.userId = fs.id " + " left join UserWalletHistory uwh on (uwh.walletId = uw.id and" + " uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY')" + " and uwh.timestamp >= :startDate )" + " left join PartnerCollectionPlan pcp on (pcp.fofoId = fs.id and pcp.commitedTimestamp >= :startDate" + " and pcp.active = 1)" + " where fs.id in :fofoIds and fs.internal=0 group by fs.id"),
|
| 30330 |
tejbeer |
10 |
|
| 31860 |
tejbeer |
11 |
@NamedQuery(name = "UserWallet.getPartnerWiseCollectionAchievement", query = "SELECT new com.spice.profitmandi.dao.model.PartnerCollectionAchievementModel(fs.id," + " sum(cast(uwh.amount AS int))) FROM FofoStore fs" + " left join UserWallet uw on uw.userId = fs.id " + " left join UserWalletHistory uwh on (uwh.walletId = uw.id and" + " uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY')" + " and uwh.timestamp >= :startDate )" + " where fs.id in :fofoIds and fs.internal=0 group by fs.id"),})
|
| 30330 |
tejbeer |
12 |
|
| 28521 |
amit.gupta |
13 |
public class UserWallet {
|
|
|
14 |
|
| 31860 |
tejbeer |
15 |
@Id
|
|
|
16 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
17 |
private int id;
|
|
|
18 |
private int userId;
|
|
|
19 |
private int amount;
|
| 28521 |
amit.gupta |
20 |
|
| 31860 |
tejbeer |
21 |
@Column(name = "refundable_amount")
|
|
|
22 |
private int refundableAmount;
|
| 28521 |
amit.gupta |
23 |
|
| 31860 |
tejbeer |
24 |
public int getId() {
|
|
|
25 |
return id;
|
|
|
26 |
}
|
| 28521 |
amit.gupta |
27 |
|
| 31860 |
tejbeer |
28 |
public void setId(int id) {
|
|
|
29 |
this.id = id;
|
|
|
30 |
}
|
| 28521 |
amit.gupta |
31 |
|
| 31860 |
tejbeer |
32 |
public int getUserId() {
|
|
|
33 |
return userId;
|
|
|
34 |
}
|
| 25546 |
amit.gupta |
35 |
|
| 31860 |
tejbeer |
36 |
public void setUserId(int userId) {
|
|
|
37 |
this.userId = userId;
|
|
|
38 |
}
|
| 28521 |
amit.gupta |
39 |
|
| 31860 |
tejbeer |
40 |
public int getAmount() {
|
|
|
41 |
return amount;
|
|
|
42 |
}
|
| 28521 |
amit.gupta |
43 |
|
| 31860 |
tejbeer |
44 |
public void setAmount(int amount) {
|
|
|
45 |
this.amount = amount;
|
|
|
46 |
}
|
| 28521 |
amit.gupta |
47 |
|
| 31860 |
tejbeer |
48 |
public int getRefundableAmount() {
|
|
|
49 |
return refundableAmount;
|
|
|
50 |
}
|
| 28521 |
amit.gupta |
51 |
|
| 31860 |
tejbeer |
52 |
public void setRefundableAmount(int refundableAmount) {
|
|
|
53 |
this.refundableAmount = refundableAmount;
|
|
|
54 |
}
|
| 28521 |
amit.gupta |
55 |
|
| 31860 |
tejbeer |
56 |
@Override
|
|
|
57 |
public int hashCode() {
|
|
|
58 |
final int prime = 31;
|
|
|
59 |
int result = 1;
|
|
|
60 |
result = prime * result + id;
|
|
|
61 |
return result;
|
|
|
62 |
}
|
| 28521 |
amit.gupta |
63 |
|
| 31860 |
tejbeer |
64 |
@Override
|
|
|
65 |
public boolean equals(Object obj) {
|
|
|
66 |
if (this == obj)
|
|
|
67 |
return true;
|
|
|
68 |
if (obj == null)
|
|
|
69 |
return false;
|
|
|
70 |
if (getClass() != obj.getClass())
|
|
|
71 |
return false;
|
|
|
72 |
UserWallet other = (UserWallet) obj;
|
|
|
73 |
if (id != other.id)
|
|
|
74 |
return false;
|
|
|
75 |
return true;
|
|
|
76 |
}
|
| 28521 |
amit.gupta |
77 |
|
| 31860 |
tejbeer |
78 |
@Override
|
|
|
79 |
public String toString() {
|
|
|
80 |
return "UserWallet [id=" + id + ", userId=" + userId + ", amount=" + amount + ", refundableAmount=" + refundableAmount + "]";
|
|
|
81 |
}
|
| 28521 |
amit.gupta |
82 |
|
| 22653 |
ashik.ali |
83 |
}
|