Subversion Repositories SmartDukaan

Rev

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