Subversion Repositories SmartDukaan

Rev

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