Rev 31903 | Rev 31920 | 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 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 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() {double paidAmount = 0;return schemePayouts.stream().collect(Collectors.summingDouble(x -> x.getAmount())) + offerPayouts.stream().collect(Collectors.summingDouble(x -> x.getAmount()));}public void setPaidAmount(double paidAmount) {this.paidAmount = paidAmount;}public double getFixedAmount() {return 0;//return schemePayouts.stream().filter(x->x.get)}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;}}