Subversion Repositories SmartDukaan

Rev

Rev 28801 | Rev 28900 | 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;
5
 
6
import org.apache.logging.log4j.LogManager;
7
import org.apache.logging.log4j.Logger;
8
 
28755 amit.gupta 9
import com.spice.profitmandi.dao.enumuration.fofo.ApplicableServiceType;
10
import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;
11
 
12
public class FinanceServicesModel {
13
 
14
	private int fofoId;
15
	private PartnerStatusType partnerStatusType;
16
	private ApplicableServiceType applicableType;
28797 amit.gupta 17
	private boolean active;
28755 amit.gupta 18
	private int brandServiceId;
19
	private int serviceId;
20
	private String brand;
21
	private String name;
28797 amit.gupta 22
	private String code;
28854 manish 23
	private ApplicableServiceType serviceApplicableType;
28797 amit.gupta 24
	private String fofoCode;
25
	private LocalDateTime createTimestamp;
26
	private LocalDateTime deploymentDate;
27
	private LocalDateTime payDate;
28755 amit.gupta 28
 
28797 amit.gupta 29
	private static final Logger LOGGER = LogManager.getLogger(FinanceServicesModel.class);
28755 amit.gupta 30
 
28797 amit.gupta 31
	public boolean getServiceStatusByCodeTimeStamp() throws NullPointerException {
28755 amit.gupta 32
 
28797 amit.gupta 33
		LOGGER.info("thisName" + this.getName());
34
		LOGGER.info("fofoThis" + this.getFofoId());
35
 
36
		if (this.getName().equals("PAYTM") && this.getCreateTimestamp() != null) {
37
 
38
			LocalDateTime paytmTime = this.getCreateTimestamp().plusDays(5);
39
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
40
 
41
			if (currDate.isBefore(paytmTime)) {
42
				LOGGER.info("PAYTMTrue");
43
				return true;
44
			}
45
			return false;
46
		}
47
 
48
		else if (this.getName().equals("PINELABS") && this.getCreateTimestamp() != null)
49
 
50
		{
51
 
52
			LOGGER.info("PINELABS");
53
			LocalDateTime pinlabsTime = this.getCreateTimestamp().plusDays(10);
54
 
55
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
56
 
57
			if (currDate.isBefore(pinlabsTime)) {
58
				LOGGER.info("PINELABTrue");
59
				return true;
60
			}
61
 
62
			return false;
63
 
64
		}
65
 
66
		else if (this.getName().equals("ZEST MONEY") && this.getCreateTimestamp() != null)
67
 
68
		{
69
			LocalDateTime zestMoneyTime = this.getCreateTimestamp().plusDays(10);
70
 
71
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
72
 
73
			if (currDate.isBefore(zestMoneyTime)) {
74
				LOGGER.info("MONEYTrue");
75
				return true;
76
			}
77
 
78
			else {
79
 
80
				return false;
81
			}
82
 
83
		}
84
 
85
		else if (this.getName().equals("SAMSUNG SURE")) {
86
			LocalDateTime minDate = null;
87
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
88
			if (this.getDeploymentDate() != null && this.getPayDate() != null) {
89
				minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate() : this.getPayDate();
90
 
91
 
92
				if (currDate.isBefore(minDate)) {
93
					LOGGER.info("MONEYTrue");
94
					return true;
95
				}
96
 
97
				else {
98
 
99
					return false;
100
				}
101
 
102
			}
103
			else if (this.getPayDate() == null  && this.getPayDate() == null) {
104
 
105
				return false;
106
			}
107
 
108
 
109
			else if (this.getPayDate() == null) {
110
				minDate = this.getDeploymentDate();
111
				if (currDate.isBefore(minDate)) {
112
					LOGGER.info("MONEYTrue");
113
					return true;
114
				}
115
 
116
				else {
117
 
118
					return false;
119
				}
120
			}
121
			else {
122
				minDate = this.getPayDate();
123
				if (currDate.isBefore(minDate)) {
124
					LOGGER.info("MONEYTrue");
125
					return true;
126
				}
127
 
128
				else {
129
 
130
					return false;
131
				}
132
			}
133
		}
134
		else if (this.getName().equals("BAJAJ FINSERV")) {
135
			LocalDateTime minDate = null;
136
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
137
			if (this.getDeploymentDate() != null && this.getPayDate() != null) {
138
				minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate() : this.getPayDate();
139
 
140
 
141
				if (currDate.isBefore(minDate)) {
142
					LOGGER.info("MONEYTrue");
143
					return true;
144
				}
145
 
146
				else {
147
 
148
					return false;
149
				}
150
 
151
			}
152
			else if (this.getPayDate() == null  && this.getPayDate() == null) {
153
 
154
				return false;
155
			}
156
 
157
 
158
			else if (this.getPayDate() == null) {
159
				minDate = this.getDeploymentDate();
160
				if (currDate.isBefore(minDate)) {
161
					LOGGER.info("MONEYTrue");
162
					return true;
163
				}
164
 
165
				else {
166
 
167
					return false;
168
				}
169
			}
170
			else {
171
				minDate = this.getPayDate();
172
				if (currDate.isBefore(minDate)) {
173
					LOGGER.info("MONEYTrue");
174
					return true;
175
				}
176
 
177
				else {
178
 
179
					return false;
180
				}
181
			}
182
		}
183
		else if (this.getName().equals("HOME CREDIT")) {
184
			LocalDateTime minDate = null;
185
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
186
			if (this.getDeploymentDate() != null && this.getPayDate() != null) {
187
				minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate() : this.getPayDate();
188
 
189
 
190
				if (currDate.isBefore(minDate)) {
191
					LOGGER.info("MONEYTrue");
192
					return true;
193
				}
194
 
195
				else {
196
 
197
					return false;
198
				}
199
 
200
			}
201
			else if (this.getPayDate() == null  && this.getPayDate() == null) {
202
 
203
				return false;
204
			}
205
 
206
 
207
			else if (this.getPayDate() == null) {
208
				minDate = this.getDeploymentDate();
209
				if (currDate.isBefore(minDate)) {
210
					LOGGER.info("MONEYTrue");
211
					return true;
212
				}
213
 
214
				else {
215
 
216
					return false;
217
				}
218
			}
219
			else {
220
				minDate = this.getPayDate();
221
				if (currDate.isBefore(minDate)) {
222
					LOGGER.info("MONEYTrue");
223
					return true;
224
				}
225
 
226
				else {
227
 
228
					return false;
229
				}
230
			}
231
		}
232
 
233
		else if (this.getName().equals("HDB")) {
234
			LocalDateTime minDate = null;
235
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
236
			if (this.getDeploymentDate() != null && this.getPayDate() != null) {
237
				minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate() : this.getPayDate();
238
 
239
 
240
				if (currDate.isBefore(minDate)) {
241
					LOGGER.info("MONEYTrue");
242
					return true;
243
				}
244
 
245
				else {
246
 
247
					return false;
248
				}
249
 
250
			}
251
			else if (this.getPayDate() == null  && this.getPayDate() == null) {
252
 
28801 amit.gupta 253
				return true;
28797 amit.gupta 254
			}
255
 
256
 
257
			else if (this.getPayDate() == null) {
258
				minDate = this.getDeploymentDate();
259
				if (currDate.isBefore(minDate)) {
260
					LOGGER.info("MONEYTrue");
261
					return true;
262
				}
263
 
264
				else {
265
 
266
					return false;
267
				}
268
			}
269
			else {
270
				minDate = this.getPayDate();
271
				if (currDate.isBefore(minDate)) {
272
					LOGGER.info("MONEYTrue");
273
					return true;
274
				}
275
 
276
				else {
277
 
278
					return false;
279
				}
280
			}
281
		}
282
 
283
		else if (this.getName().equals("CAPITAL FIRST")) {
284
			LocalDateTime minDate = null;
285
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
286
			if (this.getDeploymentDate() != null && this.getPayDate() != null) {
287
				minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate() : this.getPayDate();
288
 
289
 
290
				if (currDate.isBefore(minDate)) {
291
					LOGGER.info("MONEYTrue");
292
					return true;
293
				}
294
 
295
				else {
296
 
297
					return false;
298
				}
299
 
300
			}
301
			else if (this.getPayDate() == null  && this.getPayDate() == null) {
302
 
303
				return false;
304
			}
305
 
306
 
307
			else if (this.getPayDate() == null) {
308
				minDate = this.getDeploymentDate();
309
				if (currDate.isBefore(minDate)) {
310
					LOGGER.info("MONEYTrue");
311
					return true;
312
				}
313
 
314
				else {
315
 
316
					return false;
317
				}
318
			}
319
			else {
320
				minDate = this.getPayDate();
321
				if (currDate.isBefore(minDate)) {
322
					LOGGER.info("MONEYTrue");
323
					return true;
324
				}
325
 
326
				else {
327
 
328
					return false;
329
				}
330
			}
331
		}
332
 
333
 
334
		return true;
28755 amit.gupta 335
	}
336
 
337
	public int getFofoId() {
338
		return fofoId;
339
	}
340
 
341
	public void setFofoId(int fofoId) {
342
		this.fofoId = fofoId;
343
	}
344
 
345
	public PartnerStatusType getPartnerStatusType() {
346
		return partnerStatusType;
347
	}
348
 
349
	public void setPartnerStatusType(PartnerStatusType partnerStatusType) {
350
		this.partnerStatusType = partnerStatusType;
351
	}
352
 
28797 amit.gupta 353
	public ApplicableServiceType getApplicableType() {
354
		return applicableType;
355
	}
356
 
357
	public void setApplicableType(ApplicableServiceType applicableType) {
358
		this.applicableType = applicableType;
359
	}
360
 
361
	public boolean isActive() {
362
		return active;
363
	}
364
 
365
	public void setActive(boolean active) {
366
		this.active = active;
367
	}
368
 
28755 amit.gupta 369
	public int getBrandServiceId() {
370
		return brandServiceId;
371
	}
372
 
373
	public void setBrandServiceId(int brandServiceId) {
374
		this.brandServiceId = brandServiceId;
375
	}
376
 
377
	public int getServiceId() {
378
		return serviceId;
379
	}
380
 
381
	public void setServiceId(int serviceId) {
382
		this.serviceId = serviceId;
383
	}
384
 
385
	public String getBrand() {
386
		return brand;
387
	}
388
 
389
	public void setBrand(String brand) {
390
		this.brand = brand;
391
	}
392
 
393
	public String getName() {
394
		return name;
395
	}
396
 
397
	public void setName(String name) {
398
		this.name = name;
399
	}
400
 
28797 amit.gupta 401
	public String getCode() {
402
		return code;
403
	}
404
 
405
	public void setCode(String code) {
406
		this.code = code;
407
	}
408
 
28854 manish 409
	public ApplicableServiceType getServiceApplicableType() {
410
		return serviceApplicableType;
411
	}
412
 
413
	public void setServiceApplicableType(ApplicableServiceType serviceApplicableType) {
414
		this.serviceApplicableType = serviceApplicableType;
415
	}
416
 
28797 amit.gupta 417
	public String getFofoCode() {
418
		return fofoCode;
419
	}
420
 
421
	public void setFofoCode(String fofoCode) {
422
		this.fofoCode = fofoCode;
423
	}
424
 
425
	public LocalDateTime getCreateTimestamp() {
426
		return createTimestamp;
427
	}
428
 
429
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
430
		this.createTimestamp = createTimestamp;
431
	}
