use of com.stardata.starshop2.productcontext.command.domain.product.Product in project starshop by beautautumn.
the class ProductAppService method getDetail.
public ProductResponse getDetail(Long productIdLong) {
LongIdentity productId = LongIdentity.from(productIdLong);
Product product = managingService.detail(productId);
return ProductResponse.from(product);
}
use of com.stardata.starshop2.productcontext.command.domain.product.Product in project starshop by beautautumn.
the class ProductSettlementService method increaseCurMonthSale.
public void increaseCurMonthSale(@NotNull Map<LongIdentity, Integer> productCountsMap) {
List<Product> products = repository.instancesOf(productCountsMap.keySet());
for (Product product : products) {
int count = productCountsMap.get(product.getId());
product.increaseCurMonthSale(count);
repository.update(product);
}
}
use of com.stardata.starshop2.productcontext.command.domain.product.Product 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