Subversion Repositories SmartDukaan

Rev

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