Rev 35631 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.model;import com.fasterxml.jackson.annotation.JsonIgnore;import com.fasterxml.jackson.annotation.JsonIgnoreProperties;import com.spice.profitmandi.dao.enumuration.catalog.AmountType;import com.spice.profitmandi.service.offers.ItemCriteria;import com.spice.profitmandi.service.offers.PayoutSlab;import java.time.LocalDateTime;import java.util.List;@JsonIgnoreProperties(ignoreUnknown = true)public class ItemCriteriaPayout implements java.io.Serializable {private static final long serialVersionUID = 1L;private AmountType amountType;private ItemCriteria itemCriteria;private LocalDateTime startDate;private LocalDateTime endDate;private List<PayoutSlab> payoutSlabs;private String itemCriteriaString;private long achievedValue;private long shortValue;private PayoutSlab currentSlab;private PayoutSlab nextSlab;@JsonIgnorepublic String getCurretPayoutString() {String templateString = null;if (this.getAmountType().equals(AmountType.FIXED)) {templateString = "Rs. %f per pc";} else if (this.getAmountType().equals(AmountType.PERCENTAGE)) {templateString = "%f %%";} else {templateString = "%f %%";}return String.format(templateString, this.getCurrentSlab().getPayoutAmount());}public LocalDateTime getStartDate() {return startDate;}public void setStartDate(LocalDateTime startDate) {this.startDate = startDate;}public LocalDateTime getEndDate() {return endDate;}public void setEndDate(LocalDateTime endDate) {this.endDate = endDate;}public long getShortValue() {return shortValue;}public void setShortValue(long shortValue) {this.shortValue = shortValue;}public PayoutSlab getCurrentSlab() {return currentSlab;}public void setCurrentSlab(PayoutSlab currentSlab) {this.currentSlab = currentSlab;}public PayoutSlab getNextSlab() {return nextSlab;}public void setNextSlab(PayoutSlab nextSlab) {this.nextSlab = nextSlab;}public ItemCriteria getItemCriteria() {return itemCriteria;}public AmountType getAmountType() {return amountType;}public void setAmountType(AmountType amountType) {this.amountType = amountType;}public long getAchievedValue() {return achievedValue;}public void setAchievedValue(long achievedValue) {this.achievedValue = achievedValue;}public String getItemCriteriaString() {return itemCriteriaString;}public void setItemCriteriaString(String itemCriteriaString) {this.itemCriteriaString = itemCriteriaString;}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + ((amountType == null) ? 0 : amountType.hashCode());result = prime * result + ((currentSlab == null) ? 0 : currentSlab.hashCode());result = prime * result + ((itemCriteria == null) ? 0 : itemCriteria.hashCode());result = prime * result + ((itemCriteriaString == null) ? 0 : itemCriteriaString.hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;ItemCriteriaPayout other = (ItemCriteriaPayout) obj;if (amountType != other.amountType)return false;if (currentSlab == null) {if (other.currentSlab != null)return false;} else if (!currentSlab.equals(other.currentSlab))return false;if (itemCriteria == null) {if (other.itemCriteria != null)return false;} else if (!itemCriteria.equals(other.itemCriteria))return false;if (itemCriteriaString == null) {if (other.itemCriteriaString != null)return false;} else if (!itemCriteriaString.equals(other.itemCriteriaString))return false;return true;}public void setItemCriteria(ItemCriteria itemCriteria) {this.itemCriteria = itemCriteria;}public List<PayoutSlab> getPayoutSlabs() {return payoutSlabs;}public void setPayoutSlabs(List<PayoutSlab> payoutSlabs) {this.payoutSlabs = payoutSlabs;}@Overridepublic String toString() {return "ItemCriteriaPayout [amountType=" + amountType + ", itemCriteria=" + itemCriteria + ", payoutSlabs="+ payoutSlabs + ", itemCriteriaString=" + itemCriteriaString + ", achievedValue=" + achievedValue+ ", shortValue=" + shortValue + ", currentSlab=" + currentSlab + ", nextSlab=" + nextSlab + "]";}public boolean isWithinRange(LocalDateTime testDate) {if (startDate == null) return true;return !(testDate.isBefore(startDate) || testDate.isAfter(endDate));}@JsonIgnorepublic LocalDateTime getBillingEndDate() {return this.endDate == null ? null : this.endDate.plusDays(90);}@JsonIgnorepublic LocalDateTime getBillingStartDate() {return this.startDate == null ? null : this.startDate.minusDays(30);}}