| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.dao.entity.transaction;
|
1 |
package com.spice.profitmandi.dao.entity.transaction;
|
| 2 |
|
2 |
|
| 3 |
import java.io.Serializable;
|
- |
|
| 4 |
import java.time.LocalDateTime;
|
- |
|
| 5 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 6 |
|
- |
|
| 7 |
import javax.persistence.CascadeType;
|
- |
|
| 8 |
import javax.persistence.Column;
|
- |
|
| 9 |
import javax.persistence.Convert;
|
- |
|
| 10 |
import javax.persistence.Entity;
|
- |
|
| 11 |
import javax.persistence.EnumType;
|
- |
|
| 12 |
import javax.persistence.Enumerated;
|
- |
|
| 13 |
import javax.persistence.FetchType;
|
- |
|
| 14 |
import javax.persistence.GeneratedValue;
|
- |
|
| 15 |
import javax.persistence.GenerationType;
|
- |
|
| 16 |
import javax.persistence.Id;
|
- |
|
| 17 |
import javax.persistence.JoinColumn;
|
- |
|
| 18 |
import javax.persistence.ManyToOne;
|
- |
|
| 19 |
import javax.persistence.NamedQueries;
|
- |
|
| 20 |
import javax.persistence.NamedQuery;
|
- |
|
| 21 |
import javax.persistence.Table;
|
- |
|
| 22 |
|
- |
|
| 23 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
3 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| 24 |
|
- |
|
| 25 |
import in.shop2020.model.v1.order.OrderStatus;
|
4 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 26 |
import in.shop2020.model.v1.order.TaxType;
|
5 |
import in.shop2020.model.v1.order.TaxType;
|
| 27 |
|
6 |
|
| - |
|
7 |
import javax.persistence.*;
|
| - |
|
8 |
import java.io.Serializable;
|
| - |
|
9 |
import java.time.LocalDateTime;
|
| - |
|
10 |
import java.time.format.DateTimeFormatter;
|
| - |
|
11 |
|
| 28 |
/**
|
12 |
/**
|
| 29 |
* This class basically contains order details
|
13 |
* This class basically contains order details
|
| 30 |
*
|
- |
|
| 31 |
* @author ashikali
|
- |
|
| 32 |
*
|
14 |
*
|
| - |
|
15 |
* @author ashikali
|
| 33 |
*/
|
16 |
*/
|
| 34 |
|
17 |
|
| 35 |
@Entity
|
18 |
@Entity
|
| 36 |
@Table(name = "transaction.`order`", schema = "transaction")
|
19 |
@Table(name = "transaction.`order`", schema = "transaction")
|
| 37 |
@NamedQueries({ @NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
20 |
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
| 38 |
@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"),
|
| 39 |
@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, "
|
| 40 |
+ "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, "
|
| 41 |
+ "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 "
|
| 42 |
+ "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 160... |
Line 143... |
| 160 |
+ " from FofoStore fs join Order o on fs.id = o.retailerId"
|
143 |
+ " from FofoStore fs join Order o on fs.id = o.retailerId"
|
| 161 |
+ " join LineItem li on o.id = li.orderId " + " join TagListing tl on tl.itemId = li.itemId "
|
144 |
+ " join LineItem li on o.id = li.orderId " + " join TagListing tl on tl.itemId = li.itemId "
|
| 162 |
+ " join Item i on i.id = tl.itemId where "
|
145 |
+ " join Item i on i.id = tl.itemId where "
|
| 163 |
+ " fs.active = 1 and fs.internal = 0 and o.status in (3,4)and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
|
146 |
+ " fs.active = 1 and fs.internal = 0 and o.status in (3,4)and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
|
| 164 |
|
147 |
|
| - |
|
148 |
@NamedQuery(name = "Order.selectTodayOrders", query = "select new com.spice.profitmandi.dao.model.BrandRegionPOModel(fs.warehouseId, li.brand, "
|
| - |
|
149 |
+ " sum(case when (o.createTimestamp between :startDate and :endDate) then cast(o.totalAmount as integer) else 0 end),"
|
| - |
|
150 |
+ " sum(case when (o.billingTimestamp is not null and (o.createTimestamp between :startDate and :endDate)) 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 "
|
| - |
|
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"),
|
| - |
|
155 |
|
| 165 |
})
|
156 |
})
|
| 166 |
public class Order implements Serializable {
|
157 |
public class Order implements Serializable {
|
| 167 |
|
158 |
|
| 168 |
private static final long serialVersionUID = 1L;
|
159 |
private static final long serialVersionUID = 1L;
|
| 169 |
|
160 |
|