Browse Source

颜选商城V1.0.3

kaick 1 year ago
parent
commit
4d06cb3189

+ 18 - 1
src/main/java/com/caimei/model/po/CmHeHeProductPo.java

@@ -105,6 +105,23 @@ public class CmHeHeProductPo implements Serializable {
      * 供应商名称
      */
     private String shopName;
+    /**
+     * 外部商城付采美佣金比例
+     */
+    private Integer cmPercent;
+    /**
+     * 外部商城付组织佣金比例
+     */
+    private Integer organizePercent;
+    /**
+     * 外部商城付组织供应商佣金比例快照
+     */
+    private Integer shopPercent;
+
+    /** 成本类型:1固定成本 2比例成本 */
+    private String costCheckFlag;
+
 
     private static final long serialVersionUID = 1L;
-}
+
+}

+ 30 - 1
src/main/java/com/caimei/model/po/CmOrderProductPo.java

@@ -314,5 +314,34 @@ public class CmOrderProductPo implements Serializable {
      */
     private String splitCode;
 
+    /**
+     * 超级会员优惠价格标识:0不是,1是
+     */
+    private Integer svipPriceFlag;
+    /**
+     * 超级会员优惠价类型:1折扣价,2直接优惠价
+     */
+    private Integer svipPriceType;
+    /**
+     * 超级会员折扣
+     */
+    private Double svipDiscount;
+    /**
+     * 超级会员优惠
+     */
+    private Double svipReduction;
+    /**
+     * 外部商城付采美佣金比例
+     */
+    private Integer cmPercent;
+    /**
+     * 外部商城付组织佣金比例
+     */
+    private Integer organizePercent;
+    /**
+     * 外部商城付组织供应商佣金比例快照
+     */
+    private Integer shopPercent;
+
     private static final long serialVersionUID = 1L;
-}
+}

+ 28 - 1
src/main/java/com/caimei/model/po/CmShopOrderPo.java

@@ -1,5 +1,6 @@
 package com.caimei.model.po;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -365,5 +366,31 @@ public class CmShopOrderPo implements Serializable {
      */
     private Integer receiptStatus;
 
+    /** 是否包含冷链费 0不包含 1包含 */
+    private Integer isColdChina;
+    /** 免邮标志  运费:0 包邮 1 有运费 2 到付 */
+    private String shopPostFlag;
+
     private static final long serialVersionUID = 1L;
-}
+
+    /** 外部商城付采美佣金 */
+    private BigDecimal payCmAmount;
+
+    /** 差价类型:1 少付;2 多付 */
+    private String differenceType;
+
+    /** 补差价金额 */
+    private BigDecimal differencePrice;
+
+    /** 店铺超级会员优惠 */
+    private BigDecimal svipShopReduction;
+
+    /** 子订单已支付成功次数统计 */
+    private Integer paySuccessCounter;
+
+    /** 可用线上支付渠道1微信2支付宝3个人网银4企业网银 */
+    private String onlinePayWays;
+
+    /** 订单状态 0:待确认 1:已确认 2:交易完成 3:订单完成 4:已关闭 5:交易全退 */
+    private String shopStatus;
+}

+ 6 - 0
src/main/java/com/caimei/model/vo/OrderVo.java

@@ -274,6 +274,12 @@ public class OrderVo implements Serializable {
      * 能否分享订单:1可以,其他不行
      */
     private Integer shareFlag = 0;
+    /**  设置付款金额  */
+    private List<DiscernReceiptVo> discernReceiptVoList;
+    //退货提示
+    private String helpContent;
+    //订单中存在不能退货的商品则给出不能退货提示
+    private Boolean flag;
 
     private static final long serialVersionUID = 1L;
 }

+ 12 - 1
src/main/java/com/caimei/model/vo/ShopOrderVo.java

@@ -109,7 +109,7 @@ public class ShopOrderVo implements Serializable {
     /**
      * (收款买家)收款状态:1待收款、2部分收款、3已收款
      */
-    private Integer receiptStatus;
+    private String receiptStatus;
 
     /**
      * 订单提交时间
@@ -282,4 +282,15 @@ public class ShopOrderVo implements Serializable {
     private Double restAmount;
 
     private static final long serialVersionUID = 1L;
+
+    /** 是否包含冷链费 0不包含 1包含 */
+    private Integer isColdChina;
+
+    /** 免邮标志  运费:0 包邮 1 有运费 2 到付 */
+    private String shopPostFlag;
+
+    /** 订单状态 0:待确认 1:已确认 2:交易完成 3:订单完成 4:已关闭 5:交易全退 */
+    private Integer shopStatus;
+    /** 运费 */
+    private String postageInfo;
 }

+ 35 - 18
src/main/java/com/caimei/service/impl/HeliPayServiceImpl.java

