Rev 28854 | Rev 28977 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.model;import java.time.LocalDate;import java.time.LocalDateTime;import java.util.Arrays;import java.util.List;import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;import com.spice.profitmandi.dao.enumuration.fofo.ApplicableServiceType;import com.spice.profitmandi.dao.enumuration.fofo.PartnerStatusType;public class FinanceServicesModel {private int fofoId;private PartnerStatusType partnerStatusType;private ApplicableServiceType applicableType;private boolean active;private int brandServiceId;private int serviceId;private String brand;private String name;private String code;private ApplicableServiceType serviceApplicableType;private String fofoCode;private LocalDateTime createTimestamp;private LocalDateTime deploymentDate;private LocalDateTime payDate;private static final Logger LOGGER = LogManager.getLogger(FinanceServicesModel.class);static final List<String> paperFinanceServices = Arrays.asList("SAMSUNG SURE", "BAJAJ FINSERV", "HOME CREDIT","HDB", "CAPITAL FIRST");public boolean getServiceStatusByCodeTimeStamp() throws NullPointerException {LOGGER.info("thisName" + this.getName());LOGGER.info("fofoThis" + this.getFofoId());if (this.getName().equals("PAYTM") && this.getCreateTimestamp() != null) {LocalDateTime paytmTime = this.getCreateTimestamp().plusDays(5);LocalDateTime currDate = LocalDate.now().atStartOfDay();if (currDate.isBefore(paytmTime)) {LOGGER.info("PAYTMTrue");return true;}return false;}else if (this.getName().equals("PINELABS") && this.getCreateTimestamp() != null){LOGGER.info("PINELABS");LocalDateTime pinlabsTime = this.getCreateTimestamp().plusDays(10);LocalDateTime currDate = LocalDate.now().atStartOfDay();if (currDate.isBefore(pinlabsTime)) {LOGGER.info("PINELABTrue");return true;}return false;}else if (this.getName().equals("ZEST MONEY") && this.getCreateTimestamp() != null){LocalDateTime zestMoneyTime = this.getCreateTimestamp().plusDays(10);LocalDateTime currDate = LocalDate.now().atStartOfDay();if (currDate.isBefore(zestMoneyTime)) {LOGGER.info("MONEYTrue");return true;}else {return false;}}for (String paperFinanceServices : paperFinanceServices) {if (this.getName().equals(paperFinanceServices)) {LocalDateTime minDate = null;LocalDateTime currDate = LocalDate.now().atStartOfDay();if (this.getDeploymentDate() != null && this.getPayDate() != null) {minDate = this.getDeploymentDate().isBefore(this.getPayDate()) ? this.getDeploymentDate(): this.getPayDate();if (currDate.isBefore(minDate)) {LOGGER.info("MONEYTrue");return true;}else {return false;}}else if (this.getPayDate() == null && this.getPayDate() == null) {return false;}else if (this.getPayDate() == null) {minDate = this.getDeploymentDate();if (currDate.isBefore(minDate)) {LOGGER.info("MONEYTrue");return true;}else {return false;}} else {minDate = this.getPayDate();if (currDate.isBefore(minDate)) {LOGGER.info("MONEYTrue");return true;}else {return false;}}}}return true;}public int getFofoId() {return fofoId;}public void setFofoId(int fofoId) {this.fofoId = fofoId;}public PartnerStatusType getPartnerStatusType() {return partnerStatusType;}public void setPartnerStatusType(PartnerStatusType partnerStatusType) {this.partnerStatusType = partnerStatusType;}public ApplicableServiceType getApplicableType() {return applicableType;}public void setApplicableType(ApplicableServiceType applicableType) {this.applicableType = applicableType;}public boolean isActive() {return active;}public void setActive(boolean active) {this.active = active;}public int getBrandServiceId() {return brandServiceId;}public void setBrandServiceId(int brandServiceId) {this.brandServiceId = brandServiceId;}public int getServiceId() {return serviceId;}public void setServiceId(int serviceId) {this.serviceId = serviceId;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand = brand;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getCode() {return code;}public void setCode(String code) {this.code = code;}public ApplicableServiceType getServiceApplicableType() {return serviceApplicableType;}public void setServiceApplicableType(ApplicableServiceType serviceApplicableType) {this.serviceApplicableType = serviceApplicableType;}public String getFofoCode() {return fofoCode;}public void setFofoCode(String fofoCode) {this.fofoCode = fofoCode;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}public LocalDateTime getDeploymentDate() {return deploymentDate;}public void setDeploymentDate(LocalDateTime deploymentDate) {this.deploymentDate = deploymentDate;}public LocalDateTime getPayDate() {return payDate;}public void setPayDate(LocalDateTime payDate) {this.payDate = payDate;}public static Logger getLogger() {return LOGGER;}@Overridepublic String toString() {return "FinanceServicesModel [fofoId=" + fofoId + ", partnerStatusType=" + partnerStatusType+ ", applicableType=" + applicableType + ", active=" + active + ", brandServiceId=" + brandServiceId+ ", serviceId=" + serviceId + ", brand=" + brand + ", name=" + name + ", code=" + code+ ", serviceApplicableType=" + serviceApplicableType + ", fofoCode=" + fofoCode + ", createTimestamp="+ createTimestamp + ", deploymentDate=" + deploymentDate + ", payDate=" + payDate + "]";}public FinanceServicesModel(int fofoId, PartnerStatusType partnerStatusType, ApplicableServiceType applicableType,boolean active, int brandServiceId, int serviceId, String brand, String name, String code,ApplicableServiceType serviceApplicableType, String fofoCode, LocalDateTime createTimestamp) {super();this.fofoId = fofoId;this.partnerStatusType = partnerStatusType;this.applicableType = applicableType;this.active = active;this.brandServiceId = brandServiceId;this.serviceId = serviceId;this.brand = brand;this.name = name;this.code = code;this.serviceApplicableType = serviceApplicableType;this.fofoCode = fofoCode;this.createTimestamp = createTimestamp;}}