Subversion Repositories SmartDukaan

Rev

Rev 35474 | Rev 35490 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21716 ashik.ali 1
package com.spice.profitmandi.dao.entity.transaction;
21545 ashik.ali 2
 
29966 amit.gupta 3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
35155 ranu 4
import com.spice.profitmandi.dao.model.*;
33396 amit.gupta 5
import com.spice.profitmandi.model.WarehouseItemQtyModel;
29966 amit.gupta 6
import in.shop2020.model.v1.order.OrderStatus;
7
import in.shop2020.model.v1.order.TaxType;
8
 
32417 amit.gupta 9
import javax.persistence.*;
10
import java.io.Serializable;
11
import java.time.LocalDateTime;
12
import java.time.format.DateTimeFormatter;
13
import java.util.List;
14
 
21545 ashik.ali 15
/**
16
 * This class basically contains order details
29966 amit.gupta 17
 *
21545 ashik.ali 18
 * @author ashikali
19
 */
21634 ashik.ali 20
 
21545 ashik.ali 21
@Entity
31860 tejbeer 22
@Table(name = "transaction.`order`")
23
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"), @NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"), @NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, " + "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, " + "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 " + "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"),
33873 ranu 24
        @NamedQuery(name = "Order.partnerStockPoAndGrnPending",
25
                query = "select new com.spice.profitmandi.dao.model.PoAndGrnPendingPartnerStockModel" +
26
                        "(li.itemId, odr.partnerGrnTimestamp, odr.billingTimestamp) " +
27
                        "FROM Order odr " +
28
                        "JOIN LineItem li on li.orderId = odr.id " +
29
                        "WHERE odr.retailerId = (:fofoId) " +
30
                        "AND odr.refundTimestamp is null " +
31
                        "AND (odr.billingTimestamp is null OR (odr.billingTimestamp is not null AND odr.partnerGrnTimestamp is null))"),
27723 tejbeer 32
 
31860 tejbeer 33
        @NamedQuery(name = "Order.selectItemIdTypeQuantity", query = "select new com.spice.profitmandi.dao.model.ItemIdTypeQuantity(li.itemId, i.type, li.quantity) from Order o join LineItem li on li.orderId = o.id join Item i on i.id = li.itemId where o.invoiceNumber = :invoiceNumber and o.retailerId = :retailerId"),
27723 tejbeer 34
 
31860 tejbeer 35
        @NamedQuery(name = "Order.selectAllBilledOrderGroupByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderBillingModel(li.brand, " + "sum(case when o.billingTimestamp >= :today then CAST(o.totalAmount  AS integer) else 0 end)," + "sum(case when o.billingTimestamp >= :threedays  and o.billingTimestamp < :endDate  then CAST(o.totalAmount  AS integer) else 0 end)," + "sum(case when concat(year(o.billingTimestamp ), month(o.billingTimestamp ))= :mtd  then CAST(o.totalAmount AS integer) else 0 end)," + "sum(case when o.billingTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(o.totalAmount  AS integer) else 0 end)," + "sum(case when o.billingTimestamp between  :lmtdStartDate and :lmsEndDate  then CAST(o.totalAmount  AS integer) else 0 end)," + "	sum(case when o.billingTimestamp >= :today then li.quantity else 0 end)," + "	sum(case when o.billingTimestamp >= :threedays and o.billingTimestamp < :endDate then li.quantity else 0 end)," + " sum(case when concat(year(o.billingTimestamp), month(o.billingTimestamp))= :mtd  then li.quantity else 0 end)," + "	sum(case when o.billingTimestamp between  :lmtdStartDate and :lmtdEndDate then li.quantity else 0 end)," + "	sum(case when o.billingTimestamp between  :lmtdStartDate and :lmsEndDate  then li.quantity else 0 end)" + " )" + "	 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)" + "	and o.billingTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId and fs.internal = false group by li.brand"),
27723 tejbeer 36
 
31860 tejbeer 37
        @NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandFofoId", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand," + "	DATE_FORMAT(o.billingTimestamp, '%m-%Y'),sum(cast(o.totalAmount AS integer)))" + "	 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)" + "	and o.billingTimestamp >= :startDate and o.retailerId =:fofoId  group by li.brand,DATE_FORMAT(o.billingTimestamp, '%m-%Y')"),
28439 tejbeer 38
 
34849 ranu 39
        @NamedQuery(name = "Order.selectAllBilledByCategoryOrderGroupByBrandFofoId", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand," + "	DATE_FORMAT(o.billingTimestamp, '%m-%Y'),sum(cast((li.unitPrice * li.quantity) AS integer)))" + "	 from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId join Item i on i.id = li.itemId where o.billingTimestamp >= :startDate and o.billingTimestamp <= :endDate and o.retailerId =:fofoId and i.categoryId in (:categoryIds)  group by li.brand,DATE_FORMAT(o.billingTimestamp, '%m-%Y')"),
34721 ranu 40
 
33430 amit.gupta 41
        @NamedQuery(name = "Order.selectSecondaryGroupByYearMonth", query = "select new com.spice.profitmandi.dao.model.PartnerMonthlySaleModel(o.retailerId," + "	DATE_FORMAT(o.billingTimestamp, '%m-%Y'),sum(cast(o.totalAmount AS integer)))" + "	 from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId where  o.billingTimestamp between :startDate and :endDate and o.retailerId in :fofoIds  group by o.retailerId, DATE_FORMAT(o.billingTimestamp, '%m-%Y')"),
31361 amit.gupta 42
 
31860 tejbeer 43
        @NamedQuery(name = "Order.selectAllBilledOrderGroupByBrandWarehouse", query = "select new com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel(fs.warehouseId,date(o.billingTimestamp), li.brand, " + "sum(CAST(o.totalAmount  AS integer)),sum( li.quantity))" + "	 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)" + "	and o.billingTimestamp >= :startDate and  o.billingTimestamp < :endDate and (null is :brand or li.brand = :brand) and fs.internal = 0 group by fs.warehouseId, date(o.billingTimestamp), li.brand"),
27867 tejbeer 44
 
31860 tejbeer 45
        @NamedQuery(name = "Order.selectAllBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, " + " i.modelNumber, i.color," + "o.totalAmount," + "	 li.quantity)" + "	 from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)" + "	and date(o.billingTimestamp) in :date and fs.warehouseId in :warehouseId and li.brand = :brand and fs.internal = false order by li.itemId desc"),
27738 tejbeer 46
 
31860 tejbeer 47
        @NamedQuery(name = "Order.selectTodayBilledOrderItemByBrand", query = "select new com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel(o.retailerName,li.brand,i.modelName, " + " i.modelNumber, i.color," + "o.totalAmount," + "	 li.quantity)" + "	 from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join FofoStore fs on fs.id = o.retailerId where o.status in (7,9,10,12)" + "	and o.billingTimestamp >= :startDate and fs.warehouseId in :warehouseId and li.brand in :brand order by li.itemId desc"),
27738 tejbeer 48
 
31860 tejbeer 49
        @NamedQuery(name = "Order.selectAllBilledOrderBrandByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockBrandModel(li.brand," + "	 Sum(li.quantity),Sum(CAST(o.totalAmount AS integer)))" + "	 from Order o join LineItem li on o.id = li.orderId where o.status in (7,9,10,12)" + "	and o.billingTimestamp >= :startDate and o.billingTimestamp <= :endDate and o.retailerId = :fofoId group by li.brand"),
27893 tejbeer 50
 
31860 tejbeer 51
        @NamedQuery(name = "Order.selectAllBilledOrderBrandItemByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockBrandItemModel(" + " i.brand, i.modelName, i.modelNumber, i.color,Sum(li.quantity), Sum(CAST(o.totalAmount AS integer)))" + "	 from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId where o.status in (7,9,10,12)" + "	and o.billingTimestamp >= :startDate and o.billingTimestamp <= :endDate and o.retailerId = :fofoId  group by i.id"),
27893 tejbeer 52
 
31860 tejbeer 53
        @NamedQuery(name = "Order.selectAllGrnPendingOrderByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdQtyModel(" + "  fs.warehouseId,fs.id,sum(li.quantity )) from FofoStore fs join  Order o on fs.id = o.retailerId " + "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on (i.id = tl.itemId ) where " + "	 fs.active = false and fs.internal = true and" + "  o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null" + "  and i.catalogItemId in :catalogItemId group by fs.id"),
28004 tejbeer 54
 
31860 tejbeer 55
        @NamedQuery(name = "Order.selectAllPendingIndentOrderByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdQtyModel(" + "  fs.warehouseId,fs.id,sum(case when li.quantity is null then 0 else  li.quantity end))" + "	 from FofoStore fs  join  Order o on fs.id = o.retailerId" + "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on i.id = tl.itemId  where " + "	 fs.active = false and fs.internal = true and o.status in (3,4) and i.catalogItemId in :catalogItemId group by fs.id"),
28004 tejbeer 56
 
31860 tejbeer 57
        @NamedQuery(name = "Order.selectGrnPendingOrdersByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdCatalogQtyModel(" + "  fs.warehouseId,fs.id,i.catalogItemId,sum(li.quantity )) from FofoStore fs join  Order o on fs.id = o.retailerId " + "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on (i.id = tl.itemId ) where " + "	 fs.active = true and fs.internal = false and" + "  o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null" + "  and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId group by i.catalogItemId, fs.id"),
28474 tejbeer 58
 
31860 tejbeer 59
        @NamedQuery(name = "Order.selectPendingIndentOrdersByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdCatalogQtyModel(" + "  fs.warehouseId,fs.id,i.catalogItemId,sum(case when li.quantity is null then 0 else  li.quantity end))" + "	 from FofoStore fs  join  Order o on fs.id = o.retailerId" + "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on i.id = tl.itemId  where " + "	 fs.active = true and fs.internal = false and o.status in (3,4) and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId group by i.catalogItemId, fs.id"),
28474 tejbeer 60
 
31860 tejbeer 61
        @NamedQuery(name = "Order.selectFirstBilling", query = "select new com.spice.profitmandi.dao.model.FofoFirstBillingModel(fs.id, min(o.billingTimestamp) )" + "	from FofoStore fs  join  Order o on fs.id = o.retailerId  group by fs.id"),
30673 amit.gupta 62
 
31860 tejbeer 63
        @NamedQuery(name = "Order.selectAllGrnPendingOrderByRange", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + "  fs.warehouseId,fs.id,sum(li.quantity ),i.brand,i.modelName,i.modelNumber,i.catalogItemId) from FofoStore fs join  Order o on fs.id = o.retailerId " + "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on (i.id = tl.itemId ) where fs.active = true and fs.internal = false and" + "  o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null" + "  and tl.mop between :startPrice and :endPrice and i.categoryId=10006 group by fs.id,i.catalogItemId,i.brand,i.modelName,i.modelNumber"),
28004 tejbeer 64
 
34813 aman 65
//        query = "select o.*,tl.sellingPrice as tlSellingPrice" +
66
//        "from FofoStore fs " +
67
        @NamedQuery(
68
                name = "Order.selectGrnPendingByFofoIdForAllMobile",
69
                query = "select o " +
70
                        "from FofoStore fs " +
71
                        "join Order o on fs.id = o.retailerId " +
72
                        "join LineItem li on o.id = li.orderId " +
73
                        "join TagListing tl on tl.itemId = li.itemId " +
74
                        "join Item i on i.id = tl.itemId " +
75
                        "where fs.active = true and fs.internal = false " +
76
                        "and fs.id = :fofoId " +
77
                        "and o.billingTimestamp is not null " +
78
                        "and o.refundTimestamp is null " +
79
                        "and o.partnerGrnTimestamp is null " +
80
                        "and i.categoryId = 10006 " +
81
                        "group by o.id"
82
        ),