@@ -34,6 +34,7 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * Description
@@ -176,22 +177,38 @@ public class HeliPayServiceImpl implements HeliPayService {
         Date date = new Date();
         String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
         if (MathUtil.compare(order.getPayableAmount(), order.getReceiptAmount()) == 0) {
-            /*
-             * 订单全部支付
-             * 0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,
-             * 31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退
-             */
-            if ("11".equals(order.getStatus()) || "21".equals(order.getStatus())) {
-                order.setStatus("31");
-            } else if ("12".equals(order.getStatus()) || "22".equals(order.getStatus())) {
-                order.setStatus("32");
+            //主订单收款状态
+            List<ShopOrderVo> allShopOrder = orderMapper.findAllShopOrder(orderId);
+            if (allShopOrder.stream().filter(newShopOrder -> !newShopOrder.getReceiptStatus().equals(3)).collect(Collectors.toList()).size() == 1) {
+                /*
+                 * 订单全部支付
+                 * 0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,
+                 * 31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退
+                 */
+                if ("11".equals(order.getStatus()) || "21".equals(order.getStatus())) {
+                    order.setStatus("31");
+                } else if ("12".equals(order.getStatus()) || "22".equals(order.getStatus())) {
+                    order.setStatus("32");
+                } else {
+                    order.setStatus("33");
+                }
+                order.setPayFlag(1);
+                order.setOnlinePayFlag(0);
+                //(收款买家)收款状态:1待收款、2部分收款、3已收款
+                order.setReceiptStatus(3);
             } else {
-                order.setStatus("33");
+                //部分支付
+                if ("11".equals(order.getStatus()) || "21".equals(order.getStatus())) {
+                    order.setStatus("21");
+                } else if ("12".equals(order.getStatus()) || "22".equals(order.getStatus())) {
+                    order.setStatus("22");
+                } else {
+                    order.setStatus("23");
+                }
+                order.setOnlinePayFlag(0);
+                //(收款买家)收款状态:1待收款、2部分收款、3已收款
+                order.setReceiptStatus(2);
             }
-            order.setPayFlag(1);
-            order.setOnlinePayFlag(0);
-            //(收款买家)收款状态:1待收款、2部分收款、3已收款
-            order.setReceiptStatus(3);
             log.info("【支付异步回调】>>>>>>>>>>>>>>订单(全部支付),修改订单状态:" + order.getStatus() + ",orderId:" + orderId);
             /*
              * 保存好友消费券赠送记录
@@ -199,7 +216,7 @@ public class HeliPayServiceImpl implements HeliPayService {
             CouponSharePo couponShare = couponMapper.getCouponShareId(order.getUserId());
             if (null != couponShare) {
                 List<Integer> couponIds = couponMapper.getCurrentCouponIds(5);
-                couponIds.forEach(couponId->{
+                couponIds.forEach(couponId -> {
                     couponShare.setShareCouponId(couponId);
                     couponMapper.insertCouponShare(couponShare);
                     BigDecimal couponAmount = couponMapper.getCouponAmount(couponId);
@@ -296,9 +313,9 @@ public class HeliPayServiceImpl implements HeliPayService {
         shopOrder.setReceiptAmount(MathUtil.add(shopOrderReceiptAmount,amount).doubleValue());
         //均摊后needpay:已支付
         if (MathUtil.compare(shopOrder.getRealPay(), shopOrder.getReceiptAmount()) == 0) {
-            shopOrder.setReceiptStatus(3);
+            shopOrder.setReceiptStatus("3");
         }else{
-            shopOrder.setReceiptStatus(2);
+            shopOrder.setReceiptStatus("2");
         }
         // 更新子订单收款金额和收款状态
         payOrderMapper.updateShopOrderByReceiptStatus(shopOrder);
@@ -332,7 +349,7 @@ public class HeliPayServiceImpl implements HeliPayService {
         log.info(">>>>>>>>>>>>>>>>>>>>>>>保存付款金额到收款记录," + amount);
         return "SUCCESS";
     }
-    
+
     private String getOpenId(HeliDto heliDto, HttpHeaders headers) {
         PayParamBo payParam = new PayParamBo();
         // payDto -> payParam

+ 148 - 96
src/main/java/com/caimei/service/impl/OrderServiceImpl.java

@@ -62,28 +62,8 @@ public class OrderServiceImpl implements OrderService {
      */
     private void getOrderData(List<OrderVo> orderList) {
         for (OrderVo order : orderList) {
-            //111,待付待收待发
-            setOrderStatus(order);
-            List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(order.getOrderId());
-            for (ShopOrderVo shopOrder : shopOrderList) {
-                List<OrderProductVo> orderProductList = orderMapper.findOrderProduct(shopOrder.getShopOrderId());
-                for (OrderProductVo orderProduct : orderProductList) {
-                    orderProduct.setProductImage(ProductUtils.getImageURL("product", orderProduct.getProductImage(), 0, domain));
-                    //不含税可开票商品,单价/折后单价=税前单价+税费
-                    if ("0".equals(orderProduct.getIncludedTax()) && ("1".equals(orderProduct.getInvoiceType()) || "2".equals(orderProduct.getInvoiceType()))) {
-                        BigDecimal valueTax = MathUtil.div(MathUtil.mul(orderProduct.getPrice(), orderProduct.getTaxRate()), 100);
-                        orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax));
-                        orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getDiscountPrice(), orderProduct.getAddedValueTax()));
-                    }
-                }
-                shopOrder.setOrderProductList(orderProductList);
-                shopOrder.setShopLogo(ProductUtils.getImageURL("shopLogo", shopOrder.getShopLogo(), 0, domain));
-            }
-            //过滤运费商品
-            shopOrderList.removeIf(shopOrderVo -> shopOrderVo.getShopId() == 998);
-            order.setShopOrderList(shopOrderList);
-            //设置付款金额
-            getDiscernReceipt(order);
+            initOrder(order);
+
         }
     }
 
