Subversion Repositories SmartDukaan

Rev

Rev 29064 | Rev 29100 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
28755 amit.gupta 1
package com.spice.profitmandi.dao.model;
2
 
28797 amit.gupta 3
import java.time.LocalDate;
4
import java.time.LocalDateTime;
28900 manish 5
import java.util.Arrays;
6
import java.util.List;
28797 amit.gupta 7
 
8
import org.apache.logging.log4j.LogManager;
9
import org.apache.logging.log4j.Logger;
10
 
28755 amit.gupta 11
import com.spice.profitmandi.dao.enumuration.fofo.ApplicableServiceType;
12
import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;
13
 
14
public class FinanceServicesModel {
15
 
16
	private int fofoId;
17
	private PartnerStatusType partnerStatusType;
18
	private ApplicableServiceType applicableType;
28797 amit.gupta 19
	private boolean active;
28755 amit.gupta 20
	private int brandServiceId;
28977 manish 21
	private String pbsNaComment;
22
	private String pbsPartnerStatusComment;
29055 manish 23
 
28755 amit.gupta 24
	private int serviceId;
29055 manish 25
 
28755 amit.gupta 26
	private String brand;
27
	private String name;
28797 amit.gupta 28
	private String code;
28854 manish 29
	private ApplicableServiceType serviceApplicableType;
29055 manish 30
 
31
	private LocalDateTime serviceCodeCreateTimestamp;
32
	private LocalDateTime psPendingCreateTimestamp;
28977 manish 33
	private String psNaComment;
29064 manish 34
	private String partnerNotInterestedServiceComment;
28797 amit.gupta 35
	private String fofoCode;
29052 manish 36
	private LocalDateTime fofoactiveTimeStamp;
28797 amit.gupta 37
	private LocalDateTime createTimestamp;
38
	private LocalDateTime deploymentDate;
39
	private LocalDateTime payDate;
28755 amit.gupta 40
 
28797 amit.gupta 41
	private static final Logger LOGGER = LogManager.getLogger(FinanceServicesModel.class);
28755 amit.gupta 42
 
28900 manish 43
	static final List<String> paperFinanceServices = Arrays.asList("SAMSUNG SURE", "BAJAJ FINSERV", "HOME CREDIT",
44
			"HDB", "CAPITAL FIRST");
29055 manish 45
 
46
	public boolean getServiceStatusByCodeCreatedTimilines() throws NullPointerException {
47
 
29067 manish 48
 
29055 manish 49
		LocalDateTime timelineDate = this.getServiceCodeCreateTimestamp().plusDays(7);
28977 manish 50
		LocalDateTime currDate = LocalDate.now().atStartOfDay();
29055 manish 51
 
28977 manish 52
		if (currDate.isBefore(timelineDate)) {
53
			LOGGER.info("timeLinesDate");
54
			return true;
55
		}
29055 manish 56
 
28977 manish 57
		return false;
58
	}
28900 manish 59
 
28797 amit.gupta 60
	public boolean getServiceStatusByCodeTimeStamp() throws NullPointerException {
28755 amit.gupta 61
 
28797 amit.gupta 62
		LOGGER.info("thisName" + this.getName());
63
		LOGGER.info("fofoThis" + this.getFofoId());
29067 manish 64
 
65
		if(this.getName() != null) {
66
 
67
		if (this.getName().equals("PAYTM") && this.getCreateTimestamp() != null ) {
28797 amit.gupta 68
 
29067 manish 69
 
28797 amit.gupta 70
			LocalDateTime paytmTime = this.getCreateTimestamp().plusDays(5);
71
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
72
 
73
			if (currDate.isBefore(paytmTime)) {
74
				LOGGER.info("PAYTMTrue");
75
				return true;
76
			}
77
			return false;
78
		}
79
 
80
		else if (this.getName().equals("PINELABS") && this.getCreateTimestamp() != null)
81
 
82
		{
83
 
29067 manish 84
 
28797 amit.gupta 85
			LocalDateTime pinlabsTime = this.getCreateTimestamp().plusDays(10);
86
 
87
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
88
 
89
			if (currDate.isBefore(pinlabsTime)) {
90
				LOGGER.info("PINELABTrue");
91
				return true;
92
			}
93
 
94
			return false;
95
 
96
		}
97
 
98
		else if (this.getName().equals("ZEST MONEY") && this.getCreateTimestamp() != null)
99
 
100
		{
101
			LocalDateTime zestMoneyTime = this.getCreateTimestamp().plusDays(10);
102
 
103
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
104
 
105
			if (currDate.isBefore(zestMoneyTime)) {
106
				LOGGER.info("MONEYTrue");
107
				return true;
108
			}
109
 
110
			else {
28900 manish 111
 
28797 amit.gupta 112
				return false;
113
			}
114
 
115
		}
116
 
28900 manish 117
		for (String paperFinanceServices : paperFinanceServices) {
118
			if (this.getName().equals(paperFinanceServices)) {
119
				LocalDateTime minDate = null;
120
				LocalDateTime currDate = LocalDate.now().atStartOfDay();
121
				if (this.getDeploymentDate() != null && this.getPayDate() != null) {
122
					minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate()
123
							: this.getPayDate();
29055 manish 124
					LocalDateTime endDate = minDate.plusDays(15);
125
					LOGGER.info("endDate" + endDate);
126
					if (currDate.isBefore(endDate)) {
28797 amit.gupta 127
 
28900 manish 128
						return true;
129
					}
28797 amit.gupta 130
 
28900 manish 131
					else {
28797 amit.gupta 132
 
28900 manish 133
						return false;
134
					}
28797 amit.gupta 135
 
136
				}
137
 
29055 manish 138
				else if (this.getPayDate() == null && this.getDeploymentDate() == null) {
28797 amit.gupta 139
 
29055 manish 140
					return true;
28797 amit.gupta 141
				}
142
 
28900 manish 143
				else if (this.getPayDate() == null) {
144
					minDate = this.getDeploymentDate();
29055 manish 145
					LocalDateTime endDate = minDate.plusDays(15);
146
					if (currDate.isBefore(endDate)) {
147
 
28900 manish 148
						return true;
149
					}
28797 amit.gupta 150
 
28900 manish 151
					else {
28797 amit.gupta 152
 
28900 manish 153
						return false;
154
					}
155
				} else {
156
					minDate = this.getPayDate();
29055 manish 157
					LocalDateTime endDate = minDate.plusDays(15);
158
					if (currDate.isBefore(endDate)) {
159
 
28900 manish 160
						return true;
161
					}
28797 amit.gupta 162
 
28900 manish 163
					else {
28797 amit.gupta 164
 
28900 manish 165
						return false;
166
					}
28797 amit.gupta 167
				}
168
			}
169
 
170
		}
29067 manish 171
	}
28797 amit.gupta 172
 
173
		return true;
28755 amit.gupta 174
	}
175
 
176
	public int getFofoId() {
177
		return fofoId;
178
	}
179
 
180
	public void setFofoId(int fofoId) {
181
		this.fofoId = fofoId;
182
	}
183
 
184
	public PartnerStatusType getPartnerStatusType() {
185
		return partnerStatusType;
186
	}
187
 
188
	public void setPartnerStatusType(PartnerStatusType partnerStatusType) {
189
		this.partnerStatusType = partnerStatusType;
190
	}
191
 
28797 amit.gupta 192
	public ApplicableServiceType getApplicableType() {
193
		return applicableType;
194
	}
195
 
196
	public void setApplicableType(ApplicableServiceType applicableType) {
197
		this.applicableType = applicableType;
198
	}
199
 
200
	public boolean isActive() {
201
		return active;
202
	}
203
 
204
	public void setActive(boolean active) {
205
		this.active = active;
206
	}
207
 
28755 amit.gupta 208
	public int getBrandServiceId() {
209
		return brandServiceId;
210
	}
211
 
212
	public void setBrandServiceId(int brandServiceId) {
213
		this.brandServiceId = brandServiceId;
214
	}
215
 
216
	public int getServiceId() {
217
		return serviceId;
218
	}
219
 
220
	public void setServiceId(int serviceId) {
221
		this.serviceId = serviceId;
222
	}
223
 
224
	public String getBrand() {
225
		return brand;
226
	}
227
 
228
	public void setBrand(String brand) {
229
		this.brand = brand;
230
	}
231
 
232
	public String getName() {
233
		return name;
234
	}
235
 
236
	public void setName(String name) {
237
		this.name = name;
238
	}
239
 
28797 amit.gupta 240
	public String getCode() {
241
		return code;
242
	}
243
 
244
	public void setCode(String code) {
245
		this.code = code;
246
	}
247
 
28854 manish 248
	public ApplicableServiceType getServiceApplicableType() {
249
		return serviceApplicableType;
250
	}
251
 
252
	public void setServiceApplicableType(ApplicableServiceType serviceApplicableType) {
253
		this.serviceApplicableType = serviceApplicableType;
254
	}
255
 
28797 amit.gupta 256
	public String getFofoCode() {
257
		return fofoCode;
258
	}
259
 
260
	public void setFofoCode(String fofoCode) {
261
		this.fofoCode = fofoCode;
262
	}
263
 
264
	public LocalDateTime getCreateTimestamp() {
265
		return createTimestamp;
266
	}
267
 
268
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
269
		this.createTimestamp = createTimestamp;
270
	}