31860 tejbeer 83
        @NamedQuery(name = "Order.selectAllPendingIndentOrderByRange", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + "  fs.warehouseId, fs.id,sum(case when li.quantity is null then 0 else  li.quantity end),i.brand,i.modelName,i.modelNumber,i.catalogItemId)" + "	 from FofoStore fs  join  Order o on fs.id = o.retailerId" + "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on i.id = tl.itemId  where " + "	 fs.active = true and fs.internal = false and o.status in (3,4) and tl.mop between :startPrice and :endPrice  and i.categoryId=10006 group by fs.id,i.catalogItemId,i.brand,i.modelName,i.modelNumber"),
28004 tejbeer 84
 
31860 tejbeer 85
        @NamedQuery(name = "Order.selectAllGrnPendingOrderItemByCatalogIdFofoId", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + "  fs.warehouseId, fs.id, sum(li.quantity), i.brand, i.modelName, i.modelNumber, i.catalogItemId) from FofoStore fs join  Order o on fs.id = o.retailerId " + "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on (i.id = tl.itemId ) where " + "	 fs.active = true and fs.internal = false and" + "  o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null" + "  and i.catalogItemId in :catalogItemId and  i.categoryId=10006 and fs.id = :fofoId group by i.catalogItemId, i.brand,i.modelName,i.modelNumber"),
28032 tejbeer 86
 
31860 tejbeer 87
        @NamedQuery(name = "Order.selectAllPendingIndentOrderItemByCatalogIdFofoId", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + "   fs.warehouseId, fs.id, sum(li.quantity), i.brand, i.modelName, i.modelNumber, i.catalogItemId)" + "	 from FofoStore fs  join  Order o on fs.id = o.retailerId" + "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on i.id = tl.itemId  where " + "	 fs.active = true and fs.internal = false 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"),
28032 tejbeer 88
 
31860 tejbeer 89
        @NamedQuery(name = "Order.selectGroupByBrandLmp", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(li.brand," + " DATE_FORMAT(o.billingTimestamp,:groupParameter ),sum(cast(o.totalAmount AS integer)))" + "	 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)" + "	and (o.billingTimestamp between :lmsStartDate and :endDate) and fs.id in :fofoId and fs.warehouseId in :warehouseId and fs.internal = false group by li.brand,DATE_FORMAT(o.billingTimestamp, :groupParameter)"),
28461 tejbeer 90
 
31860 tejbeer 91
        @NamedQuery(name = "Order.selectGrnPendingOrderQtyByCatalogId", query = "select sum(case when li.quantity is null then 0 else  li.quantity end)" + "  from FofoStore fs join  Order o on fs.id = o.retailerId " + "  join LineItem li on o.id = li.orderId  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on (i.id = tl.itemId ) where  fs.active = true and fs.internal = false and" + "  o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null" + "  and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
28486 tejbeer 92
 
31860 tejbeer 93
        @NamedQuery(name = "Order.selectPendingIndentOrderQtyByCatalogId", query = "select sum(case when li.quantity is null then 0 else  li.quantity end)" + "	 from FofoStore fs  join  Order o on fs.id = o.retailerId" + "  join LineItem li on o.id = li.orderId " + "  join TagListing tl on tl.itemId = li.itemId " + "  join Item i on i.id = tl.itemId  where " + "	 fs.active = true and fs.internal = false and o.status in (3,4)and i.catalogItemId = :catalogItemId and fs.id = :fofoId group by i.catalogItemId, fs.id"),
28486 tejbeer 94
 
33947 ranu 95
        @NamedQuery(name = "Order.selectTodayOrders", query = "select new com.spice.profitmandi.dao.model.BrandRegionPOModel(" + " case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end  , li.brand, " + " sum(case when (o.createTimestamp between :startDate and :endDate and o.refundTimestamp is null) then cast(o.totalAmount AS integer ) else 0 end)," + " sum(case when (o.billingTimestamp is not null and (o.createTimestamp between :startDate and :endDate)) then cast(o.totalAmount AS integer) else 0 end)," + " sum(case when o.billingTimestamp is not null then cast(o.totalAmount AS integer ) else 0 end))" + "	from Order o join LineItem li on o.id = li.orderId join FofoStore fs on fs.id = o.retailerId" + " left join PartnerRegion pr on pr.fofoId=o.retailerId and pr.regionId=18" + " where o.refundTimestamp is null and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate)) and fs.internal = false and li.brand not in ('Smartdukaan','Dummy')" + " group by case when (pr.regionId is not null) then pr.regionId else fs.warehouseId end, li.brand"),
35155 ranu 96
       /* @NamedQuery(name = "Order.selectTodayOrdersRBM", query = "select new  com.spice.profitmandi.dao.model.BrandAuthUserPOModel( p.authUserId," +
97
                "       li.brand," +
98
                "       sum(case" +
99
                "               when (o.createTimestamp between :startDate and :endDate and o.refundTimestamp is null) then cast(o.totalAmount AS integer )" +
100
                "               else 0 end)," +
101
                "       sum(case" +
102
                "               when o.billingTimestamp is not null and (o.createTimestamp between :startDate and :endDate)" +
103
                "                   then cast(o.totalAmount AS integer )" +
104
                "               else 0 end)," +
33801 amit.gupta 105
                "       sum(case when o.billingTimestamp is not null then cast(o.totalAmount AS integer ) else 0 end)," +
35155 ranu 106
                " cast (count(distinct o.retailerId) as int))" +
107
                "from Order o" +
108
                "         join LineItem li" +
109
                "              on o.id = li.orderId" +
110
                "         join FofoStore fs on fs.id = o.retailerId" +
111
                "         join PartnerPosition pp on pp.fofoId = o.retailerId" +
112
                "         join Position p on p.id = pp.positionId" +
113
                "where o.refundTimestamp is null" +
114
                "  and ((o.createTimestamp between :startDate and :endDate) or (o.billingTimestamp between :startDate and :endDate))" +
115
                "  and fs.internal = false" +
116
                "  and p.categoryId = :categoryId" +
117
                "  and p.escalationType = :escalationType" +
118
                "  and li.brand not in ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo')" +
35154 ranu 119
                "group by p.authUserId, li.brand"),
35155 ranu 120
*/
121
        @NamedQuery(name = "Order.selectTodayPartnersBilledRBM", query = "select new  com.spice.profitmandi.dao.model.AuthIdPartnerCountModel( p.authUserId," +
122
                "       cast (count(distinct o.retailerId) as int))" +
123
                "from Order o" +
124
                "         join LineItem li" +
125
                "              on o.id = li.orderId" +
126
                "         join FofoStore fs on fs.id = o.retailerId" +
127
                "         join PartnerPosition pp on pp.fofoId = o.retailerId" +
128
                "         join Position p on p.id = pp.positionId" +
129
                " where o.refundTimestamp is null" +
130
                "  and (o.createTimestamp between :startDate and :endDate)" +
131
                "  and fs.internal = false" +
132
                "  and p.categoryId = 18" +
133
                "  and p.escalationType = 'L1'" +
134
                "  and li.brand not in ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo')" +
33805 amit.gupta 135
                "group by p.authUserId"),
136
 
31860 tejbeer 137
        @NamedQuery(name = "Order.selectAllPendingIndentAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel(" + "  o.retailerId, SUM(case when c.parentCategoryId  = 10011 then CAST(o.totalAmount  AS integer) else 0 end), SUM(case when c.parentCategoryId  = 14200 then  CAST(o.totalAmount  AS integer) else 0 end))" + "	 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 " + "  where o.retailerId in :fofoIds and o.status in (3,4) and i.categoryId != 10006 group by o.retailerId"),
30003 tejbeer 138
 
31860 tejbeer 139
        @NamedQuery(name = "Order.selectAllGrnPendingAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel(" + "  o.retailerId, SUM(case when c.parentCategoryId  = 10011 then CAST(o.totalAmount  AS integer) else 0 end), SUM(case when c.parentCategoryId  = 14200 then  CAST(o.totalAmount  AS integer) else 0 end))" + "	 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 " + "  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"),
30003 tejbeer 140
 
31860 tejbeer 141
        @NamedQuery(name = "Order.selectPartnersBilledBetweenDates", query = "select new com.spice.profitmandi.dao.model.PartnerSecondaryModel(fs.warehouseId, fs.id, count(o.id), sum(o.totalAmount) )" + " from FofoStore fs left join Order o on (fs.id=o.retailerId and o.billingTimestamp between :startDate and :endDate " + " and o.refundTimestamp is null) where" + " fs.internal = false and (fs.active= true or o.retailerId is not null)  group by fs.warehouseId, fs.id"),
31539 amit.gupta 142
 
31860 tejbeer 143
        @NamedQuery(name = "Order.selectCollectionSummary", query = "select new com.spice.profitmandi.dao.model.CollectionSummary(pot.createTimestamp, " + "  pot.referenceType,sum(case when po.name = 'CASH' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'PINELABS' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'BAJAJ FINSERV' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'HOME CREDIT' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'PAYTM' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'CAPITAL FIRST' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'ZEST MONEY' then cast(pot.amount As int) else 0 end)," + "  sum(case when po.name = 'SAMSUNG SURE' then cast(pot.amount As int) else 0 end),sum(cast(pot.amount As int)))" + "	 from PaymentOptionTransaction pot join PaymentOption po on pot.paymentOptionId=po.id join com.spice.profitmandi.dao.entity.user.User u on u.id=pot.fofoId" + "	 join Address a on a.id=u.addressId where 1=1 and  pot.fofoId = :fofoId and pot.createTimestamp between :startDate and :endDate " + "  group by (pot.createTimestamp), pot.referenceType "),
30279 tejbeer 144
 
31860 tejbeer 145
 
34641 ranu 146
        @NamedQuery(name = "Order.getLastOrderByFofoId", query = "select COALESCE(Max(o.id),0) from  Order o where  o.retailerId = :fofoId and o.status in (7,9,10,12)"),
31860 tejbeer 147
 
32478 amit.gupta 148
        @NamedQuery(name = "Order.selectOrderValueByCreateDateGroupByFofoId", query = "select new com.spice.profitmandi.common.model.IdAmountModel(o.retailerId, sum(o.totalAmount)) from  Order o where  o.retailerId in :retailerIds and o.status in :status and o.createTimestamp between :startDate and :endDate group by o.retailerId"),
34715 ranu 149
 
150
        @NamedQuery(name = "Order.selectOrderValueByBillingDateGroupByFofoId", query = "select new com.spice.profitmandi.common.model.IdAmountModel(o.retailerId, sum(o.totalAmount)) from  Order o where  o.retailerId in :retailerIds and o.billingTimestamp between :startDate and :endDate group by o.retailerId"),
151
 
33189 amit.gupta 152
        @NamedQuery(name = "Order.selectOrdersByBilledDateCatalogId",
153
                query = "select new com.spice.profitmandi.common.model.GrnPendingDataModel(" +
154
                        "o.retailerId, fs.code, o.retailerName, o.invoiceNumber, o.billingTimestamp, l.itemId, l.brand, l.modelName, l.modelNumber, l.color, " +
155
                        "l.unitPrice, lii.serialNumber, v.name, wi.created, ai.activationTimestamp, ai.createTimestamp)" +
31860 tejbeer 156
 
33189 amit.gupta 157
                        "from Order o join FofoStore fs on fs.id = o.retailerId" +
158
                        "         join LineItem l on l.orderId = o.id" +
159
                        "         join LineItemImei lii on lii.lineItemId = l.id" +
160
                        "         join Warehouse w on w.id = o.fulfilmentWarehouseId" +
161
                        "         join Vendor v on v.id = w.vendor" +
162
                        "         join WarehouseInventoryItem wi on wi.serialNumber = lii.serialNumber" +
163
                        "         join WarehouseScan  ws on (ws.orderId = o.id and ws.type = 'SALE' and wi.id = ws.inventoryItemId)" +
33202 amit.gupta 164
                        "         join Item i on i.id=l.itemId " +
165
                        "  left join ActivatedImei ai on ai.serialNumber = lii.serialNumber " +
166
                        "where fs.internal=false and i.catalogItemId=:catalogId and o.billingTimestamp >= :startDate " +
167
                        "and (:endDate is null or o.billingTimestamp < :endDate) and (o.refundTimestamp is null or o.refundTimestamp <= :endDate)"),
33443 ranu 168
        @NamedQuery(
169
                name = "Order.selectAllLiveDemoBrandItemsByBillingDate",
170
                query = "select new com.spice.profitmandi.dao.model.LiveDemoOrderLineItemModel (" +
171
                        "o.id, " +
172
                        "o.invoiceNumber, " +
173
                        "o.billingTimestamp, " +
174
                        "o.retailerName, " +
175
                        "o.retailerCity, " +
176
                        "o.retailerPinCode, " +
177
                        "o.retailerState, " +
178
                        "lii.serialNumber, " +
179
                        "li.modelNumber, " +
180
                        "li.modelName, " +
181
                        "li.brand," +
182
                        "li.itemId )" +
183
                        "FROM Order o JOIN LineItem li on o.id = li.orderId " +
184
                        "JOIN LineItemImei lii on li.id = lii.lineItemId " +
185
                        "WHERE li.brand = 'Live Demo' " +
186
                        "AND o.billingTimestamp between  :startDate and :endDate"
33464 ranu 187
        ),
188
 
189
        @NamedQuery(
190
                name = "Order.selectTodayPocoBilling",
191
                query = "select new com.spice.profitmandi.dao.model.LiveDemoOrderLineItemModel (" +
192
                        "o.id, " +
193
                        "o.invoiceNumber, " +
194
                        "o.billingTimestamp, " +
195
                        "o.retailerName, " +
196
                        "o.retailerCity, " +
197
                        "o.retailerPinCode, " +
198
                        "o.retailerState, " +
199
                        "lii.serialNumber, " +
200
                        "li.modelNumber, " +
201
                        "li.modelName, " +
202
                        "li.brand," +
203
                        "li.itemId )" +
204
                        "FROM Order o JOIN LineItem li on o.id = li.orderId " +
205
                        "JOIN LineItemImei lii on li.id = lii.lineItemId " +
206
                        "JOIN FofoStore fs on fs.id=o.retailerId "+
207
                        "WHERE li.brand = 'POCO' " +
208
                        "AND fs.internal = false " +
209
                        "AND o.billingTimestamp between  :startDate and :endDate"
33443 ranu 210
        )
32478 amit.gupta 211
 
33189 amit.gupta 212
 
33443 ranu 213
 
21545 ashik.ali 214
})
30110 tejbeer 215
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where  o.id = '1694173'", resultClass = Order.class)
216
 