@@ -97,83 +77,15 @@ public class OrderServiceImpl implements OrderService {
         if (order == null) {
             return ResponseJson.error("该订单已删除", null);
         }
-        order.setOrderMark("#" + order.getOrderId() + "#");
-        setOrderStatus(order);
-        //商品信息
-        List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(orderId);
-        BigDecimal expensesOfTaxation = new BigDecimal(0);
-        int returnedNumTotal = 0;
-        int actualCancelNumTotal = 0;
-        String helpContent=null;
-        boolean flag=false;
-        for (ShopOrderVo shopOrder : shopOrderList) {
-            List<OrderProductVo> orderProductList = orderMapper.findOrderProduct(shopOrder.getShopOrderId());
-            for (OrderProductVo orderProduct : orderProductList) {
-                //订单中存在不能退货的商品则给出不能退货提示
-                if(null!=orderProduct.getReturnGoodsStutas()&&orderProduct.getReturnGoodsStutas()==2){
-                    flag=true;
-                    helpContent = orderMapper.getHelpContent(1040);
-                }
-                //运费
-                if (shopOrder.getShopId() == 998) {
-                    order.setFreight(orderProduct.getPrice());
-                }
-                //总税费
-                expensesOfTaxation = expensesOfTaxation.add(orderProduct.getTotalAddedValueTax());
-                orderProduct.setProductImage(ProductUtils.getImageURL("product", orderProduct.getProductImage(), 0, domain));
-                //已发货数量
-                orderProduct.setShipmentsNum(orderProduct.getNum() + orderProduct.getPresentNum() - orderProduct.getNotOutStore());
-                //已退货数量
-                Integer returnedNum = orderMapper.returnedPurchase(orderProduct.getShopOrderId(), orderProduct.getProductId());
-                returnedNum = null != returnedNum ? returnedNum : 0;
-                returnedNumTotal += returnedNum;
-                orderProduct.setReturnedNum(returnedNum);
-                //已取消发货数量
-                Integer actualCancelNum = orderMapper.actualCancelNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
-                actualCancelNum = null != actualCancelNum ? actualCancelNum : 0;
-                actualCancelNumTotal += actualCancelNum;
-                orderProduct.setActualCancelNum(actualCancelNum);
-                //判断商品价格是否含税
-                if ("1".equals(orderProduct.getIncludedTax()) || ("0".equals(orderProduct.getIncludedTax()) && ("1".equals(orderProduct.getInvoiceType()) || "2".equals(orderProduct.getInvoiceType())))) {
-                    orderProduct.setIncludedTaxFlag("2");
-                } else if (orderProduct.getIncludedTax() != null && "0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
-                    orderProduct.setIncludedTaxFlag("1");
-                } else {
-                    orderProduct.setIncludedTaxFlag("3");
-                }
-                //不含税可开票商品,单价/折后单价在原基础上加上税费
-                if ("0".equals(orderProduct.getIncludedTax()) && ("1".equals(orderProduct.getInvoiceType()) || "2".equals(orderProduct.getInvoiceType()))) {
-                    //计算单价的税费
-                    BigDecimal valueTax = MathUtil.div(MathUtil.mul(orderProduct.getPrice(), orderProduct.getTaxRate()), 100);
-                    orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax));
-                    orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getDiscountPrice(), orderProduct.getAddedValueTax()));
-                }
-            }
-            shopOrder.setOrderProductList(orderProductList);
-            shopOrder.setShopLogo(ProductUtils.getImageURL("shopLogo", shopOrder.getShopLogo(), 0, domain));
-        }
-        order.setExpensesOfTaxation(expensesOfTaxation);
-        order.setReturnedNum(returnedNumTotal);
-        order.setActualCancelNum(actualCancelNumTotal);
-        // 查询该订单是否已有分享记录
-        Integer shareRecordCount = couponMapper.getShareRecordCount(orderId);
-        if (0 == shareRecordCount) {
-            order.setShareFlag(1);
-        }
-        //删除运费商品
-        shopOrderList.removeIf(student -> 998 == student.getShopId());
-        List<DiscernReceiptVo> discernReceiptList = getDiscernReceipt(order);
-        //退款总金额
-        BigDecimal returnedPurchaseFee = orderMapper.findReturnedPurchase(order.getOrderId());
-        order.setReturnedPurchaseFee(returnedPurchaseFee);
+        initOrder(order);
         map.put("order", order);
         map.put("userInfo", userInfo);
