| Line 44... |
Line 44... |
| 44 |
@NamedQuery(name = "ActivatedImei.selectActivatedUpdationDate", query = "select new com.spice.profitmandi.dao.model.ActivationImeiUpdationModel(fs.warehouseId,li.brand, "
|
44 |
@NamedQuery(name = "ActivatedImei.selectActivatedUpdationDate", query = "select new com.spice.profitmandi.dao.model.ActivationImeiUpdationModel(fs.warehouseId,li.brand, "
|
| 45 |
+ " Max(ai.createTimestamp))"
|
45 |
+ " Max(ai.createTimestamp))"
|
| 46 |
+ " from ActivatedImei ai join LineItemImeiView lim on ai.serialNumber = lim.serialNumber join LineItem li on li.id = lim.lineItemId join Order o on o.id = li.orderId "
|
46 |
+ " from ActivatedImei ai join LineItemImeiView lim on ai.serialNumber = lim.serialNumber join LineItem li on li.id = lim.lineItemId join Order o on o.id = li.orderId "
|
| 47 |
+ " join FofoStore fs on fs.id = o.retailerId group by li.brand,fs.warehouseId"),
|
47 |
+ " join FofoStore fs on fs.id = o.retailerId group by li.brand,fs.warehouseId"),
|
| 48 |
|
48 |
|
| 49 |
@NamedQuery(name = "ActivatedImei.selectImeiActivationByBrand", query = "select new com.spice.profitmandi.dao.model.ImeiActivationTimestampModel(ii.serialNumber, ai.activationTimestamp) "
|
49 |
@NamedQuery(name = "ActivatedImei.selectImeiActivationByBrand", query = "select new com.spice.profitmandi.dao.model.ImeiActivationTimestampModel(limei.serialNumber, ai.activationTimestamp) "
|
| 50 |
+ " from InventoryItem ii left join ActivatedImei ai on ii.serialNumber = ai.serialNumber join Item i on i.id = ii.itemId "
|
50 |
+ " from Order o join LineItem li on o.id=li.orderId join LineItemImei limei on li.id=limei.lineItemId join FofoStore fs on fs.id=o.retailerId left join ActivatedImei ai on limei.serialNumber = ai.serialNumber "
|
| 51 |
+ " where ii.lastScanType in('PURCHASE','SALE','SALE_RET','PURCHASE_RET') and i.brand = :brand and ai.activationTimestamp is null and ii.serialNumber is not null"),
|
51 |
+ " where (ai.createTimestamp is null or ai.createTimestamp < :fiveDaysBeforeToday) and li.brand = :brand and ai.activationTimestamp is null and fs.active=true and fs.internal = false and fs.fofoType='FRANCHISE'"),
|
| 52 |
|
52 |
|
| 53 |
})
|
53 |
})
|
| 54 |
public class ActivatedImei {
|
54 |
public class ActivatedImei {
|
| 55 |
@Id
|
55 |
@Id
|
| 56 |
@Column(name = "serial_number", unique = true)
|
56 |
@Column(name = "serial_number", unique = true)
|