Subversion Repositories SmartDukaan

Rev

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