-        map.put("shopOrderList", shopOrderList);
-        map.put("discernReceiptList", discernReceiptList);
-        if(flag){
+        map.put("shopOrderList", order.getShopOrderList());
+        map.put("discernReceiptList", order.getDiscernReceiptVoList());
+        if (order.getFlag()) {
             map.put("returnGoodsStutas", 2);
-            map.put("helpContent", helpContent);
-        }else{
+            map.put("helpContent", order.getHelpContent());
+        } else {
             map.put("returnGoodsStutas", 1);
             map.put("helpContent", null);
         }
@@ -221,6 +133,7 @@ public class OrderServiceImpl implements OrderService {
         for (LogisticsBatchVo batch : batchList) {
             List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(orderId);
             for (ShopOrderVo shopOrder : shopOrderList) {
+                initShopOrder(shopOrder);
                 List<LogisticsRecordVo> logisticsRecordList = orderMapper.findLogisticsRecord(shopOrder.getShopOrderId(), batch.getId());
                 for (LogisticsRecordVo logisticsRecord : logisticsRecordList) {
                     logisticsRecord.setImage(ProductUtils.getImageURL("product", logisticsRecord.getImage(), 0, domain));
@@ -505,5 +418,144 @@ public class OrderServiceImpl implements OrderService {
         order.setReceiptAmount(receiptAmount);
         return discernReceiptList;
     }
+
+    public void initShopOrder(ShopOrderVo shopOrder) {
+        if (1 == shopOrder.getShopStatus()) {
+            if ("1".equals(shopOrder.getReceiptStatus()) && "1".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(11);
+            } else if ("1".equals(shopOrder.getReceiptStatus()) && "2".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(12);
+            } else if ("1".equals(shopOrder.getReceiptStatus()) && "3".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(13);
+            } else if ("2".equals(shopOrder.getReceiptStatus()) && "1".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(21);
+            } else if ("2".equals(shopOrder.getReceiptStatus()) && "2".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(22);
+            } else if ("2".equals(shopOrder.getReceiptStatus()) && "3".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(23);
+            } else if ("3".equals(shopOrder.getReceiptStatus()) && "1".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(31);
+            } else if ("3".equals(shopOrder.getReceiptStatus()) && "2".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(32);
+            } else if ("3".equals(shopOrder.getReceiptStatus()) && "3".equals(shopOrder.getSendOutStatus())) {
+                shopOrder.setShopStatus(33);
+            }
+        }
+        //拼接运费
+        Double ColdChina = Double.valueOf(700);
+        String shopPostFlag = shopOrder.getShopPostFlag() != null ? shopOrder.getShopPostFlag() : "-2";
+        String postageInfo = null;
+        if (null != shopOrder.getIsColdChina() && shopOrder.getIsColdChina() == 1) {
+            if ("2" == shopOrder.getShopPostFlag()) {
+                // 到付
+                postageInfo = "¥" + ColdChina + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: 到付)";
+            } else if ("0" == shopOrder.getShopPostFlag()) {
+                // 包邮
+                postageInfo = "¥" + ColdChina + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: 包邮)";
+            } else {
+                // 有运费
+                postageInfo = "¥" + MathUtil.add(shopOrder.getShopPostFee(), ColdChina) + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: ¥" + shopOrder.getShopPostFee() + ")";
+            }
+        } else {
+            postageInfo = shopPostFlag.equals("2") ? "到付" : shopPostFlag.equals("0") ? "包邮" : "¥" + shopOrder.getShopPostFee();
+        }
+        shopOrder.setPostageInfo(postageInfo);
+    }
+
+    public void initOrder(OrderVo order) {
+        order.setOrderMark("#" + order.getOrderId() + "#");
+        setOrderStatus(order);
+        //商品信息
+        List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(order.getOrderId());
+        BigDecimal expensesOfTaxation = new BigDecimal(0);
+        int returnedNumTotal = 0;
+        int actualCancelNumTotal = 0;
+        String helpContent = null;
+        boolean flag = false;
+        //bug
+        order.setPayTotalFee(new BigDecimal(0));
+        order.setPayableAmount(new BigDecimal(0));
+        order.setPendingPayments(new BigDecimal(0));
+        for (ShopOrderVo shopOrder : shopOrderList) {
+            order.setPayTotalFee(MathUtil.add(order.getPayTotalFee(),shopOrder.getTotalAmount()));
+            order.setPayableAmount(MathUtil.add(order.getPayableAmount(),shopOrder.getRealPay()));
+            order.setPendingPayments(MathUtil.add(order.getPendingPayments(),shopOrder.getRestAmount()));
+
+            if ("81".equals(order.getStatus())) {
+                shopOrder.setShopStatus(81);
+            } else if ("82".equals(order.getStatus())) {
+                shopOrder.setShopStatus(82);
+            } else if ("83".equals(order.getStatus())) {
+                shopOrder.setShopStatus(83);
+            } else if ("6".equals(order.getStatus())) {
+                shopOrder.setShopStatus(4);
+            }
+            initShopOrder(shopOrder);
+            List<OrderProductVo> orderProductList = orderMapper.findOrderProduct(shopOrder.getShopOrderId());
+            for (OrderProductVo orderProduct : orderProductList) {
+                //订单中存在不能退货的商品则给出不能退货提示
+                if (null != orderProduct.getReturnGoodsStutas() && orderProduct.getReturnGoodsStutas() == 2) {
+                    flag = true;
+                    helpContent = orderMapper.getHelpContent(1040);
+                }
+                //运费
+                if (shopOrder.getShopId() == 998) {
+                    order.setFreight(orderProduct.getPrice());
+                }
+                //总税费
+                expensesOfTaxation = expensesOfTaxation.add(orderProduct.getTotalAddedValueTax());
+                orderProduct.setProductImage(ProductUtils.getImageURL("product", orderProduct.getProductImage(), 0, domain));
+                //已发货数量
+                orderProduct.setShipmentsNum(orderProduct.getNum() + orderProduct.getPresentNum() - orderProduct.getNotOutStore());
+                //已退货数量
+                Integer returnedNum = orderMapper.returnedPurchase(orderProduct.getShopOrderId(), orderProduct.getProductId());
+                returnedNum = null != returnedNum ? returnedNum : 0;
+                returnedNumTotal += returnedNum;
+                orderProduct.setReturnedNum(returnedNum);
+                //已取消发货数量
+                Integer actualCancelNum = orderMapper.actualCancelNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
+                actualCancelNum = null != actualCancelNum ? actualCancelNum : 0;
+                actualCancelNumTotal += actualCancelNum;
+                orderProduct.setActualCancelNum(actualCancelNum);
+                //判断商品价格是否含税
+                if ("1".equals(orderProduct.getIncludedTax()) || ("0".equals(orderProduct.getIncludedTax()) && ("1".equals(orderProduct.getInvoiceType()) || "2".equals(orderProduct.getInvoiceType())))) {
+                    orderProduct.setIncludedTaxFlag("2");
+                } else if (orderProduct.getIncludedTax() != null && "0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
+                    orderProduct.setIncludedTaxFlag("1");
+                } else {
+                    orderProduct.setIncludedTaxFlag("3");
+                }
+                //不含税可开票商品,单价/折后单价在原基础上加上税费
+                if ("0".equals(orderProduct.getIncludedTax()) && ("1".equals(orderProduct.getInvoiceType()) || "2".equals(orderProduct.getInvoiceType()))) {
+                    //计算单价的税费
+                    BigDecimal valueTax = MathUtil.div(MathUtil.mul(orderProduct.getPrice(), orderProduct.getTaxRate()), 100);
+                    orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax));
+                    orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getDiscountPrice(), orderProduct.getAddedValueTax()));
+                }
+            }
+            shopOrder.setOrderProductList(orderProductList);
+            shopOrder.setShopLogo(ProductUtils.getImageURL("shopLogo", shopOrder.getShopLogo(), 0, domain));
+        }
+        order.setExpensesOfTaxation(expensesOfTaxation);
+        order.setReturnedNum(returnedNumTotal);
+        order.setActualCancelNum(actualCancelNumTotal);
+
+        order.setFlag(flag);
+        order.setHelpContent(helpContent);
+
+        // 查询该订单是否已有分享记录
+        Integer shareRecordCount = couponMapper.getShareRecordCount(order.getOrderId());
+        if (0 == shareRecordCount) {
+            order.setShareFlag(1);
+        }
+        //删除运费商品
+        shopOrderList.removeIf(student -> 998 == student.getShopId());
+        List<DiscernReceiptVo> discernReceiptList = getDiscernReceipt(order);
+        //退款总金额
+        BigDecimal returnedPurchaseFee = orderMapper.findReturnedPurchase(order.getOrderId());
+        order.setReturnedPurchaseFee(returnedPurchaseFee);
+        order.setShopOrderList(shopOrderList);
+        order.setDiscernReceiptVoList(discernReceiptList);
+    }
 }
 

+ 29 - 13
src/main/java/com/caimei/service/impl/OrderSubmitServiceImpl.java

@@ -224,6 +224,8 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         if (null == user) {
             return ResponseJson.error("用户信息异常", null);
         }
+        // 运费
+        BigDecimal freight = BigDecimal.ZERO;
         // 商品总数量
         Integer productCount = 0;
         // 商品总金额 (商品单价乘以数量,再加上税费[默认0])
@@ -231,9 +233,9 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         // 小计金额(商品折后单价乘以数量,再加上税费[默认0])
         BigDecimal orderTotalFee = BigDecimal.ZERO;
         // 订单总额(小计金额减去经理折扣后,再加上运费[默认0])
-        BigDecimal payTotalFee = BigDecimal.ZERO;
-        // 真实支付金额(订单总额减去抵扣的账户余额)
-        BigDecimal payableAmount = BigDecimal.ZERO;
+        BigDecimal payTotalFee = MathUtil.add(BigDecimal.ZERO,freight);
+        // 真实支付金额(订单总额减去抵扣的账户余额) 实际支付金额(商品金额+运费-余额抵扣)
+        BigDecimal payableAmount =  MathUtil.add(BigDecimal.ZERO,freight);
         // 是否能线上支付
         AtomicBoolean onlinePay = new AtomicBoolean(true);
 
