zhijiezhao 3 年之前
父節點
當前提交
e69a1880a7

+ 10 - 4
src/main/java/com/caimei365/order/components/OrderCommonService.java

@@ -31,6 +31,7 @@ public class OrderCommonService {
     private String domain;
     @Resource
     private OrderCommonMapper orderCommonMapper;
+
     /**
      * 设置订单状态
      */
@@ -58,7 +59,7 @@ public class OrderCommonService {
      */
     public void getShopOrderData(OrderVo order) {
         // 子订单
-        if (StringUtils.isEmpty(order.getShopOrderIds())){
+        if (StringUtils.isEmpty(order.getShopOrderIds())) {
             return;
         }
         String[] shopOrderIdArr = order.getShopOrderIds().split(",");
@@ -96,13 +97,16 @@ public class OrderCommonService {
                 if (null != orderProduct.getSvipPriceFlag() && 1 == orderProduct.getSvipPriceFlag()) {
                     if (1 == orderProduct.getSvipPriceType()) {
                         orderProduct.setSvipPriceTag(MathUtil.div(orderProduct.getSvipDiscount(), 10, 1) + "折");
-                    } else if (2 == orderProduct.getSvipPriceType()){
+                    } else if (2 == orderProduct.getSvipPriceType()) {
                         orderProduct.setSvipPriceTag("¥" + orderProduct.getDiscountPrice());
                     }
                 }
             });
             shopOrder.setOrderProductList(orderProductList);
             shopOrder.setShopLogo(ImageUtil.getImageUrl("shopLogo", shopOrder.getShopLogo(), domain));
+            if (0 == order.getOnlinePayFlag()) {
+                shopOrder.setObligation(MathUtil.sub(shopOrder.getRealPay(), shopOrder.getReceiptAmount()).doubleValue());
+            }
         });
         // 过滤运费商品
         shopOrderList.removeIf(shopOrder -> shopOrder.getShopId() == 998);
@@ -112,6 +116,7 @@ public class OrderCommonService {
 
     /**
      * 设置付款金额
+     *
      * @param order OrderVo
      */
     public List<DiscernReceiptVo> getDiscernReceiptAndSetOrder(OrderVo order) {
@@ -174,7 +179,8 @@ public class OrderCommonService {
 
     /**
      * 设置搜索关键词历史记录
-     * @param userId 用户Id
+     *
+     * @param userId     用户Id
      * @param searchWord 搜索关键词
      */
     public void setHistoryRecord(Integer userId, String searchWord) {
@@ -187,7 +193,7 @@ public class OrderCommonService {
         // 查询搜索关键词历史记录是否存在
         Integer recordId = orderCommonMapper.getSearchHistoryIdByWord(searchWord);
         // 保存搜索关键词历史记录
-        if (null != recordId && recordId >0) {
+        if (null != recordId && recordId > 0) {
             historyRecord.setId(recordId);
             orderCommonMapper.updateSearchHistory(historyRecord);
         } else {

+ 3 - 2
src/main/resources/mapper/OrderCommonMapper.xml

@@ -37,9 +37,10 @@
         s.name AS shopName,
         s.logo AS shopLogo,
         s.shopType as shopType,
-        cso.receiptAmount,
+        ifnull(cso.receiptAmount,0) as receiptAmount,
         cso.eachDiscount,
-        cso.realPay
+        cso.realPay,
+        cso.receiptStatus
         FROM cm_shop_order cso
         LEFT JOIN shop s ON cso.shopID = s.shopID
         WHERE cso.delFlag = 0