zhijiezhao 2 years ago
parent
commit
400f79126f
41 changed files with 448 additions and 131 deletions
  1. 0 1
      src/main/java/com/caimei/modules/homepage/service/impl/PageServiceImpl.java
  2. 11 0
      src/main/java/com/caimei/modules/order/controller/CmReturnedPurchaseController.java
  3. 1 1
      src/main/java/com/caimei/modules/order/controller/OrderPayShopController.java
  4. 9 0
      src/main/java/com/caimei/modules/order/controller/OrganizeOrderController.java
  5. 3 0
      src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java
  6. 4 0
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  7. 4 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  8. 2 0
      src/main/java/com/caimei/modules/order/dao/PayShopDao.java
  9. 8 0
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  10. 4 0
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  11. 2 0
      src/main/java/com/caimei/modules/order/entity/OrderPayShopDetail.java
  12. 26 0
      src/main/java/com/caimei/modules/order/entity/ReturnRecord.java
  13. 7 1
      src/main/java/com/caimei/modules/order/entity/SettleRecord.java
  14. 29 0
      src/main/java/com/caimei/modules/order/entity/Voucher.java
  15. 3 0
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  16. 5 0
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  17. 1 1
      src/main/java/com/caimei/modules/order/service/PayShopService.java
  18. 2 1
      src/main/java/com/caimei/modules/order/service/impl/CmDiscernReceiptServiceImpl.java
  19. 20 0
      src/main/java/com/caimei/modules/order/service/impl/CmReturnedPurchaseServiceImpl.java
  20. 7 0
      src/main/java/com/caimei/modules/order/service/impl/NewOrderServiceImpl.java
  21. 18 9
      src/main/java/com/caimei/modules/order/service/impl/PayShopServiceImpl.java
  22. 79 3
      src/main/java/com/caimei/modules/order/util/OrderUtils.java
  23. 1 1
      src/main/java/com/caimei/modules/shiro/auth/AuthFilter.java
  24. 4 3
      src/main/resources/application.yml
  25. 1 1
      src/main/resources/mapper/ActiveMapper.xml
  26. 1 1
      src/main/resources/mapper/BannerMapper.xml
  27. 1 1
      src/main/resources/mapper/BpClauseMapper.xml
  28. 6 5
      src/main/resources/mapper/CmDiscernReceiptMapper.xml
  29. 5 6
      src/main/resources/mapper/CmMallOrganizeProductsMapper.xml
  30. 1 1
      src/main/resources/mapper/CmOperationUserMapper.xml
  31. 16 9
      src/main/resources/mapper/CmReturnedPurchaseMapper.xml
  32. 6 6
      src/main/resources/mapper/CmReturnedPurchaseProductMapper.xml
  33. 7 7
      src/main/resources/mapper/CmUserMapper.xml
  34. 1 1
      src/main/resources/mapper/FloorMapper.xml
  35. 2 2
      src/main/resources/mapper/LogisticsBatchMapper.xml
  36. 1 1
      src/main/resources/mapper/MainMenuMapper.xml
  37. 27 10
      src/main/resources/mapper/NewOrderMapper.xml
  38. 1 1
      src/main/resources/mapper/NewOrderProductMapper.xml
  39. 42 17
      src/main/resources/mapper/NewShopOrderMapper.xml
  40. 79 40
      src/main/resources/mapper/PayShopDao.xml
  41. 1 1
      src/main/resources/mapper/ThemeMapper.xml

+ 0 - 1
src/main/java/com/caimei/modules/homepage/service/impl/PageServiceImpl.java

@@ -6,7 +6,6 @@ import com.caimei.modules.homepage.enity.*;
 import com.caimei.modules.homepage.service.PageService;
 import com.caimei.utils.ResponseJson;
 import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 

+ 11 - 0
src/main/java/com/caimei/modules/order/controller/CmReturnedPurchaseController.java

@@ -5,6 +5,7 @@ import com.caimei.modules.order.entity.CmReturnedPurchase;
 import com.caimei.modules.order.entity.NewOrder;
 import com.caimei.modules.order.service.CmReturnedPurchaseService;
 import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.util.OrderUtils;
 import com.caimei.utils.JsonModel;
 import com.caimei.utils.ResponseJson;
 import com.github.pagehelper.PageHelper;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
 
 @Api(tags = "退货退款api")
 @RequiredArgsConstructor