@@ -469,11 +471,11 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         order.setPromotionalGiftsCount(0);
         // 0包邮 -1到付 1 有运费
         order.setFreePostFlag("0");
-        order.setFreight(BigDecimal.ZERO);
+        order.setFreight(freight);
         // 商品总额
         order.setProductTotalFee(productTotalFee);
         // 订单总额(商品金额+运费)
-        payTotalFee = productTotalFee;
+        payTotalFee = MathUtil.add(productTotalFee,payTotalFee);
         orderTotalFee = productTotalFee;
         order.setOrderTotalFee(orderTotalFee);
         // 优惠券抵扣
@@ -490,12 +492,12 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
             order.setReceiptStatus("3");
         }
         order.setPayTotalFee(payTotalFee);
-        payableAmount = payTotalFee;
         order.setConfirmTime(curDateStr);
 
         // 余额支付金额
         order.setBalancePayFee(BigDecimal.ZERO);
         // 实际支付金额(商品金额+运费-余额抵扣)
+        payableAmount = MathUtil.add(productTotalFee,payableAmount);
         order.setPayableAmount(payableAmount);
         // 售后条款
         order.setClauseID(1L);
@@ -916,6 +918,11 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         // 订单商品供应商确认标志 0否 1是
         orderProduct.setConfirmProductFlag("0");
 
+        // 佣金比例快照
+        orderProduct.setCmPercent(product.getCmPercent());
+        orderProduct.setOrganizePercent(product.getOrganizePercent());
+        orderProduct.setShopPercent(product.getShopPercent());
+
         orderProduct.setShopName(product.getShopName());
         orderProduct.setName(product.getName());
         orderProduct.setPayStatus("0");
@@ -969,12 +976,14 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         /*
          *  统计子订单金额信息
          */
-        // 订单总金额
-        BigDecimal totalAmount = new BigDecimal(0);
+        //运费
+        BigDecimal shopPostFee = BigDecimal.ZERO;
+        // 订单总金额 + 运费
+        BigDecimal totalAmount = MathUtil.add(new BigDecimal(0), shopPostFee);
         // 商品总金额
         BigDecimal productAmount = new BigDecimal(0);
-        // 需要支付金额
-        BigDecimal needPayAmount = new BigDecimal(0);
+        // 需要支付金额 + 运费
+        BigDecimal needPayAmount = MathUtil.add(new BigDecimal(0), shopPostFee);
         // 优惠金额
         BigDecimal preferential = new BigDecimal(0);
         // 佣金
@@ -1006,6 +1015,13 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
                 }
             }
         }
+        //是否冷链费
+        shopOrder.setIsColdChina(0);
+        shopOrder.setShopPostFlag("0");
+        shopOrder.setShopStatus("1");
+        shopOrder.setOnlinePayWays("1");
+
+
 
         // freePostFlag: 0包邮 -1到付 1 有运费
         shopOrder.setNote(shopNote);
@@ -1020,7 +1036,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         shopOrder.setUseBeanFlag(0);
         shopOrder.setUseBeanAmount(0);
         shopOrder.setUseBalanceFlag(0);
-        shopOrder.setRefundStatus(0);
+        shopOrder.setRefundStatus(1);
         shopOrder.setRefundsAmount(BigDecimal.ZERO);
         shopOrder.setPayStatus("1");
         shopOrder.setZeroCostFlag(0);
@@ -1041,7 +1057,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         shopOrder.setPreferential(preferential);
         shopOrder.setShopProductAmount(shopProductAmount);
         // 付给供应商运费
-        shopOrder.setShopPostFee(BigDecimal.ZERO);
+        shopOrder.setShopPostFee(shopPostFee);
         // 付给供应商税费
         shopOrder.setShopTaxFee(shopTaxFee);
         // 已付款金额
@@ -1049,7 +1065,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         // 付第三方
         shopOrder.setShopOtherFee(BigDecimal.ZERO);
         // 付供应商 = 商品费 + 运费 + 税费
