| 22653 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
| 22418 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
| 24349 |
amit.gupta |
4 |
import java.time.LocalDate;
|
| 22418 |
ashik.ali |
5 |
|
|
|
6 |
import javax.persistence.Column;
|
|
|
7 |
import javax.persistence.Entity;
|
| 23786 |
amit.gupta |
8 |
import javax.persistence.EnumType;
|
|
|
9 |
import javax.persistence.Enumerated;
|
| 22418 |
ashik.ali |
10 |
import javax.persistence.Id;
|
| 27556 |
tejbeer |
11 |
import javax.persistence.NamedQueries;
|
|
|
12 |
import javax.persistence.NamedQuery;
|
| 22418 |
ashik.ali |
13 |
import javax.persistence.Table;
|
| 23786 |
amit.gupta |
14 |
import javax.persistence.Transient;
|
| 22418 |
ashik.ali |
15 |
|
| 23786 |
amit.gupta |
16 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
|
|
17 |
import com.spice.profitmandi.dao.entity.user.Address;
|
|
|
18 |
|
| 22418 |
ashik.ali |
19 |
/**
|
|
|
20 |
* This class basically contains store code details
|
|
|
21 |
*
|
|
|
22 |
* @author ashikali
|
|
|
23 |
*
|
|
|
24 |
*/
|
|
|
25 |
@Entity
|
| 27556 |
tejbeer |
26 |
@Table(name = "fofo.fofo_store", schema = "fofo")
|
|
|
27 |
|
|
|
28 |
@NamedQueries({
|
|
|
29 |
|
|
|
30 |
@NamedQuery(name = "FofoStore.selectGroupByWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWisePartnerSaleModel(fs.warehouseId,"
|
|
|
31 |
+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop AS int) else 0 end),"
|
|
|
32 |
+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity else 0 end),"
|
|
|
33 |
+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop AS int) else 0 end),"
|
|
|
34 |
+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity else 0 end))"
|
|
|
35 |
+ " 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"
|
|
|
36 |
+ " group by fs.warehouseId"),
|
|
|
37 |
|
|
|
38 |
@NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel(i.brand, "
|
|
|
39 |
+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop AS int) else 0 end),"
|
|
|
40 |
+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity else 0 end),"
|
|
|
41 |
+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop AS int) else 0 end),"
|
|
|
42 |
+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity else 0 end))"
|
|
|
43 |
+ " 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 "
|
|
|
44 |
+ " :warehouseId IS NULL OR fs.warehouseId = :warehouseId" + " group by i.brand"),
|
|
|
45 |
|
|
|
46 |
@NamedQuery(name = "FofoStore.selectWarehouseBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId, i.brand, i.modelName, i.modelNumber,i.color,"
|
|
|
47 |
+ "case when month(foi.createTimestamp) = month(now())-1 then foi.mop else 0 end,"
|
|
|
48 |
+ "case when month(foi.createTimestamp) = month(now())-1 then foi.quantity else 0 end,"
|
|
|
49 |
+ "case when month(foi.createTimestamp) = month(now()) then foi.mop else 0 end,"
|
|
|
50 |
+ "case when month(foi.createTimestamp) = month(now()) then foi.quantity else 0 end)"
|
|
|
51 |
+ " 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"
|
|
|
52 |
+ " and fs.warehouseId in :warehouseId and i.brand = :brand"),
|
|
|
53 |
|
|
|
54 |
})
|
|
|
55 |
public class FofoStore implements Serializable {
|
|
|
56 |
|
| 22418 |
ashik.ali |
57 |
private static final long serialVersionUID = 1L;
|
| 27556 |
tejbeer |
58 |
|
| 22418 |
ashik.ali |
59 |
public FofoStore() {
|
|
|
60 |
}
|
| 27556 |
tejbeer |
61 |
|
| 22418 |
ashik.ali |
62 |
@Id
|
| 27556 |
tejbeer |
63 |
@Column(name = "id", unique = true, updatable = false)
|
| 22418 |
ashik.ali |
64 |
private int id;
|
| 27556 |
tejbeer |
65 |
|
|
|
66 |
@Column(name = "code", unique = true)
|
| 22418 |
ashik.ali |
67 |
private String code;
|
| 27556 |
tejbeer |
68 |
|
| 23847 |
ashik.ali |
69 |
@Column(name = "latitude")
|
|
|
70 |
private String latitude;
|
| 27556 |
tejbeer |
71 |
|
| 23847 |
ashik.ali |
72 |
@Column(name = "longitude")
|
|
|
73 |
private String longitude;
|
| 27556 |
tejbeer |
74 |
|
|
|
75 |
@Column(name = "counter_size")
|
| 23786 |
amit.gupta |
76 |
@Enumerated(EnumType.STRING)
|
|
|
77 |
private CounterSize counterSize = CounterSize.TEN_LAC;
|
| 27556 |
tejbeer |
78 |
|
|
|
79 |
@Column(name = "warehouse_id")
|
| 25069 |
amit.gupta |
80 |
private int warehouseId;
|
| 27556 |
tejbeer |
81 |
|
| 25069 |
amit.gupta |
82 |
public int getWarehouseId() {
|
|
|
83 |
return warehouseId;
|
|
|
84 |
}
|
| 27556 |
tejbeer |
85 |
|
| 25069 |
amit.gupta |
86 |
public void setWarehouseId(int warehouseId) {
|
|
|
87 |
this.warehouseId = warehouseId;
|
|
|
88 |
}
|
|
|
89 |
|
| 27556 |
tejbeer |
90 |
@Column(name = "minimum_investment")
|
| 23884 |
amit.gupta |
91 |
private float minimumInvestment;
|
| 27556 |
tejbeer |
92 |
|
|
|
93 |
@Column(name = "grace_date")
|
| 24349 |
amit.gupta |
94 |
private LocalDate graceDate;
|
| 27556 |
tejbeer |
95 |
|
|
|
96 |
@Column(name = "investment_ok")
|
| 25276 |
amit.gupta |
97 |
private boolean investmentOk;
|
| 27556 |
tejbeer |
98 |
|
| 25276 |
amit.gupta |
99 |
public boolean isInvestmentOk() {
|
|
|
100 |
return investmentOk;
|
|
|
101 |
}
|
| 27556 |
tejbeer |
102 |
|
| 25276 |
amit.gupta |
103 |
public void setInvestmentOk(boolean investmentOk) {
|
|
|
104 |
this.investmentOk = investmentOk;
|
|
|
105 |
}
|
|
|
106 |
|
| 27556 |
tejbeer |
107 |
@Column(name = "grace_count")
|
| 24349 |
amit.gupta |
108 |
private int graceCount;
|
| 24843 |
govind |
109 |
|
|
|
110 |
@Column
|
| 27556 |
tejbeer |
111 |
private boolean active = true;
|
| 25276 |
amit.gupta |
112 |
|
| 24349 |
amit.gupta |
113 |
public int getGraceCount() {
|
|
|
114 |
return graceCount;
|
|
|
115 |
}
|
| 27556 |
tejbeer |
116 |
|
| 24843 |
govind |
117 |
public boolean isActive() {
|
|
|
118 |
return active;
|
|
|
119 |
}
|
| 27556 |
tejbeer |
120 |
|
| 24843 |
govind |
121 |
public void setActive(boolean active) {
|
|
|
122 |
this.active = active;
|
|
|
123 |
}
|
| 27556 |
tejbeer |
124 |
|
| 24349 |
amit.gupta |
125 |
public void setGraceCount(int graceCount) {
|
|
|
126 |
this.graceCount = graceCount;
|
|
|
127 |
}
|
| 27556 |
tejbeer |
128 |
|
| 24349 |
amit.gupta |
129 |
public LocalDate getGraceDate() {
|
|
|
130 |
return graceDate;
|
|
|
131 |
}
|
| 27556 |
tejbeer |
132 |
|
| 24349 |
amit.gupta |
133 |
public void setGraceDate(LocalDate graceDate) {
|
|
|
134 |
this.graceDate = graceDate;
|
|
|
135 |
}
|
| 27556 |
tejbeer |
136 |
|
| 23884 |
amit.gupta |
137 |
public float getMinimumInvestment() {
|
|
|
138 |
return minimumInvestment;
|
|
|
139 |
}
|
| 27556 |
tejbeer |
140 |
|
| 23884 |
amit.gupta |
141 |
public void setMinimumInvestment(float minimumInvestment) {
|
|
|
142 |
this.minimumInvestment = minimumInvestment;
|
|
|
143 |
}
|
|
|
144 |
|
| 23786 |
amit.gupta |
145 |
@Transient
|
|
|
146 |
private Address userAddress;
|
| 27556 |
tejbeer |
147 |
|
|
|
148 |
/*
|
|
|
149 |
* public int getCreditCycle() { return creditCycle; } public void
|
|
|
150 |
* setCreditCycle(int creditCycle) { this.creditCycle = creditCycle; }
|
|
|
151 |
*/
|
| 23786 |
amit.gupta |
152 |
public CounterSize getCounterSize() {
|
| 23716 |
amit.gupta |
153 |
return counterSize;
|
|
|
154 |
}
|
| 27556 |
tejbeer |
155 |
|
| 23786 |
amit.gupta |
156 |
public void setCounterSize(CounterSize counterSize) {
|
| 23716 |
amit.gupta |
157 |
this.counterSize = counterSize;
|
|
|
158 |
}
|
| 27556 |
tejbeer |
159 |
|
| 22418 |
ashik.ali |
160 |
public int getId() {
|
|
|
161 |
return id;
|
|
|
162 |
}
|
| 27556 |
tejbeer |
163 |
|
| 22418 |
ashik.ali |
164 |
public void setId(int id) {
|
|
|
165 |
this.id = id;
|
|
|
166 |
}
|
| 27556 |
tejbeer |
167 |
|
|
|
168 |
public String getCode() {
|
| 22418 |
ashik.ali |
169 |
return code;
|
|
|
170 |
}
|
| 27556 |
tejbeer |
171 |
|
|
|
172 |
public void setCode(String code) {
|
| 22418 |
ashik.ali |
173 |
this.code = code;
|
|
|
174 |
}
|
| 27556 |
tejbeer |
175 |
|
|
|
176 |
public String getLatitude() {
|
| 23847 |
ashik.ali |
177 |
return latitude;
|
|
|
178 |
}
|
| 27556 |
tejbeer |
179 |
|
|
|
180 |
public void setLatitude(String latitude) {
|
| 23847 |
ashik.ali |
181 |
this.latitude = latitude;
|
|
|
182 |
}
|
| 27556 |
tejbeer |
183 |
|
|
|
184 |
public String getLongitude() {
|
| 23847 |
ashik.ali |
185 |
return longitude;
|
|
|
186 |
}
|
| 27556 |
tejbeer |
187 |
|
|
|
188 |
public void setLongitude(String longitude) {
|
| 23847 |
ashik.ali |
189 |
this.longitude = longitude;
|
|
|
190 |
}
|
| 27556 |
tejbeer |
191 |
|
| 23786 |
amit.gupta |
192 |
public Address getUserAddress() {
|
|
|
193 |
return userAddress;
|
|
|
194 |
}
|
| 27556 |
tejbeer |
195 |
|
| 23786 |
amit.gupta |
196 |
public void setUserAddress(Address userAddress) {
|
|
|
197 |
this.userAddress = userAddress;
|
|
|
198 |
}
|
| 27556 |
tejbeer |
199 |
|
| 22418 |
ashik.ali |
200 |
@Override
|
|
|
201 |
public int hashCode() {
|
|
|
202 |
final int prime = 31;
|
|
|
203 |
int result = 1;
|
| 25276 |
amit.gupta |
204 |
result = prime * result + (active ? 1231 : 1237);
|
| 24349 |
amit.gupta |
205 |
result = prime * result + ((code == null) ? 0 : code.hashCode());
|
|
|
206 |
result = prime * result + ((counterSize == null) ? 0 : counterSize.hashCode());
|
|
|
207 |
result = prime * result + graceCount;
|
|
|
208 |
result = prime * result + ((graceDate == null) ? 0 : graceDate.hashCode());
|
| 22418 |
ashik.ali |
209 |
result = prime * result + id;
|
| 25276 |
amit.gupta |
210 |
result = prime * result + (investmentOk ? 1231 : 1237);
|
| 24349 |
amit.gupta |
211 |
result = prime * result + ((latitude == null) ? 0 : latitude.hashCode());
|
|
|
212 |
result = prime * result + ((longitude == null) ? 0 : longitude.hashCode());
|
|
|
213 |
result = prime * result + Float.floatToIntBits(minimumInvestment);
|
|
|
214 |
result = prime * result + ((userAddress == null) ? 0 : userAddress.hashCode());
|
| 25276 |
amit.gupta |
215 |
result = prime * result + warehouseId;
|
| 22418 |
ashik.ali |
216 |
return result;
|
|
|
217 |
}
|
| 27556 |
tejbeer |
218 |
|
| 22418 |
ashik.ali |
219 |
@Override
|
|
|
220 |
public boolean equals(Object obj) {
|
|
|
221 |
if (this == obj)
|
|
|
222 |
return true;
|
|
|
223 |
if (obj == null)
|
|
|
224 |
return false;
|
|
|
225 |
if (getClass() != obj.getClass())
|
|
|
226 |
return false;
|
|
|
227 |
FofoStore other = (FofoStore) obj;
|
| 25276 |
amit.gupta |
228 |
if (active != other.active)
|
|
|
229 |
return false;
|
| 24349 |
amit.gupta |
230 |
if (code == null) {
|
|
|
231 |
if (other.code != null)
|
|
|
232 |
return false;
|
|
|
233 |
} else if (!code.equals(other.code))
|
|
|
234 |
return false;
|
|
|
235 |
if (counterSize != other.counterSize)
|
|
|
236 |
return false;
|
|
|
237 |
if (graceCount != other.graceCount)
|
|
|
238 |
return false;
|
|
|
239 |
if (graceDate == null) {
|
|
|
240 |
if (other.graceDate != null)
|
|
|
241 |
return false;
|
|
|
242 |
} else if (!graceDate.equals(other.graceDate))
|
|
|
243 |
return false;
|
| 22418 |
ashik.ali |
244 |
if (id != other.id)
|
|
|
245 |
return false;
|
| 25276 |
amit.gupta |
246 |
if (investmentOk != other.investmentOk)
|
|
|
247 |
return false;
|
| 24349 |
amit.gupta |
248 |
if (latitude == null) {
|
|
|
249 |
if (other.latitude != null)
|
|
|
250 |
return false;
|
|
|
251 |
} else if (!latitude.equals(other.latitude))
|
|
|
252 |
return false;
|
|
|
253 |
if (longitude == null) {
|
|
|
254 |
if (other.longitude != null)
|
|
|
255 |
return false;
|
|
|
256 |
} else if (!longitude.equals(other.longitude))
|
|
|
257 |
return false;
|
|
|
258 |
if (Float.floatToIntBits(minimumInvestment) != Float.floatToIntBits(other.minimumInvestment))
|
|
|
259 |
return false;
|
|
|
260 |
if (userAddress == null) {
|
|
|
261 |
if (other.userAddress != null)
|
|
|
262 |
return false;
|
|
|
263 |
} else if (!userAddress.equals(other.userAddress))
|
|
|
264 |
return false;
|
| 25276 |
amit.gupta |
265 |
if (warehouseId != other.warehouseId)
|
|
|
266 |
return false;
|
| 22418 |
ashik.ali |
267 |
return true;
|
|
|
268 |
}
|
| 27556 |
tejbeer |
269 |
|
| 22418 |
ashik.ali |
270 |
@Override
|
|
|
271 |
public String toString() {
|
| 23884 |
amit.gupta |
272 |
return "FofoStore [id=" + id + ", code=" + code + ", latitude=" + latitude + ", longitude=" + longitude
|
| 25069 |
amit.gupta |
273 |
+ ", counterSize=" + counterSize + ", warehouseId=" + warehouseId + ", minimumInvestment="
|
| 25276 |
amit.gupta |
274 |
+ minimumInvestment + ", graceDate=" + graceDate + ", investmentOk=" + investmentOk + ", graceCount="
|
|
|
275 |
+ graceCount + ", active=" + active + ", userAddress=" + userAddress + "]";
|
| 22418 |
ashik.ali |
276 |
}
|
| 27556 |
tejbeer |
277 |
|
| 22418 |
ashik.ali |
278 |
}
|