| 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")
|
| 33702 |
amit.gupta |
7 |
@NamedQueries({
|
|
|
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 |
|
| 33703 |
amit.gupta |
10 |
@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') or (uwh.referenceType='CREDIT_LIMIT' and uwh.amount >0))" + "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId, uwh.referenceType"),
|
| 33702 |
amit.gupta |
11 |
|
| 31860 |
tejbeer |
12 |
@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 |
13 |
|
| 31860 |
tejbeer |
14 |
@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 |
15 |
|
| 28521 |
amit.gupta |
16 |
public class UserWallet {
|
|
|
17 |
|
| 31860 |
tejbeer |
18 |
@Id
|
|
|
19 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
20 |
private int id;
|
|
|
21 |
private int userId;
|
|
|
22 |
private int amount;
|
| 28521 |
amit.gupta |
23 |
|
| 31860 |
tejbeer |
24 |
@Column(name = "refundable_amount")
|
|
|
25 |
private int refundableAmount;
|
| 28521 |
amit.gupta |
26 |
|
| 31860 |
tejbeer |
27 |
public int getId() {
|
|
|
28 |
return id;
|
|
|
29 |
}
|
| 28521 |
amit.gupta |
30 |
|
| 31860 |
tejbeer |
31 |
public void setId(int id) {
|
|
|
32 |
this.id = id;
|
|
|
33 |
}
|
| 28521 |
amit.gupta |
34 |
|
| 31860 |
tejbeer |
35 |
public int getUserId() {
|
|
|
36 |
return userId;
|
|
|
37 |
}
|
| 25546 |
amit.gupta |
38 |
|
| 31860 |
tejbeer |
39 |
public void setUserId(int userId) {
|
|
|
40 |
this.userId = userId;
|
|
|
41 |
}
|
| 28521 |
amit.gupta |
42 |
|
| 31860 |
tejbeer |
43 |
public int getAmount() {
|
|
|
44 |
return amount;
|
|
|
45 |
}
|
| 28521 |
amit.gupta |
46 |
|
| 31860 |
tejbeer |
47 |
public void setAmount(int amount) {
|
|
|
48 |
this.amount = amount;
|
|
|
49 |
}
|
| 28521 |
amit.gupta |
50 |
|
| 31860 |
tejbeer |
51 |
public int getRefundableAmount() {
|
|
|
52 |
return refundableAmount;
|
|
|
53 |
}
|
| 28521 |
amit.gupta |
54 |
|
| 31860 |
tejbeer |
55 |
public void setRefundableAmount(int refundableAmount) {
|
|
|
56 |
this.refundableAmount = refundableAmount;
|
|
|
57 |
}
|
| 28521 |
amit.gupta |
58 |
|
| 31860 |
tejbeer |
59 |
@Override
|
|
|
60 |
public int hashCode() {
|
|
|
61 |
final int prime = 31;
|
|
|
62 |
int result = 1;
|
|
|
63 |
result = prime * result + id;
|
|
|
64 |
return result;
|
|
|
65 |
}
|
| 28521 |
amit.gupta |
66 |
|
| 31860 |
tejbeer |
67 |
@Override
|
|
|
68 |
public boolean equals(Object obj) {
|
|
|
69 |
if (this == obj)
|
|
|
70 |
return true;
|
|
|
71 |
if (obj == null)
|
|
|
72 |
return false;
|
|
|
73 |
if (getClass() != obj.getClass())
|
|
|
74 |
return false;
|
|
|
75 |
UserWallet other = (UserWallet) obj;
|
|
|
76 |
if (id != other.id)
|
|
|
77 |
return false;
|
|
|
78 |
return true;
|
|
|
79 |
}
|
| 28521 |
amit.gupta |
80 |
|
| 31860 |
tejbeer |
81 |
@Override
|
|
|
82 |
public String toString() {
|
|
|
83 |
return "UserWallet [id=" + id + ", userId=" + userId + ", amount=" + amount + ", refundableAmount=" + refundableAmount + "]";
|
|
|
84 |
}
|
| 28521 |
amit.gupta |
85 |
|
| 22653 |
ashik.ali |
86 |
}
|