30161 manish 217
@NamedNativeQueries({
30110 tejbeer 218
 
31860 tejbeer 219
        @NamedNativeQuery(name = "Order.selectAllOrderWeight", query = "select i.catalog_item_id from transaction.`order` o join transaction.lineitem li on o.id = li.order_id " + "join catalog.item i on i.id = li.item_id   " + "where date(o.created_timestamp) between :startDate and :endDate  and o.status = 12 and i.hsnCode = '85171300' and i.brand != 'Live Demo'" + " group by i.catalog_item_id order by  sum((datediff(now(),o.created_timestamp)/30)*li.quantity) desc"),
31604 tejbeer 220
 
31860 tejbeer 221
        @NamedNativeQuery(name = "selectPartnerSecondaryGroupByBrand", query = "select ifnull(a.customer_id,fs.id) as id,ifnull(a.sb,brand) as brand,a.secondary_plan,sum(a.total_price) as total_price,a.auth_id, a.commited_timestamp from " + "fofo.fofo_store fs left join (select o.customer_id , li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id,psp.commited_timestamp from transaction.`order` o join transaction.lineitem li on " + "(o.id = li.order_id) left join  auth.partner_secondary_plan psp on (psp.fofo_id = o.customer_id  and date(psp.commited_timestamp) >= :startDate and " + "psp.active = 1 and psp.brand = li.brand ) where o.customer_id in :fofoIds and  o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate" + " union select if(li.brand is null, null, o.customer_id) as customer_id, li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id, psp.commited_timestamp " + " from auth.partner_secondary_plan psp  left join transaction.`order` o on (psp.fofo_id = o.customer_id and o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate) " + "left join transaction.lineitem li on  (o.id = li.order_id and psp.brand=li.brand) where psp.fofo_id in :fofoIds and date(psp.commited_timestamp) >= :startDate " + "and psp.active = 1) a on fs.id = a.customer_id or fs.id = a.fofo_id where fs.id in :fofoIds group by id,brand;", resultSetMapping = "partnerSecondaryPlanModel"),
30161 manish 222
 
33145 tejus.loha 223
        @NamedNativeQuery(name = "selectPriceDropReport", query = "select fs.code, pd.id, ci.brand,ci.model_name,"
224
                + " ci.model_number,pd.affected_on, pd.amount, pd.partner_payout, pdi.imei, pdi.status, pdi.update_timestamp, pdi.rejection_reason,pdi.credit_timestamp,pdi.reject_timestamp"
225
                + " from transaction.price_drop pd join transaction.price_drop_imei pdi on pdi.price_drop_id = pd.id "
226
                + " join (select catalog_item_id, brand, model_name, model_number from catalog.item group by catalog_item_id )"
227
                + " ci on ci.catalog_item_id=pd.catalog_id join fofo.fofo_store fs on fs.id=pdi.retailer_id where  pdi.retailer_id = :fofoId and pd.affected_on between :startDate and :endDate and pd.amount > 0;",
228
                resultSetMapping = "PriceDropReportModel"),
30279 tejbeer 229
 
32044 tejbeer 230
        @NamedNativeQuery(name = "Order.selectCreateToBillingAvg", query = "select o.customer_id, avg(DATEDIFF(o.billing_timestamp,o.created_timestamp)) as average from transaction.`order` o join fofo.fofo_store fs on o.customer_id = fs.id where date(o.created_timestamp) between :startDate and :endDate  and  o.billing_timestamp is not null and fs.internal = 0  group by o.customer_id", resultSetMapping = "BillingDaysAvg"),
31860 tejbeer 231
 
32044 tejbeer 232
        @NamedNativeQuery(name = "Order.selectBillingToDeliverAvg", query = "select o.customer_id, avg(DATEDIFF(o.delivery_timestamp,o.billing_timestamp)) as average  from transaction.`order` o join fofo.fofo_store fs on o.customer_id = fs.id where date(o.created_timestamp) between :startDate and :endDate  and  o.billing_timestamp is not null and o.delivery_timestamp is not null and fs.internal = 0 group by o.customer_id", resultSetMapping = "BillingDaysAvg"),
233
 
234
 
235
        @NamedNativeQuery(name = "Order.getLastOrders", query = "select o.customer_id, Max(o.created_timestamp) as maxdate  from transaction.`order` o join fofo.fofo_store fs on  fs.id = o.customer_id where o.status in (7,9,10,12) and o.delivery_timestamp is not null and fs.internal = 0 group by o.customer_id", resultSetMapping = "LastSaleDays"),
236
 
33396 amit.gupta 237
        @NamedNativeQuery(name = "Order.itemAvailability", query = "select grouped.item_id, " +
238
                "       grouped.vendor_warehouse_id, " +
239
                "       sum(grouped.availability)                    as availability, " +
240
                "       sum(grouped.reserved)                        as reserved, " +
241
                "       sum(grouped.availability - grouped.reserved) as net_availability " +
242
                "from (select l.item_id, " +
243
                "             o.fulfilmentWarehouseId as vendor_warehouse_id, " +
244
                "             0                       as availability, " +
245
                "             sum(l.quantity)         as reserved " +
246
                "      from fofo.fofo_store fs " +
247
                "               join transaction.order o on o.customer_id = fs.id " +
248
                "               join transaction.lineitem l on l.order_id = o.id " +
249
                "               join catalog.item i on i.id = l.item_id " +
250
                "      where o.status in (3, 4) " +
251
                "        and l.item_id in :itemIds " +
252
                "        and o.warehouse_id = :warehouseId " +
253
                "      group by l.item_id, o.warehouse_id, o.fulfilmentWarehouseId " +
254
                "      union " +
255
                "      select ii.itemId                                                                                 AS item_id, " +
256
                "             ii.currentWarehouseId, " +
257
                "             sum((case " +
258
                "                      when (s2.type in ('SALE', 'LOST_IN_WAREHOUSE', 'PURCHASE_RETURN', 'MARKED_USED', 'MARKED_BAD')) " +
259
                "                          then -(s2.quantity) " +
260
                "                      when (s2.type in ('PURCHASE', 'SALE_RET', 'MARKED_GOOD')) then s2.quantity end)) AS availability, " +
261
                "             0                                                                                         as reserved " +
262
                "      from ((warehouse.scanNew s1 join warehouse.scanNew s2 " +
263
                "          on ((s1.inventoryItemId = s2.inventoryItemId))) join warehouse.inventoryItem ii " +
264
                "          on ((ii.id = s2.inventoryItemId)) join catalog.item i on i.id = ii.itemId) " +
265
                "      where ((s1.type = 'PURCHASE') and (s1.scannedAt >= '2017-07-01')) " +
266
                "        and ii.itemId in :itemIds " +
267
                "        and ii.physicalWarehouseId = :warehouseId " +
268
                "      group by ii.itemId, ii.currentWarehouseId) as grouped " +
269
                "group by item_id, vendor_warehouse_id", resultSetMapping = "itemAvailabilityReservationMapping"),
32044 tejbeer 270
 
35155 ranu 271
        @NamedNativeQuery(
35153 ranu 272
                name = "Order.selectTodayOrdersRBM",
35473 amit 273
                query = "SELECT auth_user_id, brand, " +
274
                        "       SUM(today_po_value) AS today_po_value, " +
275
                        "       SUM(today_billed_value) AS today_billed_value, " +
276
                        "       SUM(total_billed_value) AS total_billed_value, " +
277
                        "       COUNT(DISTINCT customer_id) AS partner_count " +
278
                        "FROM ( " +
35475 amit 279
                        "    SELECT p.auth_user_id, li.brand, o.customer_id, " +
35473 amit 280
                        "           CASE WHEN o.refund_timestamp IS NULL THEN o.total_amount ELSE 0 END AS today_po_value, " +
281
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END AS today_billed_value, " +
282
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END AS total_billed_value " +
283
                        "    FROM transaction.`order` o " +
284
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
285
                        "    JOIN fofo.fofo_store fs ON fs.id = o.customer_id " +
35475 amit 286
                        "    JOIN cs.partner_position ps ON ps.partner_id = fs.id " +
287
                        "    JOIN cs.position p ON p.id = ps.position_id AND p.category_id = :categoryId AND p.escalation_type = :escalationType " +
288
                        "    WHERE o.refund_timestamp IS NULL AND o.created_timestamp BETWEEN :startDate AND :endDate " +
289
                        "      AND fs.internal = FALSE AND li.brand NOT IN ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo') " +
35473 amit 290
                        "    UNION ALL " +
35475 amit 291
                        "    SELECT p.auth_user_id, li.brand, o.customer_id, 0, 0, " +
292
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END " +
35473 amit 293
                        "    FROM transaction.`order` o " +
294
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
295
                        "    JOIN fofo.fofo_store fs ON fs.id = o.customer_id " +
35475 amit 296
                        "    JOIN cs.partner_position ps ON ps.partner_id = fs.id " +
297
                        "    JOIN cs.position p ON p.id = ps.position_id AND p.category_id = :categoryId AND p.escalation_type = :escalationType " +
298
                        "    WHERE o.refund_timestamp IS NULL AND o.billing_timestamp BETWEEN :startDate AND :endDate " +
35473 amit 299
                        "      AND o.created_timestamp NOT BETWEEN :startDate AND :endDate " +
35475 amit 300
                        "      AND fs.internal = FALSE AND li.brand NOT IN ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo') " +
301
                        "    UNION ALL " +
302
                        "    SELECT p.auth_user_id, li.brand, o.customer_id, " +
303
                        "           CASE WHEN o.refund_timestamp IS NULL THEN o.total_amount ELSE 0 END, " +
304
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END, " +
305
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END " +
306
                        "    FROM transaction.`order` o " +
307
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
308
                        "    JOIN fofo.fofo_store fs ON fs.id = o.customer_id " +
309
                        "    JOIN cs.partner_region pr ON pr.fofo_id = fs.id " +
310
                        "    JOIN cs.partner_position ps ON ps.partner_id = 0 AND ps.region_id = pr.region_id " +
311
                        "    JOIN cs.position p ON p.id = ps.position_id AND p.category_id = :categoryId AND p.escalation_type = :escalationType " +
312
                        "    WHERE o.refund_timestamp IS NULL AND o.created_timestamp BETWEEN :startDate AND :endDate " +
313
                        "      AND fs.internal = FALSE AND li.brand NOT IN ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo') " +
314
                        "    UNION ALL " +
315
                        "    SELECT p.auth_user_id, li.brand, o.customer_id, 0, 0, " +
316
                        "           CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END " +
317
                        "    FROM transaction.`order` o " +
318
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
319
                        "    JOIN fofo.fofo_store fs ON fs.id = o.customer_id " +
320
                        "    JOIN cs.partner_region pr ON pr.fofo_id = fs.id " +
321
                        "    JOIN cs.partner_position ps ON ps.partner_id = 0 AND ps.region_id = pr.region_id " +
322
                        "    JOIN cs.position p ON p.id = ps.position_id AND p.category_id = :categoryId AND p.escalation_type = :escalationType " +
323
                        "    WHERE o.refund_timestamp IS NULL AND o.billing_timestamp BETWEEN :startDate AND :endDate " +
324
                        "      AND o.created_timestamp NOT BETWEEN :startDate AND :endDate " +
325
                        "      AND fs.internal = FALSE AND li.brand NOT IN ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo') " +
35473 amit 326
                        ") AS combined " +
327
                        "GROUP BY auth_user_id, brand " +
328
                        "ORDER BY auth_user_id, brand",
35153 ranu 329
                resultSetMapping = "TodayPoByAuthUsers"
35172 ranu 330
        ),
331
 
332
        @NamedNativeQuery(
333
                name = "Order.selectTodayOrdersModelWise",
334
                query = "SELECT o.created_timestamp,o.customer_name,fs.code,fs.warehouse_id, li.brand,concat(i.model_name, ' ', i.model_number) as modal,i.catalog_item_id ,coalesce(cc.status, '-') as status,sum(li.quantity) as quantity," +
335
                        "       SUM(" +
336
                        "               CASE" +
337
                        "                   WHEN (o.created_timestamp BETWEEN :startDate AND :endDate and o.refund_timestamp is null)" +
338
                        "                       AND o.refund_timestamp IS NULL" +
339
                        "                       THEN o.total_amount" +
340
                        "                   ELSE 0" +
341
                        "                   END" +
342
                        "           )    AS today_po_value," +
343
                        "       SUM(" +
344
                        "               CASE" +
345
                        "                   WHEN o.billing_timestamp IS NOT NULL" +
346
                        "                       AND (o.created_timestamp BETWEEN :startDate AND :endDate)" +
347
                        "                       THEN o.total_amount" +
348
                        "                   ELSE 0" +
349
                        "                   END" +
350
                        "           ) AS today_billed_value" +
351
                        " FROM transaction.`order` o" +
352
                        "         JOIN transaction.lineitem li" +
353
                        "              ON o.id = li.order_id" +
354
                        "         JOIN fofo.fofo_store fs ON fs.id = o.customer_id" +
355
                        " join catalog.item i on i.id = li.item_id" +
356
                        " join catalog.catagoriesd_catalog cc on i.catalog_item_id = cc.catalog_id AND cc.end_date IS NULL" +
357
                        " WHERE o.refund_timestamp IS NULL" +
358
                        "  AND (" +
359
                        "        (o.created_timestamp BETWEEN :startDate AND :endDate)" +
360
                        "        OR (o.billing_timestamp BETWEEN :startDate AND :endDate)" +
361
                        "    )" +
362
                        "  AND fs.internal = FALSE" +
363
                        "  AND fs.active = TRUE" +
364
                        "  AND li.brand NOT IN ('Smartdukaan', 'Dummy', 'FOC', 'Live Demo')" +
365
                        "GROUP BY o.customer_id, i.catalog_item_id",
366
                resultSetMapping = "TodayPoByCatalog"
35474 amit 367
        ),
368
 
369
        @NamedNativeQuery(
370
                name = "Order.selectTodayOrdersNative",
371
                query = "SELECT " +
372
                        "    COALESCE(pr.region_id, fs.warehouse_id) AS warehouse_id, " +
373
                        "    combined.brand, " +
374
                        "    SUM(combined.today_po_value) AS today_po_value, " +
375
                        "    SUM(combined.today_billed_value) AS today_billed_value, " +
376
                        "    SUM(combined.total_billed_value) AS total_billed_value " +
377
                        "FROM ( " +
378
                        "    SELECT " +
379
                        "        o.customer_id, " +
380
                        "        li.brand, " +
381
                        "        CASE WHEN o.refund_timestamp IS NULL THEN o.total_amount ELSE 0 END AS today_po_value, " +
382
                        "        CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END AS today_billed_value, " +
383
                        "        CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END AS total_billed_value " +
384
                        "    FROM transaction.`order` o " +
385
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
386
                        "    JOIN fofo.fofo_store fs2 ON fs2.id = o.customer_id " +
387
                        "    WHERE o.refund_timestamp IS NULL " +
388
                        "      AND o.created_timestamp BETWEEN :startDate AND :endDate " +
389
                        "      AND fs2.internal = FALSE " +
390
                        "      AND li.brand NOT IN ('Smartdukaan', 'Dummy') " +
391
                        "    UNION ALL " +
392
                        "    SELECT " +
393
                        "        o.customer_id, " +
394
                        "        li.brand, " +
395
                        "        0 AS today_po_value, " +
396
                        "        0 AS today_billed_value, " +
397
                        "        CASE WHEN o.billing_timestamp IS NOT NULL THEN o.total_amount ELSE 0 END AS total_billed_value " +
398
                        "    FROM transaction.`order` o " +
399
                        "    JOIN transaction.lineitem li ON o.id = li.order_id " +
400
                        "    JOIN fofo.fofo_store fs2 ON fs2.id = o.customer_id " +
401
                        "    WHERE o.refund_timestamp IS NULL " +
402
                        "      AND o.billing_timestamp BETWEEN :startDate AND :endDate " +
403
                        "      AND o.created_timestamp NOT BETWEEN :startDate AND :endDate " +
404
                        "      AND fs2.internal = FALSE " +
405
                        "      AND li.brand NOT IN ('Smartdukaan', 'Dummy') " +
406
                        ") AS combined " +
407
                        "JOIN fofo.fofo_store fs ON fs.id = combined.customer_id " +
408
                        "LEFT JOIN cs.partner_region pr ON pr.fofo_id = combined.customer_id AND pr.region_id = 18 " +
409
                        "GROUP BY COALESCE(pr.region_id, fs.warehouse_id), combined.brand " +
410
                        "ORDER BY warehouse_id, combined.brand",
411
                resultSetMapping = "TodayPoByRegion"
35155 ranu 412
        )
33396 amit.gupta 413
 
30161 manish 414
})
415
 
