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