Subversion Repositories SmartDukaan

Rev

Rev 28977 | Rev 29055 | 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;
23
 
28755 amit.gupta 24
	private int serviceId;
28977 manish 25
 
26
 
28755 amit.gupta 27
	private String brand;
28
	private String name;
28797 amit.gupta 29
	private String code;
28854 manish 30
	private ApplicableServiceType serviceApplicableType;
28977 manish 31
 
32
	private LocalDateTime  serviceCodeCreateTimestamp;
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");
28977 manish 44
 
45
 
46
 
47
	public boolean getServiceStatusByCodeCreatedTimilines()   throws NullPointerException {
48
 
49
		LocalDateTime timelineDate = 	this.getServiceCodeCreateTimestamp().plusDays(7);
50
		LocalDateTime currDate = LocalDate.now().atStartOfDay();
51
 
52
		if (currDate.isBefore(timelineDate)) {
53
			LOGGER.info("timeLinesDate");
54
			return true;
55
		}
56
 
57
		return false;
58
	}
59
 
28900 manish 60
 
28797 amit.gupta 61
	public boolean getServiceStatusByCodeTimeStamp() throws NullPointerException {
28755 amit.gupta 62
 
28797 amit.gupta 63
		LOGGER.info("thisName" + this.getName());
64
		LOGGER.info("fofoThis" + this.getFofoId());
65
 
66
		if (this.getName().equals("PAYTM") && this.getCreateTimestamp() != null) {
67
 
68
			LocalDateTime paytmTime = this.getCreateTimestamp().plusDays(5);
69
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
70
 
71
			if (currDate.isBefore(paytmTime)) {
72
				LOGGER.info("PAYTMTrue");
73
				return true;
74
			}
75
			return false;
76
		}
77
 
78
		else if (this.getName().equals("PINELABS") && this.getCreateTimestamp() != null)
79
 
80
		{
81
 
82
			LOGGER.info("PINELABS");
83
			LocalDateTime pinlabsTime = this.getCreateTimestamp().plusDays(10);
84
 
85
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
86
 
87
			if (currDate.isBefore(pinlabsTime)) {
88
				LOGGER.info("PINELABTrue");
89
				return true;
90
			}
91
 
92
			return false;
93
 
94
		}
95
 
96
		else if (this.getName().equals("ZEST MONEY") && this.getCreateTimestamp() != null)
97
 
98
		{
99
			LocalDateTime zestMoneyTime = this.getCreateTimestamp().plusDays(10);
100
 
101
			LocalDateTime currDate = LocalDate.now().atStartOfDay();
102
 
103
			if (currDate.isBefore(zestMoneyTime)) {
104
				LOGGER.info("MONEYTrue");
105
				return true;
106
			}
107
 
108
			else {
28900 manish 109
 
28797 amit.gupta 110
				return false;
111
			}
112
 
113
		}
114
 
28900 manish 115
		for (String paperFinanceServices : paperFinanceServices) {
116
			if (this.getName().equals(paperFinanceServices)) {
117
				LocalDateTime minDate = null;
118
				LocalDateTime currDate = LocalDate.now().atStartOfDay();
119
				if (this.getDeploymentDate() != null && this.getPayDate() != null) {
120
					minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate()
121
							: this.getPayDate();
28797 amit.gupta 122
 
28900 manish 123
					if (currDate.isBefore(minDate)) {
124
						LOGGER.info("MONEYTrue");
125
						return true;
126
					}
28797 amit.gupta 127
 
28900 manish 128
					else {
28797 amit.gupta 129
 
28900 manish 130
						return false;
131
					}
28797 amit.gupta 132
 
133
				}
134
 
28900 manish 135
				else if (this.getPayDate() == null && this.getPayDate() == null) {
28797 amit.gupta 136
 
137
					return false;
138
				}
139
 
28900 manish 140
				else if (this.getPayDate() == null) {
141
					minDate = this.getDeploymentDate();
142
					if (currDate.isBefore(minDate)) {
143
						LOGGER.info("MONEYTrue");
144
						return true;
145
					}
28797 amit.gupta 146
 
28900 manish 147
					else {
28797 amit.gupta 148
 
28900 manish 149
						return false;
150
					}
151
				} else {
152
					minDate = this.getPayDate();
153
					if (currDate.isBefore(minDate)) {
154
						LOGGER.info("MONEYTrue");
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
	}
28977 manish 285
 
286
 
287
 
28755 amit.gupta 288
 
28977 manish 289
	public String getPbsNaComment() {
290
		return pbsNaComment;
291
	}
292
 
293
 
294
	public void setPbsNaComment(String pbsNaComment) {
295
		this.pbsNaComment = pbsNaComment;
296
	}
297
 
298
 
299
	public String getPbsPartnerStatusComment() {
300
		return pbsPartnerStatusComment;
301
	}
302
 
303
 
304
	public void setPbsPartnerStatusComment(String pbsPartnerStatusComment) {
305
		this.pbsPartnerStatusComment = pbsPartnerStatusComment;
306
	}
307
 
308
 
309
 
310
	public String getPsNaComment() {
311
		return psNaComment;
312
	}
313
 
314
 
315
	public void setPsNaComment(String psNaComment) {
316
		this.psNaComment = psNaComment;
317
	}
318
 
319
 
320
	public LocalDateTime getServiceCodeCreateTimestamp() {
321
		return serviceCodeCreateTimestamp;
322
	}
323
 
324
	public void setServiceCodeCreateTimestamp(LocalDateTime serviceCodeCreateTimestamp) {
325
		this.serviceCodeCreateTimestamp = serviceCodeCreateTimestamp;
326
	}
327
 
328
 
329
 
29052 manish 330
	public LocalDateTime getFofoactiveTimeStamp() {
331
		return fofoactiveTimeStamp;
332
	}
333
 
334
 
335
	public void setFofoactiveTimeStamp(LocalDateTime fofoactiveTimeStamp) {
336
		this.fofoactiveTimeStamp = fofoactiveTimeStamp;
337
	}
338
 
339
 
28755 amit.gupta 340
	@Override
28854 manish 341
	public String toString() {
342
		return "FinanceServicesModel [fofoId=" + fofoId + ", partnerStatusType=" + partnerStatusType
343
				+ ", applicableType=" + applicableType + ", active=" + active + ", brandServiceId=" + brandServiceId
28977 manish 344
				+ ", pbsNaComment=" + pbsNaComment + ", pbsPartnerStatusComment=" + pbsPartnerStatusComment
28854 manish 345
				+ ", serviceId=" + serviceId + ", brand=" + brand + ", name=" + name + ", code=" + code
28977 manish 346
				+ ", serviceApplicableType=" + serviceApplicableType + ", serviceCodeCreateTimestamp="
29052 manish 347
				+ serviceCodeCreateTimestamp + ", psNaComment=" + psNaComment + ", fofoCode=" + fofoCode
348
				+ ", fofoactiveTimeStamp=" + fofoactiveTimeStamp + ", createTimestamp=" + createTimestamp
349
				+ ", deploymentDate=" + deploymentDate + ", payDate=" + payDate + "]";
28755 amit.gupta 350
	}
351
 
28977 manish 352
 
28755 amit.gupta 353
	public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,
28977 manish 354
			boolean active, int brandServiceId, String pbsNaComment, String pbsPartnerStatusComment, int serviceId,
355
			String brand, String name, String code, ApplicableServiceType serviceApplicableType,
29052 manish 356
			LocalDateTime serviceCodeCreateTimestamp, String psNaComment, String fofoCode,
357
			LocalDateTime fofoactiveTimeStamp, LocalDateTime createTimestamp) {
28755 amit.gupta 358
		super();
359
		this.fofoId = fofoId;
360
		this.partnerStatusType = partnerStatusType;
361
		this.applicableType = applicableType;
362
		this.active = active;
363
		this.brandServiceId = brandServiceId;
28977 manish 364
		this.pbsNaComment = pbsNaComment;
365
		this.pbsPartnerStatusComment = pbsPartnerStatusComment;
28755 amit.gupta 366
		this.serviceId = serviceId;
367
		this.brand = brand;
368
		this.name = name;
28797 amit.gupta 369
		this.code = code;
28854 manish 370
		this.serviceApplicableType = serviceApplicableType;
28977 manish 371
		this.serviceCodeCreateTimestamp = serviceCodeCreateTimestamp;
29052 manish 372
		this.psNaComment = psNaComment;
28797 amit.gupta 373
		this.fofoCode = fofoCode;
29052 manish 374
		this.fofoactiveTimeStamp = fofoactiveTimeStamp;
28797 amit.gupta 375
		this.createTimestamp = createTimestamp;
28755 amit.gupta 376
	}
377
 
28977 manish 378
 
379
 
29052 manish 380
 
28977 manish 381
 
29052 manish 382
 
28977 manish 383
 
28900 manish 384
}