30279 tejbeer 416
@SqlResultSetMappings({
33396 amit.gupta 417
        @SqlResultSetMapping(name = "itemAvailabilityReservationMapping", classes = {@ConstructorResult(targetClass = WarehouseItemQtyModel.class,
418
                columns = {@ColumnResult(name = "item_id", type = Integer.class), @ColumnResult(name = "vendor_warehouse_id", type = Integer.class), 
419
                        @ColumnResult(name = "availability", type = Integer.class),
420
                        @ColumnResult(name = "reserved", type = Integer.class), @ColumnResult(name = "net_availability", type = Integer.class)})}),
30161 manish 421
 
31860 tejbeer 422
        @SqlResultSetMapping(name = "partnerSecondaryPlanModel", classes = {@ConstructorResult(targetClass = PartnerSecondaryPlanModel.class, columns = {@ColumnResult(name = "id", type = Integer.class), @ColumnResult(name = "brand", type = String.class), @ColumnResult(name = "secondary_plan", type = Long.class), @ColumnResult(name = "total_price", type = Long.class), @ColumnResult(name = "auth_id", type = Integer.class), @ColumnResult(name = "commited_timestamp", type = LocalDateTime.class)})}),
30279 tejbeer 423
 
33145 tejus.loha 424
        @SqlResultSetMapping(name = "PriceDropReportModel", classes = {@ConstructorResult(targetClass = PriceDropReportModel.class, columns = {@ColumnResult(name = "code", type = String.class), @ColumnResult(name = "id", type = Integer.class), @ColumnResult(name = "brand", type = String.class), @ColumnResult(name = "model_name", type = String.class), @ColumnResult(name = "model_number", type = String.class), @ColumnResult(name = "affected_on", type = LocalDateTime.class), @ColumnResult(name = "amount", type = Float.class), @ColumnResult(name = "partner_payout", type = Float.class), @ColumnResult(name = "imei", type = String.class), @ColumnResult(name = "status", type = String.class), @ColumnResult(name = "update_timestamp", type = LocalDateTime.class), @ColumnResult(name = "rejection_reason", type = String.class), @ColumnResult(name = "credit_timestamp", type = LocalDateTime.class), @ColumnResult(name = "reject_timestamp", type = LocalDateTime.class)})}),
30279 tejbeer 425
 
32044 tejbeer 426
        @SqlResultSetMapping(name = "BillingDaysAvg", classes = {@ConstructorResult(targetClass = BillingDaysAvg.class, columns = {@ColumnResult(name = "customer_id", type = Integer.class), @ColumnResult(name = "average", type = Long.class)})}),
427
 
35153 ranu 428
        @SqlResultSetMapping(name = "LastSaleDays", classes = {@ConstructorResult(targetClass = LastSaleDateModel.class, columns = {@ColumnResult(name = "customer_id", type = Integer.class), @ColumnResult(name = "maxdate", type = LocalDateTime.class)})}),
429
        @SqlResultSetMapping(name = "TodayPoByAuthUsers",
35155 ranu 430
                classes = @ConstructorResult(
431
                        targetClass = BrandAuthUserPOModel.class,
35153 ranu 432
                        columns = {
35155 ranu 433
                                @ColumnResult(name = "auth_user_id", type = Integer.class),
35153 ranu 434
                                @ColumnResult(name = "brand", type = String.class),
35155 ranu 435
                                @ColumnResult(name = "today_po_value", type = Long.class),
436
                                @ColumnResult(name = "today_billed_value", type = Long.class),
437
                                @ColumnResult(name = "total_billed_value", type = Long.class),
438
                                @ColumnResult(name = "partner_count", type = Integer.class)
439
                        }
440
                )
35172 ranu 441
        ),
442
 
443
        @SqlResultSetMapping(name = "TodayPoByCatalog",
444
                classes = @ConstructorResult(
445
                        targetClass = ModelWisePartnerPoModel.class,
446
                        columns = {
447
                                @ColumnResult(name = "created_timestamp", type = LocalDateTime.class),
448
                                @ColumnResult(name = "customer_name", type = String.class),
449
                                @ColumnResult(name = "code", type = String.class),
450
                                @ColumnResult(name = "warehouse_id", type = Integer.class),
451
                                @ColumnResult(name = "brand", type = String.class),
452
                                @ColumnResult(name = "modal", type = String.class),
453
                                @ColumnResult(name = "catalog_item_id", type = Integer.class),
454
                                @ColumnResult(name = "status", type = String.class),
455
                                @ColumnResult(name = "quantity", type = Long.class),
456
                                @ColumnResult(name = "today_po_value", type = Long.class),
457
                                @ColumnResult(name = "today_billed_value", type = Long.class)
458
                        }
459
                )
35474 amit 460
        ),
461
 
462
        @SqlResultSetMapping(name = "TodayPoByRegion",
463
                classes = @ConstructorResult(
464
                        targetClass = BrandRegionPOModel.class,
465
                        columns = {
466
                                @ColumnResult(name = "warehouse_id", type = Integer.class),
467
                                @ColumnResult(name = "brand", type = String.class),
468
                                @ColumnResult(name = "today_po_value", type = Long.class),
469
                                @ColumnResult(name = "today_billed_value", type = Long.class),
470
                                @ColumnResult(name = "total_billed_value", type = Long.class)
471
                        }
472
                )
35155 ranu 473
        )
35154 ranu 474
 
30161 manish 475
})
476
 
