Subversion Repositories SmartDukaan

Rev

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

Rev 31428 Rev 31860
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.fofo;
1
package com.spice.profitmandi.dao.entity.fofo;
2
 
2
 
3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
4
 
-
 
5
import javax.persistence.*;
-
 
6
import java.io.Serializable;
3
import java.io.Serializable;
7
import java.time.LocalDate;
4
import java.time.LocalDate;
8
import java.time.LocalDateTime;
5
import java.time.LocalDateTime;
9
import java.time.format.DateTimeFormatter;
6
import java.time.format.DateTimeFormatter;
10
 
7
 
-
 
8
import javax.persistence.CascadeType;
-
 
9
import javax.persistence.Column;
-
 
10
import javax.persistence.Convert;
-
 
11
import javax.persistence.Entity;
-
 
12
import javax.persistence.FetchType;
-
 
13
import javax.persistence.GeneratedValue;
-
 
14
import javax.persistence.GenerationType;
-
 
15
import javax.persistence.Id;
-
 
16
import javax.persistence.JoinColumn;
-
 
17
import javax.persistence.ManyToOne;
-
 
18
import javax.persistence.NamedNativeQueries;
-
 
19
import javax.persistence.NamedNativeQuery;
-
 
20
import javax.persistence.NamedQueries;
-
 
21
import javax.persistence.NamedQuery;
-
 
22
import javax.persistence.Table;
-
 
23
import javax.persistence.Transient;
-
 
24
 
-
 
25
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
26
 
11
@Entity
27
@Entity
12
@Table(name = "fofo.fofo_order", schema = "fofo")
28
@Table(name = "fofo.fofo_order")
13
 
29
 
