Browse Source

修改订单bugfix

zhijiezhao 1 year ago
parent
commit
8a3bbf6a7c

+ 8 - 36
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -1010,7 +1010,7 @@ public class SubmitServiceImpl implements SubmitService {
             // 超级会员优惠金额
             shopOrder.setSvipShopReduction(svipShopReduction.get());
             // 总价(含税) = totalFee + 冷链费
-            shopOrder.setTotalAmount(MathUtil.add(MathUtil.add(shopProductFee.get(), postage).doubleValue(),isColdChina.get()).doubleValue());
+            shopOrder.setTotalAmount(MathUtil.add(MathUtil.add(shopProductFee.get(), postage).doubleValue(), isColdChina.get()).doubleValue());
             // 总金额 = 订单商品totalAmount
             shopOrder.setProductAmount(shopAmount.get());
             // 需要支付金额 shouldPayFee +运费
@@ -1402,7 +1402,7 @@ public class SubmitServiceImpl implements SubmitService {
          */
         AtomicReference<String> shopOrderIds = new AtomicReference<>();
         AtomicInteger shopOrderIndex = new AtomicInteger(1);
-        log.info("shopOrderList===****====="+shopOrderList);
+        log.info("shopOrderList===****=====" + shopOrderList);
         shopOrderList.forEach(shopOrder -> {
             shopOrder.setOrderId(mainOrder.getOrderId());
             shopOrder.setOrderNo(mainOrder.getOrderNo());
@@ -2012,7 +2012,7 @@ public class SubmitServiceImpl implements SubmitService {
                 // 统计 总金额 包括税费
                 shopProductFee.set(MathUtil.add(shopProductFee.get(), product.getRealProductFee()).doubleValue());
                 // 再勾选冷链费时
-                if (1 == oldShop.get(0).getIsColdChina() && product.getProductId() == 7536 ) {
+                if (1 == oldShop.get(0).getIsColdChina() && product.getProductId() == 7536) {
                     // 需要支付金额 需支付金额 + 冷链费700
                     needPayAmount.set(MathUtil.add(needPayAmount.get(), 700).doubleValue());
                     // 总金额 + 冷链费700
@@ -2275,22 +2275,6 @@ public class SubmitServiceImpl implements SubmitService {
          */
         ShopOrderVo shopOrder = shipMapper.getShopOrder(orderProducts.get(0).getShopOrderId());
 
-        // 店铺促销活动状态
-        PromotionsVo shopPromotions = baseMapper.getPromotionByShopId(shopOrder.getShopId());
-        if (shopPromotions != null && shopPromotions.getSeen() != null && shopPromotions.getSeen() == 2) {
-            shopPromotions = null;
-        }
-        boolean svipUserFlag = null != baseMapper.getSvipUserIdByUserId(shopOrder.getUserId());
-        // 是否包含活动商品
-        boolean hasActProductFlag = false;
-        // 超级会员优惠
-        AtomicDouble svipFullReduction = new AtomicDouble(0);
-        // 促销满减优惠
-        AtomicDouble promotionFullReduction = new AtomicDouble(0);
-        //促销活动ids
-        List<Integer> promotionsIds = new ArrayList<>();
-        // 促销活动信息
-        List<PromotionsVo> promotionList = new ArrayList<>();
         // 商品总数量
         AtomicInteger shopProductCount = new AtomicInteger(0);
         // 佣金 =  应付采美
@@ -2305,12 +2289,10 @@ public class SubmitServiceImpl implements SubmitService {
         AtomicDouble shopTaxFee = new AtomicDouble(0);
         // 商品费
         AtomicDouble shopProductFee = new AtomicDouble(0);
-        // 供应商下参与店铺促销的商品总价
-        AtomicDouble shopPromotionFee = new AtomicDouble(0);
-        // 供应商超级会员优惠
-        AtomicDouble svipShopReduction = new AtomicDouble(0);
         // 不包含店铺满减的子订单应付
         AtomicDouble realNeedPay = new AtomicDouble(0);
+        // 子订单应付供应商
+        AtomicReference<Double> shouldPayShopAmount = new AtomicReference<>(0d);
         // 订单商品列表
         List<OrderProductPo> orderProductList = new ArrayList<>();
         // 组织id
@@ -2351,10 +2333,6 @@ public class SubmitServiceImpl implements SubmitService {
             }
             Double shopTax = 0d;
 
-            // 超级会员优惠商品详情
-            SvipProductPo svipProductPo = submitMapper.getSvipProductDetails(product.getSkuId());
-            // 是否以超级会员优惠价格购买
-            boolean svipPriceFlag = null != svipProductPo && 1 == svipProductPo.getSvipProductFlag() && svipUserFlag;
             // 是否是促销赠品
             if (productType == 2) {
                 // 促销赠品数+1
@@ -2495,11 +2473,6 @@ public class SubmitServiceImpl implements SubmitService {
             realNeedPay.set(MathUtil.add(realNeedPay.get(), product.getRealProductFee()).doubleValue());
             // 统计 总金额 包括税费
             shopProductFee.set(MathUtil.add(shopProductFee.get(), product.getTotalFee()).doubleValue());
-            // 统计子订单内可参与店铺促销的商品总金额
-            if (!svipPriceFlag) {
-                // 超级会员购买优惠商品,不能参与店铺促销
-                shopPromotionFee.set(MathUtil.add(shopPromotionFee.get(), product.getTotalFee()).doubleValue());
-            }
             // 商品总金额
             shopAmount.set(MathUtil.add(shopAmount.get(), product.getTotalAmount()).doubleValue());
             // 付供应商 商品费
@@ -2515,6 +2488,7 @@ public class SubmitServiceImpl implements SubmitService {
                 product.setOrganizePercent(organizeSkuInfo.getOrganizePercent());
                 product.setShopPercent(organizeSkuInfo.getShopPercent());
             }
+            shouldPayShopAmount.updateAndGet(v -> v + product.getShopFee());
             // 加入订单商品列表
             orderProductList.add(product);
         }
@@ -2525,8 +2499,6 @@ public class SubmitServiceImpl implements SubmitService {
         shopOrder.setCanRefundAmount(needPayAmount.get());
         // 购买商品数
         shopOrder.setItemCount(shopProductCount.get());
-        // 超级会员优惠金额
-        shopOrder.setSvipShopReduction(svipShopReduction.get());
         // 总价(含税) = totalFee
         shopOrder.setTotalAmount(MathUtil.add(shopProductFee.get(), shopOrder.getShopPostFee()).doubleValue());
         // 总金额 = 订单商品totalAmount
@@ -2539,8 +2511,8 @@ public class SubmitServiceImpl implements SubmitService {
         shopOrder.setShopProductAmount(shopProductAmount.get());
         // 付给供应商税费
         shopOrder.setShopTaxFee(shopTaxFee.get());
-        // 付供应商 = 商品费 + 运费 + 税费
-        shopOrder.setShouldPayShopAmount(MathUtil.add(shopProductAmount.get(), shopTaxFee.get()).doubleValue());
+        // 付供应商 = (商品费 + 运费 + 税费)* 供应商比例
+        shopOrder.setShouldPayShopAmount(shouldPayShopAmount.get());
 
         orderProductList.forEach(o -> submitMapper.updateOrderProduct(o));
         /**

+ 4 - 1
src/main/resources/mapper/SubmitMapper.xml

@@ -475,7 +475,10 @@
             receiptStatus = #{receiptStatus},
         </if>
         <if test="shopProductAmount != null">
-            shopProductAmount = #{shopProductAmount}
+            shopProductAmount = #{shopProductAmount},
+        </if>
+        <if test="shopTaxFee != null">
+            shopTaxFee = #{shopTaxFee}
         </if>
         where shopOrderId = #{shopOrderId}
     </update>