35155 ranu 477
 
27723 tejbeer 478
public class Order implements Serializable {
479
 
31860 tejbeer 480
    private static final long serialVersionUID = 1L;
481
    @Id
482
    @Column(name = "id", unique = true, updatable = false)
483
    @GeneratedValue(strategy = GenerationType.IDENTITY)
484
    private Integer id;
485
    @Column(name = "warehouse_id")
486
    private Integer warehouseId;
487
    @Column(name = "seller_id")
488
    private Integer sellerId;
489
    @Column(name = "warehouse_address_id")
490
    private Integer warehouseAddressId;
491
    @Column(name = "logistics_provider_id")
492
    private Integer logisticsProviderId;
493
    @Column(name = "airwaybill_no", length = 50)
494
    private String airwayBillNumber;
495
    @Column(name = "tracking_id", length = 50)
496
    private String trackingId;
497
    @Convert(converter = LocalDateTimeAttributeConverter.class)
498
    @Column(name = "expected_delivery_time")
499
    private LocalDateTime expectedDeliveryTime;
500
    @Convert(converter = LocalDateTimeAttributeConverter.class)
501
    @Column(name = "promised_delivery_time")
502
    private LocalDateTime promisedDeliveryTime;
503
    @Convert(converter = LocalDateTimeAttributeConverter.class)
504
    @Column(name = "expected_shipping_time")
505
    private LocalDateTime expectedShippingTime;
506
    @Convert(converter = LocalDateTimeAttributeConverter.class)
507
    @Column(name = "promised_shipping_time")
508
    private LocalDateTime promisedShippingTime;
509
    @Convert(converter = LocalDateTimeAttributeConverter.class)
510
    @Column(name = "partner_grn_timestamp")
511
    private LocalDateTime partnerGrnTimestamp;
512
    @Transient
513
    private List<String> returnedImeis;
514
    @Column(name = "customer_id")
515
    private Integer retailerId;
516
    @Column(name = "customer_name", length = 50)
517
    private String retailerName;
518
    @Column(name = "customer_mobilenumber", length = 20)
519
    private String retailerMobileNumber;
520
    @Column(name = "customer_pincode", length = 10)
521
    private String retailerPinCode;
522
    @Column(name = "customer_address1", length = 100)
523
    private String retailerAddress1;
524
    @Column(name = "customer_address2", length = 100)
525
    private String retailerAddress2;
526
    @Column(name = "customer_city", length = 100)
527
    private String retailerCity;
528
    @Column(name = "customer_state", length = 100)
529
    private String retailerState;
530
    @Column(name = "customer_email", length = 50)
531
    private String retailerEmailId;
532
    @Column(name = "status")
533
    @Enumerated(EnumType.ORDINAL)
534
    private OrderStatus status;
535
    @Column(name = "statusDescription", length = 50)
536
    private String statusDescription;
537
    @Column(name = "total_amount")
538
    private Float totalAmount;
539
    @Column(name = "gvAmount")
540
    private Float gvAmount;
541
    @Column(name = "total_weight")
542
    private Float totalWeight;
543
    @Column(name = "invoice_number", length = 30)
544
    private String invoiceNumber;
545
    @Column(name = "billed_by", length = 30)
546
    private String billedBy;
547
    @Convert(converter = LocalDateTimeAttributeConverter.class)
548
    @Column(name = "created_timestamp")
549
    private LocalDateTime createTimestamp;
550
    @Convert(converter = LocalDateTimeAttributeConverter.class)
551
    @Column(name = "accepted_timestamp")
552
    private LocalDateTime acceptedTimestamp;
553
    @Convert(converter = LocalDateTimeAttributeConverter.class)
554
    @Column(name = "billing_timestamp")
555
    private LocalDateTime billingTimestamp;
556
    @Convert(converter = LocalDateTimeAttributeConverter.class)
557
    @Column(name = "shipping_timestamp")
558
    private LocalDateTime shippingTimestamp;
559
    @Convert(converter = LocalDateTimeAttributeConverter.class)
560
    @Column(name = "pickup_timestamp")
561
    private LocalDateTime pickupTimestamp;
562
    @Convert(converter = LocalDateTimeAttributeConverter.class)
563
    @Column(name = "delivery_timestamp")
564
    private LocalDateTime deliveryTimestamp;
565
    @Convert(converter = LocalDateTimeAttributeConverter.class)
566
    @Column(name = "outofstock_timestamp")
567
    private LocalDateTime outOfStockTimestamp;
568
    @Column(name = "transaction_id")
569
    private Integer transactionId;
570
    @Column(name = "receiver", length = 50)
571
    private String receiver;
572
    @Column(name = "batchNo")
573
    private Integer batchNumber;
574
    @Column(name = "serialNo")
575
    private Integer serialNumber;
576
    @Column(name = "doaFlag", columnDefinition = "tinyInteger(1) default 0")
577
    private Boolean doaFlag;
578
    @Column(name = "pickupRequestNo")
579
    private Integer pickupRequestNumber;
27723 tejbeer 580
 
33052 amit.gupta 581
    @Column(name = "jacket_number", length = 10)
34754 ranu 582
    private Long jacketNumber;
33052 amit.gupta 583
 
584
    public Boolean getDoaFlag() {
585
        return doaFlag;
586
    }
587
 
34754 ranu 588
    public Long getJacketNumber() {
33052 amit.gupta 589
        return jacketNumber;
590
    }
591
 
34754 ranu 592
    public void setJacketNumber(Long jacketNumber) {
33052 amit.gupta 593
        this.jacketNumber = jacketNumber;
594
    }
595
 
596
    public Boolean getCod() {
597
        return cod;
598
    }
599
 
600
    public Boolean getVendorPaid() {
601
        return vendorPaid;
602
    }
603
 
604
    public Boolean getOtg() {
605
        return otg;
606
    }
607
 
608
    public Boolean getIrnGenerated() {
609
        return irnGenerated;
610
    }
611
 
612
    public void setIrnGenerated(Boolean irnGenerated) {
613
        this.irnGenerated = irnGenerated;
614
    }
615
 
31860 tejbeer 616
    @Column(name = "new_order_id")
617
    private Integer newOrderId;
618
    @Column(name = "doa_auth_timestamp")
619
    private LocalDateTime doaAuthTimestamp;
620
    @Convert(converter = LocalDateTimeAttributeConverter.class)
621
    @Column(name = "doa_pickup_timestamp")
622
    private LocalDateTime doaPickupTimestamp;
623
    @Convert(converter = LocalDateTimeAttributeConverter.class)
624
    @Column(name = "received_return_timestamp")
625
    private LocalDateTime receiverReturnTimestamp;
626
    @Convert(converter = LocalDateTimeAttributeConverter.class)
627
    @Column(name = "reship_timestamp")
628
    private LocalDateTime reShipTimestamp;
629
    @Convert(converter = LocalDateTimeAttributeConverter.class)
630
    @Column(name = "refund_timestamp")
631
    private LocalDateTime refundTimestamp;
632
    @Column(name = "purchase_order_id")
633
    private Integer purchaseOrderId;
634
    @Column(name = "cod", columnDefinition = "tinyInteger(1) default 0")
635
    private Boolean cod;
636
    @Convert(converter = LocalDateTimeAttributeConverter.class)
637
    @Column(name = "verification_timestamp")
638
    private LocalDateTime verificationTimestamp;
639
    @Column(name = "refunded_by", length = 30)
640
    private String refundBy;
641
    @Column(name = "refund_reason", length = 256)
642
    private String refundReason;
643
    @Convert(converter = LocalDateTimeAttributeConverter.class)
644
    @Column(name = "cod_reconciliation_timestamp")
645
    private LocalDateTime codReconciliationTimestamp;
646
    private Integer previousStatus;
647
    @Column(name = "vendorId")
648
    private Integer vendorId;
649
    @Column(name = "delayReasonText", length = 250)
650
    private String delayReasonText;
651
    @Column(name = "doa_logistics_provider_id")
652
    private Integer doaLogisticsProviderId;
27723 tejbeer 653
 
31860 tejbeer 654
    /*
655
     * @Column(name = "delay_reason") private DelayReason delayReason;
656
     */
657
    @Column(name = "vendor_paid", columnDefinition = "tinyInteger(1) default 0")
658
    private Boolean vendorPaid;
659
    @Convert(converter = LocalDateTimeAttributeConverter.class)
660
    @Column(name = "local_connected_timestamp")
661
    private LocalDateTime localConnectedTimestamp;
662
    @Convert(converter = LocalDateTimeAttributeConverter.class)
663
    @Column(name = "reached_destination_timestamp")
664
    private LocalDateTime reachedDestinationTimestamp;
665
    @Convert(converter = LocalDateTimeAttributeConverter.class)
666
    @Column(name = "first_dlvyatmp_timestamp")
667
    private LocalDateTime firstDlvyatmpTimestamp;
668
    @Column(name = "originalOrderId")
669
    private Integer originalOrderId;
670
    @Column(name = "fulfilmentWarehouseId")
671
    private Integer fulfilmentWarehouseId;
672
    @Column(name = "orderType")
673
    private Integer orderType;
674
    @Column(name = "pickupStoreId")
675
    private Integer pickupStoreId;
676
    @Column(name = "otg", columnDefinition = "tinyInteger(1) default 0")
677
    private Boolean otg;
678
    @Convert(converter = LocalDateTimeAttributeConverter.class)
679
    @Column(name = "courier_delivery_time")
680
    private LocalDateTime courierDeliveryTimestamp;
681
    @Column(name = "insurer")
682
    private Integer insurer;
683
    @Column(name = "insuranceAmount")
684
    private Float insuranceAmount;
685
    @Column(name = "freebieItemId")
686
    private Integer freebieItemId;
687
    @Column(name = "source")
688
    private Integer source;
689
    @Column(name = "advanceAmount")
690
    private Float advanceAmount;
691
    @Column(name = "storeId")
692
    private Integer storeId;
693
    @Column(name = "productCondition")
694
    private Integer productCondition;
695
    @Column(name = "dataProtectionInsurer")
696
    private Integer dataProtectionInsurer;
697
    @Column(name = "dataProtectionAmount")
698
    private Integer dataProtectionAmount;
699
    @Column(name = "taxType")
700
    @Enumerated(EnumType.ORDINAL)
701
    private TaxType taxType;
702
    @Column(name = "logisticsTransactionId", length = 100)
703
    private String logisticsTransactionId;
704
    @Column(name = "shippingCost")
705
    private Float shippingCost;
706
    @Column(name = "codCharges")
707
    private Float codCharges;
708
    @Column(name = "wallet_amount")
709
    private Float walletAmount;
710
    @Column(name = "net_payable_amount")
711
    private Float netPayableAmount;
712
    @Column(name = "shippingRefund")
713
    private Float shippingRefund;
714
    @Column(name = "irn_generated")
715
    private Boolean irnGenerated;
716
    @Column(name = "shipment_hold")
717
    private Boolean shipmentHold;
718
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
719
    @JoinColumn(name = "id", insertable = false, updatable = false, nullable = false, referencedColumnName = "order_id")
720
    private LineItem lineItem;
27723 tejbeer 721
 
31860 tejbeer 722
    public Order() {
723
    }
31539 amit.gupta 724
 
31860 tejbeer 725
    public LocalDateTime getPartnerGrnTimestamp() {
726
        return partnerGrnTimestamp;
727
    }
31539 amit.gupta 728
 
31860 tejbeer 729
    public void setPartnerGrnTimestamp(LocalDateTime partnerGrnTimestamp) {
730
        this.partnerGrnTimestamp = partnerGrnTimestamp;
731
    }
31539 amit.gupta 732
 
31860 tejbeer 733
    public List<String> getReturnedImeis() {
734
        return returnedImeis;
735
    }
31539 amit.gupta 736
 
31860 tejbeer 737
    public void setReturnedImeis(List<String> returnedImeis) {
738
        this.returnedImeis = returnedImeis;
739
    }
31539 amit.gupta 740
 
31860 tejbeer 741
    public Integer getId() {
742
        return id;
743
    }
27723 tejbeer 744
 
31860 tejbeer 745
    public void setId(Integer id) {
746
        this.id = id;
747
    }
27723 tejbeer 748
 
31860 tejbeer 749
    public Integer getWarehouseId() {
750
        return warehouseId;
751
    }
27723 tejbeer 752
 
31860 tejbeer 753
    public void setWarehouseId(Integer warehouseId) {
754
        this.warehouseId = warehouseId;
755
    }
27723 tejbeer 756
 
31860 tejbeer 757
    public Integer getSellerId() {
758
        return sellerId;
759
    }
27723 tejbeer 760
 
31860 tejbeer 761
    public void setSellerId(Integer sellerId) {
762
        this.sellerId = sellerId;
763
    }
27723 tejbeer 764
 
31860 tejbeer 765
    public Integer getWarehouseAddressId() {
766
        return warehouseAddressId;
767
    }
27723 tejbeer 768
 
31860 tejbeer 769
    public void setWarehouseAddressId(Integer warehouseAddressId) {
770
        this.warehouseAddressId = warehouseAddressId;
771
    }
27723 tejbeer 772
 
31860 tejbeer 773
    public Integer getLogisticsProviderId() {
774
        return logisticsProviderId;
775
    }
27723 tejbeer 776
 
31860 tejbeer 777
    public void setLogisticsProviderId(Integer logisticsProviderId) {
778
        this.logisticsProviderId = logisticsProviderId;
779
    }
27723 tejbeer 780
 
31860 tejbeer 781
    public String getAirwayBillNumber() {
782
        return airwayBillNumber;
783
    }
27723 tejbeer 784
 
31860 tejbeer 785
    public void setAirwayBillNumber(String airwayBillNumber) {
786
        this.airwayBillNumber = airwayBillNumber;
787
    }
27723 tejbeer 788
 
31860 tejbeer 789
    public String getTrackingId() {
790
        return trackingId;
791
    }
27723 tejbeer 792
 
31860 tejbeer 793
    public void setTrackingId(String trackingId) {
794
        this.trackingId = trackingId;
795
    }
27723 tejbeer 796
 
31860 tejbeer 797
    public LocalDateTime getExpectedDeliveryTime() {
798
        return expectedDeliveryTime;
799
    }
27723 tejbeer 800
 
31860 tejbeer 801
    public void setExpectedDeliveryTime(LocalDateTime expectedDeliveryTime) {
802
        this.expectedDeliveryTime = expectedDeliveryTime;
803
    }
27723 tejbeer 804
 
31860 tejbeer 805
    public LocalDateTime getPromisedDeliveryTime() {
806
        return promisedDeliveryTime;
807
    }
27723 tejbeer 808
 
31860 tejbeer 809
    public void setPromisedDeliveryTime(LocalDateTime promisedDeliveryTime) {
810
        this.promisedDeliveryTime = promisedDeliveryTime;
811
    }
27723 tejbeer 812
 
31860 tejbeer 813
    public LocalDateTime getExpectedShippingTime() {
814
        return expectedShippingTime;
815
    }
27723 tejbeer 816
 
31860 tejbeer 817
    public void setExpectedShippingTime(LocalDateTime expectedShippingTime) {
818
        this.expectedShippingTime = expectedShippingTime;
819
    }
27723 tejbeer 820
 
31860 tejbeer 821
    public LocalDateTime getPromisedShippingTime() {
822
        return promisedShippingTime;
823
    }
27723 tejbeer 824
 
31860 tejbeer 825
    public void setPromisedShippingTime(LocalDateTime promisedShippingTime) {
826
        this.promisedShippingTime = promisedShippingTime;
827
    }
27723 tejbeer 828
 
31860 tejbeer 829
    public Integer getRetailerId() {
830
        return retailerId;
831
    }
27723 tejbeer 832
 
31860 tejbeer 833
    public void setRetailerId(Integer retailerId) {
834
        this.retailerId = retailerId;
835
    }
27723 tejbeer 836
 
31860 tejbeer 837
    public String getRetailerName() {
838
        return retailerName;
839
    }
27723 tejbeer 840
 
31860 tejbeer 841
    public void setRetailerName(String retailerName) {
842
        this.retailerName = retailerName;
843
    }
27723 tejbeer 844
 
31860 tejbeer 845
    public String getRetailerMobileNumber() {
846
        return retailerMobileNumber;
847
    }
27723 tejbeer 848
 
31860 tejbeer 849
    public void setRetailerMobileNumber(String retailerMobileNumber) {
850
        this.retailerMobileNumber = retailerMobileNumber;
851
    }
27723 tejbeer 852
 
31860 tejbeer 853
    public String getRetailerPinCode() {
854
        return retailerPinCode;
855
    }
27723 tejbeer 856
 
31860 tejbeer 857
    public void setRetailerPinCode(String retailerPinCode) {
858
        this.retailerPinCode = retailerPinCode;
859
    }
27723 tejbeer 860
 
31860 tejbeer 861
    public String getRetailerAddress1() {
862
        return retailerAddress1;
863
    }
27723 tejbeer 864
 
31860 tejbeer 865
    public void setRetailerAddress1(String retailerAddress1) {
866
        this.retailerAddress1 = retailerAddress1;
867
    }
27723 tejbeer 868
 
31860 tejbeer 869
    public String getRetailerAddress2() {
870
        return retailerAddress2;
871
    }
27723 tejbeer 872
 
31860 tejbeer 873
    public void setRetailerAddress2(String retailerAddress2) {
874
        this.retailerAddress2 = retailerAddress2;
875
    }
27723 tejbeer 876
 
31860 tejbeer 877
    public String getRetailerCity() {
878
        return retailerCity;
879
    }
27723 tejbeer 880
 
31860 tejbeer 881
    public void setRetailerCity(String retailerCity) {
882
        this.retailerCity = retailerCity;
883
    }
27723 tejbeer 884
 
31860 tejbeer 885
    public String getRetailerState() {
886
        return retailerState;
887
    }
27723 tejbeer 888
 
31860 tejbeer 889
    public void setRetailerState(String retailerState) {
890
        this.retailerState = retailerState;
891
    }
27723 tejbeer 892
 
31860 tejbeer 893
    public String getRetailerEmailId() {
894
        return retailerEmailId;
895
    }
27723 tejbeer 896
 
31860 tejbeer 897
    public void setRetailerEmailId(String retailerEmailId) {
898
        this.retailerEmailId = retailerEmailId;
899
    }
27723 tejbeer 900
 
31860 tejbeer 901
    public OrderStatus getStatus() {
902
        return status;
903
    }
27723 tejbeer 904
 
31860 tejbeer 905
    public void setStatus(OrderStatus status) {
906
        this.status = status;
907
    }
27723 tejbeer 908
 
31860 tejbeer 909
    public String getStatusDescription() {
910
        return statusDescription;
911
    }
27723 tejbeer 912
 
31860 tejbeer 913
    public void setStatusDescription(String statusDescription) {
914
        this.statusDescription = statusDescription;
915
    }
27723 tejbeer 916
 
31860 tejbeer 917
    public Float getTotalAmount() {
918
        return totalAmount;
919
    }
27723 tejbeer 920
 
31860 tejbeer 921
    public void setTotalAmount(Float totalAmount) {
922
        this.totalAmount = totalAmount;
923
    }
27723 tejbeer 924
 
31860 tejbeer 925
    public Float getGvAmount() {
926
        return gvAmount;
927
    }
27723 tejbeer 928
 
31860 tejbeer 929
    public void setGvAmount(Float gvAmount) {
930
        this.gvAmount = gvAmount;
931
    }
27723 tejbeer 932
 
31860 tejbeer 933
    public Float getTotalWeight() {
934
        return totalWeight;
935
    }
27723 tejbeer 936
 
31860 tejbeer 937
    public void setTotalWeight(Float totalWeight) {
938
        this.totalWeight = totalWeight;
939
    }
27723 tejbeer 940
 
31860 tejbeer 941
    public String getInvoiceNumber() {
942
        return invoiceNumber;
943
    }
27723 tejbeer 944
 
31860 tejbeer 945
    public void setInvoiceNumber(String invoiceNumber) {
946
        this.invoiceNumber = invoiceNumber;
947
    }
27723 tejbeer 948
 
31860 tejbeer 949
    public String getBilledBy() {
950
        return billedBy;
951
    }
27723 tejbeer 952
 
31860 tejbeer 953
    public void setBilledBy(String billedBy) {
954
        this.billedBy = billedBy;
955
    }
27723 tejbeer 956
 
31860 tejbeer 957
    public LocalDateTime getCreateTimestamp() {
958
        return createTimestamp;
959
    }
27723 tejbeer 960
 
31860 tejbeer 961
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
962
        this.createTimestamp = createTimestamp;
963
    }