14
@NamedQueries({
30
@NamedQueries({
15
 
31
 
16
		@NamedQuery(name = "FofoOrder.SelectItemWiseTertiary", query = "select new com.spice.profitmandi.dao.model.ItemWiseTertiaryModel(foi.brand,"
-
 
17
				+ "foi.modelName, foi.modelNumber, foi.color, foi.quantity, foi.mop)"
-
 
18
				+ " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId where fo.cancelledTimestamp is null and fo.fofoId = :fofoId"
32
        @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"),
19
				+ " and fo.createTimestamp between :startDate and :endDate"),
-
 
20
 
33
 
21
		@NamedQuery(name = "FofoOrder.selectOrderByModelsAndSaleBetween", query = "select fo from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId"
34
        @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"),
22
				+ " join Item i on i.id=foi.itemId where fo.cancelledTimestamp is null and i.catalogItemId in :catalogItemIds"
-
 
23
				+ " and fo.createTimestamp between :startDate and :endDate"),
-
 
24
 
35
 
25
		@NamedQuery(name = "FofoOrder.selectGroupByBrandPartnerTertiary", query = "select new com.spice.profitmandi.dao.model.BrandWiseTertiaryModel(foi.brand, "
-
 
26
				+ "sum(case when foi.createTimestamp >= :today then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
-
 
27
				+ "sum(case when foi.createTimestamp >= :threedays  and foi.createTimestamp < :endDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
-
 
28
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
-
 
29
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
-
 
30
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmsEndDate  then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
-
 
31
				+ "sum(case when foi.createTimestamp >= :today then foi.quantity else 0 end),"
-
 
32
				+ "sum(case when foi.createTimestamp >= :threedays and foi.createTimestamp < :endDate then foi.quantity else 0 end),"
-
 
33
				+ "sum(case when concat(year(foi.createTimestamp), month(foi.createTimestamp))= :mtd  then foi.quantity else 0 end), "
-
 
34
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmtdEndDate then foi.quantity else 0 end),"
-
 
35
				+ "sum(case when foi.createTimestamp between  :lmtdStartDate and :lmsEndDate  then foi.quantity else 0 end)"
-
 
36
				+ "	)"
-
 
37
				+ " 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 "
36
        @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 "),
38
				+ "  where fo.cancelledTimestamp is null and fs.active = true "
-
 
39
				+ " and foi.createTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId"
-
 
40
				+ " group by foi.brand "),
-
 
41
 
37
 
42
		@NamedQuery(name = "FofoOrder.selectItemPartnerTertiaryByBrand", query = "select new com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel(foi.brand, i.modelName,"
-
 
43
				+ " i.modelNumber, i.color, foi.quantity*foi.mop, foi.quantity)"
-
 
44
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join "
-
 
45
				+ " Item i on i.id = foi.itemId where fo.cancelledTimestamp is null and fs.active = true "
-
 
46
				+ " and foi.createTimestamp >= :startDate and foi.createTimestamp < :endDate and fs.warehouseId in :warehouseId and foi.brand in :brand order by foi.itemId desc"),
38
        @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"),
47
 
39
 
48
		@NamedQuery(name = "FofoOrder.selectTodayItemPartnerTertiaryByBrand", query = "select new com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel(foi.brand, i.modelName,"
-
 
49
				+ " i.modelNumber, i.color, foi.quantity*foi.mop, foi.quantity)"
-
 
50
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join "
40
        @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"),
51
				+ " Item i on i.id = foi.itemId where fo.cancelledTimestamp is null and fs.active = true "
-
 
52
				+ " and foi.createTimestamp >= :startDate and fs.warehouseId in :warehouseId and foi.brand in :brand order by foi.itemId desc"),
-
 
53
 
41
 
54
		@NamedQuery(name = "FofoOrder.selectValueOfActivatedImeis", query = "select new com.spice.profitmandi.common.model.ActivatedImeisWithSellingPrice("
-
 
55
				+ "  fo.fofoId, foi.brand, sum(CAST(foi.mop  AS int) * foi.quantity)) "
-
 
56
				+ " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId join FofoLineItem fli on foi.id = fli.fofoOrderItemId join ActivatedImei ai on "
-
 
57
				+ " fli.serialNumber = ai.serialNumber where  fo.createTimestamp between :startDate and :endDate and  fo.fofoId = :fofoId and fo.cancelledTimestamp is null group by foi.brand"),
42
        @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)) " + " from FofoOrder fo join FofoOrderItem foi on fo.id = foi.orderId join FofoLineItem fli on foi.id = fli.fofoOrderItemId join ActivatedImei ai on " + " fli.serialNumber = ai.serialNumber where  fo.createTimestamp between :startDate and :endDate and  fo.fofoId = :fofoId and fo.cancelledTimestamp is null group by foi.brand"),
58
 
43
 
59
		@NamedQuery(name = "FofoOrder.selectPartnersSaleByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdQtyModel("
-
 
60
				+ "  fs.warehouseId, fs.id,sum(case when foi.quantity is null then 0 else  foi.quantity end))"
-
 
61
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
-
 
62
				+ " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId "
-
 
63
				+ " join Item i on i.id = tl.itemId"
-
 
64
				+ " 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"),
44
        @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"),
65
 
45
 
66
		@NamedQuery(name = "FofoOrder.selectPartnersSaleByRange", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel("
-
 
67
				+ " 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)"
-
 
68
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
-
 
69
				+ " join FofoOrderItem foi on foi.orderId = fo.id join TagListing tl on tl.itemId = foi.itemId "
-
 
70
				+ " join Item i on i.id = tl.itemId"
-
 
71
				+ " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null "
-
 
72
				+ " 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"),
46
        @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"),
73
 
47
 
74
		@NamedQuery(name = "FofoOrder.selectPartnersSaleItemByCatalogIdFofoId", query = "select new com.spice.profitmandi.dao.model.FofoIdItemDetailModel("
-
 
75
				+ "  fs.warehouseId, fs.id,sum(foi.quantity),i.brand,i.modelName,i.modelNumber,i.catalogItemId)"
-
 
76
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
-
 
77
				+ " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId "
-
 
78
				+ " join Item i on i.id = tl.itemId"
-
 
79
				+ " 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"),
48
        @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"),
80
 
49
 
81
		@NamedQuery(name = "FofoOrder.selectSaleByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdCatalogQtyModel("
-
 
82
				+ "  fs.warehouseId, fs.id,i.catalogItemId, sum(case when foi.quantity is null then 0 else  foi.quantity end))"
-
 
83
				+ " from FofoStore fs  join FofoOrder fo on fs.id = fo.fofoId  "
-
 
84
				+ " join FofoOrderItem foi on foi.orderId = fo.id join  TagListing tl on tl.itemId = foi.itemId "
-
 
85
				+ " join Item i on i.id = tl.itemId"
-
 
86
				+ " where fs.active = 1 and fs.internal = 0 and fo.cancelledTimestamp is null and fo.createTimestamp > :startDate and i.catalogItemId in :catalogItemId and fs.warehouseId in :warehouseId and  i.categoryId=10006 group by i.catalogItemId, fs.id"),
50
        @NamedQuery(name = "FofoOrder.selectSaleByCatalogId", query = "select new com.spice.profitmandi.dao.model.FofoIdCatalogQtyModel(" + "  fs.warehouseId, fs.id,i.catalogItemId, 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 fs.warehouseId in :warehouseId and  i.categoryId=10006 group by i.catalogItemId, fs.id"),
87
 
51
 
88
 
52
 
89
		@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,"
-
 
90
				+ " 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,"
-
 
91
				+ " ca.city, ca.pinCode, fo.invoiceNumber, p.purchaseReference, fo.customerGstNumber, fo.cancelledTimestamp, p.completeTimestamp, hd.hygieneRating,hd.rating, hd.status, hd.remark,"
-
 
92
				+ " hd.createdTimestamp, hd.disposedTimestamp, hd.nextTimestamp, ai.activationTimestamp, ai.createTimestamp, c.label)"
-
 
93
				+ " 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"
53
        @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," + " 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 1=1 and (foi.createTimestamp between :startDate and :endDate or foi.createTimestamp is null) and fs.code= :code and fs.id=:fofoId  group by fo.id "),
94
				+ " 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"
-
 
95
				+ " 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"
-
 
96
				+ " 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 fo.id "),
-
 
97
 
54
 
98
		@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,"
-
 
99
				+ " 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,"
-
 
100
				+ " ca.city, ca.pinCode, fo.invoiceNumber, p.purchaseReference, fo.customerGstNumber, fo.cancelledTimestamp, p.completeTimestamp, hd.hygieneRating,hd.rating, hd.status, hd.remark,"
-
 
101
				+ " hd.createdTimestamp, hd.disposedTimestamp, hd.nextTimestamp, ai.activationTimestamp, ai.createTimestamp, c.label)"
-
 
102
				+ " 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"
55
        @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 "),
103
				+ " 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"
-
 
104
				+ " 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"
-
 
105
				+ " where (foi.createTimestamp between :startDate and :endDate or foi.createTimestamp is null) and fs.id=:fofoId and i.brand=:brand group by fo.id "),
