huangzhiguo 1 年間 前
コミット
b46af26b53

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java

@@ -32,4 +32,6 @@ public interface NewShopOrderDao {
     List<Integer> findSettleStatus(Integer orderId);
 
     NewShopOrder findColdChainShopOrder(Integer orderId);
+
+    Double getFreightAmount(Integer productId);
 }

+ 23 - 17
src/main/java/com/caimei/modules/order/util/OrderUtils.java

@@ -303,6 +303,8 @@ public class OrderUtils {
         if (null != shopOrder) {
             Integer itemCount = shopOrder.getItemCount();
             Integer isColdChina = shopOrder.getIsColdChina();
+            // 冷链费商品运费模板配置运费
+            Double freightAmount = shopOrderDao.getFreightAmount(7578);
             /**     拼接运费信息--联合丽格
              *      itemCount > 1,有不止一个商品
              *      有冷链费 且不止一个商品的时候,显示其他商品运费,否则不显示
@@ -311,19 +313,19 @@ public class OrderUtils {
             double fee = shopOrder.getFreePostageFee() != null ? shopOrder.getFreePostageFee() : 0;
             double other = 0d;
             if (1 == isColdChina) {
-                if (fee >= 700) {
-                    other = fee - 700;
+                if (fee >= freightAmount) {
+                    other = fee - freightAmount;
                 }
-                coldString = "¥ " + fee + "(冷链费: ¥ 700.00 ";
+                coldString = "¥ " + fee + "(冷链费: ¥ " + freightAmount;
             }
             if (itemCount > 1) {
-                otherString = "-1".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
+                otherString = "2".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
                         "1".equals(freePostFlag) ? ",其他: ¥" + other + ")" : "";
             } else {
                 coldString += ")";
             }
             if (0 == isColdChina && 1 == itemCount) {
-                coldString = "¥ 0.00";
+                coldString = "¥ "+fee;
                 otherString = "";
             }
             order.setPostageInfo(coldString + otherString);
@@ -345,7 +347,7 @@ public class OrderUtils {
                         , newShopOrder.getReceiptAmount());
                 newShopOrder.setRestAmount(sub.doubleValue());
 
-                Double ColdChina = Double.valueOf(700);
+                Double ColdChina = shopOrderDao.getFreightAmount(7578);
                 String shopPostFlag = newShopOrder.getShopPostFlag()!=null?newShopOrder.getShopPostFlag():"-2";
                 String PostageInfo = null;
                 if (null!=newShopOrder.getIsColdChina()&&newShopOrder.getIsColdChina()==1) {
@@ -357,7 +359,7 @@ public class OrderUtils {
                         PostageInfo = "¥" + ColdChina+ "(" + (newShopOrder.getIsColdChina()==1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: 包邮)";
                     } else {
                         // 有运费
-                        PostageInfo = "¥" + MathUtil.add(newShopOrder.getShopPostFee(), ColdChina) + "(" + (newShopOrder.getIsColdChina()==1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: ¥" + newShopOrder.getShopPostFee()+ ")";
+                        PostageInfo = "¥" +newShopOrder.getShopPostFee() + "(" + (newShopOrder.getIsColdChina()==1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: ¥" + MathUtil.sub(newShopOrder.getShopPostFee(), ColdChina)+ ")";
                     }
                 } else {
                     PostageInfo = shopPostFlag.equals("2") ? "到付" : shopPostFlag.equals("0") ? "包邮" : "¥" + newShopOrder.getShopPostFee();
@@ -678,6 +680,8 @@ public class OrderUtils {
         if (null != shopOrder) {
             Integer itemCount = shopOrder.getItemCount();
             Integer isColdChina = shopOrder.getIsColdChina();
+            // 冷链费商品运费模板配置运费
+            Double freightAmount = shopOrderDao.getFreightAmount(7578);
             /**     拼接运费信息--联合丽格
              *      itemCount > 1,有不止一个商品
              *      有冷链费 且不止一个商品的时候,显示其他商品运费,否则不显示
@@ -686,19 +690,19 @@ public class OrderUtils {
             double fee = shopOrder.getFreePostageFee() != null ? shopOrder.getFreePostageFee() : 0;
             double other = 0d;
             if (1 == isColdChina) {
-                if (fee >= 700) {
-                    other = fee - 700;
+                if (fee >= freightAmount) {
+                    other = fee - freightAmount;
                 }
-                coldString = "¥ " + fee + "(冷链费: ¥ 700.00 ";
+                coldString = "¥ " + fee + "(冷链费: ¥ " + freightAmount;
             }
             if (itemCount > 1) {
-                otherString = "-1".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
+                otherString = "2".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
                         "1".equals(freePostFlag) ? ",其他: ¥" + other + ")" : "";
             } else {
                 coldString += ")";
             }
             if (0 == isColdChina && 1 == itemCount) {
-                coldString = "¥ 0.00";
+                coldString = "¥ " + fee;
                 otherString = "";
             }
             detail.setPostageInfo(coldString + otherString);
@@ -720,6 +724,8 @@ public class OrderUtils {
         if (null != shopOrder) {
             Integer itemCount = shopOrder.getItemCount();
             Integer isColdChina = shopOrder.getIsColdChina();
+            // 冷链费商品运费模板配置运费
+            Double freightAmount = shopOrderDao.getFreightAmount(7578);
             /**     拼接运费信息--联合丽格
              *      itemCount > 1,有不止一个商品
              *      有冷链费 且不止一个商品的时候,显示其他商品运费,否则不显示
@@ -728,19 +734,19 @@ public class OrderUtils {
             double fee = shopOrder.getFreePostageFee() != null ? shopOrder.getFreePostageFee() : 0;
             double other = 0d;
             if (1 == isColdChina) {
-                if (fee >= 700) {
-                    other = fee - 700;
+                if (fee >= freightAmount) {
+                    other = fee - freightAmount;
                 }
-                coldString = "¥ " + fee + "(冷链费: ¥ 700.00 ";
+                coldString = "¥ " + fee + "(冷链费: ¥ " + freightAmount;
             }
             if (itemCount > 1) {
-                otherString = "-1".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
+                otherString = "2".equals(freePostFlag) ? ", 其他: 到付)" : "0".equals(freePostFlag) ? ", 其他: 包邮)" :
                         "1".equals(freePostFlag) ? ",其他: ¥" + other + ")" : "";
             } else {
                 coldString += ")";
             }
             if (0 == isColdChina && 1 == itemCount) {
-                coldString = "¥ 0.00";
+                coldString = "¥ " + fee;
                 otherString = "";
             }
             s.setPostageInfo(coldString + otherString);

+ 8 - 0
src/main/resources/mapper/NewShopOrderMapper.xml

@@ -589,4 +589,12 @@
           and orderId = #{orderId}
           and delFlag = 0
     </select>
+
+    <select id="getFreightAmount" resultType="java.lang.Double">
+        SELECT ifnull(SUM(cfr.freightAmount), 0)
+        FROM cm_freight_rule cfr
+        LEFT JOIN cm_freight_template cft ON cft.id = cfr.freightId
+        LEFT JOIN product p ON p.freightTemplateId = cft.id
+        WHERE productId = #{productId} and cft.delFlag = 0
+    </select>
 </mapper>