Rev 31989 | Rev 32021 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.service.scheme;import com.spice.profitmandi.dao.entity.fofo.OfferPayout;import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;import com.spice.profitmandi.dao.enumuration.catalog.AmountType;import com.spice.profitmandi.dao.model.AmountModel;import java.util.List;import java.util.Objects;import java.util.stream.Collectors;public class InventoryPayoutModel {int inventoryItemId;List<SchemeInOut> schemePayouts;List<OfferPayout> offerPayouts;private double fixedAmount;private double percentageAmount;private double paidAmount;private double dp;public double getActualRolloutAmount() {double effectiveDp = this.getDp() - this.getFixedAmount();double value = effectiveDp*percentageAmount/(100 + percentageAmount);return this.getFixedAmount() + value;}public double getRolloutAmount(AmountModel amountModel) {double rollout = 0;if (amountModel.getAmountType().equals(AmountType.PERCENTAGE)) {double effectiveDp = this.getDp() - this.getFixedAmount();double totalPercentage = this.getPercentageAmount() + amountModel.getAmount();rollout = effectiveDp * (totalPercentage / (100 + totalPercentage) - (this.getPercentageAmount() / (100 + this.getPercentageAmount())));} else {rollout = amountModel.getAmount() * (100 / (100 + this.getPercentageAmount()));}return rollout;}public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> schemePayouts, List<OfferPayout> offerPayouts) {this.inventoryItemId = inventoryItemId;this.schemePayouts = schemePayouts;this.offerPayouts = offerPayouts;}@Overridepublic String toString() {return "InventoryPayoutModel{" +"inventoryItemId=" + inventoryItemId +", schemePayouts=" + schemePayouts +", offerPayouts=" + offerPayouts +", fixedAmount=" + fixedAmount +", percentageAmount=" + percentageAmount +", paidAmount=" + paidAmount +'}';}public double getPercentageAmount() {return percentageAmount;}public void setPercentageAmount(double percentageAmount) {this.percentageAmount = percentageAmount;}public double getPaidAmount() {return this.paidAmount;}public void setPaidAmount(double paidAmount) {this.paidAmount = paidAmount;}public double getFixedAmount() {return this.fixedAmount;}public void setFixedAmount(double fixedAmount) {this.fixedAmount = fixedAmount;}public int getInventoryItemId() {return inventoryItemId;}public void setInventoryItemId(int inventoryItemId) {this.inventoryItemId = inventoryItemId;}public List<SchemeInOut> getSchemePayouts() {return schemePayouts;}public void setSchemePayouts(List<SchemeInOut> schemePayouts) {this.schemePayouts = schemePayouts;}public List<OfferPayout> getOfferPayouts() {return offerPayouts;}public double getDp() {return dp;}public void setDp(double dp) {this.dp = dp;}@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;InventoryPayoutModel that = (InventoryPayoutModel) o;return inventoryItemId == that.inventoryItemId && Double.compare(that.fixedAmount, fixedAmount) == 0 && Double.compare(that.percentageAmount, percentageAmount) == 0 && Double.compare(that.paidAmount, paidAmount) == 0 && Double.compare(that.dp, dp) == 0 && Objects.equals(schemePayouts, that.schemePayouts) && Objects.equals(offerPayouts, that.offerPayouts);}@Overridepublic int hashCode() {return Objects.hash(inventoryItemId, schemePayouts, offerPayouts, fixedAmount, percentageAmount, paidAmount, dp);}public void setOfferPayouts(List<OfferPayout> offerPayouts) {this.offerPayouts = offerPayouts;}}