-
 
106
 
56
 
107
		@NamedQuery(name = "FofoOrder.selectWalletSummaryReport", query = "select new com.spice.profitmandi.dao.model.WalletSummaryReportModel(uwh.id, fs.code, ua.name, "
-
 
108
				+ " u.emailId, ua.phoneNumber, uwh.amount, uwh.refundableAmount, uwh.reference, uwh.referenceType, uwh.timestamp, uwh.businessTimestamp, uwh.description)"
-
 
109
				+ " from FofoStore fs join com.spice.profitmandi.dao.entity.user.User u on u.id=fs.id join"
-
 
110
				+ " Address ua on u.addressId=ua.id join UserWallet uw on  uw.userId=fs.id join UserWalletHistory uwh on uwh.walletId=uw.id "
57
        @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 group by uwh.timestamp"),
111
				+ " where 1=1 and uwh.timestamp between :startDate and :endDate and fs.id=:fofoId group by uwh.timestamp"),
-
 
112
 
58
 
113
 
59
 
114
		@NamedQuery(name = "FofoOrder.selectPendingIndentReport", query = "select new com.spice.profitmandi.dao.model.PendingIndentReportModel(o.transactionId , o.id, o.createTimestamp,"
-
 
115
				+ "  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' "
-
 
116
				+ "  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' "
60
        @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 "),
117
				+ "  when 31  then 'Returned to Origin, refunded' when 34 then 'Low inventory cancellation, refunded' "
-
 
118
				+ "  else o.statusDescription end as Description, o.invoiceNumber, o.billingTimestamp ) from Order o join LineItem l on l.orderId=o.id "
-
 
119
				+ "  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 "),
-
 
120
 
61
 
121
		@NamedQuery(name = "FofoOrder.selectSchemePayoutReport", query = "select new com.spice.profitmandi.dao.model.SchemePayoutReportModel(i.id, i.brand, i.modelName, i.modelNumber,"
-
 
122
				+ " 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 "
62
        @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 "),
123
				+ " then sio.amount when sio.rolledBackTimestamp  is not null then 0 end),sio.status, sio.statusDescription, sio.createTimestamp, sio.rolledBackTimestamp, ii.serialNumber ) from "
-
 
124
				+ " 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 "
-
 
125
				+ " 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"
-
 
126
				+ " 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  " +
-
 
127
				" (foi.createTimestamp  between :startDate and :endDate " +
-
 
128
				" or ii.createTimestamp  between :startDate and :endDate )" +
-
 
129
				"and ii.fofoId= :fofoId "),
