| 22600 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.catalog;
|
|
|
2 |
|
| 35099 |
amit |
3 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 30121 |
amit.gupta |
4 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
|
|
5 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
|
|
6 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
|
|
7 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
|
|
8 |
|
|
|
9 |
import javax.persistence.*;
|
| 22600 |
ashik.ali |
10 |
import java.io.Serializable;
|
|
|
11 |
import java.time.LocalDateTime;
|
| 22859 |
ashik.ali |
12 |
import java.time.format.DateTimeFormatter;
|
| 30454 |
amit.gupta |
13 |
import java.util.*;
|
| 22600 |
ashik.ali |
14 |
|
|
|
15 |
/**
|
|
|
16 |
* This class basically contains scheme details
|
| 30896 |
amit.gupta |
17 |
*
|
| 22600 |
ashik.ali |
18 |
* @author ashikali
|
|
|
19 |
*/
|
| 31651 |
tejbeer |
20 |
@NamedQueries({ @NamedQuery(name = "scheme.selectSchemesByRetailerIdsSchemeIds", query = "select sr.schemeId from"
|
|
|
21 |
+ " SchemeRegion sr join PartnerRegion pr on pr.regionId=sr.regionId where pr.fofoId in :fofoIds and sr.schemeId in :schemeIds"),
|
| 30896 |
amit.gupta |
22 |
|
| 31651 |
tejbeer |
23 |
@NamedQuery(name = "Scheme.selectSchemeByModelsPartnerTypeFofoId", query = "select s from Scheme s"
|
|
|
24 |
+ " join SchemeItem si on si.schemeId = s.id" + " join SchemeRegion sr on sr.schemeId = s.id"
|
|
|
25 |
+ " join PartnerRegion pr on pr.regionId=sr.regionId"
|
|
|
26 |
+ " where pr.fofoId in :fofoIds and s.partnerType in :partnerTypes" + " and si.catalogId in :catalogIds"
|
|
|
27 |
+ " and :onDate between s.startDateTime and s.endDateTime" +
|
|
|
28 |
// " and s.endDateTime >= :onDate" +
|
| 36374 |
ranu |
29 |
" and s.activeTimestamp is not null"),
|
| 31441 |
amit.gupta |
30 |
|
| 36374 |
ranu |
31 |
@NamedQuery(name = "Scheme.selectSchemesByBrandsAndFofoRegion", query = "select distinct s from Scheme s"
|
|
|
32 |
+ " join SchemeItem si on si.schemeId = s.id"
|
|
|
33 |
+ " join Item i on i.catalogItemId = si.catalogId"
|
|
|
34 |
+ " join SchemeRegion sr on sr.schemeId = s.id"
|
|
|
35 |
+ " where i.brand in :brands"
|
|
|
36 |
+ " and s.activeTimestamp is not null"
|
|
|
37 |
+ " and s.partnerType in :partnerTypes"
|
|
|
38 |
+ " and s.startDateTime <= :onDate"
|
|
|
39 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
|
|
40 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
|
|
41 |
+ " and (sr.regionId = 5 or sr.regionId in :regionIds)"
|
|
|
42 |
+ " order by s.id desc"),
|
|
|
43 |
|
|
|
44 |
@NamedQuery(name = "Scheme.selectSchemesByBrands", query = "select distinct s from Scheme s"
|
|
|
45 |
+ " join SchemeItem si on si.schemeId = s.id"
|
|
|
46 |
+ " join Item i on i.catalogItemId = si.catalogId"
|
|
|
47 |
+ " where i.brand in :brands"
|
|
|
48 |
+ " and s.activeTimestamp is not null"
|
|
|
49 |
+ " and s.partnerType in :partnerTypes"
|
|
|
50 |
+ " and s.startDateTime <= :onDate"
|
|
|
51 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
|
|
52 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
|
|
53 |
+ " order by s.id desc"),
|
|
|
54 |
|
|
|
55 |
@NamedQuery(name = "Scheme.selectActiveSchemesByFofoRegion", query = "select distinct s from Scheme s"
|
|
|
56 |
+ " join SchemeItem si on si.schemeId = s.id"
|
|
|
57 |
+ " join SchemeRegion sr on sr.schemeId = s.id"
|
|
|
58 |
+ " where s.activeTimestamp is not null"
|
|
|
59 |
+ " and s.partnerType in :partnerTypes"
|
|
|
60 |
+ " and s.startDateTime <= :onDate"
|
|
|
61 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
|
|
62 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
|
|
63 |
+ " and (sr.regionId = 5 or sr.regionId in :regionIds)"
|
|
|
64 |
+ " order by s.id desc"),
|
|
|
65 |
|
|
|
66 |
@NamedQuery(name = "Scheme.selectAllActiveSchemes", query = "select distinct s from Scheme s"
|
|
|
67 |
+ " join SchemeItem si on si.schemeId = s.id"
|
|
|
68 |
+ " where s.activeTimestamp is not null"
|
|
|
69 |
+ " and s.partnerType in :partnerTypes"
|
|
|
70 |
+ " and s.startDateTime <= :onDate"
|
|
|
71 |
+ " and COALESCE(s.expireTimestamp, s.endDateTime) >= :onDate"
|
|
|
72 |
+ " and (si.endDate is null or si.endDate >= :onDate)"
|
|
|
73 |
+ " order by s.id desc")
|
|
|
74 |
|
| 31651 |
tejbeer |
75 |
/*
|
|
|
76 |
* ,
|
|
|
77 |
*
|
|
|
78 |
* @NamedQuery(name="scheme.getImeiMarginsPaidOnBillingMonth", query=
|
|
|
79 |
* "select new com.spice.profitmandi.dao.repository.catalog.ImeiMarginModel(" +
|
|
|
80 |
* ") from LineItemImei li1" +
|
|
|
81 |
* " left join LineItemImei li2 on (li1.serialNumber = li2.serialNumber and li1.id < li2.id)"
|
|
|
82 |
* + " join LineItem li on li.id = li1.lineItemId" +
|
|
|
83 |
* " join Order o on o.id = li.orderId" +
|
|
|
84 |
* " join Item ci on li.itemId = ci.id" +
|
|
|
85 |
* " join SchemeItem si on si.catalogId = ci.catalogItemId" +
|
|
|
86 |
* " join Scheme s1 on s1.id = si.schemeId" +
|
|
|
87 |
* " join SchemeRegion sr on sr.schemeId = s1.id" +
|
|
|
88 |
* " join PartnerRegion pr on (pr.regionId = sr.regionId and pr.fofoId in (0, o.id))"
|
|
|
89 |
* + " left join PartnerTypeChange ptc on ptc.fofoId = o.retailerId" +
|
|
|
90 |
* " left join PartnerTypeChange ptc2 on (ptc2.fofoId = ptc.fofoId and ptc.createTimestamp < ptc2.createTimestamp)"
|
|
|
91 |
* + "where li2.id is null" + " and ptc2.createTimestamp is null" +
|
|
|
92 |
* " and o.billing_timestamp between :startDate and :endDate" +
|
|
|
93 |
* " and '2022-12-01' between s1.start_date_time and s1.end_date_time" +
|
|
|
94 |
* " and ((ptc.partnerType is null and s1.partner_type in ('ALL', 'NEW'))" +
|
|
|
95 |
* " or s1.partnerType in (ptc.partnerType, 'ALL'))" +
|
|
|
96 |
* " and s1.activeTimestamp is not null" + " and s1.amountType = 'PERCENTAGE'"
|
|
|
97 |
* + "group by li.serial_number) as set1\n" + "")
|
|
|
98 |
*/
|
| 31441 |
amit.gupta |
99 |
|
| 31170 |
amit.gupta |
100 |
})
|
|
|
101 |
|
| 30896 |
amit.gupta |
102 |
@NamedNativeQueries({
|
|
|
103 |
|
| 31695 |
tejbeer |
104 |
@NamedNativeQuery(name = "scheme.getActiveScheme", query = "select si.catalog_id from catalog.scheme s join "
|
| 31696 |
tejbeer |
105 |
+ " fofo.scheme_item si on s.id = si.scheme_id join catalog.item i on i.catalog_item_id = si.catalog_id"
|
| 36397 |
amit |
106 |
+ " where s.active_timestamp is not null and start_date_time <= :startDate and end_date_time >= :startDate"
|
|
|
107 |
+ " and (si.start_date is null or :startDate between si.start_date and si.end_date)"
|
|
|
108 |
+ " and s.type = 'SPECIAL_SUPPORT' and i.hsnCode = '85171300' order by active_timestamp desc "),
|
| 31651 |
tejbeer |
109 |
|
|
|
110 |
@NamedNativeQuery(name = "scheme.selectMissedActivationSale", query = "select cs.id as scheme_id, ai.serial_number, sr.order_id, ii.id as inventory_item_id, ai.activation_timestamp"
|
|
|
111 |
+ " from fofo.activated_imei ai "
|
|
|
112 |
+ " join fofo.inventory_item ii on ai.serial_number = ii.serial_number "
|
|
|
113 |
+ " join catalog.item i on i.id = ii.item_id "
|
| 34752 |
amit.gupta |
114 |
+ " join catalog.scheme cs on ai.activation_timestamp >= cs.start_date_time and ai.activation_timestamp <= cs.end_date_time "
|
| 36397 |
amit |
115 |
+ " join fofo.scheme_item si on (si.scheme_id = cs.id and i.catalog_item_id = si.catalog_id and (si.start_date is null or ai.activation_timestamp between si.start_date and si.end_date)) "
|
| 34697 |
amit.gupta |
116 |
+ " join fofo.scan_record sr on (sr.inventory_item_id = ii.id)"
|
|
|
117 |
+ " join fofo.scheme_region sre on sre.scheme_id = cs.id"
|
|
|
118 |
+ " join cs.partner_region pr on (pr.region_id = sre.region_id and (pr.fofo_id = ii.fofo_id or pr.fofo_id = 0))"
|
| 31651 |
tejbeer |
119 |
+ " left join fofo.scheme_in_out sio on (sio.scheme_id = cs.id and sio.inventory_item_id = ii.id) "
|
| 34752 |
amit.gupta |
120 |
+ " where cs.active_timestamp is not null " + " and cs.type ='SPECIAL_SUPPORT'"
|
| 31651 |
tejbeer |
121 |
+ " and sr.type = 'SALE'" + " and (sio.id is null or sio.status='REJECTED') "
|
|
|
122 |
+ " and ai.checked = false", resultSetMapping = "missedActivationSaleMapping") })
|
|
|
123 |
|
|
|
124 |
@SqlResultSetMappings({ @SqlResultSetMapping(name = "missedActivationSaleMapping", classes = {
|
|
|
125 |
@ConstructorResult(targetClass = SchemesImeisModel.class, columns = {
|
|
|
126 |
@ColumnResult(name = "serial_number", type = String.class),
|
|
|
127 |
@ColumnResult(name = "activation_timestamp", type = LocalDateTime.class),
|
|
|
128 |
@ColumnResult(name = "order_id", type = Integer.class),
|
|
|
129 |
@ColumnResult(name = "inventory_item_id", type = Integer.class),
|
|
|
130 |
@ColumnResult(name = "scheme_id", type = Integer.class), }) }) })
|
| 22600 |
ashik.ali |
131 |
@Entity
|
| 31860 |
tejbeer |
132 |
@Table(name = "catalog.scheme")
|
| 25503 |
amit.gupta |
133 |
public class Scheme implements Serializable {
|
|
|
134 |
|
|
|
135 |
public PartnerType getPartnerType() {
|
|
|
136 |
return partnerType;
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
public void setPartnerType(PartnerType partnerType) {
|
|
|
140 |
this.partnerType = partnerType;
|
|
|
141 |
}
|
|
|
142 |
|
| 22600 |
ashik.ali |
143 |
private static final long serialVersionUID = 1L;
|
| 25503 |
amit.gupta |
144 |
|
| 22600 |
ashik.ali |
145 |
public Scheme() {
|
|
|
146 |
}
|
| 25503 |
amit.gupta |
147 |
|
| 22600 |
ashik.ali |
148 |
@Id
|
| 25503 |
amit.gupta |
149 |
@Column(name = "id")
|
| 22600 |
ashik.ali |
150 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
151 |
private int id;
|
| 25503 |
amit.gupta |
152 |
|
| 31651 |
tejbeer |
153 |
@Column(name = "`name`")
|
| 22653 |
ashik.ali |
154 |
private String name;
|
| 25503 |
amit.gupta |
155 |
|
| 22653 |
ashik.ali |
156 |
@Column(name = "description")
|
|
|
157 |
private String description;
|
| 25503 |
amit.gupta |
158 |
|
| 31651 |
tejbeer |
159 |
@Column(name = "`type`")
|
| 23297 |
ashik.ali |
160 |
@Enumerated(EnumType.STRING)
|
| 22653 |
ashik.ali |
161 |
private SchemeType type;
|
| 25503 |
amit.gupta |
162 |
|
| 22600 |
ashik.ali |
163 |
@Column(name = "amount_type")
|
| 23297 |
ashik.ali |
164 |
@Enumerated(EnumType.STRING)
|
| 23527 |
ashik.ali |
165 |
private AmountType amountType;
|
| 25503 |
amit.gupta |
166 |
|
| 30454 |
amit.gupta |
167 |
@Column(name = "base_plus_gst_calc")
|
|
|
168 |
private boolean basePlusGstCalc;
|
|
|
169 |
|
| 22600 |
ashik.ali |
170 |
@Column(name = "amount")
|
|
|
171 |
private float amount;
|
| 25503 |
amit.gupta |
172 |
|
| 22600 |
ashik.ali |
173 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 23019 |
ashik.ali |
174 |
@Column(name = "start_date_time")
|
|
|
175 |
private LocalDateTime startDateTime = LocalDateTime.now();
|
| 25503 |
amit.gupta |
176 |
|
| 22600 |
ashik.ali |
177 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 23019 |
ashik.ali |
178 |
@Column(name = "end_date_time")
|
|
|
179 |
private LocalDateTime endDateTime = LocalDateTime.now();
|
| 25503 |
amit.gupta |
180 |
|
| 22608 |
ashik.ali |
181 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 22600 |
ashik.ali |
182 |
@Column(name = "create_timestamp")
|
| 22859 |
ashik.ali |
183 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
| 25503 |
amit.gupta |
184 |
|
| 22653 |
ashik.ali |
185 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
186 |
@Column(name = "active_timestamp")
|
|
|
187 |
private LocalDateTime activeTimestamp = null;
|
| 25503 |
amit.gupta |
188 |
|
| 22653 |
ashik.ali |
189 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 22702 |
ashik.ali |
190 |
@Column(name = "expire_timestamp")
|
| 22653 |
ashik.ali |
191 |
private LocalDateTime expireTimestamp = null;
|
| 25503 |
amit.gupta |
192 |
|
| 22600 |
ashik.ali |
193 |
@Column(name = "created_by")
|
|
|
194 |
private int createdBy;
|
| 25503 |
amit.gupta |
195 |
|
| 32310 |
amit.gupta |
196 |
//Dummy hardcode
|
|
|
197 |
@Transient
|
|
|
198 |
private int target;
|
|
|
199 |
|
|
|
200 |
public int getTarget() {
|
|
|
201 |
return target;
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
public void setTarget(int target) {
|
|
|
205 |
this.target = target;
|
|
|
206 |
}
|
|
|
207 |
|
| 26679 |
amit.gupta |
208 |
@Column
|
| 26685 |
amit.gupta |
209 |
private boolean cashback;
|
| 26679 |
amit.gupta |
210 |
|
| 22859 |
ashik.ali |
211 |
@Transient
|
| 34697 |
amit.gupta |
212 |
private Set<Integer> retailerIds;
|
| 30896 |
amit.gupta |
213 |
|
| 27388 |
amit.gupta |
214 |
@Transient
|
|
|
215 |
private String amountModel;
|
| 30896 |
amit.gupta |
216 |
|
| 28653 |
amit.gupta |
217 |
@Transient
|
|
|
218 |
private float schemeValue;
|
| 25503 |
amit.gupta |
219 |
|
| 28653 |
amit.gupta |
220 |
public float getSchemeValue() {
|
|
|
221 |
return schemeValue;
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
public void setSchemeValue(float schemeValue) {
|
|
|
225 |
this.schemeValue = schemeValue;
|
|
|
226 |
}
|
|
|
227 |
|
| 35099 |
amit |
228 |
public String getSchemePeriod() {
|
|
|
229 |
return FormattingUtils.formatDateMonthNonHyphenated(this.getStartDateTime()) + " - " + FormattingUtils.formatDateMonthNonHyphenated(this.getEndDateTime());
|
|
|
230 |
}
|
|
|
231 |
|
| 30454 |
amit.gupta |
232 |
@Column(name = "partner_type")
|
| 25503 |
amit.gupta |
233 |
@Enumerated(EnumType.STRING)
|
|
|
234 |
private PartnerType partnerType;
|
|
|
235 |
|
| 30454 |
amit.gupta |
236 |
@Override
|
|
|
237 |
public String toString() {
|
| 31651 |
tejbeer |
238 |
return "Scheme{" + "id=" + id + ", name='" + name + '\'' + ", description='" + description + '\'' + ", type="
|
|
|
239 |
+ type + ", amountType=" + amountType + ", gstReversal=" + basePlusGstCalc + ", amount=" + amount
|
|
|
240 |
+ ", startDateTime=" + startDateTime + ", endDateTime=" + endDateTime + ", createTimestamp="
|
|
|
241 |
+ createTimestamp + ", activeTimestamp=" + activeTimestamp + ", expireTimestamp=" + expireTimestamp
|
|
|
242 |
+ ", createdBy=" + createdBy + ", cashback=" + cashback + ", retailerIds=" + retailerIds
|
|
|
243 |
+ ", amountModel='" + amountModel + '\'' + ", schemeValue=" + schemeValue + ", partnerType="
|
| 36451 |
amit |
244 |
+ partnerType + ", reference='" + reference + '\''
|
|
|
245 |
+ ", catalogStringMap=" + catalogStringMap + '}';
|
| 30454 |
amit.gupta |
246 |
}
|
|
|
247 |
|
|
|
248 |
@Override
|
|
|
249 |
public boolean equals(Object o) {
|
| 31651 |
tejbeer |
250 |
if (this == o)
|
|
|
251 |
return true;
|
|
|
252 |
if (o == null || getClass() != o.getClass())
|
|
|
253 |
return false;
|
| 30454 |
amit.gupta |
254 |
Scheme scheme = (Scheme) o;
|
| 31651 |
tejbeer |
255 |
return id == scheme.id && basePlusGstCalc == scheme.basePlusGstCalc && Float.compare(scheme.amount, amount) == 0
|
|
|
256 |
&& createdBy == scheme.createdBy && cashback == scheme.cashback
|
|
|
257 |
&& Float.compare(scheme.schemeValue, schemeValue) == 0 && Objects.equals(name, scheme.name)
|
|
|
258 |
&& Objects.equals(description, scheme.description) && type == scheme.type
|
|
|
259 |
&& amountType == scheme.amountType && Objects.equals(startDateTime, scheme.startDateTime)
|
|
|
260 |
&& Objects.equals(endDateTime, scheme.endDateTime)
|
|
|
261 |
&& Objects.equals(createTimestamp, scheme.createTimestamp)
|
|
|
262 |
&& Objects.equals(activeTimestamp, scheme.activeTimestamp)
|
|
|
263 |
&& Objects.equals(expireTimestamp, scheme.expireTimestamp)
|
|
|
264 |
&& Objects.equals(retailerIds, scheme.retailerIds) && Objects.equals(amountModel, scheme.amountModel)
|
|
|
265 |
&& partnerType == scheme.partnerType && Objects.equals(catalogStringMap, scheme.catalogStringMap);
|
| 30454 |
amit.gupta |
266 |
}
|
|
|
267 |
|
|
|
268 |
@Override
|
|
|
269 |
public int hashCode() {
|
| 31651 |
tejbeer |
270 |
return Objects.hash(id, name, description, type, amountType, basePlusGstCalc, amount, startDateTime,
|
|
|
271 |
endDateTime, createTimestamp, activeTimestamp, expireTimestamp, createdBy, cashback, retailerIds,
|
|
|
272 |
amountModel, schemeValue, partnerType, catalogStringMap);
|
| 30454 |
amit.gupta |
273 |
}
|
|
|
274 |
|
| 36451 |
amit |
275 |
@Column(name = "reference")
|
|
|
276 |
private String reference;
|
|
|
277 |
|
| 22859 |
ashik.ali |
278 |
@Transient
|
| 30121 |
amit.gupta |
279 |
private Map<Integer, String> catalogStringMap = new HashMap<>();
|
| 25503 |
amit.gupta |
280 |
|
| 22600 |
ashik.ali |
281 |
public int getId() {
|
|
|
282 |
return id;
|
|
|
283 |
}
|
| 25503 |
amit.gupta |
284 |
|
| 22600 |
ashik.ali |
285 |
public void setId(int id) {
|
|
|
286 |
this.id = id;
|
|
|
287 |
}
|
| 25503 |
amit.gupta |
288 |
|
| 27388 |
amit.gupta |
289 |
public String getAmountModel() {
|
|
|
290 |
return amountModel;
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
public void setAmountModel(String amountModel) {
|
|
|
294 |
this.amountModel = amountModel;
|
|
|
295 |
}
|
|
|
296 |
|
| 22653 |
ashik.ali |
297 |
public String getName() {
|
|
|
298 |
return name;
|
| 22600 |
ashik.ali |
299 |
}
|
| 25503 |
amit.gupta |
300 |
|
| 22653 |
ashik.ali |
301 |
public void setName(String name) {
|
|
|
302 |
this.name = name;
|
| 22600 |
ashik.ali |
303 |
}
|
| 25503 |
amit.gupta |
304 |
|
| 22653 |
ashik.ali |
305 |
public String getDescription() {
|
|
|
306 |
return description;
|
| 22600 |
ashik.ali |
307 |
}
|
| 25503 |
amit.gupta |
308 |
|
| 22653 |
ashik.ali |
309 |
public void setDescription(String description) {
|
|
|
310 |
this.description = description;
|
| 22600 |
ashik.ali |
311 |
}
|
| 25503 |
amit.gupta |
312 |
|
| 26685 |
amit.gupta |
313 |
public boolean isCashback() {
|
|
|
314 |
return cashback;
|
| 26679 |
amit.gupta |
315 |
}
|
|
|
316 |
|
| 26685 |
amit.gupta |
317 |
public void setCashback(boolean cashback) {
|
|
|
318 |
this.cashback = cashback;
|
| 26679 |
amit.gupta |
319 |
}
|
|
|
320 |
|
| 22653 |
ashik.ali |
321 |
public SchemeType getType() {
|
|
|
322 |
return type;
|
|
|
323 |
}
|
| 25503 |
amit.gupta |
324 |
|
| 22653 |
ashik.ali |
325 |
public void setType(SchemeType type) {
|
|
|
326 |
this.type = type;
|
|
|
327 |
}
|
| 25503 |
amit.gupta |
328 |
|
| 23527 |
ashik.ali |
329 |
public AmountType getAmountType() {
|
| 22600 |
ashik.ali |
330 |
return amountType;
|
|
|
331 |
}
|
| 25503 |
amit.gupta |
332 |
|
| 23527 |
ashik.ali |
333 |
public void setAmountType(AmountType amountType) {
|
| 22600 |
ashik.ali |
334 |
this.amountType = amountType;
|
|
|
335 |
}
|
| 25503 |
amit.gupta |
336 |
|
| 22600 |
ashik.ali |
337 |
public float getAmount() {
|
|
|
338 |
return amount;
|
|
|
339 |
}
|
| 25503 |
amit.gupta |
340 |
|
| 22600 |
ashik.ali |
341 |
public void setAmount(float amount) {
|
|
|
342 |
this.amount = amount;
|
|
|
343 |
}
|
| 25503 |
amit.gupta |
344 |
|
| 23019 |
ashik.ali |
345 |
public LocalDateTime getStartDateTime() {
|
|
|
346 |
return startDateTime;
|
| 22600 |
ashik.ali |
347 |
}
|
| 25503 |
amit.gupta |
348 |
|
| 23019 |
ashik.ali |
349 |
public void setStartDateTime(LocalDateTime startDateTime) {
|
|
|
350 |
this.startDateTime = startDateTime;
|
| 22600 |
ashik.ali |
351 |
}
|
| 25503 |
amit.gupta |
352 |
|
| 23019 |
ashik.ali |
353 |
public LocalDateTime getEndDateTime() {
|
|
|
354 |
return endDateTime;
|
| 22653 |
ashik.ali |
355 |
}
|
| 25503 |
amit.gupta |
356 |
|
| 23019 |
ashik.ali |
357 |
public void setEndDateTime(LocalDateTime endDateTime) {
|
|
|
358 |
this.endDateTime = endDateTime;
|
| 22653 |
ashik.ali |
359 |
}
|
| 25503 |
amit.gupta |
360 |
|
| 22859 |
ashik.ali |
361 |
public LocalDateTime getCreateTimestamp() {
|
|
|
362 |
return createTimestamp;
|
| 22600 |
ashik.ali |
363 |
}
|
| 25503 |
amit.gupta |
364 |
|
| 22859 |
ashik.ali |
365 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
366 |
this.createTimestamp = createTimestamp;
|
| 22600 |
ashik.ali |
367 |
}
|
| 25503 |
amit.gupta |
368 |
|
| 22600 |
ashik.ali |
369 |
public int getCreatedBy() {
|
|
|
370 |
return createdBy;
|
|
|
371 |
}
|
| 25503 |
amit.gupta |
372 |
|
| 22600 |
ashik.ali |
373 |
public void setCreatedBy(int createdBy) {
|
|
|
374 |
this.createdBy = createdBy;
|
|
|
375 |
}
|
| 25503 |
amit.gupta |
376 |
|
| 22653 |
ashik.ali |
377 |
public LocalDateTime getActiveTimestamp() {
|
|
|
378 |
return activeTimestamp;
|
| 22600 |
ashik.ali |
379 |
}
|
| 25503 |
amit.gupta |
380 |
|
| 22653 |
ashik.ali |
381 |
public void setActiveTimestamp(LocalDateTime activeTimestamp) {
|
|
|
382 |
this.activeTimestamp = activeTimestamp;
|
| 22600 |
ashik.ali |
383 |
}
|
| 25503 |
amit.gupta |
384 |
|
| 22653 |
ashik.ali |
385 |
public LocalDateTime getExpireTimestamp() {
|
|
|
386 |
return expireTimestamp;
|
|
|
387 |
}
|
| 25503 |
amit.gupta |
388 |
|
| 22653 |
ashik.ali |
389 |
public void setExpireTimestamp(LocalDateTime expireTimestamp) {
|
|
|
390 |
this.expireTimestamp = expireTimestamp;
|
|
|
391 |
}
|
| 25503 |
amit.gupta |
392 |
|
|
|
393 |
public String getFormattedStartDateTime() {
|
|
|
394 |
if (startDateTime == null) {
|
| 22859 |
ashik.ali |
395 |
return null;
|
|
|
396 |
}
|
| 24402 |
amit.gupta |
397 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
| 23019 |
ashik.ali |
398 |
return startDateTime.format(formatter);
|
| 25503 |
amit.gupta |
399 |
}
|
|
|
400 |
|
|
|
401 |
public String getFormattedEndDateTime() {
|
|
|
402 |
if (endDateTime == null) {
|
| 22859 |
ashik.ali |
403 |
return null;
|
|
|
404 |
}
|
| 24402 |
amit.gupta |
405 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
| 23019 |
ashik.ali |
406 |
return endDateTime.format(formatter);
|
| 25503 |
amit.gupta |
407 |
}
|
|
|
408 |
|
|
|
409 |
public String getFormattedCreateTimestamp() {
|
|
|
410 |
if (createTimestamp == null) {
|
| 22859 |
ashik.ali |
411 |
return null;
|
|
|
412 |
}
|
| 24402 |
amit.gupta |
413 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
|
| 22859 |
ashik.ali |
414 |
return createTimestamp.format(formatter);
|
| 25503 |
amit.gupta |
415 |
}
|
|
|
416 |
|
|
|
417 |
public String getFormattedActiveTimestamp() {
|
|
|
418 |
if (activeTimestamp == null) {
|
| 22859 |
ashik.ali |
419 |
return null;
|
|
|
420 |
}
|
| 24402 |
amit.gupta |
421 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
|
| 22859 |
ashik.ali |
422 |
return activeTimestamp.format(formatter);
|
| 25503 |
amit.gupta |
423 |
}
|
|
|
424 |
|
|
|
425 |
public String getFormattedExpireTimestamp() {
|
|
|
426 |
if (expireTimestamp == null) {
|
| 22859 |
ashik.ali |
427 |
return null;
|
|
|
428 |
}
|
| 24402 |
amit.gupta |
429 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
|
| 22859 |
ashik.ali |
430 |
return expireTimestamp.format(formatter);
|
| 25503 |
amit.gupta |
431 |
}
|
|
|
432 |
|
| 22859 |
ashik.ali |
433 |
public Set<Integer> getRetailerIds() {
|
|
|
434 |
return retailerIds;
|
|
|
435 |
}
|
| 25503 |
amit.gupta |
436 |
|
| 22859 |
ashik.ali |
437 |
public void setRetailerIds(Set<Integer> retailerIds) {
|
|
|
438 |
this.retailerIds = retailerIds;
|
|
|
439 |
}
|
| 25503 |
amit.gupta |
440 |
|
|
|
441 |
public String getRetailerIdsString() {
|
| 36374 |
ranu |
442 |
if (retailerIds == null || retailerIds.isEmpty()) {
|
|
|
443 |
return "";
|
|
|
444 |
}
|
| 22859 |
ashik.ali |
445 |
Set<String> stringRetailerIds = new HashSet<>();
|
| 36374 |
ranu |
446 |
for (int retailerId : retailerIds) {
|
|
|
447 |
stringRetailerIds.add(String.valueOf(retailerId));
|
| 22859 |
ashik.ali |
448 |
}
|
|
|
449 |
return String.join(", ", stringRetailerIds);
|
|
|
450 |
}
|
| 25503 |
amit.gupta |
451 |
|
| 30454 |
amit.gupta |
452 |
public boolean isBasePlusGstCalc() {
|
|
|
453 |
return basePlusGstCalc;
|
|
|
454 |
}
|
|
|
455 |
|
|
|
456 |
public void setBasePlusGstCalc(boolean gstReversal) {
|
|
|
457 |
this.basePlusGstCalc = gstReversal;
|
|
|
458 |
}
|
|
|
459 |
|
| 30121 |
amit.gupta |
460 |
public Map<Integer, String> getCatalogStringMap() {
|
|
|
461 |
return catalogStringMap;
|
| 22859 |
ashik.ali |
462 |
}
|
| 25503 |
amit.gupta |
463 |
|
| 30121 |
amit.gupta |
464 |
public void setCatalogStringMap(Map<Integer, String> catalogStringMap) {
|
|
|
465 |
this.catalogStringMap = catalogStringMap;
|
| 22859 |
ashik.ali |
466 |
}
|
| 25503 |
amit.gupta |
467 |
|
| 36451 |
amit |
468 |
public String getReference() {
|
|
|
469 |
return reference;
|
|
|
470 |
}
|
|
|
471 |
|
|
|
472 |
public void setReference(String reference) {
|
|
|
473 |
this.reference = reference;
|
|
|
474 |
}
|
|
|
475 |
|
| 30640 |
amit.gupta |
476 |
public boolean isWithinRange(LocalDateTime testDate) {
|
|
|
477 |
return !(testDate.isBefore(this.startDateTime) || testDate.isAfter(endDateTime));
|
|
|
478 |
}
|
| 22600 |
ashik.ali |
479 |
}
|