Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
21714 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
21596 ashik.ali 2
 
33177 tejus.loha 3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
34384 ranu 4
import com.spice.profitmandi.dao.model.DateWiseSoldCatalogQtyModel;
33177 tejus.loha 5
import com.spice.profitmandi.dao.model.LastSaleDateModel;
6
 
7
import javax.persistence.*;
21596 ashik.ali 8
import java.io.Serializable;
25726 amit.gupta 9
import java.time.LocalDate;
21596 ashik.ali 10
import java.time.LocalDateTime;
22243 ashik.ali 11
import java.time.format.DateTimeFormatter;
21596 ashik.ali 12
 
13
@Entity
31860 tejbeer 14
@Table(name = "fofo.fofo_order")
21596 ashik.ali 15
 
27579 tejbeer 16
@NamedQueries({
17
 
31860 tejbeer 18
        @NamedQuery(name = "FofoOrder.SelectItemWiseTertiary", query = "select new com.spice.profitmandi.dao.model.ItemWiseTertiaryModel(foi.brand," + "foi.modelName, foi.modelNumber, foi.color, foi.quantity, foi.mop)" + " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId where fo.cancelledTimestamp is null and fo.fofoId = :fofoId" + " and fo.createTimestamp between :startDate and :endDate"),
27579 tejbeer 19
 
31860 tejbeer 20
        @NamedQuery(name = "FofoOrder.selectOrderByModelsAndSaleBetween", query = "select fo from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId" + " join Item i on i.id=foi.itemId where fo.cancelledTimestamp is null and i.catalogItemId in :catalogItemIds" + " and fo.createTimestamp between :startDate and :endDate"),
30641 amit.gupta 21
 
31860 tejbeer 22
        @NamedQuery(name = "FofoOrder.selectGroupByBrandPartnerTertiary", query = "select new com.spice.profitmandi.dao.model.BrandWiseTertiaryModel(foi.brand, " + "sum(case when foi.createTimestamp >= :today then CAST(foi.quantity*foi.mop  AS int) else 0 end)," + "sum(case when foi.createTimestamp >= :threedays  and foi.createTimestamp < :endDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end)," + "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then CAST(foi.quantity*foi.mop  AS int) else 0 end)," + "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end)," + "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmsEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end)," + "sum(case when foi.createTimestamp >= :today then foi.quantity else 0 end)," + "sum(case when foi.createTimestamp >= :threedays and foi.createTimestamp < :endDate then foi.quantity else 0 end)," + "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then foi.quantity else 0 end), " + "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate then foi.quantity else 0 end)," + "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmsEndDate  then foi.quantity else 0 end)" + "	)" + " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId " + "  where fo.cancelledTimestamp is null and fs.active = true " + " and foi.createTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId" + " group by foi.brand "),
27723 tejbeer 23
 
31860 tejbeer 24
        @NamedQuery(name = "FofoOrder.selectItemPartnerTertiaryByBrand", query = "select new com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel(foi.brand, i.modelName," + " i.modelNumber, i.color, foi.quantity*foi.mop, foi.quantity)" + " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join " + " Item i on i.id = foi.itemId where fo.cancelledTimestamp is null and fs.active = true " + " and foi.createTimestamp >= :startDate and foi.createTimestamp < :endDate and fs.warehouseId in :warehouseId and foi.brand in :brand order by foi.itemId desc"),
27738 tejbeer 25
 
31860 tejbeer 26
        @NamedQuery(name = "FofoOrder.selectTodayItemPartnerTertiaryByBrand", query = "select new com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel(foi.brand, i.modelName," + " i.modelNumber, i.color, foi.quantity*foi.mop, foi.quantity)" + " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join " + " Item i on i.id = foi.itemId where fo.cancelledTimestamp is null and fs.active = true " + " and foi.createTimestamp >= :startDate and fs.warehouseId in :warehouseId and foi.brand in :brand order by foi.itemId desc"),
27738 tejbeer 27
 
34390 tejus.loha 28
        @NamedQuery(name = "FofoOrder.selectValueOfActivatedImeis", query = "select new com.spice.profitmandi.common.model.ActivatedImeisWithSellingPrice(fo.fofoId, foi.brand, sum(CAST(foi.mop  AS int)*foi.quantity),sum(foi.quantity)) " + " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId join FofoLineItem fli on foi.id = fli.fofoOrderItemId JOIN Item i ON i.id = foi.itemId join ActivatedImei ai on " + " fli.serialNumber = ai.serialNumber where  fo.createTimestamp between :startDate and :endDate and fo.fofoId = :fofoId and fo.cancelledTimestamp is null AND i.categoryId=10006 group by foi.brand"),
28020 tejbeer 29
 
31860 tejbeer 30
        @NamedQuery(name = "FofoOrder.selectPartnersSaleByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdQtyModel(" + "  fs.warehouseId, fs.id,sum(case when foi.quantity is null then 0 else  foi.quantity end))" + " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  " + " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId " + " join Item i on i.id = tl.itemId" + " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate and i.catalogItemId in :catalogItemId and  i.categoryId=10006 group by fs.id"),
27884 tejbeer 31
 
31860 tejbeer 32
        @NamedQuery(name = "FofoOrder.selectPartnersSaleByRange", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + " fs.warehouseId, fs.id,sum(case when foi.quantity is null then 0 else  foi.quantity end),i.brand,i.modelName,i.modelNumber,i.catalogItemId)" + " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  " + " join FofoOrderItem foi on foi.orderId = fo.id join TagListing tl on tl.itemId = foi.itemId " + " join Item i on i.id = tl.itemId" + " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null " + " and fo.createTimestamp > :startDate 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 33
 
31860 tejbeer 34
        @NamedQuery(name = "FofoOrder.selectPartnersSaleItemByCatalogIdFofoId", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel(" + "  fs.warehouseId, fs.id,sum(foi.quantity),i.brand,i.modelName,i.modelNumber,i.catalogItemId)" + " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  " + " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId " + " join Item i on i.id = tl.itemId" + " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate 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 35
 
32906 amit.gupta 36
        @NamedQuery(name = "FofoOrder.selectSaleByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdCatalogQtyModel(" +
37
                "  fs.warehouseId, fs.id,i.catalogItemId, sum(case when foi.quantity is null then 0 else  foi.quantity end))" +
38
                " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  " +
39
                " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId " +
40
                " join Item i on i.id = tl.itemId" +
41
                " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate" +
42
                " and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId and  i.categoryId=10006 group by i.catalogItemId, fs.id"),
28474 tejbeer 43
 
31008 amit.gupta 44
 
32906 amit.gupta 45
        @NamedQuery(name = "FofoOrder.selectFocoSaleReport", query = "select new com.spice.profitmandi.dao.model.FocoSaleReportModel(fs.code, ua.name,ua.city, ua.state, w.displayName, foi.itemId," +
34121 ranu 46
                " foi.brand, foi.modelName, foi.modelNumber, foi.color, fli.quantity, cast(foi.dp As int), cast(foi.sellingPrice As int), cast(foi.mop As int), fli.serialNumber, foi.createTimestamp, coalesce( ca.name, cus.firstName), ca.phoneNumber," +
32906 amit.gupta 47
                " ca.city, ca.pinCode, fo.invoiceNumber, p.purchaseReference, fo.customerGstNumber, fo.cancelledTimestamp, p.completeTimestamp, hd.hygieneRating,hd.rating, hd.status, hd.remark," +
48
                " hd.createdTimestamp, hd.disposedTimestamp, hd.nextTimestamp, ai.activationTimestamp, ai.createTimestamp, c.label)" +
34121 ranu 49
                " from FofoStore fs join Warehouse w on w.id=fs.warehouseId join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join Address ua on u.addressId = ua.id join FofoOrder fo on fo.fofoId=fs.id left join FofoOrderItem foi" + " on foi.orderId=fo.id left join Customer cus on cus.id = fo.customerId join Item i on i.id=foi.itemId join Category c on c.id=i.categoryId left join CustomerAddress ca on ca.id=fo.customerAddressId left join FofoLineItem fli on fli.fofoOrderItemId=foi.id" + " left join InventoryItem ii on ii.id=fli.inventoryItemId left join Purchase p on ii.purchaseId=p.id left join HygieneData hd on hd.orderId=fo.id left join ActivatedImei ai on ai.serialNumber=fli.serialNumber" + " where 1=1 and (foi.createTimestamp between :startDate and :endDate or foi.createTimestamp is null) and fs.code= :code and fs.id=:fofoId  group by fli.id "),
30160 manish 50
 
31860 tejbeer 51
        @NamedQuery(name = "FofoOrder.selectFocoSaleReportByBrand", query = "select new com.spice.profitmandi.dao.model.FocoSaleReportModel(fs.code, ua.name,ua.city, ua.state, w.displayName, foi.itemId," + " foi.brand, foi.modelName, foi.modelNumber, foi.color, foi.quantity, cast(foi.dp As int), cast(foi.sellingPrice As int), cast(foi.mop As int), fli.serialNumber, foi.createTimestamp, ca.name, ca.phoneNumber," + " ca.city, ca.pinCode, fo.invoiceNumber, p.purchaseReference, fo.customerGstNumber, fo.cancelledTimestamp, p.completeTimestamp, hd.hygieneRating,hd.rating, hd.status, hd.remark," + " hd.createdTimestamp, hd.disposedTimestamp, hd.nextTimestamp, ai.activationTimestamp, ai.createTimestamp, c.label)" + " from FofoStore fs join Warehouse w on w.id=fs.warehouseId join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join Address ua on u.addressId = ua.id join FofoOrder fo on fo.fofoId=fs.id left join FofoOrderItem foi" + " on foi.orderId=fo.id join Item i on i.id=foi.itemId join Category c on c.id=i.categoryId left join CustomerAddress ca on ca.id=fo.customerAddressId left join FofoLineItem fli on fli.fofoOrderItemId=foi.id" + " left join InventoryItem ii on ii.id=fli.inventoryItemId left join Purchase p on ii.purchaseId=p.id left join HygieneData hd on hd.orderId=fo.id left join ActivatedImei ai on ai.serialNumber=fli.serialNumber" + " where (foi.createTimestamp between :startDate and :endDate or foi.createTimestamp is null) and fs.id=:fofoId and i.brand=:brand group by fo.id "),
31008 amit.gupta 52
 
34066 aman.kumar 53
        @NamedQuery(name = "FofoOrder.selectWalletSummaryReport", query = "select new com.spice.profitmandi.dao.model.WalletSummaryReportModel(uwh.id, fs.code, ua.name, " + " u.emailId, ua.phoneNumber, uwh.amount, uwh.refundableAmount, uwh.reference, uwh.referenceType, uwh.timestamp, uwh.businessTimestamp, uwh.description)" + " from FofoStore fs join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join" + " Address ua on u.addressId=ua.id join UserWallet uw on  uw.userId=fs.id join UserWalletHistory uwh on uwh.walletId=uw.id " + " where 1=1 and uwh.timestamp between :startDate and :endDate and fs.id=:fofoId order by uwh.timestamp asc "),
30160 manish 54
 
31008 amit.gupta 55
 
31860 tejbeer 56
        @NamedQuery(name = "FofoOrder.selectPendingIndentReport", query = "select new com.spice.profitmandi.dao.model.PendingIndentReportModel(o.transactionId , o.id, o.createTimestamp," + "  l.itemId, l.brand, l.modelName, l.modelNumber, l.color, l.quantity, l.unitPrice, o.walletAmount,case o.status when 3 then  'In Process' when 4  then 'Accepted' " + "  when 7  then 'Billed' when 9   then 'Shipped' when 12  then 'Delivered' when 13  then 'Cancellation in process' when 15 then 'Cancelled,amount refunded to wallet' " + "  when 31  then 'Returned to Origin, refunded' when 34 then 'Low inventory cancellation, refunded' " + "  else o.statusDescription end as Description, o.invoiceNumber, o.billingTimestamp ) from Order o join LineItem l on l.orderId=o.id " + "  where o.partnerGrnTimestamp is null and o.retailerId= :fofoId and o.status != 1 and o.createTimestamp between :startDate and :endDate group by o.status,o.createTimestamp "),
30160 manish 57
 
31860 tejbeer 58
        @NamedQuery(name = "FofoOrder.selectSchemePayoutReport", query = "select new com.spice.profitmandi.dao.model.SchemePayoutReportModel(i.id, i.brand, i.modelName, i.modelNumber," + " i.color,ii.unitPrice-ii.priceDropAmount,case when foi.dp is not null then foi.dp else 0 end, s.id, s.name, s.type, s.amountType, s.amount,p.purchaseReference, fo.invoiceNumber,(case when sio.rolledBackTimestamp is null " + " then sio.amount when sio.rolledBackTimestamp  is not null then 0 end),sio.status, sio.statusDescription, sio.createTimestamp, sio.rolledBackTimestamp, ii.serialNumber ) from " + " SchemeInOut sio join InventoryItem ii on sio.inventoryItemId=ii.id join com.spice.profitmandi.dao.entity.catalog.Item i on i.id=ii.itemId join FofoStore fs on fs.id=ii.fofoId " + " join com.spice.profitmandi.dao.entity.user.User u on u.id = fs.id join Address ua on u.addressId = ua.id join Scheme s on sio.schemeId=s.id join Purchase p on p.id=ii.purchaseId" + " left join FofoLineItem fli on fli.inventoryItemId=ii.id left join FofoOrderItem foi on foi.id=fli.fofoOrderItemId left join FofoOrder fo on fo.id=foi.orderId where  " + " (foi.createTimestamp  between :startDate and :endDate " + " or ii.createTimestamp  between :startDate and :endDate )" + "and ii.fofoId= :fofoId "),
31423 amit.gupta 59
 
31860 tejbeer 60
        @NamedQuery(name = "FofoOrder.selectInvoiceSchemeOutSummaryReport", query = "select new com.spice.profitmandi.dao.model.FocoSchemeOutReportModel(fo.invoiceNumber, foi.quantity, foi.brand," + " foi.modelName, foi.modelNumber, foi.color,  sum(cast(sio.amount As float)) ) FROM FofoOrderItem foi join FofoOrder fo on fo.id=foi.orderId join FofoLineItem fli on " + " fli.fofoOrderItemId=foi.id join SchemeInOut sio on sio.inventoryItemId=fli.inventoryItemId join Scheme s on s.id=sio.schemeId where s.type ='IN' and fo.fofoId= :fofoId and" + " fo.createTimestamp between :startDate and :endDate and sio.rolledBackTimestamp is null group by fo.id, foi.id "),
31423 amit.gupta 61
 
32906 amit.gupta 62
        //String sellerName, String hsnCode, String gstNumber, String stateName
63
        @NamedQuery(name = "FofoOrder.selectPartnerBillingSummaryReport", query = "select new com.spice.profitmandi.dao.model.PartnerBillingSummaryModel(o.id,  o.createTimestamp, o.billingTimestamp," +
64
                " o.deliveryTimestamp, o.partnerGrnTimestamp, o.transactionId, case when o.logisticsTransactionId is null then 'NA' else o.logisticsTransactionId end,o.airwayBillNumber,  " +
65
                " os.statusSubGroup, os.statusName, o.retailerId, o.retailerName, i.id, i.brand, i.modelName, i.modelNumber, i.color, l.unitPrice, l.quantity, l.totalPrice,  o.invoiceNumber," +
66
                " l.igstRate, l.cgstRate, l.sgstRate, org.name, l.hsnCode,  s.gstin, state.name )" +
67
                " From Order o join LineItem l on l.orderId = o.id join Item i on l.itemId = i.id join Category c on i.categoryId = c.id join OrderStatus os on os.status=o.status" +
32907 amit.gupta 68
                " join FofoStore fs on fs.id=o.retailerId join Seller s on s.id=o.sellerId join State state on s.stateId=state.id join Organisation org on org.id=s.organisationId" +
32906 amit.gupta 69
                " where 1=1 and  o.billingTimestamp between :startDate and :endDate and o.retailerId = :fofoId "),
31423 amit.gupta 70
 
33873 ranu 71
        @NamedQuery(name = "FofoOrder.soldAllItemByToday",
72
                query = "select new com.spice.profitmandi.dao.model.SoldAllCatalogitemQtyByPartnerModel" +
73
                        "(i.catalogItemId, foi.modelNumber, SUM(foi.quantity)) " +
74
                        "FROM FofoOrder fo " +
75
                        "JOIN FofoOrderItem foi ON fo.id = foi.orderId " +
76
                        "JOIN Item i ON foi.itemId = i.id " +
77
                        "JOIN Catalog c ON i.catalogItemId = c.id " +
78
                        "WHERE fo.createTimestamp BETWEEN :startOfDay AND :endOfDay and fo.fofoId = :fofoId " +
34390 tejus.loha 79
                        "GROUP BY i.catalogItemId"),
31860 tejbeer 80
 
33873 ranu 81
 
34390 tejus.loha 82
        @NamedQuery(name = "FofoOrder.selectValueOfActivatedImeisModelWise",
83
                query = "select new com.spice.profitmandi.common.model.ActivatedImeisWithSellingPrice" +
84
                        "(fo.customerId,foi.brand,foi.modelNumber,foi.modelName, sum(CAST(foi.mop  AS int)*foi.quantity),SUM(foi.quantity))" +
85
                        "FROM FofoOrder fo " +
86
                        "JOIN FofoOrderItem foi ON fo.id = foi.orderId " +
87
                        "join FofoLineItem fli on foi.id = fli.fofoOrderItemId " +
88
                        "JOIN Item i ON i.id = foi.itemId " +
89
                        "JOIN ActivatedImei ai on fli.serialNumber = ai.serialNumber " +
90
                        "WHERE " +
91
                        "fo.createTimestamp BETWEEN :startDate AND :endDate  " +
92
                        "AND fo.fofoId = :fofoId " +
93
                        "AND foi.brand = :brand " +
94
                        "AND fo.cancelledTimestamp IS NULL " +
95
                        "AND i.categoryId = 10006 " +
96
                        "GROUP BY foi.modelNumber"
97
        )
98
 
99
 
27579 tejbeer 100
})
31860 tejbeer 101
 
102
 
103
@NamedNativeQueries({
104
 
105
 
32044 tejbeer 106
        @NamedNativeQuery(name = "FofoOrder.getLastTertiaryByFofoId", query = "select Max(fo.create_timestamp) from  fofo.fofo_order fo where fo.fofo_id = :fofoId and fo.cancelled_timestamp is null"),
31860 tejbeer 107
 
108
 
32044 tejbeer 109
        @NamedNativeQuery(name = "FofoOrder.getLastTertiaryOrders", query = "select fo.fofo_id, Max(fo.create_timestamp) as maxdate from fofo.fofo_order fo where fo.cancelled_timestamp is null group by fofo_id", resultSetMapping = "LastTertiaryDays"),
110
 
34384 ranu 111
        @NamedNativeQuery(name = "FofoOrder.getCatalogSoldQtyLastDaysByDate", query = "" +
34412 ranu 112
                " SELECT i.catalog_item_id,fo.fofo_id, i.model_number,i.brand, SUM(foi.quantity) AS total_quantity_sold FROM fofo.fofo_order fo" +
34384 ranu 113
                " LEFT JOIN fofo.fofo_order_item foi ON foi.order_id = fo.id " +
114
                " JOIN catalog.item i ON i.id = foi.item_id " +
34490 ranu 115
                " WHERE fo.fofo_id = :fofoId AND fo.create_timestamp >= :cutOffDate" +
34384 ranu 116
                " GROUP BY i.catalog_item_id", resultSetMapping = "lastDaysSoldQtyByDateAndCatalogId"),
32044 tejbeer 117
 
34384 ranu 118
 
31860 tejbeer 119
})
120
 
32044 tejbeer 121
@SqlResultSetMappings({
122
 
34384 ranu 123
        @SqlResultSetMapping(name = "LastTertiaryDays", classes = {@ConstructorResult(targetClass = LastSaleDateModel.class, columns = {@ColumnResult(name = "fofo_id", type = Integer.class), @ColumnResult(name = "maxdate ", type = LocalDateTime.class)})}),
32044 tejbeer 124
 
34384 ranu 125
        @SqlResultSetMapping(name = "lastDaysSoldQtyByDateAndCatalogId", classes = {
126
                @ConstructorResult(targetClass = DateWiseSoldCatalogQtyModel.class, columns = {
127
                        @ColumnResult(name = "catalog_item_id", type = Integer.class),
128
                        @ColumnResult(name = "fofo_id", type = Integer.class),
129
                        @ColumnResult(name = "model_number", type = String.class),
34412 ranu 130
                        @ColumnResult(name = "brand", type = String.class),
34384 ranu 131
                        @ColumnResult(name = "total_quantity_sold", type = Integer.class),
132
 
133
                })}),
32044 tejbeer 134
})
135
 
27579 tejbeer 136
public class FofoOrder implements Serializable {
137
 
31860 tejbeer 138
    private static final long serialVersionUID = 1L;
21596 ashik.ali 139
 
31860 tejbeer 140
    @Id
141
    @Column(name = "id")
142
    @GeneratedValue(strategy = GenerationType.IDENTITY)
143
    private int id;
27579 tejbeer 144
 
34287 vikas.jang 145
    @Column(name = "pending_order_id")
146
    private int pendingOrderId;
147
 
31860 tejbeer 148
    @Column(name = "fofo_id")
149
    private int fofoId;
27579 tejbeer 150
 
31860 tejbeer 151
    @Column(name = "customer_id")
152
    private int customerId;
27579 tejbeer 153
 
31860 tejbeer 154
    @Column(name = "customer_address_id")
155
    private int customerAddressId;
27579 tejbeer 156
 
31860 tejbeer 157
    @Column(name = "customer_gst_number")
158
    private String customerGstNumber;
27579 tejbeer 159
 
31860 tejbeer 160
    @Column(name = "total_amount")
161
    private float totalAmount;
27579 tejbeer 162
 
31860 tejbeer 163
    @Column(name = "invoice_number", length = 50)
164
    private String invoiceNumber;
27579 tejbeer 165
 
31860 tejbeer 166
    @Column(name = "cashback")
167
    private float cashback;
27579 tejbeer 168
 
31860 tejbeer 169
    @Convert(converter = LocalDateTimeAttributeConverter.class)
170
    @Column(name = "create_timestamp")
171
    private LocalDateTime createTimestamp = LocalDateTime.now();
27579 tejbeer 172
 
31860 tejbeer 173
    @Convert(converter = LocalDateTimeAttributeConverter.class)
174
    @Column(name = "cancelled_timestamp")
175
    private LocalDateTime cancelledTimestamp;
27579 tejbeer 176
 
31860 tejbeer 177
    // @Convert(converter = LocalDateTimeAttributeConverter.class)
178
    // @Column(name = "billing_timestamp")
179
    @Transient
180
    private LocalDateTime billingTimestamp;
27579 tejbeer 181
 
31860 tejbeer 182
    @Transient
183
    private FofoOrderItem orderItem;
27579 tejbeer 184
 
31860 tejbeer 185
    @Transient
186
    private LocalDate dateOfBirth;
27579 tejbeer 187
 
188
 
31860 tejbeer 189
    public LocalDate getDateOfBirth() {
190
        return dateOfBirth;
191
    }
27579 tejbeer 192
 
31860 tejbeer 193
    public void setDateOfBirth(LocalDate dateOfBirth) {
194
        this.dateOfBirth = dateOfBirth;
195
    }
27579 tejbeer 196
 
31860 tejbeer 197
    public FofoOrderItem getOrderItem() {
198
        return orderItem;
199
    }
27579 tejbeer 200
 
31860 tejbeer 201
    public void setOrderItem(FofoOrderItem orderItem) {
202
        this.orderItem = orderItem;
203
    }
27579 tejbeer 204
 
31860 tejbeer 205
    public LocalDateTime getCancelledTimestamp() {
206
        return cancelledTimestamp;
207
    }
27579 tejbeer 208
 
31860 tejbeer 209
    public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
210
        this.cancelledTimestamp = cancelledTimestamp;
211
    }
27579 tejbeer 212
 
31860 tejbeer 213
    public int getId() {
214
        return id;
215
    }
27579 tejbeer 216
 
31860 tejbeer 217
    public void setId(int id) {
218
        this.id = id;
219
    }
27579 tejbeer 220
 
34287 vikas.jang 221
    public int getPendingOrderId() {
222
        return pendingOrderId;
223
    }
224
 
225
    public void setPendingOrderId(int pendingOrderId) {
226
        this.pendingOrderId = pendingOrderId;
227
    }
228
 
31860 tejbeer 229
    public int getFofoId() {
230
        return fofoId;
231
    }
27579 tejbeer 232
 
31860 tejbeer 233
    public void setFofoId(int fofoId) {
234
        this.fofoId = fofoId;
235
    }
27579 tejbeer 236
 
31860 tejbeer 237
    public int getCustomerId() {
238
        return customerId;
239
    }
27579 tejbeer 240
 
31860 tejbeer 241
    public void setCustomerId(int customerId) {
242
        this.customerId = customerId;
243
    }
27579 tejbeer 244
 
31860 tejbeer 245
    public int getCustomerAddressId() {
246
        return customerAddressId;
247
    }
27579 tejbeer 248
 
31860 tejbeer 249
    public void setCustomerAddressId(int customerAddressId) {
250
        this.customerAddressId = customerAddressId;
251
    }
27579 tejbeer 252
 
31860 tejbeer 253
    public String getCustomerGstNumber() {
254
        return customerGstNumber;
255
    }
27579 tejbeer 256
 
31860 tejbeer 257
    public void setCustomerGstNumber(String customerGstNumber) {
258
        this.customerGstNumber = customerGstNumber;
259
    }
27579 tejbeer 260
 
31860 tejbeer 261
    public float getTotalAmount() {
262
        return totalAmount;
263
    }
27579 tejbeer 264
 
31860 tejbeer 265
    public void setTotalAmount(float totalAmount) {
266
        this.totalAmount = totalAmount;
267
    }
27579 tejbeer 268
 
31860 tejbeer 269
    public String getInvoiceNumber() {
270
        return invoiceNumber;
271
    }
27579 tejbeer 272
 
31860 tejbeer 273
    public void setInvoiceNumber(String invoiceNumber) {
274
        this.invoiceNumber = invoiceNumber;
275
    }
27579 tejbeer 276
 
31860 tejbeer 277
    public float getCashback() {
278
        return cashback;
279
    }
27579 tejbeer 280
 
31860 tejbeer 281
    public void setCashback(float cashback) {
282
        this.cashback = cashback;
283
    }
27579 tejbeer 284
 
31860 tejbeer 285
    public LocalDateTime getCreateTimestamp() {
286
        return createTimestamp;
287
    }
27579 tejbeer 288
 
31860 tejbeer 289
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
290
        this.createTimestamp = createTimestamp;
291
    }
27579 tejbeer 292
 
31860 tejbeer 293
    public String getFormattedDate() {
294
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
295
        return this.createTimestamp.format(formatter);
296
    }
27579 tejbeer 297
 
27586 tejbeer 298
 
31860 tejbeer 299
    @Override
300
    public int hashCode() {
301
        final int prime = 31;
302
        int result = 1;
303
        result = prime * result + ((billingTimestamp == null) ? 0 : billingTimestamp.hashCode());
304
        result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
305
        result = prime * result + Float.floatToIntBits(cashback);
306
        result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
307
        result = prime * result + customerAddressId;
308
        result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
309
        result = prime * result + customerId;
310
        result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
311
        result = prime * result + fofoId;
312
        result = prime * result + id;
313
        result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
314
        result = prime * result + ((orderItem == null) ? 0 : orderItem.hashCode());
315
        result = prime * result + Float.floatToIntBits(totalAmount);
316
        return result;
317
    }
27586 tejbeer 318
 
31860 tejbeer 319
    @Override
320
    public boolean equals(Object obj) {
321
        if (this == obj) return true;
322
        if (obj == null) return false;
323
        if (getClass() != obj.getClass()) return false;
324
        FofoOrder other = (FofoOrder) obj;
325
        if (billingTimestamp == null) {
326
            if (other.billingTimestamp != null) return false;
327
        } else if (!billingTimestamp.equals(other.billingTimestamp)) return false;
328
        if (cancelledTimestamp == null) {
329
            if (other.cancelledTimestamp != null) return false;
330
        } else if (!cancelledTimestamp.equals(other.cancelledTimestamp)) return false;
331
        if (Float.floatToIntBits(cashback) != Float.floatToIntBits(other.cashback)) return false;
332
        if (createTimestamp == null) {
333
            if (other.createTimestamp != null) return false;
334
        } else if (!createTimestamp.equals(other.createTimestamp)) return false;
335
        if (customerAddressId != other.customerAddressId) return false;
336
        if (customerGstNumber == null) {
337
            if (other.customerGstNumber != null) return false;
338
        } else if (!customerGstNumber.equals(other.customerGstNumber)) return false;
339
        if (customerId != other.customerId) return false;
340
        if (dateOfBirth == null) {
341
            if (other.dateOfBirth != null) return false;
342
        } else if (!dateOfBirth.equals(other.dateOfBirth)) return false;
343
        if (fofoId != other.fofoId) return false;
344
        if (id != other.id) return false;
345
        if (invoiceNumber == null) {
346
            if (other.invoiceNumber != null) return false;
347
        } else if (!invoiceNumber.equals(other.invoiceNumber)) return false;
348
        if (orderItem == null) {
349
            if (other.orderItem != null) return false;
350
        } else if (!orderItem.equals(other.orderItem)) return false;
351
        if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount)) return false;
352
        return true;
353
    }
354
 
355
    @Override
356
    public String toString() {
357
        return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId=" + customerAddressId + ", customerGstNumber=" + customerGstNumber + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp + ", cancelledTimestamp=" + cancelledTimestamp + ", billingTimestamp=" + billingTimestamp + ", orderItem=" + orderItem + ", dateOfBirth=" + dateOfBirth + " ]";
358
    }
359
 
21596 ashik.ali 360
}