| Line 9... |
Line 9... |
| 9 |
@NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount)) FROM FofoStore fs"
|
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 "
|
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') "
|
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"),
|
12 |
+ "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId"),
|
| 13 |
|
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"
|
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"
|
| 15 |
+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id"
|
16 |
+ " left join UserWallet uw on uw.userId = fs.id "
|
| 16 |
+ " left join PartnerCollectionPlan pcp on (pcp.fofoId = fs.id and pcp.createTimestamp > :startDate)"
|
17 |
+ " left join UserWalletHistory uwh on (uwh.walletId = uw.id and"
|
| 17 |
+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
|
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)"
|
| 18 |
+ "and uwh.timestamp > :startDate and fs.id in :fofoIds and fs.internal=0 group by fs.id"), })
|
22 |
+ " where fs.id in :fofoIds and fs.internal=0 group by fs.id"), })
|
| 19 |
public class UserWallet {
|
23 |
public class UserWallet {
|
| 20 |
|
24 |
|
| 21 |
@Id
|
25 |
@Id
|
| 22 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 23 |
private int id;
|
27 |
private int id;
|