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