-
 
130
 
63
 
131
		@NamedQuery(name = "FofoOrder.selectInvoiceSchemeOutSummaryReport", query = "select new com.spice.profitmandi.dao.model.FocoSchemeOutReportModel(fo.invoiceNumber, foi.quantity, foi.brand,"
-
 
132
				+ " 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 "
64
        @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 "),
133
				+ " 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"
-
 
134
				+ " fo.createTimestamp between :startDate and :endDate and sio.rolledBackTimestamp is null group by fo.id, foi.id "),
-
 
135
 
65
 
136
 
66
 
137
		@NamedQuery(name = "FofoOrder.selectPartnerBillingSummaryReport", query = "select new com.spice.profitmandi.dao.model.PartnerBillingSummaryModel(o.id,  o.createTimestamp, o.billingTimestamp,"
-
 
138
				+ " o.deliveryTimestamp, o.partnerGrnTimestamp, o.transactionId, case when o.logisticsTransactionId is null then 'NA' else o.logisticsTransactionId end,o.airwayBillNumber,  "
-
 
139
				+ " 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,"
-
 
140
	    		+ " l.igstRate, l.cgstRate, l.sgstRate ) 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"
67
        @NamedQuery(name = "FofoOrder.selectPartnerBillingSummaryReport", query = "select new com.spice.profitmandi.dao.model.PartnerBillingSummaryModel(o.id,  o.createTimestamp, o.billingTimestamp," + " o.deliveryTimestamp, o.partnerGrnTimestamp, o.transactionId, case when o.logisticsTransactionId is null then 'NA' else o.logisticsTransactionId end,o.airwayBillNumber,  " + " 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," + " l.igstRate, l.cgstRate, l.sgstRate ) 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" + " join FofoStore fs on fs.id=o.retailerId where 1=1 and  o.billingTimestamp between :startDate and :endDate and o.retailerId = :fofoId "),
141
	    		+ " join FofoStore fs on fs.id=o.retailerId where 1=1 and  o.billingTimestamp between :startDate and :endDate and o.retailerId = :fofoId "),
-
 
-
 
68
 
142
	    
69
 
143
})
70
})
-
 
71
 
-
 
72
 
-
 
73
@NamedNativeQueries({
-
 
74
 
-
 
75
 
-
 
76
        @NamedNativeQuery(name = "FofoOrder.getLastTertiaryByFofoId", query = "select fo.create_timestamp from  fofo.fofo_order fo where  fo.fofo_id = :fofoId order by fo.id desc limit 1"),
-
 
77
 
-
 
78
 
-
 
79
})
-
 
80
 
