| Line 15... |
Line 15... |
| 15 |
* @author ashikali
|
15 |
* @author ashikali
|
| 16 |
*/
|
16 |
*/
|
| 17 |
|
17 |
|
| 18 |
@Entity
|
18 |
@Entity
|
| 19 |
@Table(name = "transaction.`order`", schema = "transaction")
|
19 |
@Table(name = "transaction.`order`", schema = "transaction")
|
| 20 |
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
20 |
@NamedQueries({ @NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
| 21 |
@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
|
21 |
@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
|
| 22 |
@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
|
22 |
@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
|
| 23 |
+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
|
23 |
+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
|
| 24 |
+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name, o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status, i.catalogItemId from Transaction t join Order o on o.transactionId = t.id "
|
24 |
+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name, o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status, i.catalogItemId from Transaction t join Order o on o.transactionId = t.id "
|
| 25 |
+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId join Item i on i.id=li.itemId where o.transactionId = :transactionId"),
|
25 |
+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId join Item i on i.id=li.itemId where o.transactionId = :transactionId"),
|
| Line 151... |
Line 151... |
| 151 |
+ " sum(case when o.billingTimestamp is not null then cast(o.totalAmount as integer) else 0 end))"
|
151 |
+ " sum(case when o.billingTimestamp is not null then cast(o.totalAmount as integer) else 0 end))"
|
| 152 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId "
|
152 |
+ " from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId "
|
| 153 |
+ " where o.refundTimestamp is null and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate)) and fs.internal = 0 and li.brand not in ('Smartdukaan','Dummy')"
|
153 |
+ " where o.refundTimestamp is null and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate)) and fs.internal = 0 and li.brand not in ('Smartdukaan','Dummy')"
|
| 154 |
+ " group by fs.warehouseId , li.brand"),
|
154 |
+ " group by fs.warehouseId , li.brand"),
|
| 155 |
|
155 |
|
| - |
|
156 |
@NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
| - |
|
157 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS int) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS int) else 0 end))"
|
| - |
|
158 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
| - |
|
159 |
+ " where o.retailerId in :fofoIds and o.status in (3,4) and i.categoryId != 10006 group by o.retailerId"),
|
| - |
|
160 |
|
| - |
|
161 |
@NamedQuery(name = "Order.selectAllGrnPendingAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
| - |
|
162 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS int) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS int) else 0 end))"
|
| - |
|
163 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
| - |
|
164 |
+ " where o.retailerId in :fofoIds and o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null and i.categoryId != 10006 group by o.retailerId"),
|
| - |
|
165 |
|
| 156 |
})
|
166 |
})
|
| 157 |
public class Order implements Serializable {
|
167 |
public class Order implements Serializable {
|
| 158 |
|
168 |
|
| 159 |
private static final long serialVersionUID = 1L;
|
169 |
private static final long serialVersionUID = 1L;
|
| 160 |
|
170 |
|