Search in sources :

Example 1 with Product

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);
}
Also used : Product(com.stardata.starshop2.productcontext.command.domain.product.Product) LongIdentity(com.stardata.starshop2.sharedcontext.domain.LongIdentity)

Example 2 with 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);
    }
}
Also used : Product(com.stardata.starshop2.productcontext.command.domain.product.Product)

Example 3 with 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;
}
Also used : ProductSettlement(com.stardata.starshop2.productcontext.command.domain.product.ProductSettlement) Product(com.stardata.starshop2.productcontext.command.domain.product.Product)

Aggregations

Product (com.stardata.starshop2.productcontext.command.domain.product.Product)3 ProductSettlement (com.stardata.starshop2.productcontext.command.domain.product.ProductSettlement)1 LongIdentity (com.stardata.starshop2.sharedcontext.domain.LongIdentity)1