27723 tejbeer 964
 
31860 tejbeer 965
    public LocalDateTime getAcceptedTimestamp() {
966
        return acceptedTimestamp;
967
    }
27723 tejbeer 968
 
31860 tejbeer 969
    public void setAcceptedTimestamp(LocalDateTime acceptedTimestamp) {
970
        this.acceptedTimestamp = acceptedTimestamp;
971
    }
27723 tejbeer 972
 
31860 tejbeer 973
    public LocalDateTime getBillingTimestamp() {
974
        return billingTimestamp;
975
    }
27723 tejbeer 976
 
31860 tejbeer 977
    public void setBillingTimestamp(LocalDateTime billingTimestamp) {
978
        this.billingTimestamp = billingTimestamp;
979
    }
27723 tejbeer 980
 
31860 tejbeer 981
    public LocalDateTime getShippingTimestamp() {
982
        return shippingTimestamp;
983
    }
27723 tejbeer 984
 
31860 tejbeer 985
    public void setShippingTimestamp(LocalDateTime shippingTimestamp) {
986
        this.shippingTimestamp = shippingTimestamp;
987
    }
27723 tejbeer 988
 
31860 tejbeer 989
    public LocalDateTime getPickupTimestamp() {
990
        return pickupTimestamp;
991
    }
