Subversion Repositories SmartDukaan

Rev

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