Subversion Repositories SmartDukaan

Rev

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