| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.dao.entity.transaction;
|
1 |
package com.spice.profitmandi.dao.entity.transaction;
|
| 2 |
|
2 |
|
| - |
|
3 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| - |
|
4 |
|
| - |
|
5 |
import javax.persistence.*;
|
| 3 |
import java.io.Serializable;
|
6 |
import java.io.Serializable;
|
| 4 |
import java.time.LocalDateTime;
|
7 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.format.DateTimeFormatter;
|
8 |
import java.time.format.DateTimeFormatter;
|
| 6 |
import java.util.ArrayList;
|
- |
|
| 7 |
import java.util.List;
|
- |
|
| 8 |
|
- |
|
| 9 |
import javax.persistence.Column;
|
- |
|
| 10 |
import javax.persistence.Convert;
|
- |
|
| 11 |
import javax.persistence.Entity;
|
- |
|
| 12 |
import javax.persistence.GeneratedValue;
|
- |
|
| 13 |
import javax.persistence.GenerationType;
|
- |
|
| 14 |
import javax.persistence.Id;
|
- |
|
| 15 |
import javax.persistence.NamedQueries;
|
- |
|
| 16 |
import javax.persistence.NamedQuery;
|
- |
|
| 17 |
import javax.persistence.Table;
|
- |
|
| 18 |
import javax.persistence.Transient;
|
- |
|
| 19 |
|
- |
|
| 20 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
- |
|
| 21 |
|
9 |
|
| 22 |
/**
|
10 |
/**
|
| 23 |
* This class basically contains details
|
11 |
* This class basically contains details
|
| 24 |
*
|
12 |
*
|
| 25 |
* @author ashikali
|
13 |
* @author ashikali
|
| Line 30... |
Line 18... |
| 30 |
*
|
18 |
*
|
| 31 |
*/
|
19 |
*/
|
| 32 |
@Entity
|
20 |
@Entity
|
| 33 |
@Table(name = "transaction.price_drop", schema = "transaction")
|
21 |
@Table(name = "transaction.price_drop", schema = "transaction")
|
| 34 |
|
22 |
|
| 35 |
@NamedQueries({
|
23 |
@NamedQueries(value = {
|
| 36 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropYearMonthModel(i.brand, "
|
24 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropYearMonthModel(i.brand, "
|
| 37 |
+ " DATE_FORMAT(pd.affectedOn, '%m-%Y'),sum(cast(pd.amount As int)) ) from PriceDrop pd join PriceDropIMEI pdi on"
|
25 |
+ " DATE_FORMAT(pd.affectedOn, '%m-%Y'),sum(cast(pd.amount As integer )) ) from PriceDrop pd join PriceDropIMEI pdi on"
|
| 38 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
26 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
| 39 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
27 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
| 40 |
+ " pd.amount > 0 and pd.affectedOn >= :startDate group by i.brand, DATE_FORMAT(pd.affectedOn, '%m-%Y')"),
|
28 |
+ " pd.amount > 0 and pd.affectedOn >= :startDate group by i.brand, DATE_FORMAT(pd.affectedOn, '%m-%Y')"),
|
| 41 |
|
29 |
|
| 42 |
@NamedQuery(name = "PriceDrop.selectSixMonthBrandPriceDropByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropBrandModel(i.brand, "
|
30 |
@NamedQuery(name = "PriceDrop.selectSixMonthBrandPriceDropByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropBrandModel(i.brand, "
|
| 43 |
+ " sum(cast(pd.amount As int)) ) from PriceDrop pd join PriceDropIMEI pdi on"
|
31 |
+ " sum(cast(pd.amount As integer )) ) from PriceDrop pd join PriceDropIMEI pdi on"
|
| 44 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
32 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
| 45 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
33 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
| 46 |
+ " pd.amount > 0 and pd.affectedOn >= :startDate and pd.affectedOn <= :endDate group by i.brand"),
|
34 |
+ " pd.amount > 0 and pd.affectedOn >= :startDate and pd.affectedOn <= :endDate group by i.brand"),
|
| 47 |
|
35 |
|
| 48 |
|
36 |
|
| 49 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropWithDetailsByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel(i.brand, "
|
37 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropWithDetailsByYearMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel(i.brand, "
|
| 50 |
+ " i.modelName,i.modelNumber,cast(pd.amount As int),pdi.imei ) from PriceDrop pd join PriceDropIMEI pdi on"
|
38 |
+ " i.modelName,i.modelNumber,cast(pd.amount As integer ),pdi.imei ) from PriceDrop pd join PriceDropIMEI pdi on"
|
| 51 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
39 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
| 52 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
40 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
| 53 |
+ " pd.amount > 0 and i.brand = :brand and DATE_FORMAT(pd.affectedOn, '%m-%Y') = :yearMonthValue"),
|
41 |
+ " pd.amount > 0 and i.brand = :brand and DATE_FORMAT(pd.affectedOn, '%m-%Y') = :yearMonthValue"),
|
| 54 |
|
42 |
|
| 55 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropWithDetailsAndSixMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel(i.brand, "
|
43 |
@NamedQuery(name = "PriceDrop.selectBrandPendingPriceDropWithDetailsAndSixMonth", query = "select new com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel(i.brand, "
|
| 56 |
+ " i.modelName,i.modelNumber,cast(pd.amount As int),pdi.imei ) from PriceDrop pd join PriceDropIMEI pdi on"
|
44 |
+ " i.modelName,i.modelNumber,cast(pd.amount As integer ),pdi.imei ) from PriceDrop pd join PriceDropIMEI pdi on"
|
| 57 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
45 |
+ " (pd.id = pdi.priceDropId) join InventoryItem it on (pdi.imei = it.serialNumber and pdi.partnerId=it.fofoId)"
|
| 58 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
46 |
+ " join Item i on i.id = it.itemId where pdi.status ='PENDING' and pdi.partnerId = :fofoId and "
|
| 59 |
+ " pd.amount > 0 and i.brand = :brand and pd.affectedOn >= :startDate and pd.affectedOn <= :endDate"),
|
47 |
+ " pd.amount > 0 and i.brand = :brand and pd.affectedOn >= :startDate and pd.affectedOn <= :endDate"),
|
| 60 |
|
48 |
|
| 61 |
|
49 |
|