|
@@ -5,14 +5,16 @@ import com.caimei.mapper.ProductMapper;
|
|
|
import com.caimei.mapper.ShoppingCartMapper;
|
|
|
import com.caimei.model.ResponseJson;
|
|
|
import com.caimei.model.po.*;
|
|
|
-import com.caimei.model.vo.*;
|
|
|
+import com.caimei.model.vo.AddressVo;
|
|
|
+import com.caimei.model.vo.CartProductVo;
|
|
|
+import com.caimei.model.vo.LadderPriceVo;
|
|
|
+import com.caimei.model.vo.ShopVo;
|
|
|
import com.caimei.service.OrderSubmitService;
|
|
|
import com.caimei.service.ShoppingCartService;
|
|
|
import com.caimei.util.MathUtil;
|
|
|
import com.caimei.util.OrderNoUtils;
|
|
|
import com.caimei.util.ProductUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -69,11 +71,13 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
shopTotalPrice = MathUtil.add(shopTotalPrice, MathUtil.mul(product.getProductCount(), product.getRetailPrice()));
|
|
|
fullReduction = MathUtil.add(fullReduction, product.getFullReduction());
|
|
|
}
|
|
|
- shop.setShopTotalPrice(shopTotalPrice);
|
|
|
+ shop.setFullReduction(fullReduction);
|
|
|
+ shop.setShopTotalPrice(MathUtil.sub(shopTotalPrice, fullReduction));
|
|
|
shop.setProductList(products);
|
|
|
totalPrice.set(MathUtil.add(totalPrice.get(), shopTotalPrice));
|
|
|
totalFullReduction.set(MathUtil.add(totalFullReduction.get(), shop.getFullReduction()));
|
|
|
});
|
|
|
+ totalPrice.set(MathUtil.sub(totalPrice.get(), totalFullReduction.get()));
|
|
|
//单品满赠
|
|
|
if (productGifts.size() > 0) {
|
|
|
for (CartProductVo productGift : productGifts) {
|
|
@@ -853,7 +857,22 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- shopOrder.setPromotionFullReduction(BigDecimal.ZERO);
|
|
|
+ AtomicReference<BigDecimal> promotionFullReduction = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
+ orderProductList.forEach(orderProduct -> {
|
|
|
+ if (shopId.intValue() == orderProduct.getShopID()) {
|
|
|
+ PromotionsPo promotionsVo = productMapper.findPromotionByProductId(orderProduct.getOrganizeProductID());
|
|
|
+ //单品满减
|
|
|
+ if (promotionsVo != null && promotionsVo.getType() == 1) {
|
|
|
+ if (promotionsVo.getMode() == 2) {
|
|
|
+ PromotionsPo orderPromotions = orderSubmitMapper.findOrderPromotions(shopOrder.getOrderID(), promotionsVo.getId());
|
|
|
+ if (orderPromotions != null) {
|
|
|
+ promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), orderPromotions.getReducedPrice()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ shopOrder.setPromotionFullReduction(promotionFullReduction.get());
|
|
|
if (MathUtil.compare(shopOrder.getPromotionFullReduction(), 0) > 0) {
|
|
|
totalAmount = MathUtil.sub(totalAmount, shopOrder.getPromotionFullReduction());
|
|
|
productAmount = MathUtil.sub(productAmount, shopOrder.getPromotionFullReduction());
|