271
 
272
	public LocalDateTime getDeploymentDate() {
273
		return deploymentDate;
274
	}
275
 
276
	public void setDeploymentDate(LocalDateTime deploymentDate) {
277
		this.deploymentDate = deploymentDate;
278
	}
279
 
280
	public LocalDateTime getPayDate() {
281
		return payDate;
282
	}
283
 
284
	public void setPayDate(LocalDateTime payDate) {
285
		this.payDate = payDate;
286
	}
287
 
28854 manish 288
	public static Logger getLogger() {
289
		return LOGGER;
28755 amit.gupta 290
	}
291
 
28977 manish 292
	public String getPbsNaComment() {
293
		return pbsNaComment;
294
	}
295
 
296
	public void setPbsNaComment(String pbsNaComment) {
297
		this.pbsNaComment = pbsNaComment;
298
	}
299
 
300
	public String getPbsPartnerStatusComment() {
301
		return pbsPartnerStatusComment;
302
	}
303
 
304
	public void setPbsPartnerStatusComment(String pbsPartnerStatusComment) {
305
		this.pbsPartnerStatusComment = pbsPartnerStatusComment;
306
	}
307
 
308
	public String getPsNaComment() {
309
		return psNaComment;
310
	}
311
 
312
	public void setPsNaComment(String psNaComment) {
313
		this.psNaComment = psNaComment;
314
	}
