| Line 17... |
Line 17... |
| 17 |
" else 0 end as float), lii.serialNumber, op.description, o.invoiceNumber, " +
|
17 |
" else 0 end as float), lii.serialNumber, op.description, o.invoiceNumber, " +
|
| 18 |
" case when op.rejectTimestamp between :startDate and :endDate then op.rejectTimestamp else op.createTimestamp end) from "
|
18 |
" case when op.rejectTimestamp between :startDate and :endDate then op.rejectTimestamp else op.createTimestamp end) from "
|
| 19 |
+ " OfferPayout op join LineItemImei lii on (op.serialNumber=lii.serialNumber) join LineItem li on li.id=lii.lineItemId "
|
19 |
+ " OfferPayout op join LineItemImei lii on (op.serialNumber=lii.serialNumber) join LineItem li on li.id=lii.lineItemId "
|
| 20 |
+ " join Order o on (o.retailerId=op.fofoId and o.billingTimestamp is not null and o.id=li.orderId) "
|
20 |
+ " join Order o on (o.retailerId=op.fofoId and o.billingTimestamp is not null and o.id=li.orderId) "
|
| 21 |
+ " where op.createTimestamp >= :cnDate and ((op.createTimestamp between :startDate and :endDate) or (op.rejectTimestamp between :startDate and :endDate))"
|
21 |
+ " where op.createTimestamp >= :cnDate and ((op.createTimestamp between :startDate and :endDate) or (op.rejectTimestamp between :startDate and :endDate))"
|
| 22 |
+ " and lii.id=(select max(lii2.id) from LineItemImei lii2 where lii2.lineItemId=lii.lineItemId)")
|
22 |
+ " and lii.id=(select max(lii2.id) from LineItemImei lii2 join LineItem li2 on li2.id=lii2.lineItemId join Order o2 on o2.id=li2.orderId where lii2.serialNumber=lii.serialNumber and o2.retailerId=op.fofoId)")
|
| 23 |
})
|
23 |
})
|
| 24 |
public class OfferPayout {
|
24 |
public class OfferPayout {
|
| 25 |
@Id
|
25 |
@Id
|
| 26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 27 |
private long id;
|
27 |
private long id;
|