Subversion Repositories SmartDukaan

Rev

Rev 30161 | Rev 30279 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30161 Rev 30220
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 com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
-
 
5
import java.time.LocalDateTime;
-
 
6
import java.time.format.DateTimeFormatter;
-
 
7
 
-
 
8
import javax.persistence.CascadeType;
-
 
9
import javax.persistence.Column;
-
 
10
import javax.persistence.ColumnResult;
-
 
11
import javax.persistence.ConstructorResult;
-
 
12
import javax.persistence.Convert;
-
 
13
import javax.persistence.Entity;
-
 
14
import javax.persistence.EnumType;
-
 
15
import javax.persistence.Enumerated;
-
 
16
import javax.persistence.FetchType;
-
 
17
import javax.persistence.GeneratedValue;
-
 
18
import javax.persistence.GenerationType;
-
 
19
import javax.persistence.Id;
-
 
20
import javax.persistence.JoinColumn;
-
 
21
import javax.persistence.ManyToOne;
-
 
22
import javax.persistence.NamedNativeQueries;
-
 
23
import javax.persistence.NamedNativeQuery;
-
 
24
import javax.persistence.NamedQueries;
-
 
25
import javax.persistence.NamedQuery;
-
 
26
import javax.persistence.SqlResultSetMapping;
-
 
27
import javax.persistence.SqlResultSetMappings;
-
 
28
import javax.persistence.Table;
-
 
29
 
-
 
30
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
31
import com.spice.profitmandi.dao.model.PartnerSecondaryPlanModel;
4
import com.spice.profitmandi.dao.model.PartnerSecondaryPlanModel;
32
import com.spice.profitmandi.dao.model.PriceDropReportModel;
5
import com.spice.profitmandi.dao.model.PriceDropReportModel;
33
 
-
 
34
import in.shop2020.model.v1.order.OrderStatus;
6
import in.shop2020.model.v1.order.OrderStatus;
35
import in.shop2020.model.v1.order.TaxType;
7
import in.shop2020.model.v1.order.TaxType;
36
 
8
 
-
 
9
import javax.persistence.*;
-
 
10
import java.io.Serializable;
-
 
11
import java.time.LocalDateTime;
-
 
12
import java.time.format.DateTimeFormatter;
-
 
13
 
37
/**
14
/**
38
 * This class basically contains order details
15
 * This class basically contains order details
39
 *
16
 *
40
 * @author ashikali
17
 * @author ashikali
41
 */
18
 */
42
 
19
 
43
@Entity
20
@Entity
44
@Table(name = "transaction.`order`", schema = "transaction")
21
@Table(name = "transaction.`order`", schema = "transaction")
45
@NamedQueries({ @NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
22
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
46
		@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
23
		@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
47
		@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
24
		@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
48
				+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
25
				+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
49
				+ "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 "
26
				+ "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 "
50
				+ "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"),
27
				+ "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 128...
151
				+ "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId "
128
				+ "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId "
152
				+ "  join Item i on i.id = tl.itemId  where "
129
				+ "  join Item i on i.id = tl.itemId  where "
153
				+ "	 fs.active = 1 and fs.internal = 0 and o.status in (3,4) and i.catalogItemId in :catalogItemId and  i.categoryId=10006 and fs.id = :fofoId group by i.catalogItemId, i.brand,i.modelName,i.modelNumber"),
130
				+ "	 fs.active = 1 and fs.internal = 0 and o.status in (3,4) and i.catalogItemId in :catalogItemId and  i.categoryId=10006 and fs.id = :fofoId group by i.catalogItemId, i.brand,i.modelName,i.modelNumber"),
154
 
131
 
155
		@NamedQuery(name = "Order.selectGroupByBrandLmp", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand,"
132
		@NamedQuery(name = "Order.selectGroupByBrandLmp", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand,"
156
				+ " DATE_FORMAT(o.billingTimestamp, '%m-%Y'),sum(cast(o.totalAmount AS integer)))"
133
				+ " DATE_FORMAT(o.billingTimestamp, '%m-%d-%Y'),sum(cast(o.totalAmount AS integer)))"
157
				+ "	 from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
134
				+ "	 from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)"
158
				+ "	and o.billingTimestamp >= :lmsStartDate and fs.id in :fofoId and fs.warehouseId in :warehouseId and fs.internal = 0 group by li.brand,DATE_FORMAT(o.billingTimestamp, '%m-%Y')"),
135
				+ "	and o.billingTimestamp >= :lmsStartDate and fs.id in :fofoId and fs.warehouseId in :warehouseId and fs.internal = 0 group by li.brand,DATE_FORMAT(o.billingTimestamp, '%m-%d-%Y')"),
159
 
136
 
160
		@NamedQuery(name = "Order.selectGrnPendingOrderQtyByCatalogId", query = "select sum(case when li.quantity is null then 0 else  li.quantity end)"
137
		@NamedQuery(name = "Order.selectGrnPendingOrderQtyByCatalogId", query = "select sum(case when li.quantity is null then 0 else  li.quantity end)"
161
				+ "  from FofoStore fs join  Order o on fs.id = o.retailerId "
138
				+ "  from FofoStore fs join  Order o on fs.id = o.retailerId "
162
				+ "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId "
139
				+ "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId "
163
				+ "  join Item i on (i.id = tl.itemId ) where " + "	 fs.active = 1 and fs.internal = 0 and"
140
				+ "  join Item i on (i.id = tl.itemId ) where " + "	 fs.active = 1 and fs.internal = 0 and"