Просмотр исходного кода

修复店铺未开启自动派单导致的最终结算金额错误bug;

codingliang 2 лет назад
Родитель
Сommit
613cfccb5e

+ 6 - 4
src/main/java/com/sqx/modules/order/service/impl/AppAppOrderServiceImpl.java

@@ -683,6 +683,8 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
             BigDecimal shopErrandMoney = goodsShop.getErrandMoney() != null ? goodsShop.getErrandMoney() : BigDecimal.ZERO;
             BigDecimal shopErrandMoney = goodsShop.getErrandMoney() != null ? goodsShop.getErrandMoney() : BigDecimal.ZERO;
             // 减免配送费最小订单金额
             // 减免配送费最小订单金额
             BigDecimal exemptMinMoney = goodsShop.getExemptMinMoney() != null ? goodsShop.getExemptMinMoney() : BigDecimal.ZERO;
             BigDecimal exemptMinMoney = goodsShop.getExemptMinMoney() != null ? goodsShop.getExemptMinMoney() : BigDecimal.ZERO;
+            // 店铺是否开启自动派单 0开启 1关闭
+            Integer autoSendOrder = goodsShop.getAutoSendOrder() == 0 ? 0 : 1;
 
 
             // 店铺开启了配送费满减
             // 店铺开启了配送费满减
             if (enableFullReductionFlag == 0) {
             if (enableFullReductionFlag == 0) {
@@ -693,6 +695,10 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
                     order.setErrandMoneyIsShop("本单未达到商家满减金额,跑腿费由用户承担");
                     order.setErrandMoneyIsShop("本单未达到商家满减金额,跑腿费由用户承担");
                 } else {
                 } else {
                     order.setErrandMoneyIsShop("本单已达到商家满减金额,跑腿费由商家承担");
                     order.setErrandMoneyIsShop("本单已达到商家满减金额,跑腿费由商家承担");
+                    // 店铺关闭自动派单,则为商家自己配送订单,跑腿金额设置为0
+                    if (autoSendOrder == 1) {
+                        shopErrandMoney = BigDecimal.ZERO;
+                    }
                 }
                 }
             }
             }
             // 店铺未开启配送费满减
             // 店铺未开启配送费满减
@@ -719,10 +725,6 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
             order.setAddressId(addressId);
             order.setAddressId(addressId);
 
 
             // 设置是否自动派单
             // 设置是否自动派单
-            Integer autoSendOrder = 1;
-            if(goodsShop.getAutoSendOrder() == 0){
-                autoSendOrder = 0;
-            }
             order.setAutoSendOrder(autoSendOrder);
             order.setAutoSendOrder(autoSendOrder);
         }
         }
     }
     }