27723 tejbeer 992
 
31860 tejbeer 993
    public void setPickupTimestamp(LocalDateTime pickupTimestamp) {
994
        this.pickupTimestamp = pickupTimestamp;
995
    }
27723 tejbeer 996
 
31860 tejbeer 997
    public LocalDateTime getDeliveryTimestamp() {
998
        return deliveryTimestamp;
999
    }
27723 tejbeer 1000
 
31860 tejbeer 1001
    public void setDeliveryTimestamp(LocalDateTime deliveryTimestamp) {
1002
        this.deliveryTimestamp = deliveryTimestamp;
1003
    }
27723 tejbeer 1004
 
31860 tejbeer 1005
    public LocalDateTime getOutOfStockTimestamp() {
1006
        return outOfStockTimestamp;
1007
    }
27723 tejbeer 1008
 
31860 tejbeer 1009
    public void setOutOfStockTimestamp(LocalDateTime outOfStockTimestamp) {
1010
        this.outOfStockTimestamp = outOfStockTimestamp;
1011
    }
27723 tejbeer 1012
 
31860 tejbeer 1013
    public Integer getTransactionId() {
1014
        return transactionId;
1015
    }
27723 tejbeer 1016
 
31860 tejbeer 1017
    public void setTransactionId(Integer transactionId) {
1018
        this.transactionId = transactionId;
1019
    }
27723 tejbeer 1020
 
31860 tejbeer 1021
    /*
1022
     * public Integer getJacketNumber() { return jacketNumber; } public void
1023
     * setJacketNumber(Integer jacketNumber) { this.jacketNumber = jacketNumber; }
1024
     */
1025
    public String getReceiver() {
1026
        return receiver;
1027
    }
27723 tejbeer 1028
 
31860 tejbeer 1029
    public void setReceiver(String receiver) {
1030
        this.receiver = receiver;
1031
    }
27723 tejbeer 1032
 
31860 tejbeer 1033
    public Integer getBatchNumber() {
1034
        return batchNumber;
1035
    }
27723 tejbeer 1036
 
31860 tejbeer 1037
    public void setBatchNumber(Integer batchNumber) {
1038
        this.batchNumber = batchNumber;
1039
    }
27723 tejbeer 1040
 
31860 tejbeer 1041
    public Integer getSerialNumber() {
1042
        return serialNumber;
1043
    }
27723 tejbeer 1044
 
31860 tejbeer 1045
    public void setSerialNumber(Integer serialNumber) {
1046
        this.serialNumber = serialNumber;
1047
    }
27723 tejbeer 1048
 
31860 tejbeer 1049
    public Boolean getShipmentHold() {
1050
        return shipmentHold;
1051
    }
31020 tejbeer 1052
 
31860 tejbeer 1053
    public void setShipmentHold(Boolean shipmentHold) {
1054
        this.shipmentHold = shipmentHold;
1055
    }
31020 tejbeer 1056
 
31860 tejbeer 1057
    public Boolean isDoaFlag() {
1058
        return doaFlag;
1059
    }
27723 tejbeer 1060
 
31860 tejbeer 1061
    public void setDoaFlag(Boolean doaFlag) {
1062
        this.doaFlag = doaFlag;
1063
    }
27723 tejbeer 1064
 
31860 tejbeer 1065
    public Integer getPickupRequestNumber() {
1066
        return pickupRequestNumber;
1067
    }
27723 tejbeer 1068
 
31860 tejbeer 1069
    public void setPickupRequestNumber(Integer pickupRequestNumber) {
1070
        this.pickupRequestNumber = pickupRequestNumber;
1071
    }
27723 tejbeer 1072
 
31860 tejbeer 1073
    public Integer getNewOrderId() {
1074
        return newOrderId;
1075
    }
27723 tejbeer 1076
 
31860 tejbeer 1077
    public void setNewOrderId(Integer newOrderId) {
1078
        this.newOrderId = newOrderId;
1079
    }
27723 tejbeer 1080
 
31860 tejbeer 1081
    public LocalDateTime getDoaAuthTimestamp() {
1082
        return doaAuthTimestamp;
1083
    }
27723 tejbeer 1084
 
31860 tejbeer 1085
    public void setDoaAuthTimestamp(LocalDateTime doaAuthTimestamp) {
1086
        this.doaAuthTimestamp = doaAuthTimestamp;
1087
    }
27723 tejbeer 1088
 
31860 tejbeer 1089
    public LocalDateTime getDoaPickupTimestamp() {
1090
        return doaPickupTimestamp;
1091
    }
27723 tejbeer 1092
 
31860 tejbeer 1093
    public void setDoaPickupTimestamp(LocalDateTime doaPickupTimestamp) {
1094
        this.doaPickupTimestamp = doaPickupTimestamp;
1095
    }
27723 tejbeer 1096
 
31860 tejbeer 1097
    public LocalDateTime getReceiverReturnTimestamp() {
1098
        return receiverReturnTimestamp;
1099
    }
27723 tejbeer 1100
 
31860 tejbeer 1101
    public void setReceiverReturnTimestamp(LocalDateTime receiverReturnTimestamp) {
1102
        this.receiverReturnTimestamp = receiverReturnTimestamp;
1103
    }
27723 tejbeer 1104
 
31860 tejbeer 1105
    public LocalDateTime getReShipTimestamp() {
1106
        return reShipTimestamp;
1107
    }
27723 tejbeer 1108
 
31860 tejbeer 1109
    public void setReShipTimestamp(LocalDateTime reShipTimestamp) {
1110
        this.reShipTimestamp = reShipTimestamp;
1111
    }
27723 tejbeer 1112
 
31860 tejbeer 1113
    public LocalDateTime getRefundTimestamp() {
1114
        return refundTimestamp;
1115
    }
27723 tejbeer 1116
 
31860 tejbeer 1117
    public void setRefundTimestamp(LocalDateTime refundTimestamp) {
1118
        this.refundTimestamp = refundTimestamp;
1119
    }
27723 tejbeer 1120
 
31860 tejbeer 1121
    public Integer getPurchaseOrderId() {
1122
        return purchaseOrderId;
1123
    }
27723 tejbeer 1124
 
31860 tejbeer 1125
    public void setPurchaseOrderId(Integer purchaseOrderId) {
1126
        this.purchaseOrderId = purchaseOrderId;
1127
    }
27723 tejbeer 1128
 
31860 tejbeer 1129
    public Boolean isCod() {
1130
        return cod;
1131
    }
27723 tejbeer 1132
 
31860 tejbeer 1133
    public void setCod(Boolean cod) {
1134
        this.cod = cod;
1135
    }
27723 tejbeer 1136
 
31860 tejbeer 1137
    public LocalDateTime getVerificationTimestamp() {
1138
        return verificationTimestamp;
1139
    }
27723 tejbeer 1140
 
31860 tejbeer 1141
    public void setVerificationTimestamp(LocalDateTime verificationTimestamp) {
1142
        this.verificationTimestamp = verificationTimestamp;
1143
    }
27723 tejbeer 1144
 
31860 tejbeer 1145
    public String getRefundBy() {
1146
        return refundBy;
1147
    }
27723 tejbeer 1148
 
31860 tejbeer 1149
    public void setRefundBy(String refundBy) {
1150
        this.refundBy = refundBy;
1151
    }
27723 tejbeer 1152
 
31860 tejbeer 1153
    public String getRefundReason() {
1154
        return refundReason;
1155
    }
27723 tejbeer 1156
 
31860 tejbeer 1157
    public void setRefundReason(String refundReason) {
1158
        this.refundReason = refundReason;
1159
    }
27723 tejbeer 1160
 
31860 tejbeer 1161
    /*
1162
     * public DelayReason getDelayReason() { return delayReason; } public void
1163
     * setDelayReason(DelayReason delayReason) { this.delayReason = delayReason; }
1164
     */
1165
    public LocalDateTime getCodReconciliationTimestamp() {
1166
        return codReconciliationTimestamp;
1167
    }
27723 tejbeer 1168
 
31860 tejbeer 1169
    public void setCodReconciliationTimestamp(LocalDateTime codReconciliationTimestamp) {
1170
        this.codReconciliationTimestamp = codReconciliationTimestamp;
1171
    }
27723 tejbeer 1172
 
31860 tejbeer 1173
    public Integer getPreviousStatus() {
1174
        return previousStatus;
1175
    }
27723 tejbeer 1176
 
31860 tejbeer 1177
    public void setPreviousStatus(Integer previousStatus) {
1178
        this.previousStatus = previousStatus;
1179
    }
27723 tejbeer 1180
 
31860 tejbeer 1181
    public Integer getVendorId() {
1182
        return vendorId;
1183
    }
27723 tejbeer 1184
 
31860 tejbeer 1185
    public void setVendorId(Integer vendorId) {
1186
        this.vendorId = vendorId;
1187
    }
27723 tejbeer 1188
 
31860 tejbeer 1189
    public String getDelayReasonText() {
1190
        return delayReasonText;
1191
    }
27723 tejbeer 1192
 
31860 tejbeer 1193
    public void setDelayReasonText(String delayReasonText) {
1194
        this.delayReasonText = delayReasonText;
1195
    }
