| 26588 |
tejbeer |
1 |
package com.spice.profitmandi.dao.model;
|
|
|
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
|
|
4 |
import java.util.List;
|
|
|
5 |
|
| 28019 |
amit.gupta |
6 |
import com.spice.profitmandi.dao.enumuration.catalog.AchievementType;
|
| 27878 |
amit.gupta |
7 |
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
|
|
|
8 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
|
|
9 |
import com.spice.profitmandi.service.offers.PartnerCriteria;
|
| 26588 |
tejbeer |
10 |
|
|
|
11 |
public class CreateOfferRequest {
|
| 27360 |
tejbeer |
12 |
private int id;
|
| 27878 |
amit.gupta |
13 |
private boolean active;
|
| 28019 |
amit.gupta |
14 |
private boolean incrementalTarget;
|
| 26588 |
tejbeer |
15 |
private String name;
|
|
|
16 |
private LocalDateTime startDate;
|
|
|
17 |
private LocalDateTime endDate;
|
| 27878 |
amit.gupta |
18 |
private String offerNotes;
|
|
|
19 |
private String terms;
|
| 27918 |
amit.gupta |
20 |
private AchievementType targetType;
|
|
|
21 |
private AchievementType payoutType;
|
| 27878 |
amit.gupta |
22 |
private String activationBrands;
|
|
|
23 |
private OfferSchemeType schemeType;
|
|
|
24 |
private double sellinPercentage;
|
|
|
25 |
private double brandShareTerms;
|
|
|
26 |
private ItemCriteria itemCriteria;
|
|
|
27 |
private String itemCriteriaString;
|
|
|
28 |
private LocalDateTime createdOn;
|
|
|
29 |
private List<TargetSlab> targetSlabs;
|
|
|
30 |
private PartnerCriteria partnerCriteria;
|
|
|
31 |
private String partnerCriteriaString;
|
|
|
32 |
|
|
|
33 |
public int getEligibleSale() {
|
|
|
34 |
return eligibleSale;
|
| 26694 |
tejbeer |
35 |
}
|
| 27878 |
amit.gupta |
36 |
public void setEligibleSale(int eligibleSale) {
|
|
|
37 |
this.eligibleSale = eligibleSale;
|
| 27353 |
tejbeer |
38 |
}
|
|
|
39 |
|
| 28028 |
amit.gupta |
40 |
public String getDashboardHtml() {
|
|
|
41 |
String s= null;
|
|
|
42 |
if(this.getTargetType().equals(AchievementType.VALUE)) {
|
|
|
43 |
|
|
|
44 |
} else {
|
|
|
45 |
|
|
|
46 |
}
|
|
|
47 |
StringBuffer sb = new StringBuffer();
|
|
|
48 |
if(this.getNextTargetSlab() != null) {
|
|
|
49 |
sb.append("Sell ");
|
|
|
50 |
if(this.getTargetType().equals(AchievementType.VALUE)) {
|
|
|
51 |
sb.append("stock worth Rs.<span class=\"currency\">").append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
|
|
|
52 |
.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
|
|
|
53 |
.append("</span> to earn ").append(this.getNextTargetSlab().getTargetDescription());
|
|
|
54 |
} else {
|
|
|
55 |
sb.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
|
|
|
56 |
.append(" more units to earn ")
|
|
|
57 |
.append(this.getNextTargetSlab().getTargetDescription()).append(" per unit");
|
|
|
58 |
}
|
|
|
59 |
} else {
|
|
|
60 |
sb.append("Congratulations for achieving the highest slab of ");
|
|
|
61 |
if(this.getTargetType().equals(AchievementType.VALUE)) {
|
|
|
62 |
sb.append("Rs.<span class=\"currency\">")
|
|
|
63 |
.append(this.getCurrentTargetSlab().getOnwardsAmount())
|
|
|
64 |
.append("</span>");
|
|
|
65 |
} else {
|
|
|
66 |
sb.append(this.getCurrentTargetSlab().getOnwardsAmount()).append(" units")
|
|
|
67 |
.append(", you are eligible for ").append(this.getCurrentTargetSlab().getTargetDescription());
|
|
|
68 |
|
|
|
69 |
}
|
|
|
70 |
sb.append("keep up!!");
|
|
|
71 |
}
|
|
|
72 |
return sb.toString();
|
|
|
73 |
}
|
| 28019 |
amit.gupta |
74 |
|
|
|
75 |
|
|
|
76 |
public boolean isIncrementalTarget() {
|
|
|
77 |
return incrementalTarget;
|
|
|
78 |
}
|
|
|
79 |
public void setIncrementalTarget(boolean incrementalTarget) {
|
|
|
80 |
this.incrementalTarget = incrementalTarget;
|
|
|
81 |
}
|
|
|
82 |
@Override
|
|
|
83 |
public String toString() {
|
|
|
84 |
return "CreateOfferRequest [id=" + id + ", active=" + active + ", incrementalTarget=" + incrementalTarget
|
|
|
85 |
+ ", name=" + name + ", startDate=" + startDate + ", endDate=" + endDate + ", offerNotes=" + offerNotes
|
|
|
86 |
+ ", terms=" + terms + ", targetType=" + targetType + ", payoutType=" + payoutType
|
|
|
87 |
+ ", activationBrands=" + activationBrands + ", schemeType=" + schemeType + ", sellinPercentage="
|
|
|
88 |
+ sellinPercentage + ", brandShareTerms=" + brandShareTerms + ", itemCriteria=" + itemCriteria
|
|
|
89 |
+ ", itemCriteriaString=" + itemCriteriaString + ", createdOn=" + createdOn + ", targetSlabs="
|
|
|
90 |
+ targetSlabs + ", partnerCriteria=" + partnerCriteria + ", partnerCriteriaString="
|
|
|
91 |
+ partnerCriteriaString + ", eligibleSale=" + eligibleSale + ", nextTargetSlab=" + nextTargetSlab
|
|
|
92 |
+ ", currentTargetSlab=" + currentTargetSlab + "]";
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
| 27878 |
amit.gupta |
97 |
private int eligibleSale;
|
|
|
98 |
private TargetSlab nextTargetSlab;
|
|
|
99 |
private TargetSlab currentTargetSlab;
|
|
|
100 |
|
|
|
101 |
|
| 27353 |
tejbeer |
102 |
|
| 27878 |
amit.gupta |
103 |
public TargetSlab getNextTargetSlab() {
|
|
|
104 |
return nextTargetSlab;
|
| 27353 |
tejbeer |
105 |
}
|
| 27878 |
amit.gupta |
106 |
public void setNextTargetSlab(TargetSlab nextTargetSlab) {
|
|
|
107 |
this.nextTargetSlab = nextTargetSlab;
|
| 26694 |
tejbeer |
108 |
}
|
| 27878 |
amit.gupta |
109 |
public TargetSlab getCurrentTargetSlab() {
|
|
|
110 |
return currentTargetSlab;
|
| 26694 |
tejbeer |
111 |
}
|
| 27878 |
amit.gupta |
112 |
public void setCurrentTargetSlab(TargetSlab currentTargetSlab) {
|
|
|
113 |
this.currentTargetSlab = currentTargetSlab;
|
| 26694 |
tejbeer |
114 |
}
|
|
|
115 |
|
| 27878 |
amit.gupta |
116 |
public boolean isActive() {
|
|
|
117 |
return active;
|
| 26694 |
tejbeer |
118 |
}
|
|
|
119 |
|
| 27878 |
amit.gupta |
120 |
public void setActive(boolean active) {
|
|
|
121 |
this.active = active;
|
| 26694 |
tejbeer |
122 |
}
|
|
|
123 |
|
| 27878 |
amit.gupta |
124 |
public LocalDateTime getCreatedOn() {
|
|
|
125 |
return createdOn;
|
| 26694 |
tejbeer |
126 |
}
|
| 27878 |
amit.gupta |
127 |
|
|
|
128 |
|
| 27918 |
amit.gupta |
129 |
|
|
|
130 |
|
| 26694 |
tejbeer |
131 |
|
| 27918 |
amit.gupta |
132 |
public AchievementType getPayoutType() {
|
|
|
133 |
return payoutType;
|
|
|
134 |
}
|
|
|
135 |
public void setPayoutType(AchievementType payoutType) {
|
|
|
136 |
this.payoutType = payoutType;
|
|
|
137 |
}
|
| 27878 |
amit.gupta |
138 |
public String getActivationBrands() {
|
|
|
139 |
return activationBrands;
|
| 26694 |
tejbeer |
140 |
}
|
| 27878 |
amit.gupta |
141 |
public void setActivationBrands(String activationBrands) {
|
|
|
142 |
this.activationBrands = activationBrands;
|
| 26674 |
tejbeer |
143 |
}
|
| 27878 |
amit.gupta |
144 |
public void setCreatedOn(LocalDateTime createdOn) {
|
|
|
145 |
this.createdOn = createdOn;
|
|
|
146 |
}
|
| 26674 |
tejbeer |
147 |
|
| 27878 |
amit.gupta |
148 |
|
|
|
149 |
public String getItemCriteriaString() {
|
|
|
150 |
return itemCriteriaString;
|
| 26674 |
tejbeer |
151 |
}
|
|
|
152 |
|
| 27878 |
amit.gupta |
153 |
public String getPartnerCriteriaString() {
|
|
|
154 |
return partnerCriteriaString;
|
| 26674 |
tejbeer |
155 |
}
|
|
|
156 |
|
| 27878 |
amit.gupta |
157 |
public void setPartnerCriteriaString(String partnerCriteriaString) {
|
|
|
158 |
this.partnerCriteriaString = partnerCriteriaString;
|
| 26674 |
tejbeer |
159 |
}
|
|
|
160 |
|
| 27878 |
amit.gupta |
161 |
public PartnerCriteria getPartnerCriteria() {
|
|
|
162 |
return partnerCriteria;
|
| 26674 |
tejbeer |
163 |
}
|
|
|
164 |
|
| 27878 |
amit.gupta |
165 |
public void setPartnerCriteria(PartnerCriteria partnerCriteria) {
|
|
|
166 |
this.partnerCriteria = partnerCriteria;
|
| 26588 |
tejbeer |
167 |
}
|
|
|
168 |
|
| 27878 |
amit.gupta |
169 |
public ItemCriteria getItemCriteria() {
|
|
|
170 |
return itemCriteria;
|
| 26588 |
tejbeer |
171 |
}
|
|
|
172 |
|
| 27878 |
amit.gupta |
173 |
public void setItemCriteria(ItemCriteria itemCriteria) {
|
|
|
174 |
this.itemCriteria = itemCriteria;
|
| 26588 |
tejbeer |
175 |
}
|
|
|
176 |
|
| 27878 |
amit.gupta |
177 |
public double getBrandShareTerms() {
|
|
|
178 |
return brandShareTerms;
|
| 26588 |
tejbeer |
179 |
}
|
|
|
180 |
|
| 27878 |
amit.gupta |
181 |
public void setBrandShareTerms(double brandShareTerms) {
|
|
|
182 |
this.brandShareTerms = brandShareTerms;
|
| 26588 |
tejbeer |
183 |
}
|
|
|
184 |
|
| 27878 |
amit.gupta |
185 |
public List<TargetSlab> getTargetSlabs() {
|
|
|
186 |
return targetSlabs;
|
| 26588 |
tejbeer |
187 |
}
|
|
|
188 |
|
| 27878 |
amit.gupta |
189 |
public void setTargetSlabs(List<TargetSlab> targetSlabs) {
|
|
|
190 |
this.targetSlabs = targetSlabs;
|
| 26588 |
tejbeer |
191 |
}
|
|
|
192 |
|
| 27878 |
amit.gupta |
193 |
public int getId() {
|
|
|
194 |
return id;
|
| 26588 |
tejbeer |
195 |
}
|
|
|
196 |
|
| 27878 |
amit.gupta |
197 |
public void setId(int id) {
|
|
|
198 |
this.id = id;
|
| 26588 |
tejbeer |
199 |
}
|
|
|
200 |
|
|
|
201 |
public String getName() {
|
|
|
202 |
return name;
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
public void setName(String name) {
|
|
|
206 |
this.name = name;
|
|
|
207 |
}
|
|
|
208 |
|
| 27878 |
amit.gupta |
209 |
public LocalDateTime getStartDate() {
|
|
|
210 |
return startDate;
|
| 26588 |
tejbeer |
211 |
}
|
|
|
212 |
|
| 27878 |
amit.gupta |
213 |
public void setStartDate(LocalDateTime startDate) {
|
|
|
214 |
this.startDate = startDate;
|
| 26588 |
tejbeer |
215 |
}
|
|
|
216 |
|
| 27878 |
amit.gupta |
217 |
public LocalDateTime getEndDate() {
|
|
|
218 |
return endDate;
|
| 26588 |
tejbeer |
219 |
}
|
|
|
220 |
|
| 27878 |
amit.gupta |
221 |
public void setEndDate(LocalDateTime endDate) {
|
|
|
222 |
this.endDate = endDate;
|
| 26588 |
tejbeer |
223 |
}
|
|
|
224 |
|
| 27918 |
amit.gupta |
225 |
public AchievementType getTargetType() {
|
| 27878 |
amit.gupta |
226 |
return targetType;
|
| 26588 |
tejbeer |
227 |
}
|
|
|
228 |
|
| 27918 |
amit.gupta |
229 |
public void setTargetType(AchievementType targetType) {
|
| 27878 |
amit.gupta |
230 |
this.targetType = targetType;
|
| 26588 |
tejbeer |
231 |
}
|
|
|
232 |
|
| 27878 |
amit.gupta |
233 |
public OfferSchemeType getSchemeType() {
|
|
|
234 |
return schemeType;
|
| 26588 |
tejbeer |
235 |
}
|
|
|
236 |
|
| 27878 |
amit.gupta |
237 |
public void setSchemeType(OfferSchemeType schemeType) {
|
|
|
238 |
this.schemeType = schemeType;
|
| 26588 |
tejbeer |
239 |
}
|
|
|
240 |
|
| 27878 |
amit.gupta |
241 |
public double getSellinPercentage() {
|
|
|
242 |
return sellinPercentage;
|
| 26588 |
tejbeer |
243 |
}
|
|
|
244 |
|
| 27878 |
amit.gupta |
245 |
public void setSellinPercentage(double sellinPercentage) {
|
|
|
246 |
this.sellinPercentage = sellinPercentage;
|
| 26588 |
tejbeer |
247 |
}
|
|
|
248 |
|
| 27878 |
amit.gupta |
249 |
public String getOfferNotes() {
|
|
|
250 |
return offerNotes;
|
| 26588 |
tejbeer |
251 |
}
|
|
|
252 |
|
| 27878 |
amit.gupta |
253 |
public void setOfferNotes(String offerNotes) {
|
|
|
254 |
this.offerNotes = offerNotes;
|
| 26588 |
tejbeer |
255 |
}
|
|
|
256 |
|
| 27878 |
amit.gupta |
257 |
public String getTerms() {
|
|
|
258 |
return terms;
|
| 26588 |
tejbeer |
259 |
}
|
|
|
260 |
|
| 27878 |
amit.gupta |
261 |
public void setTerms(String terms) {
|
|
|
262 |
this.terms = terms;
|
| 26588 |
tejbeer |
263 |
}
|
|
|
264 |
|
| 27878 |
amit.gupta |
265 |
public void setItemCriteriaString(String itemCriteriaString) {
|
|
|
266 |
this.itemCriteriaString = itemCriteriaString;
|
| 26588 |
tejbeer |
267 |
}
|
|
|
268 |
|
| 27878 |
amit.gupta |
269 |
@Override
|
|
|
270 |
public boolean equals(Object obj) {
|
|
|
271 |
if (this == obj)
|
|
|
272 |
return true;
|
|
|
273 |
if (obj == null)
|
|
|
274 |
return false;
|
|
|
275 |
if (getClass() != obj.getClass())
|
|
|
276 |
return false;
|
|
|
277 |
CreateOfferRequest other = (CreateOfferRequest) obj;
|
|
|
278 |
if (activationBrands == null) {
|
|
|
279 |
if (other.activationBrands != null)
|
|
|
280 |
return false;
|
|
|
281 |
} else if (!activationBrands.equals(other.activationBrands))
|
|
|
282 |
return false;
|
|
|
283 |
if (active != other.active)
|
|
|
284 |
return false;
|
|
|
285 |
if (Double.doubleToLongBits(brandShareTerms) != Double.doubleToLongBits(other.brandShareTerms))
|
|
|
286 |
return false;
|
|
|
287 |
if (createdOn == null) {
|
|
|
288 |
if (other.createdOn != null)
|
|
|
289 |
return false;
|
|
|
290 |
} else if (!createdOn.equals(other.createdOn))
|
|
|
291 |
return false;
|
|
|
292 |
if (currentTargetSlab == null) {
|
|
|
293 |
if (other.currentTargetSlab != null)
|
|
|
294 |
return false;
|
|
|
295 |
} else if (!currentTargetSlab.equals(other.currentTargetSlab))
|
|
|
296 |
return false;
|
|
|
297 |
if (eligibleSale != other.eligibleSale)
|
|
|
298 |
return false;
|
|
|
299 |
if (endDate == null) {
|
|
|
300 |
if (other.endDate != null)
|
|
|
301 |
return false;
|
|
|
302 |
} else if (!endDate.equals(other.endDate))
|
|
|
303 |
return false;
|
|
|
304 |
if (id != other.id)
|
|
|
305 |
return false;
|
| 28019 |
amit.gupta |
306 |
if (incrementalTarget != other.incrementalTarget)
|
|
|
307 |
return false;
|
| 27878 |
amit.gupta |
308 |
if (itemCriteria == null) {
|
|
|
309 |
if (other.itemCriteria != null)
|
|
|
310 |
return false;
|
|
|
311 |
} else if (!itemCriteria.equals(other.itemCriteria))
|
|
|
312 |
return false;
|
|
|
313 |
if (itemCriteriaString == null) {
|
|
|
314 |
if (other.itemCriteriaString != null)
|
|
|
315 |
return false;
|
|
|
316 |
} else if (!itemCriteriaString.equals(other.itemCriteriaString))
|
|
|
317 |
return false;
|
|
|
318 |
if (name == null) {
|
|
|
319 |
if (other.name != null)
|
|
|
320 |
return false;
|
|
|
321 |
} else if (!name.equals(other.name))
|
|
|
322 |
return false;
|
|
|
323 |
if (nextTargetSlab == null) {
|
|
|
324 |
if (other.nextTargetSlab != null)
|
|
|
325 |
return false;
|
|
|
326 |
} else if (!nextTargetSlab.equals(other.nextTargetSlab))
|
|
|
327 |
return false;
|
|
|
328 |
if (offerNotes == null) {
|
|
|
329 |
if (other.offerNotes != null)
|
|
|
330 |
return false;
|
|
|
331 |
} else if (!offerNotes.equals(other.offerNotes))
|
|
|
332 |
return false;
|
|
|
333 |
if (partnerCriteria == null) {
|
|
|
334 |
if (other.partnerCriteria != null)
|
|
|
335 |
return false;
|
|
|
336 |
} else if (!partnerCriteria.equals(other.partnerCriteria))
|
|
|
337 |
return false;
|
|
|
338 |
if (partnerCriteriaString == null) {
|
|
|
339 |
if (other.partnerCriteriaString != null)
|
|
|
340 |
return false;
|
|
|
341 |
} else if (!partnerCriteriaString.equals(other.partnerCriteriaString))
|
|
|
342 |
return false;
|
| 27918 |
amit.gupta |
343 |
if (payoutType != other.payoutType)
|
|
|
344 |
return false;
|
| 27878 |
amit.gupta |
345 |
if (schemeType != other.schemeType)
|
|
|
346 |
return false;
|
|
|
347 |
if (Double.doubleToLongBits(sellinPercentage) != Double.doubleToLongBits(other.sellinPercentage))
|
|
|
348 |
return false;
|
|
|
349 |
if (startDate == null) {
|
|
|
350 |
if (other.startDate != null)
|
|
|
351 |
return false;
|
|
|
352 |
} else if (!startDate.equals(other.startDate))
|
|
|
353 |
return false;
|
|
|
354 |
if (targetSlabs == null) {
|
|
|
355 |
if (other.targetSlabs != null)
|
|
|
356 |
return false;
|
|
|
357 |
} else if (!targetSlabs.equals(other.targetSlabs))
|
|
|
358 |
return false;
|
|
|
359 |
if (targetType != other.targetType)
|
|
|
360 |
return false;
|
|
|
361 |
if (terms == null) {
|
|
|
362 |
if (other.terms != null)
|
|
|
363 |
return false;
|
|
|
364 |
} else if (!terms.equals(other.terms))
|
|
|
365 |
return false;
|
|
|
366 |
return true;
|
| 26588 |
tejbeer |
367 |
}
|
|
|
368 |
|
| 27878 |
amit.gupta |
369 |
@Override
|
|
|
370 |
public int hashCode() {
|
|
|
371 |
final int prime = 31;
|
|
|
372 |
int result = 1;
|
|
|
373 |
result = prime * result + ((activationBrands == null) ? 0 : activationBrands.hashCode());
|
|
|
374 |
result = prime * result + (active ? 1231 : 1237);
|
|
|
375 |
long temp;
|
|
|
376 |
temp = Double.doubleToLongBits(brandShareTerms);
|
|
|
377 |
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
378 |
result = prime * result + ((createdOn == null) ? 0 : createdOn.hashCode());
|
|
|
379 |
result = prime * result + ((currentTargetSlab == null) ? 0 : currentTargetSlab.hashCode());
|
|
|
380 |
result = prime * result + eligibleSale;
|
|
|
381 |
result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
|
|
|
382 |
result = prime * result + id;
|
| 28019 |
amit.gupta |
383 |
result = prime * result + (incrementalTarget ? 1231 : 1237);
|
| 27878 |
amit.gupta |
384 |
result = prime * result + ((itemCriteria == null) ? 0 : itemCriteria.hashCode());
|
|
|
385 |
result = prime * result + ((itemCriteriaString == null) ? 0 : itemCriteriaString.hashCode());
|
|
|
386 |
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
|
387 |
result = prime * result + ((nextTargetSlab == null) ? 0 : nextTargetSlab.hashCode());
|
|
|
388 |
result = prime * result + ((offerNotes == null) ? 0 : offerNotes.hashCode());
|
|
|
389 |
result = prime * result + ((partnerCriteria == null) ? 0 : partnerCriteria.hashCode());
|
|
|
390 |
result = prime * result + ((partnerCriteriaString == null) ? 0 : partnerCriteriaString.hashCode());
|
| 27918 |
amit.gupta |
391 |
result = prime * result + ((payoutType == null) ? 0 : payoutType.hashCode());
|
| 27878 |
amit.gupta |
392 |
result = prime * result + ((schemeType == null) ? 0 : schemeType.hashCode());
|
|
|
393 |
temp = Double.doubleToLongBits(sellinPercentage);
|
|
|
394 |
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
395 |
result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
|
|
|
396 |
result = prime * result + ((targetSlabs == null) ? 0 : targetSlabs.hashCode());
|
|
|
397 |
result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
|
|
|
398 |
result = prime * result + ((terms == null) ? 0 : terms.hashCode());
|
|
|
399 |
return result;
|
| 26588 |
tejbeer |
400 |
}
|
|
|
401 |
}
|