144
public class FofoOrder implements Serializable {
81
public class FofoOrder implements Serializable {
145
 
82
 
146
	private static final long serialVersionUID = 1L;
83
    private static final long serialVersionUID = 1L;
147
 
84
 
148
	@Id
85
    @Id
149
	@Column(name = "id")
86
    @Column(name = "id")
150
	@GeneratedValue(strategy = GenerationType.IDENTITY)
87
    @GeneratedValue(strategy = GenerationType.IDENTITY)
151
	private int id;
88
    private int id;
152
 
89
 
153
	@Column(name = "fofo_id")
90
    @Column(name = "fofo_id")
154
	private int fofoId;
91
    private int fofoId;
155
 
92
 
156
	@Column(name = "customer_id")
93
    @Column(name = "customer_id")
157
	private int customerId;
94
    private int customerId;
158
 
95
 
159
	@Column(name = "customer_address_id")
96
    @Column(name = "customer_address_id")
160
	private int customerAddressId;
97
    private int customerAddressId;
161
 
98
 
162
	@Column(name = "customer_gst_number")
99
    @Column(name = "customer_gst_number")
163
	private String customerGstNumber;
100
    private String customerGstNumber;
164
 
101
 
165
	@Column(name = "total_amount")
102
    @Column(name = "total_amount")
166
	private float totalAmount;
103
    private float totalAmount;
167
 
104
 
168
	@Column(name = "invoice_number", length = 50)
105
    @Column(name = "invoice_number", length = 50)
169
	private String invoiceNumber;
106
    private String invoiceNumber;
170
 
107
 
171
	@Column(name = "cashback")
108
    @Column(name = "cashback")
172
	private float cashback;
109
    private float cashback;
173
 
110
 
174
	@Convert(converter = LocalDateTimeAttributeConverter.class)
111
    @Convert(converter = LocalDateTimeAttributeConverter.class)
175
	@Column(name = "create_timestamp")
112
    @Column(name = "create_timestamp")
176
	private LocalDateTime createTimestamp = LocalDateTime.now();
113
    private LocalDateTime createTimestamp = LocalDateTime.now();
177
 
114
 
178
	@Convert(converter = LocalDateTimeAttributeConverter.class)
115
    @Convert(converter = LocalDateTimeAttributeConverter.class)
179
	@Column(name = "cancelled_timestamp")
116
    @Column(name = "cancelled_timestamp")
180
	private LocalDateTime cancelledTimestamp;
117
    private LocalDateTime cancelledTimestamp;
181
 
118
 
182
	// @Convert(converter = LocalDateTimeAttributeConverter.class)
119
    // @Convert(converter = LocalDateTimeAttributeConverter.class)
183
	// @Column(name = "billing_timestamp")
120
    // @Column(name = "billing_timestamp")
184
	@Transient
121
    @Transient
185
	private LocalDateTime billingTimestamp;
122
    private LocalDateTime billingTimestamp;
186
 
123
 
187
	@Transient
124
    @Transient
188
	private FofoOrderItem orderItem;
125
    private FofoOrderItem orderItem;
189
 
126
 
190
	@Transient
127
    @Transient
191
	private LocalDate dateOfBirth;
128
    private LocalDate dateOfBirth;
192
 
129
 
193
	public LocalDate getDateOfBirth() {
130
 
194
		return dateOfBirth;
131
    public LocalDate getDateOfBirth() {
195
	}
132
        return dateOfBirth;
196
 
133
    }
197
	public void setDateOfBirth(LocalDate dateOfBirth) {
134
 
198
		this.dateOfBirth = dateOfBirth;
135
    public void setDateOfBirth(LocalDate dateOfBirth) {
199
	}
136
        this.dateOfBirth = dateOfBirth;
200
 
137
    }
201
	public FofoOrderItem getOrderItem() {
138
 
202
		return orderItem;
139
    public FofoOrderItem getOrderItem() {
203
	}
140
        return orderItem;
204
 
141
    }
205
	public void setOrderItem(FofoOrderItem orderItem) {
142
 
206
		this.orderItem = orderItem;
143
    public void setOrderItem(FofoOrderItem orderItem) {
207
	}
144
        this.orderItem = orderItem;
208
 
145
    }
209
	public LocalDateTime getCancelledTimestamp() {
146
 
210
		return cancelledTimestamp;
147
    public LocalDateTime getCancelledTimestamp() {
211
	}
148
        return cancelledTimestamp;
212
 
149
    }
213
	public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
150
 
214
		this.cancelledTimestamp = cancelledTimestamp;
151
    public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
215
	}
152
        this.cancelledTimestamp = cancelledTimestamp;
216
 
153
    }
217
	public int getId() {
154
 
218
		return id;
155
    public int getId() {
219
	}
156
        return id;
220
 
157
    }
221
	public void setId(int id) {
158
 
222
		this.id = id;
159
    public void setId(int id) {
223
	}
160
        this.id = id;
224
 
161
    }
225
	public int getFofoId() {
162
 
226
		return fofoId;
163
    public int getFofoId() {
227
	}
164
        return fofoId;
228
 
165
    }
229
	public void setFofoId(int fofoId) {
166
 
230
		this.fofoId = fofoId;
167
    public void setFofoId(int fofoId) {
231
	}
168
        this.fofoId = fofoId;
232
 
169
    }
233
	public int getCustomerId() {
170
 
234
		return customerId;
171
    public int getCustomerId() {
235
	}
172
        return customerId;
236
 
173
    }
237
	public void setCustomerId(int customerId) {
174
 
238
		this.customerId = customerId;
175
    public void setCustomerId(int customerId) {
239
	}
176
        this.customerId = customerId;
240
 
177
    }
241
	public int getCustomerAddressId() {
178
 
242
		return customerAddressId;
179
    public int getCustomerAddressId() {
243
	}
180
        return customerAddressId;
244
 
181
    }
