use of com.stardata.starshop2.productcontext.command.domain.product.ProductSettlement in project starshop by beautautumn.
the class ProductSettlementService method calcSettlement.
public int calcSettlement(@NotNull Map<LongIdentity, Integer> productCountsMap, @NotNull List<ProductSettlement> settlements) {
List<Product> products = repository.instancesOf(productCountsMap.keySet());
int totalPriceFen = 0;
settlements.clear();
for (Product product : products) {
int count = productCountsMap.get(product.getId());
ProductSettlement settlement = product.settlePrice(count);
totalPriceFen += settlement.getSettlePriceFen();
settlements.add(settlement);
}
return totalPriceFen;
}
Aggregations