| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import javax.persistence.*;
|
3 |
import javax.persistence.*;
|
| 4 |
|
4 |
|
| 5 |
@Entity
|
5 |
@Entity
|
| 6 |
@Table(name = "transaction.userwallet")
|
6 |
@Table(name = "transaction.userwallet")
|
| - |
|
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"),
|
| - |
|
9 |
|
| 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') 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"),
|
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"),
|
| 8 |
|
11 |
|
| 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"),
|
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"),
|
| 10 |
|
13 |
|
| 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"),})
|
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"),})
|
| 12 |
|
15 |
|