245
	public void setCustomerAddressId(int customerAddressId) {
182
 
246
		this.customerAddressId = customerAddressId;
183
    public void setCustomerAddressId(int customerAddressId) {
247
	}
184
        this.customerAddressId = customerAddressId;
248
 
185
    }
249
	public String getCustomerGstNumber() {
186
 
250
		return customerGstNumber;
187
    public String getCustomerGstNumber() {
251
	}
188
        return customerGstNumber;
252
 
189
    }
253
	public void setCustomerGstNumber(String customerGstNumber) {
190
 
254
		this.customerGstNumber = customerGstNumber;
191
    public void setCustomerGstNumber(String customerGstNumber) {
255
	}
192
        this.customerGstNumber = customerGstNumber;
256
 
193
    }
257
	public float getTotalAmount() {
194
 
258
		return totalAmount;
195
    public float getTotalAmount() {
259
	}
196
        return totalAmount;
260
 
197
    }
261
	public void setTotalAmount(float totalAmount) {
198
 
262
		this.totalAmount = totalAmount;
199
    public void setTotalAmount(float totalAmount) {
263
	}
200
        this.totalAmount = totalAmount;
264
 
201
    }
265
	public String getInvoiceNumber() {
202
 
266
		return invoiceNumber;
203
    public String getInvoiceNumber() {
267
	}
204
        return invoiceNumber;
268
 
205
    }
269
	public void setInvoiceNumber(String invoiceNumber) {
206
 
270
		this.invoiceNumber = invoiceNumber;
207
    public void setInvoiceNumber(String invoiceNumber) {
271
	}
208
        this.invoiceNumber = invoiceNumber;
272
 
209
    }
273
	public float getCashback() {
210
 
274
		return cashback;
211
    public float getCashback() {
275
	}
212
        return cashback;
276
 
213
    }
277
	public void setCashback(float cashback) {
214
 
278
		this.cashback = cashback;
215
    public void setCashback(float cashback) {
279
	}
216
        this.cashback = cashback;
280
 
217
    }
281
	public LocalDateTime getCreateTimestamp() {
218
 
282
		return createTimestamp;
219
    public LocalDateTime getCreateTimestamp() {
283
	}
220
        return createTimestamp;
284
 
221
    }
285
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
222
 
286
		this.createTimestamp = createTimestamp;
223
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
287
	}
224
        this.createTimestamp = createTimestamp;
288
 
225
    }
289
	public String getFormattedDate() {
226
 
290
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
227
    public String getFormattedDate() {
291
		return this.createTimestamp.format(formatter);
228
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
292
	}
229
        return this.createTimestamp.format(formatter);
293
 
230
    }
294
	@Override
231
 
295
	public int hashCode() {
232
 
296
		final int prime = 31;
233
    @Override
297
		int result = 1;
234
    public int hashCode() {
298
		result = prime * result + ((billingTimestamp == null) ? 0 : billingTimestamp.hashCode());
235
        final int prime = 31;
299
		result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
236
        int result = 1;
300
		result = prime * result + Float.floatToIntBits(cashback);
237
        result = prime * result + ((billingTimestamp == null) ? 0 : billingTimestamp.hashCode());
301
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
238
        result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
302
		result = prime * result + customerAddressId;
239
        result = prime * result + Float.floatToIntBits(cashback);
303
		result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
240
        result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
304
		result = prime * result + customerId;
241
        result = prime * result + customerAddressId;
305
		result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
242
        result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
306
		result = prime * result + fofoId;
243
        result = prime * result + customerId;
307
		result = prime * result + id;
244
        result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
308
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
245
        result = prime * result + fofoId;
309
		result = prime * result + ((orderItem == null) ? 0 : orderItem.hashCode());
246
        result = prime * result + id;
310
		result = prime * result + Float.floatToIntBits(totalAmount);
247
        result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
311
		return result;
248
        result = prime * result + ((orderItem == null) ? 0 : orderItem.hashCode());
312
	}
249
        result = prime * result + Float.floatToIntBits(totalAmount);
313
 
250
        return result;
314
	@Override
251
    }
