|
@@ -62,12 +62,15 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
|
|
|
Map<String, Object> map = new HashMap<>(3);
|
|
|
List<ShopVo> shopList = shoppingCartMapper.findCartShop(userId);
|
|
|
shopList.forEach(shop -> {
|
|
|
+ BigDecimal fullReduction = BigDecimal.ZERO;
|
|
|
BigDecimal shopTotalPrice = BigDecimal.ZERO;
|
|
|
List<CartProductVo> productList = shoppingCartMapper.findByShopCartProduct(shop.getShopId(), userId);
|
|
|
for (CartProductVo product : productList) {
|
|
|
setProductPrice(product);
|
|
|
shopTotalPrice = MathUtil.add(shopTotalPrice, MathUtil.mul(product.getProductCount(), product.getRetailPrice()));
|
|
|
+ fullReduction = MathUtil.add(fullReduction, product.getFullReduction());
|
|
|
}
|
|
|
+ shop.setFullReduction(fullReduction);
|
|
|
shop.setShopTotalPrice(shopTotalPrice);
|
|
|
shop.setProductList(productList);
|
|
|
});
|
|
@@ -101,6 +104,8 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
|
|
|
// 活动价
|
|
|
if (activity.getMode() == 1) {
|
|
|
product.setRetailPrice(activity.getTouchPrice());
|
|
|
+ BigDecimal reduction = MathUtil.sub(product.getPrice(), activity.getTouchPrice());
|
|
|
+ product.setFullReduction(MathUtil.mul(reduction, product.getProductCount()));
|
|
|
} else {
|
|
|
BigDecimal totalPrice = MathUtil.mul(product.getProductCount(), product.getPrice());
|
|
|
if (addTaxFlag) {
|
|
@@ -113,8 +118,7 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
|
|
|
}
|
|
|
if (MathUtil.compare(totalPrice, activity.getTouchPrice()) > -1) {
|
|
|
if (activity.getMode() == 2) {
|
|
|
- BigDecimal retailPrice = MathUtil.sub(product.getPrice(), activity.getReducedPrice());
|
|
|
- product.setRetailPrice(retailPrice);
|
|
|
+ product.setFullReduction(activity.getReducedPrice());
|
|
|
} else {
|
|
|
productGifts = activity.getProductGifts();
|
|
|
}
|