Subversion Repositories SmartDukaan

Rev

Rev 28755 | Rev 28801 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28755 Rev 28797
Line 1... Line 1...
1
package com.spice.profitmandi.dao.model;
1
package com.spice.profitmandi.dao.model;
2
 
2
 
-
 
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
 
3
import com.spice.profitmandi.dao.enumuration.fofo.ApplicableServiceType;
9
import com.spice.profitmandi.dao.enumuration.fofo.ApplicableServiceType;
4
import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;
10
import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;
5
 
11
 
6
public class FinanceServicesModel {
12
public class FinanceServicesModel {
7
 
13
 
8
	private int fofoId;
14
	private int fofoId;
9
	private PartnerStatusType partnerStatusType;
15
	private PartnerStatusType partnerStatusType;
10
	private ApplicableServiceType applicableType;
16
	private ApplicableServiceType applicableType;
11
	private boolean active; 
17
	private boolean active;
12
	private int brandServiceId;
18
	private int brandServiceId;
13
	private int serviceId;
19
	private int serviceId;
14
	private String brand;
20
	private String brand;
15
	private String name;
21
	private String name;
16
	
22
	private String code;
-
 
23
	private String fofoCode;
-
 
24
	private LocalDateTime createTimestamp;
-
 
25
	private LocalDateTime deploymentDate;
-
 
26
	private LocalDateTime payDate;
17
 
27
 
18
	
-
 
19
	
-
 
20
	public ApplicableServiceType getApplicableType() {
28
	private static final Logger LOGGER = LogManager.getLogger(FinanceServicesModel.class);
21
		return applicableType;
-
 
22
	}
-
 
23
 
29
 
24
	public void setApplicableType(ApplicableServiceType applicableType) {
30
	public boolean getServiceStatusByCodeTimeStamp() throws NullPointerException {
25
		this.applicableType = applicableType;
-
 
26
	}
-
 
27
 
31
 
-
 
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 {
28
	public boolean isActive() {
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
		
29
		return active;
333
		return true;
30
	}
334
	}
31
 
335
 
-
 
336
	@Override
32
	public void setActive(boolean active) {
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
33
		this.active = active;
342
				+ ", payDate=" + payDate + "]";
34
	}
343
	}
35
 
344
 
36
	public int getFofoId() {
345
	public int getFofoId() {
37
		return fofoId;
346
		return fofoId;
38
	}
347
	}
Line 47... Line 356...
47
 
356
 
48
	public void setPartnerStatusType(PartnerStatusType partnerStatusType) {
357
	public void setPartnerStatusType(PartnerStatusType partnerStatusType) {
49
		this.partnerStatusType = partnerStatusType;
358
		this.partnerStatusType = partnerStatusType;
50
	}
359
	}
51
 
360
 
-
 
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
 
52
	public int getBrandServiceId() {
377
	public int getBrandServiceId() {
53
		return brandServiceId;
378
		return brandServiceId;
54
	}
379
	}
55
 
380
 
56
	public void setBrandServiceId(int brandServiceId) {
381
	public void setBrandServiceId(int brandServiceId) {
Line 79... Line 404...
79
 
404
 
80
	public void setName(String name) {
405
	public void setName(String name) {
81
		this.name = name;
406
		this.name = name;
82
	}
407
	}
83
 
408
 
-
 
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
 
84
	@Override
449
	@Override
85
	public int hashCode() {
450
	public int hashCode() {
86
		final int prime = 31;
451
		final int prime = 31;
87
		int result = 1;
452
		int result = 1;
-
 
453
		result = prime * result + (active ? 1231 : 1237);
-
 
454
		result = prime * result + ((applicableType == null) ? 0 : applicableType.hashCode());
88
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
455
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
89
		result = prime * result + brandServiceId;
456
		result = prime * result + brandServiceId;
-
 
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());
90
		result = prime * result + fofoId;
460
		result = prime * result + fofoId;
91
		result = prime * result + ((name == null) ? 0 : name.hashCode());
461
		result = prime * result + ((name == null) ? 0 : name.hashCode());
92
		result = prime * result + ((partnerStatusType == null) ? 0 : partnerStatusType.hashCode());
462
		result = prime * result + ((partnerStatusType == null) ? 0 : partnerStatusType.hashCode());
93
		result = prime * result + serviceId;
463
		result = prime * result + serviceId;
94
		return result;
464
		return result;
Line 101... Line 471...
101
		if (obj == null)
471
		if (obj == null)
102
			return false;
472
			return false;
103
		if (getClass() != obj.getClass())
473
		if (getClass() != obj.getClass())
104
			return false;
474
			return false;
105
		FinanceServicesModel other = (FinanceServicesModel) obj;
475
		FinanceServicesModel other = (FinanceServicesModel) obj;
-
 
476
		if (active != other.active)
-
 
477
			return false;
-
 
478
		if (applicableType != other.applicableType)
-
 
479
			return false;
106
		if (brand == null) {
480
		if (brand == null) {
107
			if (other.brand != null)
481
			if (other.brand != null)
108
				return false;
482
				return false;
109
		} else if (!brand.equals(other.brand))
483
		} else if (!brand.equals(other.brand))
110
			return false;
484
			return false;
111
		if (brandServiceId != other.brandServiceId)
485
		if (brandServiceId != other.brandServiceId)
112
			return false;
486
			return false;
-
 
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;
113
		if (fofoId != other.fofoId)
502
		if (fofoId != other.fofoId)
114
			return false;
503
			return false;
115
		if (name == null) {
504
		if (name == null) {
116
			if (other.name != null)
505
			if (other.name != null)
117
				return false;
506
				return false;
118
		} else if (!name.equals(other.name))
507
		} else if (!name.equals(other.name))
119
			return false;
508
			return false;
120
		if (partnerStatusType == null) {
-
 
121
			if (other.partnerStatusType != null)
-
 
122
				return false;
-
 
123
		} else if (!partnerStatusType.equals(other.partnerStatusType))
509
		if (partnerStatusType != other.partnerStatusType)
124
			return false;
510
			return false;
125
		if (serviceId != other.serviceId)
511
		if (serviceId != other.serviceId)
126
			return false;
512
			return false;
127
		return true;
513
		return true;
128
	}
514
	}
129
 
515
 
130
	
-
 
131
 
-
 
132
	@Override
-
 
133
	public String toString() {
-
 
134
		return "FinanceServicesModel [fofoId=" + fofoId + ", partnerStatusType=" + partnerStatusType
-
 
135
				+ ", applicableType=" + applicableType + ", active=" + active + ", brandServiceId=" + brandServiceId
-
 
136
				+ ", serviceId=" + serviceId + ", brand=" + brand + ", name=" + name + "]";
-
 
137
	}
-
 
138
 
-
 
139
	public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,
516
	public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,
140
			boolean active, int brandServiceId, int serviceId, String brand, String name) {
517
			boolean active, int brandServiceId, int serviceId, String brand, String name, String code, String fofoCode,
-
 
518
			LocalDateTime createTimestamp) {
141
		super();
519
		super();
142
		this.fofoId = fofoId;
520
		this.fofoId = fofoId;
143
		this.partnerStatusType = partnerStatusType;
521
		this.partnerStatusType = partnerStatusType;
144
		this.applicableType = applicableType;
522
		this.applicableType = applicableType;
145
		this.active = active;
523
		this.active = active;
146
		this.brandServiceId = brandServiceId;
524
		this.brandServiceId = brandServiceId;
147
		this.serviceId = serviceId;
525
		this.serviceId = serviceId;
148
		this.brand = brand;
526
		this.brand = brand;
149
		this.name = name;
527
		this.name = name;
-
 
528
		this.code = code;
-
 
529
		this.fofoCode = fofoCode;
-
 
530
		this.createTimestamp = createTimestamp;
150
	}
531
	}
151
 
532
 
152
	
-
 
153
 
-
 
154
}
533
}
155
534