@@ -28,6 +30,8 @@ public class CmReturnedPurchaseController {
 
     private final NewOrderService newOrderService;
 
+    private final OrderUtils orderUtil;
+
 
     @ApiOperation("用户退款列表")
     @GetMapping(value = "list")
@@ -44,6 +48,7 @@ public class CmReturnedPurchaseController {
     public ResponseJson<NewOrder> toReturnRecord(@PathVariable("id") Integer id) {
         CmReturnedPurchase cmReturnedPurchase = cmReturnedPurchaseService.get(id);
         NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderId().toString());
+        orderUtil.setOrderPostInfo(newOrder);
         newOrder.setCmReturnedPurchase(cmReturnedPurchase);
         cmReturnedPurchaseService.toReturnRecord(newOrder, cmReturnedPurchase);
         return ResponseJson.success(newOrder);
@@ -55,5 +60,11 @@ public class CmReturnedPurchaseController {
         return ResponseJson.success(cmReturnedPurchaseService.getReturnDetailList(orderId));
     }
 
+    @ApiOperation("退付款记录")
+    @GetMapping(value = "/returnAndPay/{shopOrderId}")
+    public ResponseJson<Map<String, Object>> returnAndPay(@PathVariable("shopOrderId") Integer shopOrderId) {
+        return ResponseJson.success(cmReturnedPurchaseService.getReturnAndPay(shopOrderId));
+    }
+
 
 }

+ 1 - 1
src/main/java/com/caimei/modules/order/controller/OrderPayShopController.java

@@ -84,7 +84,7 @@ public class OrderPayShopController {
     @ApiImplicitParam(required = true, name = "shopOrderIds", value = "子订单IdList")
     @PostMapping("/apply/pays")
     public ResponseJson<OrderPayShopDetail> applyPayList(@RequestBody List<Integer> shopOrderIds) {
-        return ResponseJson.success(payShopService.applyPayList(shopOrderIds));
+        return payShopService.applyPayList(shopOrderIds);
     }
 
     @ApiOperation("审核付款单")

+ 9 - 0
src/main/java/com/caimei/modules/order/controller/OrganizeOrderController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.caimei.modules.club.entity.Page;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.service.*;
+import com.caimei.modules.order.util.OrderUtils;
 import com.caimei.utils.JsonModel;
 import com.caimei.utils.ResponseJson;
 import io.swagger.annotations.Api;
@@ -34,6 +35,8 @@ public class OrganizeOrderController {
 
     private final CmDiscernReceiptService cmDiscernReceiptService;
 
+    private final OrderUtils orderUtil;
+
     @ModelAttribute
     public NewOrder getOrder(@RequestParam(required = false) String id) {
         NewOrder entity = null;
@@ -107,7 +110,11 @@ public class OrganizeOrderController {
         if (order.getProductCount() == null) {
             order.setProductCount(1);
         }
+        orderUtil.setOrderPostInfo(order);
         map.put("order", order);
+
+        List<Voucher> vouchers = newOrderService.findVoucher(order.getOrderId());
+        map.put("voucher", vouchers);
         CmReturnedPurchase cmReturnedPurchase = new CmReturnedPurchase();
         cmReturnedPurchase.setStatus("2");
         cmReturnedPurchase.setOrderId(order.getOrderId());
@@ -146,6 +153,7 @@ public class OrganizeOrderController {
         JsonModel jsonModel = JsonModel.newInstance();
         Map<String, Object> map = new HashMap(6);
         NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderId().toString());
+        orderUtil.setOrderPostInfo(newOrder);
         List<CmReceiptOrderRelation> listRelation = cmReceiptOrderRelationService.findByOrderId(newOrder.getOrderId());
         List<CmReturnedPurchase> dataList = cmReturnedPurchaseService.getReturnedPurchaseList(cmReturnedPurchase);
         //退款总额
@@ -170,6 +178,7 @@ public class OrganizeOrderController {
         Map<String, Object> map = new HashMap();
         try {
             NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderId().toString());
+            orderUtil.setOrderPostInfo(newOrder);
             List<CmReturnedPurchase> dataList = cmReturnedPurchaseService.getReturnedPurchaseList(cmReturnedPurchase);
             //退款(退货)总金额
             Double returnedPurchaseFee = 0D;

+ 3 - 0
src/main/java/com/caimei/modules/order/dao/CmReturnedPurchaseDao.java

@@ -2,6 +2,7 @@ package com.caimei.modules.order.dao;
 
 import com.caimei.modules.order.entity.CmReturnedPurchase;
 import com.caimei.modules.order.entity.NewShopOrder;
+import com.caimei.modules.order.entity.ReturnRecord;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -23,4 +24,6 @@ public interface CmReturnedPurchaseDao {
     List<NewShopOrder> findReturnShopOrder(Integer id);
 
     List<Integer> findReturnIds(Integer orderId);
+
+    List<ReturnRecord> findRecordByShopOrder(Integer shopOrderId);
 }

+ 4 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -49,4 +49,8 @@ public interface NewOrderDao {
     List<String> findNotes(Integer orderId);
 
     void updateReceiptStatus(Integer status, Integer orderId);
+
+    List<Voucher> findVoucher(Integer orderId);
+
+    List<String> findVocherImage(Integer id);
 }

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

@@ -26,4 +26,8 @@ public interface NewShopOrderDao {
     void inPaying(Integer payShopId);
 
     List<NewShopOrder> findPayShopOrderList(OrderPayShop orderPayShop);
+
+    Double findColdChain(Integer orderId);
+
+    List<Integer> findSettleStatus(Integer orderId);
 }

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

@@ -84,4 +84,6 @@ public interface PayShopDao {
     List<SettleRecord> findSettleRecord(Integer orderId);
 
     void insertPayRecordForNow(OrderPayShopRecord shopRecord);
+
+    List<OrderPayShopRecord> findPayShopRecordsByShopOrder(Integer shopOrderId);
 }

+ 8 - 0
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -19,6 +19,12 @@ public class NewOrder implements Serializable {
 
     private String orderNo;
 
+    @ApiModelProperty("结算状态")
+    private Integer settleStatus;
+
+    @ApiModelProperty("邮费信息")
+    private String PostageInfo;
+
     @ApiModelProperty("订单归属人userId")
     private Integer userId;
 
@@ -202,6 +208,8 @@ public class NewOrder implements Serializable {
     @ApiModelProperty("有没有收款待审核的订单 , 有的1")
     private String toAudit;
 
+    private String productName;
+
     /**
      * 当主订单为【待收款】或者为线下支付的【部分收款】状态时,才显示更改订单状态按钮
      * (排除交易全退订单)

+ 4 - 0
src/main/java/com/caimei/modules/order/entity/NewShopOrder.java

@@ -17,6 +17,10 @@ import java.util.List;
 @Data
 public class NewShopOrder {
 
+    @ApiModelProperty("邮费信息")
+    private String postageInfo;
+    @ApiModelProperty("是否包含冷链费 0不包含 1包含")
+    private Integer isColdChina;
     @ApiModelProperty("展示字段:付款单详情所有子订单")
     private List<String> shopOrderNos;
     @ApiModelProperty("主订单金额")

+ 2 - 0
src/main/java/com/caimei/modules/order/entity/OrderPayShopDetail.java

@@ -19,6 +19,8 @@ public class OrderPayShopDetail implements Serializable {
 
     @ApiModelProperty("其他不传,1编辑付款单")
     private Integer operateMode;
+    @ApiModelProperty("邮费信息")
+    private String PostageInfo;
 
     @ApiModelProperty("供应商付款账号的户名")
     private String bankAccountName;

+ 26 - 0
src/main/java/com/caimei/modules/order/entity/ReturnRecord.java

@@ -0,0 +1,26 @@
+package com.caimei.modules.order.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author zzj
+ */
+@ApiModel(description = "退款记录")
+@Data
+public class ReturnRecord  implements Serializable {
+
+    @ApiModelProperty("退款记录Id")
+    private Integer id;
+    @ApiModelProperty("退款时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String returnTime;
+    @ApiModelProperty("退款方式")
+    private String returnWay;
+    @ApiModelProperty("退款金额")
+    private Double amount;
+}

+ 7 - 1
src/main/java/com/caimei/modules/order/entity/SettleRecord.java

@@ -14,10 +14,16 @@ public class SettleRecord implements Serializable {
 
     @ApiModelProperty("结算金额")
     private Double settleAmount;
-    @ApiModelProperty("结算类型 1供应商成本,2佣金")
+    @ApiModelProperty("结算类型 1供应商成本,2采美佣金,3外部商城佣金")
     private Integer settleType;
     @ApiModelProperty("子订单id")
     private Integer shopOrderId;
+    @ApiModelProperty("结算供应商金额")
+    private Double shouldSettleShop;
+    @ApiModelProperty("结算采美金额")
+    private Double shouldSettleCm;
+    @ApiModelProperty("结算组织金额")
+    private Double shouldSettleOrganize;
     @ApiModelProperty("分帐号")
     private String splitCode;
     @ApiModelProperty("结算时间")

+ 29 - 0
src/main/java/com/caimei/modules/order/entity/Voucher.java

@@ -0,0 +1,29 @@
+package com.caimei.modules.order.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author zzj
+ */
+@ApiModel("线下支付凭证")
+@Data
+public class Voucher implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("凭证Id")
+    private Integer id;
+    private Integer orderId;
+    @ApiModelProperty("备注")
+    private String remarks;
+    @ApiModelProperty("添加时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String addTime;
+    private List<String> images;
+}

+ 3 - 0
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -4,6 +4,7 @@ import com.caimei.modules.order.entity.CmReturnedPurchase;
 import com.caimei.modules.order.entity.NewOrder;
 
 import java.util.List;
+import java.util.Map;
 
 public interface CmReturnedPurchaseService {
 
@@ -18,4 +19,6 @@ public interface CmReturnedPurchaseService {
     void toReturnRecord(NewOrder newOrder,CmReturnedPurchase cmReturnedPurchase);
 
     List<NewOrder> getReturnDetailList(Integer orderId);
+
+    Map<String, Object> getReturnAndPay(Integer shopOrderId);
 }

+ 5 - 0
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -2,8 +2,11 @@ package com.caimei.modules.order.service;
 
 import com.caimei.modules.club.entity.Page;
 import com.caimei.modules.order.entity.NewOrder;
+import com.caimei.modules.order.entity.Voucher;
 import com.caimei.utils.ResponseJson;
 
+import java.util.List;
+
 public interface NewOrderService {
 
     Page<NewOrder> findList(NewOrder newOrder, Page page);
@@ -11,4 +14,6 @@ public interface NewOrderService {
     NewOrder get(String id);
 
     ResponseJson checkReceipt(Double amount, Integer status, Integer orderId);
+
+    List<Voucher> findVoucher(Integer orderId);
 }

+ 1 - 1
src/main/java/com/caimei/modules/order/service/PayShopService.java

@@ -31,7 +31,7 @@ public interface PayShopService {
 
     PageInfo<NewShopOrder> findPayOrderList(OrderPayShop orderPayShop, Integer pageNum, Integer pageSize);
 
-    OrderPayShopDetail applyPayList(List<Integer> shopOrderIds);
+    ResponseJson<OrderPayShopDetail> applyPayList(List<Integer> shopOrderIds);
 
     ResponseJson<PageInfo<NewOrder>> orderPayInfoList(OrderPayShop orderPayShop, Integer pageNum, Integer pageSize);
 

+ 2 - 1
src/main/java/com/caimei/modules/order/service/impl/CmDiscernReceiptServiceImpl.java

@@ -1,16 +1,17 @@
 package com.caimei.modules.order.service.impl;
 
 import com.caimei.modules.order.dao.CmDiscernReceiptDao;
-import com.caimei.modules.order.dao.NewOrderDao;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.service.CmDiscernReceiptService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.List;
 
+@Slf4j
 @Service
 public class CmDiscernReceiptServiceImpl implements CmDiscernReceiptService {
 

+ 20 - 0
src/main/java/com/caimei/modules/order/service/impl/CmReturnedPurchaseServiceImpl.java

@@ -29,6 +29,10 @@ public class CmReturnedPurchaseServiceImpl implements CmReturnedPurchaseService
     private NewOrderService orderService;
     @Resource
     private OrderUtils orderUtil;
+    @Resource
+    private PayShopDao payShopDao;
+    @Resource
+    private NewShopOrderDao shopOrderDao;
 
     @Override
     public List<Integer> findOrderIdsInApplyReturnFlag(List<Integer> oId) {
@@ -146,4 +150,20 @@ public class CmReturnedPurchaseServiceImpl implements CmReturnedPurchaseService
         });
         return newOrders;
     }
+
+    @Override
+    public Map<String, Object> getReturnAndPay(Integer shopOrderId) {
+        Map<String, Object> map = new HashMap<>();
+        OrderPayShop orderPayShop = new OrderPayShop();
+        orderPayShop.setShopOrderId(shopOrderId);
+        NewShopOrder shopOrder = shopOrderDao.findPayShopOrderList(orderPayShop).get(0);
+        orderUtil.getShouldPay(shopOrder);
+        orderUtil.setShopPostInfo(shopOrder);
+        List<OrderPayShopRecord> pays = payShopDao.findPayShopRecordsByShopOrder(shopOrderId);
+        List<ReturnRecord> returns = cmReturnedPurchaseDao.findRecordByShopOrder(shopOrderId);
+        map.put("shopOrder", shopOrder);
+        map.put("pays", pays);
+        map.put("returns", returns);
+        return map;
+    }
 }

+ 7 - 0
src/main/java/com/caimei/modules/order/service/impl/NewOrderServiceImpl.java

@@ -173,4 +173,11 @@ public class NewOrderServiceImpl implements NewOrderService {
         orderUtil.addReceiptRecord(amount, status, orderId);
         return ResponseJson.success();
     }
+
+    @Override
+    public List<Voucher> findVoucher(Integer orderId) {
+        List<Voucher> voucher = newOrderDao.findVoucher(orderId);
+        voucher.forEach(v -> v.setImages(newOrderDao.findVocherImage(v.getId())));
+        return voucher;
+    }
 }

+ 18 - 9
src/main/java/com/caimei/modules/order/service/impl/PayShopServiceImpl.java

@@ -60,13 +60,14 @@ public class PayShopServiceImpl implements PayShopService {
         OrderPayShopDetail detail = payShopDao.findPayShopDetail(id);
         List<NewShopOrder> shopOrders = payShopDao.findPayShopOrders(detail.getPayShopId());
         shopOrders.forEach(s -> orderUtils.getShouldPay(s));
+        detail.setShopOrders(shopOrders);
+        orderUtils.setPayShopPostInfo(detail);
         Double totalPayShop = shopOrders.stream().mapToDouble(NewShopOrder::getPayedShopAmount).sum();
         // 付供应商
         detail.setTotalAmount(totalPayShop);
         Double totalPayCm = shopOrders.stream().mapToDouble(NewShopOrder::getPayCmAmount).sum();
         // 付采美
         detail.setPayCmTotalAmount(totalPayCm);
-        detail.setShopOrders(shopOrders);
         return detail;
     }
 
@@ -375,19 +376,25 @@ public class PayShopServiceImpl implements PayShopService {
         List<NewShopOrder> shopOrders = newShopOrderDao.findPayShopOrderList(orderPayShop);
         shopOrders.forEach(s -> {
             orderUtils.getShouldPay(s);
+            orderUtils.setShopPostInfo(s);
         });
         return new PageInfo(shopOrders);
     }
 
     @Override
-    public OrderPayShopDetail applyPayList(List<Integer> shopOrderIds) {
-        OrderPayShopDetail detail = new OrderPayShopDetail();
-        List<NewShopOrder> shopOrders = payShopDao.findPayShopOrderByShopOrderIds(shopOrderIds);
-        shopOrders.forEach(s -> orderUtils.getShouldPay(s));
-        detail.setShopId(shopOrders.get(0).getShopId());
-        detail.setShopName(shopOrders.get(0).getShopName());
-        detail.setShopOrders(shopOrders);
-        return detail;
+    public ResponseJson<OrderPayShopDetail> applyPayList(List<Integer> shopOrderIds) {
+        if (null != shopOrderIds && shopOrderIds.size() > 0) {
+            OrderPayShopDetail detail = new OrderPayShopDetail();
+            List<NewShopOrder> shopOrders = payShopDao.findPayShopOrderByShopOrderIds(shopOrderIds);
+            shopOrders.forEach(s -> orderUtils.getShouldPay(s));
+            detail.setShopOrders(shopOrders);
+            orderUtils.setPayShopPostInfo(detail);
+            detail.setShopId(shopOrders.get(0).getShopId());
+            detail.setShopName(shopOrders.get(0).getShopName());
+
+            return ResponseJson.success(detail);
+        }
+        return ResponseJson.error("未选择子订单!");
     }
 
     @Override
@@ -416,6 +423,7 @@ public class PayShopServiceImpl implements PayShopService {
         NewOrder newOrder = newOrderDao.get(orderId.toString());
         orderUtils.setReceiverVal(newOrder);
         orderUtils.setRefundVal(newOrder);
+        orderUtils.setOrderPostInfo(newOrder);
         val.put("order", newOrder);
         List<ReceiptVo> receiptVos = orderUtils.getReceiptRecord(newOrder);
         val.put("receiptList", receiptVos);
@@ -463,6 +471,7 @@ public class PayShopServiceImpl implements PayShopService {
         NewOrder newOrder = newOrderDao.get(orderId.toString());
         orderUtils.setReceiverVal(newOrder);
         orderUtils.setRefundVal(newOrder);
+        orderUtils.setSettleStatus(newOrder);
         val.put("order", newOrder);
         List<SettleRecord> settleRecord = orderUtils.getSettleRecord(newOrder);
         val.put("settleRecord", settleRecord);

+ 79 - 3
src/main/java/com/caimei/modules/order/util/OrderUtils.java

@@ -246,6 +246,22 @@ public class OrderUtils {
         }
     }
 
+    public NewOrder setOrderPostInfo(NewOrder order) {
+        Double fee = shopOrderDao.findColdChain(order.getOrderId());
+        fee = fee != null ? fee : 0;
+        //     拼接运费信息--联合丽格
+        if ("-1".equals(order.getFreePostFlag())) {
+            // 到付
+            order.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 到付)");
+        } else if ("0".equals(order.getFreePostFlag())) {
+            // 包邮
+            order.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 包邮)");
+        } else {
+            // 有运费
+            order.setPostageInfo("¥" + MathUtil.add(fee, order.getFreight()).doubleValue() + "(冷链费: ¥" + fee + ", 其他: ¥" + order.getFreight() + ")");
+        }
+        return order;
+    }
 
     public NewOrder setOrderValue(NewOrder order) {
         List<NewShopOrder> shopOrders = shopOrderDao.findListByOrderId(order.getOrderId());
@@ -255,12 +271,13 @@ public class OrderUtils {
 
         Double totalPayShop = shopOrders.stream().mapToDouble(NewShopOrder::getShouldPayShopAmount).sum();
         Double totalPayCm = shopOrders.stream().mapToDouble(NewShopOrder::getShouldPayCmAmount).sum();
-        order.setPayableAmount(MathUtil.add(totalPayShop,totalPayCm).doubleValue());
+        order.setPayableAmount(MathUtil.add(totalPayShop, totalPayCm).doubleValue());
 
         Double totalPaidShop = shopOrders.stream().mapToDouble(NewShopOrder::getPayedShopAmount).sum();
         Double totalPaidCm = shopOrders.stream().mapToDouble(NewShopOrder::getPayCmAmount).sum();
-        order.setPaidAmount(MathUtil.add(totalPaidCm,totalPaidShop).doubleValue());
+        order.setPaidAmount(MathUtil.add(totalPaidCm, totalPaidShop).doubleValue());
         setRefundVal(order);
+        setOrderPostInfo(order);
         return order;
     }
 
@@ -449,6 +466,65 @@ public class OrderUtils {
     }
 
     public List<SettleRecord> getSettleRecord(NewOrder newOrder) {
-        return payShopDao.findSettleRecord(newOrder.getOrderId());
+        List<SettleRecord> settleRecord = payShopDao.findSettleRecord(newOrder.getOrderId());
+        settleRecord.forEach(s -> {
+            double payCm = 0d;
+            double payShop = 0d;
+            double payOrg = 0d;
+            payShop = 1 == s.getSettleType() ? s.getSettleAmount() : 0d;
+            payCm = 2 == s.getSettleType() ? s.getSettleAmount() : 0d;
+            payOrg = 3 == s.getSettleType() ? s.getSettleAmount() : 0d;
+            s.setShouldSettleCm(payCm);
+            s.setShouldSettleShop(payShop);
+            s.setShouldSettleOrganize(payOrg);
+        });
+        return settleRecord;
+    }
+
+    public void setPayShopPostInfo(OrderPayShopDetail detail) {
+        NewOrder order = newOrderDao.get(detail.getShopOrders().get(0).getOrderId().toString());
+        Double fee = shopOrderDao.findColdChain(detail.getShopOrders().get(0).getOrderId());
+        fee = fee != null ? fee : 0;
+        //     拼接运费信息--联合丽格
+        if ("-1".equals(order.getFreePostFlag())) {
+            // 到付
+            detail.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 到付)");
+        } else if ("0".equals(order.getFreePostFlag())) {
+            // 包邮
+            detail.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 包邮)");
+        } else {
+            // 有运费
+            detail.setPostageInfo("¥" + MathUtil.add(fee, order.getFreight()).doubleValue() + "(冷链费: ¥" + fee + ", 其他: ¥" + order.getFreight() + ")");
+        }
+    }
+
+    public void setShopPostInfo(NewShopOrder s) {
+        NewOrder order = newOrderDao.get(s.getOrderId().toString());
+        Double fee = shopOrderDao.findColdChain(s.getOrderId());
+        fee = fee != null ? fee : 0;
+        //     拼接运费信息--联合丽格
+        if ("-1".equals(order.getFreePostFlag())) {
+            // 到付
+            s.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 到付)");
+        } else if ("0".equals(order.getFreePostFlag())) {
+            // 包邮
+            s.setPostageInfo("¥" + fee + "(冷链费: ¥" + fee + ", 其他: 包邮)");
+        } else {
+            // 有运费
+            s.setPostageInfo("¥" + MathUtil.add(fee, order.getFreight()).doubleValue() + "(冷链费: ¥" + fee + ", 其他: ¥" + order.getFreight() + ")");
+        }
+    }
+
+    public void setSettleStatus(NewOrder newOrder) {
+        List<Integer> status = shopOrderDao.findSettleStatus(newOrder.getOrderId());
+        if (!status.contains(3) && !status.contains(2)) {
+            newOrder.setSettleStatus(1);
+        }
+        if (status.contains(2) || status.contains(3)) {
+            newOrder.setSettleStatus(2);
+        }
+        if (!status.contains(1) && !status.contains(2)) {
+            newOrder.setSettleStatus(3);
+        }
     }
 }

+ 1 - 1
src/main/java/com/caimei/modules/shiro/auth/AuthFilter.java

@@ -116,7 +116,7 @@ public class AuthFilter extends AuthenticatingFilter {
             //处理登录失败的异常
             Throwable throwable = e.getCause() == null ? e : e.getCause();
             Map<String, Object> result = new HashMap<>();
-            result.put("status", "-1");
+            result.put("status", "-99");
             result.put("msg", "登录异常,请重新登录");
             String json = JSON.toJSONString(result);
             httpResponse.getWriter().print(json);

+ 4 - 3
src/main/resources/application.yml

@@ -3,9 +3,10 @@ spring:
     active: @activatedProperties@
 
 # 开启logging myabtis语句打印
-# mybatis:
-#   configuration:
-#     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#mybatis:
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
 logging:
   level:
     com.caimei.modules.products.dao: debug

+ 1 - 1
src/main/resources/mapper/ActiveMapper.xml

@@ -33,7 +33,7 @@
             <if test="topic != null and topic !=''">
                 topic = #{topic},
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 enabledStatus = #{enabledStatus}
             </if>
         </set>

+ 1 - 1
src/main/resources/mapper/BannerMapper.xml

@@ -78,7 +78,7 @@
             <if test="bannerName != null and bannerName != ''">
                 AND bannerName LIKE concat('%',#{bannerName},'%')
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 AND enabledStatus = #{enabledStatus}
             </if>
         </where>

+ 1 - 1
src/main/resources/mapper/BpClauseMapper.xml

@@ -20,7 +20,7 @@
             <if test="name != null and name != ''">
                 AND a.name LIKE concat('%',#{name},'%')
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 AND a.enabledStatus = #{enabledStatus}
             </if>
         </where>

+ 6 - 5
src/main/resources/mapper/CmDiscernReceiptMapper.xml

@@ -70,10 +70,10 @@
         left join cm_shop_order cso on cso.orderId = crr.orderId
         LEFT JOIN cm_offline_collection cof ON a.payType = cof.type
         <where>
-            <if test="receiptId != null and receiptId != 0 ">
+            <if test="organizeId != null">
                 AND cr.organizeId = #{organizeId}
             </if>
-            <if test="receiptId != null and receiptId != 0 ">
+            <if test="receiptId != null">
                 AND a.id = #{receiptId}
             </if>
             <if test="startTime != null and startTime != ''">
@@ -101,7 +101,7 @@
                 AND (u.userName LIKE concat('%',#{userName},'%') or u.name LIKE concat('%',#{userName},'%'))
             </if>
             <if test="receiptProgress != null">
-                cr.receiptStatus = #{receiptProgress}
+                AND cr.receiptStatus = #{receiptProgress}
             </if>
             <if test="associationNum != null and associationNum != ''">
                 <if test="associationNum == 1">
@@ -112,9 +112,10 @@
                     <![CDATA[ > ]]> 1
                 </if>
             </if>
-            and a.delFlag = '0' group by a.id
+            and a.delFlag = 0
         </where>
-        order by a.receiptDate desc
+        group by a.id
+        order by a.id desc
     </select>
 
     <select id="findReceiptDetail" resultType="com.caimei.modules.order.entity.ReceiptDetail">

+ 5 - 6
src/main/resources/mapper/CmMallOrganizeProductsMapper.xml

@@ -26,16 +26,16 @@
         FROM cm_mall_organize_products a
         <include refid="cmMallOrganizeProductsJoins"/>
         <where>
-            <if test="id != null and id != ''">
+            <if test="id != null">
                 AND a.id = #{id}
             </if>
-            <if test="productId != null and productId != ''">
+            <if test="productId != null">
                 AND a.productId = #{productId}
             </if>
-            <if test="organizeId != null and organizeId != ''">
+            <if test="organizeId != null">
                 AND a.organizeId = #{organizeId}
             </if>
-            <if test="validFlag != null and validFlag != ''">
+            <if test="validFlag != null">
                 AND a.validFlag = #{validFlag}
             </if>
             <if test="productName != null and productName != ''">
@@ -97,8 +97,7 @@
         FROM cm_mall_organize_products a
         <include refid="cmMallOrganizeProductsJoins"/>
         <where>
-
-            <if test="id != null and id != ''">
+            <if test="id != null">
                 AND a.id = #{id}
             </if>
             <if test="productId != null and productId != ''">

+ 1 - 1
src/main/resources/mapper/CmOperationUserMapper.xml

@@ -60,7 +60,7 @@
         FROM cm_mall_operation_user a
         <where>
             a.mobile = #{mobile}
-            <if test="id != null and id != ''">
+            <if test="id != null">
                 AND a.id != #{id}
             </if>
             AND a.delFlag = 0

+ 16 - 9
src/main/resources/mapper/CmReturnedPurchaseMapper.xml

@@ -30,8 +30,8 @@
 		a.applicationUserID AS "applicationUserId",
 		a.reviewUserID AS "reviewUserId",
 		a.refundBalanceFee AS "refundBalanceFee",
-		a.refundOnlineFee AS "refundOnlineFee",
-		a.refundOfflineFee AS "refundOfflineFee",
+		ifnull(a.refundOnlineFee,0) AS "refundOnlineFee",
+		ifnull(a.refundOfflineFee,0) AS "refundOfflineFee",
 		a.bankAccountName AS "bankAccountName",
 		a.bankAccountNo AS "bankAccountNo",
 		a.openBank AS "openBank",
@@ -76,25 +76,22 @@
         LEFT JOIN cm_order co ON a.orderID=co.orderID
         <include refid="cmReturnedPurchaseJoins"/>
         <where>
-            <if test="organizeId != null and organizeId != '' and organizeId != 0 ">
+            <if test="organizeId != null">
                 AND co.organizeID = #{organizeId}
             </if>
-            <if test="organizeId == 0 ">
-                AND co.organizeID IS NULL
-            </if>
             <if test="id != null and id != ''">
                 AND a.id = #{id}
             </if>
             <if test="returnedNo != null and returnedNo != ''">
                 AND a.returnedNo = #{returnedNo}
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND a.orderID = #{orderId}
             </if>
-            <if test="userId != null and userId != ''">
+            <if test="userId != null">
                 AND a.userID = #{userId}
             </if>
-            <if test="status != null and status != ''">
+            <if test="status != null">
                 AND a.status = #{status}
             </if>
             <if test="returnTime != null and returnTime != ''">
@@ -215,4 +212,14 @@
         where orderId = #{orderId}
         and delFlag =0
     </select>
+
+    <select id="findRecordByShopOrder" resultType="com.caimei.modules.order.entity.ReturnRecord">
+        select id,
+               refundFee as amount,
+               returnTime,
+               if(refundOnlineFee > 0,'线上退回'+refundOfflineFee+'元','线下转账'+refundOfflineFee+'元') as returnWay,
+               refundType
+        from cm_returned_purchase
+        where id = #{id}
+    </select>
 </mapper>

+ 6 - 6
src/main/resources/mapper/CmReturnedPurchaseProductMapper.xml

@@ -29,7 +29,7 @@
         left join product c on c.productId = a.productId
         left join shop d on d.shopId = a.shopId
         <where>
-            <if test="returnedId != null and returnedId != ''">
+            <if test="returnedId != null">
                 AND a.returnedId = #{returnedId}
             </if>
         </where>
@@ -42,10 +42,10 @@
         FROM cm_returned_purchase_product a
         left join cm_returned_purchase b on a.returnedId = b.id
         <where>
-            <if test="productId != null and productId != ''">
+            <if test="productId != null">
                 AND a.productId = #{productId}
             </if>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND a.shopOrderId = #{shopOrderId}
             </if>
             AND b.status in(2)
@@ -59,13 +59,13 @@
         FROM cm_returned_purchase_product a
         left join cm_returned_purchase b on a.returnedId = b.id
         <where>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND a.shopOrderId = #{shopOrderId}
             </if>
-            <if test="orderProductId != null and orderProductId != ''">
+            <if test="orderProductId != null">
                 AND a.orderProductId = #{orderProductId}
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND b.orderId = #{orderId}
             </if>
             <if test="returnTime != null and returnTime != ''">

+ 7 - 7
src/main/resources/mapper/CmUserMapper.xml

@@ -55,7 +55,7 @@
         FROM user a
         <where>
             a.bindMobile = #{bindMobile}
-            <if test="clubId != null and clubId != ''">
+            <if test="clubId != null">
                 AND a.clubId != #{clubId}
             </if>
         </where>
@@ -96,7 +96,7 @@
         loginIP,
         validFlag,
         clubStatus,
-        <if test="clubId != null and clubId != ''">
+        <if test="clubId != null">
             clubId,
         </if>
         agreeFlag,
@@ -136,7 +136,7 @@
         #{loginIP},
         #{validFlag},
         #{clubStatus},
-        <if test="clubId != null and clubId != ''">
+        <if test="clubId != null">
             #{clubId},
         </if>
         #{agreeFlag},
@@ -165,13 +165,13 @@
             <if test="realName != null and realName != ''">
                 realName = #{realName},
             </if>
-            <if test="userIdentity != null and userIdentity != ''">
+            <if test="userIdentity != null">
                 userIdentity = #{userIdentity},
             </if>
             <if test="mobile != null and mobile != ''">
                 mobile = #{mobile},
             </if>
-            <if test="userPermission != null and userPermission != ''">
+            <if test="userPermission != null">
                 userPermission = #{userPermission},
             </if>
             <if test="email != null and email != ''">
@@ -213,13 +213,13 @@
             <if test="loginTime != null and loginTime != ''">
                 loginTime = #{loginTime},
             </if>
-            <if test="validFlag != null and validFlag != ''">
+            <if test="validFlag != null">
                 validFlag = #{validFlag},
             </if>
             <if test="clubStatus != null and clubStatus != ''">
                 clubStatus = #{clubStatus},
             </if>
-            <if test="clubId != null and clubId != ''">
+            <if test="clubId != null">
                 clubId = #{clubId},
             </if>
             <if test="agreeFlag != null and agreeFlag != ''">

+ 1 - 1
src/main/resources/mapper/FloorMapper.xml

@@ -39,7 +39,7 @@
             <if test="topic != null and topic != ''">
                 AND topic LIKE concat('%',#{topic},'%')
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 AND enabledStatus = #{enabledStatus}
             </if>
         </where>

+ 2 - 2
src/main/resources/mapper/LogisticsBatchMapper.xml

@@ -44,10 +44,10 @@
         <include refid="columns"/>
         from cm_logistics_batch a
         <where>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 and a.orderId = #{orderId}
             </if>
-            <if test="logisticsBatchId != null and logisticsBatchId != ''">
+            <if test="logisticsBatchId != null">
                 and a.logisticsBatchId = #{logisticsBatchId}
             </if>
         </where>

+ 1 - 1
src/main/resources/mapper/MainMenuMapper.xml

@@ -21,7 +21,7 @@
             <if test="topic != null and topic != ''">
                 AND topic LIKE concat('%',#{topic},'%')
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 AND enabledStatus = #{enabledStatus}
             </if>
         </where>

+ 27 - 10
src/main/resources/mapper/NewOrderMapper.xml

@@ -40,7 +40,8 @@
 		a.payStatus	as payStatus,
 		a.sendOutStatus as sendOutStatus,
 		a.refundType as refundType,
-		a.postageOrderFlag AS postageOrderFlag
+		a.postageOrderFlag AS postageOrderFlag,
+        a.invoiceFlag
     </sql>
 
     <insert id="insertSplitAccount">
@@ -284,7 +285,7 @@
         co.payStatus AS payStatus,
         co.refundType AS refundType,
         co.sendOutStatus AS sendOutStatus,
-        co.receiptStatus AS receiptStatus,
+        ifnull(co.receiptStatus,1) AS receiptStatus,
         co.productCount AS productCount,
         (SELECT IFNULL(sum(cop.shouldPayFee),0) FROM cm_order_product cop WHERE cop.orderId=co.orderId) AS
         "shouldPayProduct",
@@ -292,14 +293,15 @@
         co.postageOrderFlag AS postageOrderFlag
         FROM cm_order co
         LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderId
+        left join cm_order_product cop on co.orderID = cop.orderID
         <where>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND co.orderId = #{orderId}
             </if>
             <if test="orderNo != null and orderNo != ''">
                 AND co.orderNo = #{orderNo}
             </if>
-            <if test="organizeId != null and organizeId != '' and organizeId != 0 ">
+            <if test="organizeId != null">
                 AND co.organizeId = #{organizeId}
             </if>
             <if test="status != null and status != ''">
@@ -312,6 +314,9 @@
                     </otherwise>
                 </choose>
             </if>
+            <if test="productName != null and productName != ''">
+                and cop.name like concat('%',#{productName},'%')
+            </if>
             <if test="buyer != null and buyer != ''">
                 AND bou.name LIKE concat('%',#{buyer},'%')
             </if>
@@ -572,7 +577,7 @@
                  LEFT JOIN product p ON cop.productID = p.productID
                  left join cm_order co on co.orderID = cop.orderID
         WHERE cop.shopOrderID = #{shopOrderId}
-          AND IF(co.userBeans = 0, 1 = 1, cop.shopid != 998)
+          AND IF(co.userBeans = 0, 1 = 1, cop.skuId != 4099)
         ORDER BY cop.discountPrice DESC
     </select>
 
@@ -622,13 +627,13 @@
             <if test="clubName != null and clubName != ''">
                 AND c.name like concat('%', #{clubName} ,'%')
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND co.orderId = #{orderId}
             </if>
             <if test="orderNo != null and orderNo != ''">
                 AND co.orderNo = #{orderNo}
             </if>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND cso.shopOrderID = #{shopOrderId}
             </if>
             <if test="shopOrderNo != null and shopOrderNo != ''">
@@ -640,13 +645,13 @@
             <if test="orderEndTime != null and orderEndTime != ''">
                 AND co.orderTime <![CDATA[   <=  ]]> #{orderEndTime}
             </if>
-            <if test="receiptStatus != null and receiptStatus != ''">
+            <if test="receiptStatus != null">
                 AND co.receiptStatus = #{receiptStatus}
             </if>
-            <if test="payStatus != null and payStatus != ''">
+            <if test="payStatus != null">
                 AND co.payStatus = #{payStatus}
             </if>
-            <if test="refundStatus != null and refundStatus != ''">
+            <if test="refundStatus != null">
                 AND
                 <if test="refundStatus == 0">
                     co.refundType = 0 or co.refundType is null
@@ -685,4 +690,16 @@
         where orderId = #{orderId}
             and note is not null
     </select>
+
+    <select id="findVoucher" resultType="com.caimei.modules.order.entity.Voucher">
+        select id,orderId,remarks,addTime
+        from cm_order_payment_voucher
+        where orderId = #{orderId}
+    </select>
+
+    <select id="findVocherImage" resultType="java.lang.String">
+        select image
+        from cm_voucher_image
+        where voucherId = #{id}
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/NewOrderProductMapper.xml

@@ -122,7 +122,7 @@
 		FROM cm_order_product a
 		<include refid="orderProductJoins"/>
 		WHERE a.orderId = #{orderId}
-		and a.shopId != 998
+		and a.skuId != 4099
 	</select>
 
 	<select id="getActualCancelNum" resultType="java.lang.Integer">

+ 42 - 17
src/main/resources/mapper/NewShopOrderMapper.xml

@@ -15,6 +15,7 @@
 			a.itemCount  AS itemCount,
 			a.townId  AS townId,
 			a.productAmount  AS productAmount,
+            a.isColdChina,
 			a.discountAmount AS  discountAmount,
 			a.totalAmount AS  totalAmount,
 			a.payFlag  AS payFlag,
@@ -73,10 +74,10 @@
             <if test="orderNo != null and orderNo != ''">
                 orderNo = #{orderNo},
             </if>
-            <if test="itemCount != null and itemCount != ''">
+            <if test="itemCount != null">
                 itemCount = #{itemCount},
             </if>
-            <if test="townId != null and itemCount != ''">
+            <if test="townId != null">
                 townID = #{townId},
             </if>
             <if test="productAmount != null and productAmount != ''">
@@ -94,10 +95,10 @@
             <if test="refundAmount != null and refundAmount != ''">
                 refundAmount = #{refundAmount},
             </if>
-            <if test="clubId != null and clubId != ''">
+            <if test="clubId != null">
                 clubID = #{clubId},
             </if>
-            <if test="spId != null and itemCount != ''">
+            <if test="spId != null and itemCount != null">
                 spID = #{spId},
             </if>
             <if test="canRefundFlag != null and canRefundFlag != ''">
@@ -183,10 +184,10 @@
             </if>
         </set>
         <where>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND shopOrderID = #{shopOrderId}
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND orderID = #{orderId}
             </if>
         </where>
@@ -228,26 +229,34 @@
     <select id="findByShopOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
         select
         <include refid="shopOrderColumns"/>
+        ,co.payTotalFee
         from cm_shop_order a
+        left join cm_order co on a.orderId = co.orderId
         where a.shopOrderId = #{shopOrderId}
     </select>
 
     <select id="findListByOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
         SELECT<include refid="shopOrderColumns"/>,
         b.name as shopName,
-        (select ifnull(sum(payAmount),0) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0) as payedShopAmount,
-        (select ifnull(sum(payCmAmount),0) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0) as payCmAmount
+        (select ifnull(sum(payAmount),0) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and
+        delFlag = 0) as payedShopAmount,
+        (select ifnull(sum(payCmAmount),0) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and
+        delFlag = 0) as payCmAmount
         FROM cm_shop_order a
         left join shop b on a.shopId = b.shopId
-        WHERE a.orderId = #{orderId} ORDER BY a.shopOrderNo DESC
+        left join cm_order_product cop on a.shopOrderId = cop.shopOrderId
+        WHERE a.orderId = #{orderId}
+        and cop.skuId != 4099
+        ORDER BY a.shopOrderNo DESC
     </select>
 
     <select id="findUnPaidShopOrder" resultType="java.lang.Integer">
-        SELECT COUNT(shopOrderId)
-        FROM cm_shop_order
-        WHERE orderID = #{orderId}
-          AND shopID != 998
-          AND payStatus != 3
+        SELECT COUNT(cso.shopOrderId)
+        FROM cm_shop_order cso
+        left join cm_order_product cop on cso.orderID=cop.orderID
+        WHERE cso.orderID = #{orderId}
+          AND cop.skuId != 4099
+          AND cso.payStatus != 3
     </select>
 
     <select id="getPayingStatus" resultType="java.lang.Integer">
@@ -313,6 +322,7 @@
         co.payTotalFee AS payTotalFee,
         co.status AS status,
         co.receiptStatus as orderReceiptStatus,
+        a.isColdChina,
         bou.name AS buyer,
         s.name AS shopName,
         c.name AS clubName,
@@ -327,6 +337,7 @@
         from cm_shop_order a
         left join bp_order_userinfo bou on bou.orderId = a.orderID
         left join cm_order co on co.orderID = a.orderID
+        left join cm_order_product cop on co.orderID = cop.orderID
         left join shop s on s.shopID = a.shopID
         LEFT JOIN club c ON c.userID = a.userID
         LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
@@ -339,7 +350,7 @@
             <if test="orderEndTime != null and orderEndTime != ''">
                 AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND a.orderID = #{orderId}
             </if>
             <if test="orderNo != null and orderNo != ''">
@@ -351,7 +362,7 @@
             <if test="clubName != null and clubName != ''">
                 AND c.name like concat('%', #{clubName} ,'%')
             </if>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND a.shopOrderID = #{shopOrderId}
             </if>
             <if test="shopOrderNo != null and shopOrderNo != ''">
@@ -382,7 +393,7 @@
             and a.payStatus != 3 and co.status NOT IN (6,7)
             and co.delFlag = 0
             and a.delFlag = 0
-            and a.shopID != 998
+            and cop.skuId != 4099
             and a.paying != 1
             and co.orderID not in (
             SELECT orderID FROM cm_order_product WHERE productID IN
@@ -392,4 +403,18 @@
         group by a.shopOrderID
         ORDER BY a.shopOrderID DESC
     </select>
+
+    <select id="findColdChain" resultType="java.lang.Double">
+        select totalAmount
+        from cm_shop_order
+        where shopId = 998
+          and orderId = #{orderId}
+          and delFlag = 0
+    </select>
+
+    <select id="findSettleStatus" resultType="java.lang.Integer">
+        select ifnull(settleStatus,1)
+        from cm_shop_order
+        where orderID = #{orderId}
+    </select>
 </mapper>

+ 79 - 40
src/main/resources/mapper/PayShopDao.xml

@@ -237,9 +237,11 @@
         FROM cm_pay_shop a
         left join cm_mall_admin_user u1 on u1.id = a.applicant
         left join cm_mall_admin_user u2 on u2.id = a.reviewer
+        left join cm_pay_shop_record cpr on a.id = cpr.payShopID
         left join shop s on s.shopID = a.shopID
+        LEFT JOIN cm_order_product cop ON cpr.shopOrderId = cop.shopOrderId
         <where>
-            <if test="payShopId != null and payShopId != ''">
+            <if test="payShopId != null">
                 and a.id = #{payShopId}
             </if>
             <if test="shopName != null and shopName != ''">
@@ -260,21 +262,21 @@
             <if test="payEndTime != null and payEndTime != ''">
                 AND a.payTime <![CDATA[   <=  ]]> #{payEndTime}
             </if>
-            <if test="status != null and status != ''">
+            <if test="status != null">
                 AND a.status = #{status}
             </if>
             <if test="shopOrderNo != null and shopOrderNo != ''">
                 AND a.id in (select cpsr.payShopID from cm_pay_shop_record cpsr where cpsr.shopOrderNo like
                 concat('%',#{shopOrderNo},'%'))
             </if>
-            <if test="shopOrderId != null and shopOrderId != ''">
+            <if test="shopOrderId != null">
                 AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record cpsr WHERE cpsr.shopOrderID=#{shopOrderId})
             </if>
-            <if test="orderId != null and orderId != ''">
+            <if test="orderId != null">
                 AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record cpsr LEFT JOIN cm_shop_order so ON
                 so.shopOrderID=cpsr.shopOrderID WHERE so.orderID=#{orderId})
             </if>
-            <if test='organizeId != null and organizeId != ""'>
+            <if test='organizeId != null'>
                 AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record cpsr LEFT JOIN cm_shop_order so ON
                 so.shopOrderID=cpsr.shopOrderID WHERE so.organizeID = #{organizeId})
             </if>
@@ -283,7 +285,7 @@
                 so.shopOrderID=cpsr.shopOrderID WHERE so.orderNo LIKE CONCAT('%',#{orderNo},'%'))
             </if>
             and a.delFlag = 0
-            and a.shopID != 998
+            and cop.skuId != 4099
         </where>
         ORDER BY a.id desc
     </select>
@@ -333,21 +335,27 @@
                         a.shopPostFee       AS shopPostFee,
                         ifnull((select sum(payAmount)
                                 from cm_pay_shop_record
-                                where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
+                                where shopOrderId = a.shopOrderId
+                                  and status = 1
+                                  and delFlag = 0),
                                0)           as payedShopAmount,
                         ifnull((select sum(payCmAmount)
                                 from cm_pay_shop_record
-                                where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
+                                where shopOrderId = a.shopOrderId
+                                  and status = 1
+                                  and delFlag = 0),
                                0)           as payCmAmount,
                         a.payedShopAmount   AS payedShopAmount,
                         co.payTotalFee      AS payTotalFee,
                         s.name              AS shopName,
                         s.shopId,
                         a.paying,
-                        co.receiptStatus    AS orderReceiptStatus
+                        co.receiptStatus    AS orderReceiptStatus,
+                        bou.name            as buyer
         FROM cm_shop_order a
                  LEFT JOIN cm_order co ON co.orderID = a.orderID
                  LEFT JOIN shop s ON s.shopID = a.shopID
+                 left join bp_order_userinfo bou on bou.orderId = a.orderID
         WHERE a.shopOrderID IN
               (SELECT shoporderId
                FROM cm_pay_shop_record
@@ -357,14 +365,14 @@
     </select>
 
     <select id="findPayOrderProducts" resultType="com.caimei.modules.order.entity.NewOrderProduct">
-        select cop.name                 AS name,
-               cop.orderProductID       AS orderProductId,
-               cop.productID            AS productId,
-               cop.productUnit          AS unit,
-               cop.num                  AS num,
-               cop.totalFee             AS totalFee,
-               cop.costPrice            AS costPrice,
-               cop.productType          AS productType,
+        select cop.name                            AS name,
+               cop.orderProductID                  AS orderProductId,
+               cop.productID                       AS productId,
+               cop.productUnit                     AS unit,
+               cop.num                             AS num,
+               cop.totalFee                        AS totalFee,
+               cop.costPrice                       AS costPrice,
+               cop.productType                     AS productType,
                cop.price,
                cop.shopPercent,
                cop.organizePercent,
@@ -372,25 +380,26 @@
                cop.totalAmount,
                cop.notOutStore,
                cop.presentNum,
-               (SELECT SUM(crpp.actualReturnedNum) + SUM(crpp.actualCancelNum)
-                FROM cm_returned_purchase_product crpp
-                         LEFT JOIN cm_returned_purchase rp ON rp.id = crpp.returnedID
-                WHERE crpp.orderProductID = cop.orderProductId
-                  AND rp.status = '2'
-                  AND rp.delFlag = '0') AS returnedNum
+               ifnull((SELECT SUM(crpp.actualReturnedNum) + SUM(crpp.actualCancelNum)
+                       FROM cm_returned_purchase_product crpp
+                                LEFT JOIN cm_returned_purchase rp ON rp.id = crpp.returnedID
+                       WHERE crpp.orderProductID = cop.orderProductId
+                         AND rp.status = '2'
+                         AND rp.delFlag = '0'), 0) AS returnedNum
         from cm_order_product cop
-        left join cm_sku cs on cop.skuId = cs.skuId
-        left join product p on p.productID = cop.productID
-        left join cm_order co on co.orderID = cop.orderID
-        left join user u on u.userID = co.userID
+                 left join cm_sku cs on cop.skuId = cs.skuId
+                 left join product p on p.productID = cop.productID
+                 left join cm_order co on co.orderID = cop.orderID
+                 left join user u on u.userID = co.userID
         where cop.shopOrderID = #{shopOrderId}
     </select>
 
     <select id="findShopOrderNos" resultType="java.lang.String">
-        SELECT CONCAT(shopOrderNo, '(', shopOrderID, ')') AS result
-        FROM cm_shop_order
-        WHERE orderID = #{orderId}
-          and shopId != 998
+        SELECT CONCAT(cso.shopOrderNo, '(', cso.shopOrderID, ')') AS result
+        FROM cm_shop_order cso
+        left join cm_order_product cop on cso.orderID = cop.orderID
+        WHERE cso.orderID = #{orderId}
+          and cop.skuId != 4099
     </select>
 
     <select id="findPayShopRecords" resultType="com.caimei.modules.order.entity.OrderPayShopRecord">
@@ -414,18 +423,20 @@
     <select id="findShopOrderNosByPayShop" resultType="java.lang.String">
         SELECT distinct CONCAT(cso.shopOrderNo, '(', cso.shopOrderID, ')') AS result
         FROM cm_shop_order cso
-                 left join cm_pay_shop_record cpsr on cso.shopOrderID = cpsr.shopOrderID
+        left join cm_pay_shop_record cpsr on cso.shopOrderID = cpsr.shopOrderID
+        left join cm_order_product cop on cpsr.shopOrderId = cop.shopOrderId
         WHERE cpsr.payShopID = #{id}
-          and cso.shopId != 998
+          and cop.skuId != 4099
     </select>
 
     <select id="findOrderNos" resultType="java.lang.String">
         SELECT distinct CONCAT(co.orderNo, '(', co.orderID, ')') AS result
         FROM cm_pay_shop_record cpsr
-                 left join cm_shop_order cso on cpsr.shopOrderID = cso.shopOrderID
-                 left join cm_order co on cso.orderID = co.orderID
+        left join cm_shop_order cso on cpsr.shopOrderID = cso.shopOrderID
+        left join cm_order co on cso.orderID = co.orderID
+        left join cm_order_product cop on co.orderId = cop.orderID
         WHERE cpsr.payShopID = #{id}
-          and cso.shopId != 998
+          and cop.skuId != 4099
     </select>
 
     <select id="findShouldPayShopAmount" resultType="java.lang.Double">
@@ -503,7 +514,7 @@
     </select>
 
     <select id="findOnlinePayCm" resultType="java.lang.Double">
-        SELECT ifnull(SUM(splitAccount),0)
+        SELECT ifnull(SUM(splitAccount), 0)
         FROM cm_split_account
         WHERE productType = #{status}
           AND shoporderid = #{shopOrderId}
@@ -531,8 +542,8 @@
                a.payShopID   AS "payShopID",
                a.status      AS "status"
         FROM cm_pay_shop_record a
-        LEFT JOIN cm_offline_collection f ON a.payType = f.type
-        left join cm_pay_shop cps on a.shopID = cps.shopID
+                 LEFT JOIN cm_offline_collection f ON a.payType = f.type
+                 left join cm_pay_shop cps on a.shopID = cps.shopID
         WHERE a.shopOrderID in (select shopOrderId from cm_shop_order where orderId = #{orderId})
           and a.delFlag = 0
           and cps.delFlag = 0
@@ -541,7 +552,35 @@
     </select>
 
     <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
-        select settleAmount, settleType, shopOrderId, splitCode, settleTime
+        select settleAmount,
+               settleType,
+               shopOrderId,
+               splitCode,
+               settleTime
         from cm_settle_record
+        where shopOrderId in (select shopOrderId from cm_shop_order where orderId = #{orderId})
+    </select>
+
+    <select id="findPayShopRecordsByShopOrder" resultType="com.caimei.modules.order.entity.OrderPayShopRecord">
+        SELECT f.bankAccount AS "bankNameType",
+               a.id          AS "id",
+               a.shopID      AS "shopId",
+               a.shopOrderID AS "shopOrderId",
+               a.shopOrderNo AS "shopOrderNo",
+               a.payAmount   AS "payAmount",
+               a.payCmAmount,
+               a.payType     AS "payType",
+               a.payTime     AS "payTime",
+               a.wipeTime    AS "wipeTime",
+               a.payShopID   AS "payShopID",
+               a.status      AS "status"
+        FROM cm_pay_shop_record a
+                 LEFT JOIN cm_offline_collection f ON a.payType = f.type
+                 left join cm_pay_shop cps on a.shopID = cps.shopID
+        WHERE a.shopOrderID in (select shopOrderId from cm_shop_order where orderId = #{shopOrderId})
+          and a.delFlag = 0
+          and cps.delFlag = 0
+          and a.status = 1
+          and cps.status = 1
     </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/ThemeMapper.xml

@@ -27,7 +27,7 @@
             <if test="topic != null and topic != ''">
                 AND topic LIKE concat('%',#{topic},'%')
             </if>
-            <if test="enabledStatus != null and enabledStatus != ''">
+            <if test="enabledStatus != null">
                 AND enabledStatus = #{enabledStatus}
             </if>
         </where>