27723 tejbeer 1196
 
31860 tejbeer 1197
    public Integer getDoaLogisticsProviderId() {
1198
        return doaLogisticsProviderId;
1199
    }
27723 tejbeer 1200
 
31860 tejbeer 1201
    public void setDoaLogisticsProviderId(Integer doaLogisticsProviderId) {
1202
        this.doaLogisticsProviderId = doaLogisticsProviderId;
1203
    }
27723 tejbeer 1204
 
31860 tejbeer 1205
    public Boolean isVendorPaid() {
1206
        return vendorPaid;
1207
    }
27723 tejbeer 1208
 
31860 tejbeer 1209
    public void setVendorPaid(Boolean vendorPaid) {
1210
        this.vendorPaid = vendorPaid;
1211
    }
27723 tejbeer 1212
 
31860 tejbeer 1213
    public LocalDateTime getLocalConnectedTimestamp() {
1214
        return localConnectedTimestamp;
1215
    }
27723 tejbeer 1216
 
31860 tejbeer 1217
    public void setLocalConnectedTimestamp(LocalDateTime localConnectedTimestamp) {
1218
        this.localConnectedTimestamp = localConnectedTimestamp;
1219
    }
27723 tejbeer 1220
 
31860 tejbeer 1221
    public LocalDateTime getReachedDestinationTimestamp() {
1222
        return reachedDestinationTimestamp;
1223
    }
27723 tejbeer 1224
 
31860 tejbeer 1225
    public void setReachedDestinationTimestamp(LocalDateTime reachedDestinationTimestamp) {
1226
        this.reachedDestinationTimestamp = reachedDestinationTimestamp;
1227
    }
27723 tejbeer 1228
 
31860 tejbeer 1229
    public LocalDateTime getFirstDlvyatmpTimestamp() {
1230
        return firstDlvyatmpTimestamp;
1231
    }
27723 tejbeer 1232
 
31860 tejbeer 1233
    public void setFirstDlvyatmpTimestamp(LocalDateTime firstDlvyatmpTimestamp) {
1234
        this.firstDlvyatmpTimestamp = firstDlvyatmpTimestamp;
1235
    }
27723 tejbeer 1236
 
31860 tejbeer 1237
    public Integer getOriginalOrderId() {
1238
        return originalOrderId;
1239
    }
27723 tejbeer 1240
 
31860 tejbeer 1241
    public void setOriginalOrderId(Integer originalOrderId) {
1242
        this.originalOrderId = originalOrderId;
1243
    }
27723 tejbeer 1244
 
31860 tejbeer 1245
    public Integer getFulfilmentWarehouseId() {
1246
        return fulfilmentWarehouseId;
1247
    }
27723 tejbeer 1248
 
31860 tejbeer 1249
    public void setFulfilmentWarehouseId(Integer fulfilmentWarehouseId) {
1250
        this.fulfilmentWarehouseId = fulfilmentWarehouseId;
1251
    }
27723 tejbeer 1252
 
31860 tejbeer 1253
    public Integer getOrderType() {
1254
        return orderType;
1255
    }
27723 tejbeer 1256
 
31860 tejbeer 1257
    public void setOrderType(Integer orderType) {
1258
        this.orderType = orderType;
1259
    }
27723 tejbeer 1260
 
31860 tejbeer 1261
    public Integer getPickupStoreId() {
1262
        return pickupStoreId;
1263
    }
27723 tejbeer 1264
 
31860 tejbeer 1265
    public void setPickupStoreId(Integer pickupStoreId) {
1266
        this.pickupStoreId = pickupStoreId;
1267
    }
27723 tejbeer 1268
 
31860 tejbeer 1269
    public Boolean isOtg() {
1270
        return otg;
1271
    }
27723 tejbeer 1272
 
31860 tejbeer 1273
    public void setOtg(Boolean otg) {
1274
        this.otg = otg;
1275
    }
27723 tejbeer 1276
 
31860 tejbeer 1277
    public LocalDateTime getCourierDeliveryTimestamp() {
1278
        return courierDeliveryTimestamp;
1279
    }
27723 tejbeer 1280
 
31860 tejbeer 1281
    public void setCourierDeliveryTimestamp(LocalDateTime courierDeliveryTimestamp) {
1282
        this.courierDeliveryTimestamp = courierDeliveryTimestamp;
1283
    }
27723 tejbeer 1284
 
31860 tejbeer 1285
    public Integer getInsurer() {
1286
        return insurer;
1287
    }
27723 tejbeer 1288
 
31860 tejbeer 1289
    public void setInsurer(Integer insurer) {
1290
        this.insurer = insurer;
1291
    }
27723 tejbeer 1292
 
31860 tejbeer 1293
    public Float getInsuranceAmount() {
1294
        return insuranceAmount;
1295
    }
27723 tejbeer 1296
 
31860 tejbeer 1297
    public void setInsuranceAmount(Float insuranceAmount) {
1298
        this.insuranceAmount = insuranceAmount;
1299
    }
27723 tejbeer 1300
 
31860 tejbeer 1301
    public Integer getFreebieItemId() {
1302
        return freebieItemId;
1303
    }
27723 tejbeer 1304
 
31860 tejbeer 1305
    public void setFreebieItemId(Integer freebieItemId) {
1306
        this.freebieItemId = freebieItemId;
1307
    }
27723 tejbeer 1308
 
31860 tejbeer 1309
    public Integer getSource() {
1310
        return source;
1311
    }
27723 tejbeer 1312
 
31860 tejbeer 1313
    public void setSource(Integer source) {
1314
        this.source = source;
1315
    }
27723 tejbeer 1316
 
31860 tejbeer 1317
    public Float getAdvanceAmount() {
1318
        return advanceAmount;
1319
    }
27723 tejbeer 1320
 
31860 tejbeer 1321
    public void setAdvanceAmount(Float advanceAmount) {
1322
        this.advanceAmount = advanceAmount;
1323
    }
27723 tejbeer 1324
 
31860 tejbeer 1325
    public Integer getStoreId() {
1326
        return storeId;
1327
    }
27723 tejbeer 1328
 
31860 tejbeer 1329
    public void setStoreId(Integer storeId) {
1330
        this.storeId = storeId;
1331
    }
27723 tejbeer 1332
 
31860 tejbeer 1333
    public Integer getProductCondition() {
1334
        return productCondition;
1335
    }
27723 tejbeer 1336
 
31860 tejbeer 1337
    public void setProductCondition(Integer productCondition) {
1338
        this.productCondition = productCondition;
1339
    }
27723 tejbeer 1340
 
31860 tejbeer 1341
    public Integer getDataProtectionInsurer() {
1342
        return dataProtectionInsurer;
1343
    }
27723 tejbeer 1344
 
31860 tejbeer 1345
    public void setDataProtectionInsurer(Integer dataProtectionInsurer) {
1346
        this.dataProtectionInsurer = dataProtectionInsurer;
1347
    }
27723 tejbeer 1348
 
31860 tejbeer 1349
    public Integer getDataProtectionAmount() {
1350
        return dataProtectionAmount;
1351
    }
27723 tejbeer 1352
 
31860 tejbeer 1353
    public void setDataProtectionAmount(Integer dataProtectionAmount) {
1354
        this.dataProtectionAmount = dataProtectionAmount;
1355
    }
27723 tejbeer 1356
 
31860 tejbeer 1357
    public TaxType getTaxType() {
1358
        return taxType;
1359
    }
27723 tejbeer 1360
 
31860 tejbeer 1361
    public void setTaxType(TaxType taxType) {
1362
        this.taxType = taxType;
1363
    }
27723 tejbeer 1364
 
31860 tejbeer 1365
    public String getLogisticsTransactionId() {
1366
        return logisticsTransactionId;
1367
    }
27723 tejbeer 1368
 
31860 tejbeer 1369
    public void setLogisticsTransactionId(String logisticsTransactionId) {
1370
        this.logisticsTransactionId = logisticsTransactionId;
1371
    }
27723 tejbeer 1372
 
31860 tejbeer 1373
    public Float getShippingCost() {
1374
        return shippingCost;
1375
    }
27723 tejbeer 1376
 
31860 tejbeer 1377
    public void setShippingCost(Float shippingCost) {
1378
        this.shippingCost = shippingCost;
1379
    }
27723 tejbeer 1380
 
31860 tejbeer 1381
    public Float getCodCharges() {
1382
        return codCharges;
1383
    }
27723 tejbeer 1384
 
31860 tejbeer 1385
    public void setCodCharges(Float codCharges) {
1386
        this.codCharges = codCharges;
1387
    }
27723 tejbeer 1388
 
31860 tejbeer 1389
    public Float getWalletAmount() {
1390
        return walletAmount;
1391
    }
27723 tejbeer 1392
 
31860 tejbeer 1393
    public void setWalletAmount(Float walletAmount) {
1394
        this.walletAmount = walletAmount;
1395
    }
27723 tejbeer 1396
 
31860 tejbeer 1397
    public Float getNetPayableAmount() {
1398
        return netPayableAmount;
1399
    }
27723 tejbeer 1400
 
31860 tejbeer 1401
    public void setNetPayableAmount(Float netPayableAmount) {
1402
        this.netPayableAmount = netPayableAmount;
1403
    }
27723 tejbeer 1404
 
31860 tejbeer 1405
    public Float getShippingRefund() {
1406
        return shippingRefund;
1407
    }
27723 tejbeer 1408
 
31860 tejbeer 1409
    public void setShippingRefund(Float shippingRefund) {
1410
        this.shippingRefund = shippingRefund;
1411
    }
27723 tejbeer 1412
 
31860 tejbeer 1413
    public LineItem getLineItem() {
1414
        return lineItem;
1415
    }
27723 tejbeer 1416
 
31860 tejbeer 1417
    public void setLineItem(LineItem lineItem) {
1418
        this.lineItem = lineItem;
1419
    }
27723 tejbeer 1420
 
31860 tejbeer 1421
    public String getFormattedDate() {
1422
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
1423
        return this.createTimestamp.format(formatter);
1424
    }
27723 tejbeer 1425
 
31860 tejbeer 1426
    @Override
1427
    public int hashCode() {
1428
        final int prime = 31;
1429
        int result = 1;
1430
        result = prime * result + ((id == null) ? 0 : id.hashCode());
1431
        return result;
1432
    }
27723 tejbeer 1433
 
31860 tejbeer 1434
    @Override
1435
    public boolean equals(Object obj) {
1436
        if (this == obj)
1437
            return true;
1438
        if (obj == null)
1439
            return false;
1440
        if (getClass() != obj.getClass())
1441
            return false;
1442
        Order other = (Order) obj;
1443
        if (id == null) {
1444
            if (other.id != null)
1445
                return false;
1446
        } else if (!id.equals(other.id))
1447
            return false;
1448
        return true;
1449
    }
27723 tejbeer 1450
 
31860 tejbeer 1451
    public Boolean isIrnGenerated() {
1452
        return irnGenerated;
1453
    }
30289 amit.gupta 1454
 
31860 tejbeer 1455
    public void setIrnGenerated(boolean irnGenerated) {
1456
        this.irnGenerated = irnGenerated;
1457
    }
30289 amit.gupta 1458
 
31860 tejbeer 1459
    @Override
1460
    public String toString() {
1461
        return "Order [id=" + id + "]";
1462
    }
27723 tejbeer 1463
 
21545 ashik.ali 1464
}