315
 
316
	public LocalDateTime getServiceCodeCreateTimestamp() {
317
		return serviceCodeCreateTimestamp;
318
	}
319
 
320
	public void setServiceCodeCreateTimestamp(LocalDateTime serviceCodeCreateTimestamp) {
321
		this.serviceCodeCreateTimestamp = serviceCodeCreateTimestamp;
322
	}
323
 
29052 manish 324
	public LocalDateTime getFofoactiveTimeStamp() {
325
		return fofoactiveTimeStamp;
326
	}
327
 
328
	public void setFofoactiveTimeStamp(LocalDateTime fofoactiveTimeStamp) {
329
		this.fofoactiveTimeStamp = fofoactiveTimeStamp;
330
	}
29055 manish 331
 
332
 
333
 
29052 manish 334
 
29055 manish 335
	public LocalDateTime getPsPendingCreateTimestamp() {
336
		return psPendingCreateTimestamp;
337
	}
29052 manish 338
 
29055 manish 339
	public void setPsPendingCreateTimestamp(LocalDateTime psPendingCreateTimestamp) {
340
		this.psPendingCreateTimestamp = psPendingCreateTimestamp;
341
	}
29064 manish 342
 
343
 
29055 manish 344
 
29064 manish 345
	public String getPartnerNotInterestedServiceComment() {
346
		return partnerNotInterestedServiceComment;
347
	}
348
 
349
	public void setPartnerNotInterestedServiceComment(String partnerNotInterestedServiceComment) {
350
		this.partnerNotInterestedServiceComment = partnerNotInterestedServiceComment;
351
	}
352
 
28755 amit.gupta 353
	@Override
28854 manish 354
	public String toString() {
355
		return "FinanceServicesModel [fofoId=" + fofoId + ", partnerStatusType=" + partnerStatusType
356
				+ ", applicableType=" + applicableType + ", active=" + active + ", brandServiceId=" + brandServiceId
28977 manish 357
				+ ", pbsNaComment=" + pbsNaComment + ", pbsPartnerStatusComment=" + pbsPartnerStatusComment
28854 manish 358
				+ ", serviceId=" + serviceId + ", brand=" + brand + ", name=" + name + ", code=" + code
28977 manish 359
				+ ", serviceApplicableType=" + serviceApplicableType + ", serviceCodeCreateTimestamp="
29055 manish 360
				+ serviceCodeCreateTimestamp + ", psPendingCreateTimestamp=" + psPendingCreateTimestamp
361
				+ ", psNaComment=" + psNaComment + ", fofoCode=" + fofoCode + ", fofoactiveTimeStamp="
362
				+ fofoactiveTimeStamp + ", createTimestamp=" + createTimestamp + ", deploymentDate=" + deploymentDate
363
				+ ", payDate=" + payDate + "]";
28755 amit.gupta 364
	}
365
 
29055 manish 366
	public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,
367
			boolean active, int brandServiceId, String pbsNaComment, String pbsPartnerStatusComment, int serviceId,
368
			String brand, String name, String code, ApplicableServiceType serviceApplicableType,
369
			LocalDateTime serviceCodeCreateTimestamp, LocalDateTime psPendingCreateTimestamp, String psNaComment,
29064 manish 370
			String partnerNotInterestedServiceComment, String fofoCode, LocalDateTime fofoactiveTimeStamp,
371
			LocalDateTime createTimestamp) {
29055 manish 372
		super();
373
		this.fofoId = fofoId;
374
		this.partnerStatusType = partnerStatusType;
375
		this.applicableType = applicableType;
376
		this.active = active;
377
		this.brandServiceId = brandServiceId;
378
		this.pbsNaComment = pbsNaComment;
379
		this.pbsPartnerStatusComment = pbsPartnerStatusComment;
380
		this.serviceId = serviceId;
381
		this.brand = brand;
382
		this.name = name;
383
		this.code = code;
384
		this.serviceApplicableType = serviceApplicableType;
385
		this.serviceCodeCreateTimestamp = serviceCodeCreateTimestamp;
386
		this.psPendingCreateTimestamp = psPendingCreateTimestamp;
387
		this.psNaComment = psNaComment;
29064 manish 388
		this.partnerNotInterestedServiceComment = partnerNotInterestedServiceComment;
29055 manish 389
		this.fofoCode = fofoCode;
390
		this.fofoactiveTimeStamp = fofoactiveTimeStamp;
391
		this.createTimestamp = createTimestamp;
392
	}
28977 manish 393
 
29064 manish 394
 
28900 manish 395
}