Subversion Repositories SmartDukaan

Rev

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