-        shopOrder.setShouldPayShopAmount(MathUtil.add(shopProductAmount, shopTaxFee));
+        shopOrder.setShouldPayShopAmount(MathUtil.add(MathUtil.add(shopProductAmount, shopTaxFee), shopPostFee));
         // 订单能否拆分 1 为可拆分, 0为不可拆分
         if (buyNum > 1) {
             shopOrder.setSplitFlag("1");

+ 8 - 4
src/main/resources/config/dev/application-dev.yml

@@ -2,9 +2,12 @@ spring:
   #数据源连接--start
   datasource:
     #driverClassName: com.mysql.jdbc.Driver
-    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: developer
-    password: 05bZ/OxTB:X+yd%1
+    password: J5p3tgOVazNl4ydf
+#    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+#    username: developer
+#    password: 05bZ/OxTB:X+yd%1
     type: com.zaxxer.hikari.HikariDataSource
     hikari:
       minimum-idle: 5
@@ -73,8 +76,9 @@ caimei:
   #支付链接重定向地址
   redirectLink: https://mall2c-b.caimei365.com/PayOrder/jumpPage
   #微服务网关地址
-  cloudApi: http://localhost:18002
+#  cloudApi: http://localhost:18002
+  cloudApi: https://core-b.caimei365.com
   #延时分账异步回调地址
   delayedSplittingUrl: https://mall2c-b.caimei365.com/PayOrder/delayedSplittingCallback
   #图片服务器
-  imageDomain: http://192.168.2.100
+  imageDomain: http://192.168.2.100

+ 16 - 2
src/main/resources/mapper/OrderMapper.xml

@@ -46,9 +46,10 @@
         select
           <include refid="cm_Order_List"></include>
         from cm_order co
+        left join cm_shop_order cso on co.orderID = cso.orderId
         left join cm_hehe_collage_member chcm on co.orderID = chcm.orderId
         left join cm_hehe_collage chc on chcm.collageId = chc.id
-        where co.delFlag = '0'
+        where co.delFlag = '0' and cso.delFlag = '0'
         AND co.orderType = 2
         <if test="userId != null ">
             AND co.userID = #{userId}
@@ -68,6 +69,7 @@
         <if test="orderState == 5">
             AND chcm.id is not null and co.refundType not in (1,2) and chc.status = 1
         </if>
+        group by co.orderId
         ORDER BY co.orderTime DESC
     </select>
 
@@ -106,6 +108,11 @@
         cso.realPay,
         cso.receiptAmount,
         cso.receiptStatus,
+        cso.isColdChina,
+        cso.shopPostFlag,
+        cso.onlinePayWays,
+        cso.shopStatus,
+        cso.sendOutStatus,
         (ifnull(cso.realPay,0)-ifnull(cso.receiptAmount,0)) as restAmount,
         s.name AS shopName,
         s.logo AS shopLogo
@@ -149,6 +156,9 @@
           cop.productType,
           cop.ladderPriceFlag,
           cop.heUserId,
+          cop.shopPercent,
+          cop.organizePercent,
+          cop.cmPercent,
           p.returnGoodsStutas,
           cop.isActProduct as actProduct
         FROM
@@ -602,6 +612,10 @@
             splitFlag,
             realPay,
             receiptAmount,
+            isColdChina,
+            shopPostFlag,
+            onlinePayWays,
+            shopStatus,
             receiptStatus
         FROM cm_shop_order
         WHERE delFlag = 0
@@ -632,4 +646,4 @@
     <select id="getHelpContent" resultType="java.lang.String">
         select content from helppage where helpPageID=#{helpId}
     </select>
-</mapper>
+</mapper>

+ 66 - 373
src/main/resources/mapper/OrderSubmitMapper.xml

@@ -36,6 +36,10 @@
         chp.includedTax,
         chp.invoiceType,
         chp.clubTaxPoint,
+        cs.cmPercent,
+        cs.organizePercent,
+        cs.shopPercent,
+        cs.costCheckFlag,
         p.name,
         p.shopID AS shopId,
         p.mainImage as productImage,
@@ -77,9 +81,13 @@
                chp.clubTaxPoint,
                chp.shopTaxPoint,
                cs.costPrice,
-               cs.costProportional,
+               cs.shopPercent  AS costProportional,
                p.shopID        AS shopId,
                cs.unit,
+               cs.cmPercent,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.costCheckFlag,
                p.name,
                p.mainImage,
                p.splitCode,
@@ -682,6 +690,18 @@
             <if test="receiptStatus != null">
                 receiptStatus,
             </if>
+            <if test="isColdChina != null">
+                isColdChina,
+            </if>
+            <if test="shopPostFlag != null">
+                shopPostFlag,
+            </if>
+            <if test="onlinePayWays != null">
+                onlinePayWays,
+            </if>
+            <if test="shopStatus != null">
+                shopStatus,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="shopOrderNo != null">
@@ -909,384 +929,53 @@
             <if test="receiptStatus != null">
                 #{receiptStatus},
             </if>
-        </trim>
-    </insert>
-
-    <insert id="insertOrderProduct" keyColumn="orderProductID" keyProperty="orderProductID"
-            parameterType="com.caimei.model.po.CmOrderProductPo" useGeneratedKeys="true">
-        insert into cm_order_product
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="skuId != null">
-                skuId,
-            </if>
-            <if test="orderNo != null">
-                orderNo,
-            </if>
-            <if test="orderID != null">
-                orderID,
-            </if>
-            <if test="shopOrderID != null">
-                shopOrderID,
-            </if>
-            <if test="shopOrderNo != null">
-                shopOrderNo,
-            </if>
-            <if test="shopID != null">
-                shopID,
-            </if>
-            <if test="productID != null">
-                productID,
-            </if>
-            <if test="organizeProductID != null">
-                organizeProductID,
-            </if>
-            <if test="organizeID != null">
-                organizeID,
-            </if>
-            <if test="num != null">
-                num,
-            </if>
-            <if test="presentNum != null">
-                presentNum,
-            </if>
-            <if test="outStoreType != null">
-                outStoreType,
-            </if>
-            <if test="productNo != null">
-                productNo,
-            </if>
-            <if test="price != null">
-                price,
-            </if>
-            <if test="normalPrice != null">
-                normalPrice,
-            </if>
-            <if test="costPrice != null">
-                costPrice,
-            </if>
-            <if test="totalAmount != null">
-                totalAmount,
-            </if>
-            <if test="totalFee != null">
-                totalFee,
-            </if>
-            <if test="shouldPayFee != null">
-                shouldPayFee,
-            </if>
-            <if test="discount != null">
-                discount,
-            </if>
-            <if test="discountPrice != null">
-                discountPrice,
-            </if>
-            <if test="taxRate != null">
-                taxRate,
-            </if>
-            <if test="addedValueTax != null">
-                addedValueTax,
-            </if>
-            <if test="totalAddedValueTax != null">
-                totalAddedValueTax,
-            </if>
-            <if test="shouldPayTotalTax != null">
-                shouldPayTotalTax,
-            </if>
-            <if test="singleShouldPayTotalTax != null">
-                singleShouldPayTotalTax,
-            </if>
-            <if test="shopProductAmount != null">
-                shopProductAmount,
-            </if>
-            <if test="shopFee != null">
-                shopFee,
-            </if>
-            <if test="otherFee != null">
-                otherFee,
-            </if>
-            <if test="cmFee != null">
-                cmFee,
-            </if>
-            <if test="singleShopFee != null">
-                singleShopFee,
-            </if>
-            <if test="singleOtherFee != null">
-                singleOtherFee,
-            </if>
-            <if test="singleCmFee != null">
-                singleCmFee,
-            </if>
-            <if test="status != null">
-                `status`,
-            </if>
-            <if test="totalBeans != null">
-                totalBeans,
-            </if>
-            <if test="useBalanceAmount != null">
-                useBalanceAmount,
-            </if>
-            <if test="useBeanAmount != null">
-                useBeanAmount,
-            </if>
-            <if test="notOutStore != null">
-                notOutStore,
-            </if>
-            <if test="cmbeanPrice != null">
-                cmbeanPrice,
-            </if>
-            <if test="isActProduct != null">
-                isActProduct,
-            </if>
-            <if test="isGiftProduct != null">
-                isGiftProduct,
-            </if>
-            <if test="productActInfo != null">
-                productActInfo,
-            </if>
-            <if test="buyAgainFlag != null">
-                buyAgainFlag,
-            </if>
-            <if test="confirmProductFlag != null">
-                confirmProductFlag,
-            </if>
-            <if test="payStatus != null">
-                payStatus,
-            </if>
-            <if test="shopName != null">
-                shopName,
-            </if>
-            <if test="name != null">
-                `name`,
-            </if>
-            <if test="productUnit != null">
-                productUnit,
-            </if>
-            <if test="productImage != null">
-                productImage,
-            </if>
-            <if test="actType != null">
-                actType,
-            </if>
-            <if test="actPreferential != null">
-                actPreferential,
-            </if>
-            <if test="productType != null">
-                productType,
-            </if>
-            <if test="orderPromotionsId != null">
-                orderPromotionsId,
-            </if>
-            <if test="preferential != null">
-                preferential,
-            </if>
-            <if test="discountFee != null">
-                discountFee,
-            </if>
-            <if test="cancelNum != null">
-                cancelNum,
-            </if>
-            <if test="supplierTaxRate != null">
-                supplierTaxRate,
-            </if>
-            <if test="includedTax != null">
-                includedTax,
+            <if test="isColdChina != null">
+                #{isColdChina},
             </if>
-            <if test="invoiceType != null">
-                invoiceType,
+            <if test="shopPostFlag != null">
+                #{shopPostFlag},
             </if>
-            <if test="ladderPriceFlag != null">
-                ladderPriceFlag,
+            <if test="onlinePayWays != null">
+                #{onlinePayWays},
             </if>
-            <if test="heUserId != null">
-                heUserId,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="skuId != null">
-                #{skuId},
-            </if>
-            <if test="orderNo != null">
-                #{orderNo,jdbcType=VARCHAR},
-            </if>
-            <if test="orderID != null">
-                #{orderID,jdbcType=BIGINT},
-            </if>
-            <if test="shopOrderID != null">
-                #{shopOrderID,jdbcType=INTEGER},
-            </if>
-            <if test="shopOrderNo != null">
-                #{shopOrderNo,jdbcType=VARCHAR},
-            </if>
-            <if test="shopID != null">
-                #{shopID,jdbcType=BIGINT},
-            </if>
-            <if test="productID != null">
-                #{productID,jdbcType=INTEGER},
-            </if>
-            <if test="organizeProductID != null">
-                #{organizeProductID,jdbcType=INTEGER},
-            </if>
-            <if test="organizeID != null">
-                #{organizeID},
-            </if>
-            <if test="num != null">
-                #{num,jdbcType=INTEGER},
-            </if>
-            <if test="presentNum != null">
-                #{presentNum,jdbcType=INTEGER},
-            </if>
-            <if test="outStoreType != null">
-                #{outStoreType,jdbcType=CHAR},
-            </if>
-            <if test="productNo != null">
-                #{productNo,jdbcType=VARCHAR},
-            </if>
-            <if test="price != null">
-                #{price,jdbcType=DECIMAL},
-            </if>
-            <if test="normalPrice != null">
-                #{normalPrice,jdbcType=DECIMAL},
-            </if>
-            <if test="costPrice != null">
-                #{costPrice,jdbcType=DECIMAL},
-            </if>
-            <if test="totalAmount != null">
-                #{totalAmount,jdbcType=DECIMAL},
-            </if>
-            <if test="totalFee != null">
-                #{totalFee,jdbcType=DECIMAL},
-            </if>
-            <if test="shouldPayFee != null">
-                #{shouldPayFee,jdbcType=DECIMAL},
-            </if>
-            <if test="discount != null">
-                #{discount,jdbcType=DECIMAL},
-            </if>
-            <if test="discountPrice != null">
-                #{discountPrice,jdbcType=DECIMAL},
-            </if>
-            <if test="taxRate != null">
-                #{taxRate,jdbcType=DECIMAL},
-            </if>
-            <if test="addedValueTax != null">
-                #{addedValueTax,jdbcType=DECIMAL},
-            </if>
-            <if test="totalAddedValueTax != null">
-                #{totalAddedValueTax,jdbcType=DECIMAL},
-            </if>
-            <if test="shouldPayTotalTax != null">
-                #{shouldPayTotalTax,jdbcType=DECIMAL},
-            </if>
-            <if test="singleShouldPayTotalTax != null">
-                #{singleShouldPayTotalTax,jdbcType=DECIMAL},
-            </if>
-            <if test="shopProductAmount != null">
-                #{shopProductAmount,jdbcType=DECIMAL},
-            </if>
-            <if test="shopFee != null">
-                #{shopFee,jdbcType=DECIMAL},
-            </if>
-            <if test="otherFee != null">
-                #{otherFee,jdbcType=DECIMAL},
-            </if>
-            <if test="cmFee != null">
-                #{cmFee,jdbcType=DECIMAL},
-            </if>
-            <if test="singleShopFee != null">
-                #{singleShopFee,jdbcType=DECIMAL},
-            </if>
-            <if test="singleOtherFee != null">
-                #{singleOtherFee,jdbcType=DECIMAL},
-            </if>
-            <if test="singleCmFee != null">
-                #{singleCmFee,jdbcType=DECIMAL},
-            </if>
-            <if test="status != null">
-                #{status,jdbcType=CHAR},
-            </if>
-            <if test="totalBeans != null">
-                #{totalBeans,jdbcType=DECIMAL},
-            </if>
-            <if test="useBalanceAmount != null">
-                #{useBalanceAmount,jdbcType=DOUBLE},
-            </if>
-            <if test="useBeanAmount != null">
-                #{useBeanAmount,jdbcType=INTEGER},
-            </if>
-            <if test="notOutStore != null">
-                #{notOutStore,jdbcType=INTEGER},
-            </if>
-            <if test="cmbeanPrice != null">
-                #{cmbeanPrice,jdbcType=INTEGER},
-            </if>
-            <if test="isActProduct != null">
-                #{isActProduct,jdbcType=VARCHAR},
-            </if>
-            <if test="isGiftProduct != null">
-                #{isGiftProduct,jdbcType=VARCHAR},
-            </if>
-            <if test="productActInfo != null">
-                #{productActInfo,jdbcType=VARCHAR},
-            </if>
-            <if test="buyAgainFlag != null">
-                #{buyAgainFlag,jdbcType=CHAR},
-            </if>
-            <if test="confirmProductFlag != null">
-                #{confirmProductFlag,jdbcType=CHAR},
-            </if>
-            <if test="payStatus != null">
-                #{payStatus,jdbcType=CHAR},
-            </if>
-            <if test="shopName != null">
-                #{shopName,jdbcType=VARCHAR},
-            </if>
-            <if test="name != null">
-                #{name,jdbcType=VARCHAR},
-            </if>
-            <if test="productUnit != null">
-                #{productUnit,jdbcType=VARCHAR},
-            </if>
-            <if test="productImage != null">
-                #{productImage,jdbcType=VARCHAR},
-            </if>
-            <if test="actType != null">
-                #{actType,jdbcType=VARCHAR},
-            </if>
-            <if test="actPreferential != null">
-                #{actPreferential,jdbcType=DECIMAL},
-            </if>
-            <if test="productType != null">
-                #{productType},
-            </if>
-            <if test="orderPromotionsId != null">
-                #{orderPromotionsId},
-            </if>
-            <if test="preferential != null">
-                #{preferential,jdbcType=DECIMAL},
-            </if>
-            <if test="discountFee != null">
-                #{discountFee,jdbcType=DECIMAL},
-            </if>
-            <if test="cancelNum != null">
-                #{cancelNum,jdbcType=INTEGER},
-            </if>
-            <if test="supplierTaxRate != null">
-                #{supplierTaxRate,jdbcType=DECIMAL},
-            </if>
-            <if test="includedTax != null">
-                #{includedTax,jdbcType=VARCHAR},
-            </if>
-            <if test="invoiceType != null">
-                #{invoiceType,jdbcType=VARCHAR},
-            </if>
-            <if test="ladderPriceFlag != null">
-                #{ladderPriceFlag,jdbcType=INTEGER},
-            </if>
-            <if test="heUserId != null">
-                #{heUserId},
+            <if test="shopStatus != null">
+                #{shopStatus},
             </if>
         </trim>
     </insert>
 
+    <insert id="insertOrderProduct" keyColumn="orderProductID" keyProperty="orderProductID"
+            parameterType="com.caimei.model.po.CmOrderProductPo" useGeneratedKeys="true">
+        INSERT INTO cm_order_product (orderID, orderNo, shopOrderID, shopOrderNo, organizeID, orderPromotionsId,
+        productId, shopId,
+        name,
+        productImage, price, shopName, costPrice, normalPrice, ladderPriceFlag,
+        discountPrice, discount,
+        totalAmount, totalFee, shouldPayFee, productUnit, num, presentNum, discountFee,
+        includedTax,
+        invoiceType, taxRate, addedValueTax, totalAddedValueTax, supplierTaxRate,
+        singleShouldPayTotalTax, shouldPayTotalTax,
+        shopProductAmount, singleShopFee, shopFee, singleOtherFee, otherFee, singleCmFee,
+        cmFee,
+        payStatus, buyAgainFlag, notOutStore, isActProduct, productType, svipPriceFlag,
+        svipPriceType,
+        svipDiscount, svipReduction, skuID, cmPercent, organizePercent, shopPercent)
+        VALUES (#{orderID}, #{orderNo}, #{shopOrderID}, #{shopOrderNo}, #{organizeID}, #{orderPromotionsId},
+        #{productID}, #{shopID},
+        #{name},
+        #{productImage}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
+        #{discountPrice}, #{discount},
+        #{totalAmount}, #{totalFee}, #{shouldPayFee}, #{productUnit}, #{num}, #{presentNum}, #{discountFee},
+        #{includedTax},
+        #{invoiceType}, #{taxRate}, #{addedValueTax}, #{totalAddedValueTax}, #{supplierTaxRate},
+        #{singleShouldPayTotalTax}, #{shouldPayTotalTax},
+        #{shopProductAmount}, #{singleShopFee}, #{shopFee}, #{singleOtherFee}, #{otherFee}, #{singleCmFee},
+        #{cmFee},
+        #{payStatus}, #{buyAgainFlag}, #{notOutStore}, #{isActProduct}, #{productType}, #{svipPriceFlag},
+        #{svipPriceType}, #{svipDiscount}, #{svipReduction}, #{skuId}, #{cmPercent}, #{organizePercent},
+        #{shopPercent})
+    </insert>
+
     <insert id="insertOrderProductLadderPrice" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.caimei.model.po.OrderProductLadderPricePo">
         insert into order_product_ladder_price (orderProductId, ladderNum, buyNum, buyPrice, createDate)
@@ -1599,6 +1288,10 @@
                chp.includedTax,
                chp.invoiceType,
                chp.clubTaxPoint,
+               cs.cmPercent,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.costCheckFlag,
                p.name,
                p.shopID    AS shopId,
                p.mainImage as productImage,
@@ -1655,4 +1348,4 @@
     <select id="getHelpContent" resultType="java.lang.String">
         select content from helppage where helpPageID=#{helpId}
     </select>
-</mapper>
+</mapper>

+ 3 - 0
src/main/resources/mapper/PayOrderMapper.xml

@@ -141,6 +141,9 @@
           productUnit,
           productImage,
           productType,
+          shopPercent,
+          organizePercent,
+          cmPercent,
           orderPromotionsId
         FROM
           cm_order_product

+ 5 - 1
src/main/resources/mapper/ProductMapper.xml

@@ -51,6 +51,10 @@
                p.bigTypeID   AS "bigTypeId",
                p.smallTypeID AS "smallTypeId",
                p.tinyTypeID  AS "tinyTypeId",
+               cs.cmPercent,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.costCheckFlag,
                cs.unit,
                cs.stock,
                p.tags
@@ -99,4 +103,4 @@
         limit 1
     </select>
 
-</mapper>
+</mapper>

+ 9 - 1
src/main/resources/mapper/ShoppingCartMapper.xml

@@ -66,6 +66,10 @@
                cc.cm_cartID    AS cartId,
                cc.productID    AS productId,
                cc.productCount as num,
+               cs.cmPercent,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.costCheckFlag,
                cc.heUserId,
                chs.price,
                chs.price       as normalPrice,
@@ -99,6 +103,10 @@
                p.name,
                p.shopID        AS shopId,
                p.mainImage     as productImage,
+               cs.cmPercent,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.costCheckFlag,
                cs.unit         as productUnit
         FROM cm_cart cc
                  LEFT JOIN cm_sku cs on cc.skuId = cs.skuId
@@ -114,4 +122,4 @@
         FROM cm_cart
         WHERE cm_cartID = #{cartId}
     </delete>
-</mapper>
+</mapper>