432
 
433
	public LocalDateTime getDeploymentDate() {
434
		return deploymentDate;
435
	}
436
 
437
	public void setDeploymentDate(LocalDateTime deploymentDate) {
438
		this.deploymentDate = deploymentDate;
439
	}
440
 
441
	public LocalDateTime getPayDate() {
442
		return payDate;
443
	}
444
 
445
	public void setPayDate(LocalDateTime payDate) {
446
		this.payDate = payDate;
447
	}
448
 
28854 manish 449
	public static Logger getLogger() {
450
		return LOGGER;
28755 amit.gupta 451
	}
452
 
453
	@Override
28854 manish 454
	public String toString() {
455
		return "FinanceServicesModel [fofoId=" + fofoId + ", partnerStatusType=" + partnerStatusType
456
				+ ", applicableType=" + applicableType + ", active=" + active + ", brandServiceId=" + brandServiceId
457
				+ ", serviceId=" + serviceId + ", brand=" + brand + ", name=" + name + ", code=" + code
458
				+ ", serviceApplicableType=" + serviceApplicableType + ", fofoCode=" + fofoCode + ", createTimestamp="
459
				+ createTimestamp + ", deploymentDate=" + deploymentDate + ", payDate=" + payDate + "]";
28755 amit.gupta 460
	}
461
 
462
	public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,
28854 manish 463
			boolean active, int brandServiceId, int serviceId, String brand, String name, String code,
464
			ApplicableServiceType serviceApplicableType, String fofoCode, LocalDateTime createTimestamp) {
28755 amit.gupta 465
		super();
466
		this.fofoId = fofoId;
467
		this.partnerStatusType = partnerStatusType;
468
		this.applicableType = applicableType;
469
		this.active = active;
470
		this.brandServiceId = brandServiceId;
471
		this.serviceId = serviceId;
472
		this.brand = brand;
473
		this.name = name;
28797 amit.gupta 474
		this.code = code;
28854 manish 475
		this.serviceApplicableType = serviceApplicableType;
28797 amit.gupta 476
		this.fofoCode = fofoCode;
477
		this.createTimestamp = createTimestamp;
28755 amit.gupta 478
	}
479
 
28854 manish 480
 
481
 
482
 
483
 
484
 
485
 
486
	}