315
	public boolean equals(Object obj) {
252
 
316
		if (this == obj)
253
    @Override
317
			return true;
254
    public boolean equals(Object obj) {
318
		if (obj == null)
255
        if (this == obj) return true;
319
			return false;
256
        if (obj == null) return false;
320
		if (getClass() != obj.getClass())
257
        if (getClass() != obj.getClass()) return false;
321
			return false;
258
        FofoOrder other = (FofoOrder) obj;
322
		FofoOrder other = (FofoOrder) obj;
259
        if (billingTimestamp == null) {
323
		if (billingTimestamp == null) {
260
            if (other.billingTimestamp != null) return false;
324
			if (other.billingTimestamp != null)
261
        } else if (!billingTimestamp.equals(other.billingTimestamp)) return false;
325
				return false;
262
        if (cancelledTimestamp == null) {
326
		} else if (!billingTimestamp.equals(other.billingTimestamp))
263
            if (other.cancelledTimestamp != null) return false;
327
			return false;
264
        } else if (!cancelledTimestamp.equals(other.cancelledTimestamp)) return false;
328
		if (cancelledTimestamp == null) {
265
        if (Float.floatToIntBits(cashback) != Float.floatToIntBits(other.cashback)) return false;
329
			if (other.cancelledTimestamp != null)
266
        if (createTimestamp == null) {
330
				return false;
267
            if (other.createTimestamp != null) return false;
331
		} else if (!cancelledTimestamp.equals(other.cancelledTimestamp))
268
        } else if (!createTimestamp.equals(other.createTimestamp)) return false;
332
			return false;
269
        if (customerAddressId != other.customerAddressId) return false;
333
		if (Float.floatToIntBits(cashback) != Float.floatToIntBits(other.cashback))
270
        if (customerGstNumber == null) {
334
			return false;
271
            if (other.customerGstNumber != null) return false;
335
		if (createTimestamp == null) {
272
        } else if (!customerGstNumber.equals(other.customerGstNumber)) return false;
336
			if (other.createTimestamp != null)
273
        if (customerId != other.customerId) return false;
337
				return false;
274
        if (dateOfBirth == null) {
338
		} else if (!createTimestamp.equals(other.createTimestamp))
275
            if (other.dateOfBirth != null) return false;
339
			return false;
276
        } else if (!dateOfBirth.equals(other.dateOfBirth)) return false;
340
		if (customerAddressId != other.customerAddressId)
277
        if (fofoId != other.fofoId) return false;
341
			return false;
278
        if (id != other.id) return false;
342
		if (customerGstNumber == null) {
279
        if (invoiceNumber == null) {
343
			if (other.customerGstNumber != null)
280
            if (other.invoiceNumber != null) return false;
344
				return false;
281
        } else if (!invoiceNumber.equals(other.invoiceNumber)) return false;
345
		} else if (!customerGstNumber.equals(other.customerGstNumber))
282
        if (orderItem == null) {
346
			return false;
283
            if (other.orderItem != null) return false;
347
		if (customerId != other.customerId)
284
        } else if (!orderItem.equals(other.orderItem)) return false;
348
			return false;
285
        if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount)) return false;
349
		if (dateOfBirth == null) {
286
        return true;
350
			if (other.dateOfBirth != null)
287
    }
351
				return false;
288
 
352
		} else if (!dateOfBirth.equals(other.dateOfBirth))
289
    @Override
353
			return false;
290
    public String toString() {
354
		if (fofoId != other.fofoId)
291
        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 + " ]";
355
			return false;
292
    }
356
		if (id != other.id)
-
 
357
			return false;
-
 
358
		if (invoiceNumber == null) {
-
 
359
			if (other.invoiceNumber != null)
-
 
360
				return false;
-
 
361
		} else if (!invoiceNumber.equals(other.invoiceNumber))
-
 
362
			return false;
-
 
363
		if (orderItem == null) {
-
 
364
			if (other.orderItem != null)
-
 
365
				return false;
-
 
366
		} else if (!orderItem.equals(other.orderItem))
-
 
367
			return false;
-
 
368
		if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))
-
 
369
			return false;
-
 
370
		return true;
-
 
371
	}
-
 
372
 
-
 
373
	@Override
-
 
374
	public String toString() {
-
 
375
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
-
 
376
				+ customerAddressId + ", customerGstNumber=" + customerGstNumber + ", totalAmount=" + totalAmount
-
 
377
				+ ", invoiceNumber=" + invoiceNumber + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp
-
 
378
				+ ", cancelledTimestamp=" + cancelledTimestamp + ", billingTimestamp=" + billingTimestamp
-
 
379
				+ ", orderItem=" + orderItem + ", dateOfBirth=" + dateOfBirth + "]";
-
 
380
	}
-
 
381
 
293
 
382
}
294
}