Эх сурвалжийг харах

Merge branch 'dev' into sky_v1

15928045575 2 жил өмнө
parent
commit
92937c334e
46 өөрчлөгдсөн 845 нэмэгдсэн , 119 устгасан
  1. 11 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java
  2. 6 2
      sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/constant/RedisConstant.java
  3. 15 0
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/constant/ChannelEnum.java
  4. 1 1
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletDto.java
  5. 4 4
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java
  6. 0 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/PurchaseOrderDraftParam.java
  7. 0 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateOrderParam.java
  8. 4 16
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  9. 45 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java
  10. 11 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerLogistics.java
  11. 11 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerTrade.java
  12. 4 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/ILedger.java
  13. 5 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCarrierDto.java
  14. 5 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerLogisticsDto.java
  15. 10 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerPurchaseDto.java
  16. 5 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerSellDto.java
  17. 9 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerShipperDto.java
  18. 2 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerTradeDto.java
  19. 4 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementPurchaseDto.java
  20. 4 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementSellDto.java
  21. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/AddWalletReq.java
  22. 23 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashPageReq.java
  23. 7 5
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashWalletReq.java
  24. 23 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayReq.java
  25. 38 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/RefundReq.java
  26. 8 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java
  27. 8 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java
  28. 27 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpWalletRelationService.java
  29. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java
  30. 324 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java
  31. 35 4
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml
  32. 8 2
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml
  33. 16 16
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml
  34. 5 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java
  35. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java
  36. 2 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java
  37. 6 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WayBillDetailDTO.java
  38. 23 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/OrderDetailVO.java
  39. 11 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillTicketVO.java
  40. 52 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java
  41. 5 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java
  42. 6 7
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java
  43. 5 6
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java
  44. 22 6
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java
  45. 31 14
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java
  46. 1 1
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

+ 11 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java

@@ -1,5 +1,8 @@
 package com.sckw.core.model.enums;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author lfdc
  * @description 车辆运单状态枚举
@@ -111,6 +114,14 @@ public enum CarWaybillEnum {
         return null;
     }
 
+    public static List<Integer> getCodes() {
+        List<Integer> codes = new ArrayList<>();
+        for (CarWaybillEnum waybillEnum : CarWaybillEnum.values()) {
+            codes.add(waybillEnum.getCode());
+        }
+        return codes;
+    }
+
     /**
      * @param code 状态码
      * @desc 是否可以变更司机/车辆

+ 6 - 2
sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/constant/RedisConstant.java

@@ -71,8 +71,12 @@ public class RedisConstant {
      */
     public static final String SETTLEMENT_KEY = "sckw:kst:%s";
     /**
-     * 钱包企业关联关系
+     * 企业关联钱包
      */
-    public static final String WALLET = "wallet:uid";
+    public static final String WALLET_ENT = "wallet:ent";
+    /**
+     * 钱包关联企业
+     */
+    public static final String WALLET_UID = "wallet:uid";
 
 }

+ 15 - 0
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/constant/ChannelEnum.java

@@ -31,6 +31,21 @@ public enum ChannelEnum {
         return null;
     }
 
+    /**
+     * 通过渠道获取
+     *
+     * @param channel 渠道
+     * @return
+     */
+    public static ChannelEnum getByChannel(String channel) {
+        for (ChannelEnum channelEnum : ChannelEnum.values()) {
+            if (channelEnum.getChannel().equals(channel)) {
+                return channelEnum;
+            }
+        }
+        return null;
+    }
+
     /**
      * 通过渠道获取描述
      *

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletDto.java

@@ -24,7 +24,7 @@ public class WalletDto implements Serializable {
 
     private String uid;
     /**
-     * 渠道
+     * 渠道 huifu
      */
     private String channel;
 

+ 4 - 4
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java

@@ -33,9 +33,9 @@ public class TestController {
     public R<List<WalletDto>> wall(@RequestParam("uid") Long uid, String channel, Long filter) {
         return payCenterDubboService.wallet(uid, null, filter);
     }
-    @GetMapping("/test")
-    public R<Object> test(@RequestParam("entId") Long entId) {
-        return R.ok(paymentDubboService.checkSettlement(entId));
-    }
+//    @GetMapping("/test")
+//    public R<Object> test(@RequestParam("entId") Long entId) {
+//        return R.ok(paymentDubboService.checkSettlement(entId));
+//    }
 
 }

+ 0 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/PurchaseOrderDraftParam.java

@@ -32,12 +32,10 @@ public class PurchaseOrderDraftParam {
     /**
      * 订单总量
      */
-    @DecimalMin(value = "0.01",message = "订单总量必须大于零")
     private BigDecimal amount;
     /**
      * 订单金额
      */
-    @DecimalMin(value = "0.01",message = "订单金额必须大于零")
     private BigDecimal price;
 
     /**

+ 0 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateOrderParam.java

@@ -44,13 +44,11 @@ public class UpdateOrderParam {
     /**
      * 订单总量
      */
-    @DecimalMin(value = "0.01",message = "订单总量必须大于零")
     private BigDecimal amount;
 
     /**
      * 订单金额
      */
-    @DecimalMin(value = "0.01",message = "订单金额必须大于零")
     private BigDecimal price;
 
     /**

+ 4 - 16
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -614,11 +614,11 @@ public class KwoTradeOrderService {
 
 
     private void checkParams(UpdateOrderParam param, String source) {
-        if (Objects.isNull(param.getAmount())) {
-            throw new BusinessException("订单总量不能为空!");
+        if (Objects.isNull(param.getAmount()) || param.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+            throw new BusinessException("订单总量不能为空且必须大于零!");
         }
-        if (Objects.isNull(param.getPrice())) {
-            throw new BusinessException("订单金额不能为空!");
+        if (Objects.isNull(param.getPrice()) || param.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
+            throw new BusinessException("订单金额不能为空且必须大于零!");
         }
         if (StringUtils.isBlank(param.getTrading())) {
             throw new BusinessException("交易方式不能为空!");
@@ -643,18 +643,6 @@ public class KwoTradeOrderService {
             if (Objects.isNull(contractInfo.getContractId())) {
                 throw new BusinessException("合同id不能为空!");
             }
-            if (StringUtils.isBlank(contractInfo.getContractNo())) {
-                throw new BusinessException("合同编号不能为空!");
-            }
-            if (StringUtils.isBlank(contractInfo.getContractName())) {
-                throw new BusinessException("合同名称不能为空!");
-            }
-            if (StringUtils.isBlank(contractInfo.getContractSigningWay())) {
-                throw new BusinessException("合同签约方式不能为空!");
-            }
-            if (StringUtils.isBlank(contractInfo.getContractStatus())) {
-                throw new BusinessException("合同状态不能为空!");
-            }
         }
         GoodsInfo goodsInfo = param.getGoodsInfo();
         if (Objects.isNull(goodsInfo)) {

+ 45 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java

@@ -0,0 +1,45 @@
+package com.sckw.payment.controller;
+
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.payment.model.vo.req.WalletDetailReq;
+import com.sckw.payment.service.WalletService;
+import jakarta.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 钱包
+ *
+ * @author xucaiqin
+ * @date 2023-08-28 15:36:48
+ */
+@Validated
+@RestController
+@RequestMapping("/wallet")
+public class WalletController {
+    @Resource
+    private WalletService walletService;
+
+    /**
+     * 钱包总览信息
+     *
+     * @return
+     */
+    @GetMapping("overview")
+    public HttpResult overview() {
+        return HttpResult.ok(walletService.walletOverview());
+    }
+
+    /**
+     * 查询资金明细
+     *
+     * @return
+     */
+    @GetMapping("detail")
+    public HttpResult detail(WalletDetailReq walletDetailReq) {
+        return HttpResult.ok(walletService.walletDetail(walletDetailReq));
+    }
+
+}

+ 11 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerLogistics.java

@@ -107,6 +107,17 @@ public class KwpLedgerLogistics {
      */
     @TableField(value = "audit_phone")
     private String auditPhone;
+    /**
+     * 财务联系人(承运方)
+     */
+    @TableField(value = "success_user")
+    private String successUser;
+
+    /**
+     * 财务联系人电话(承运方)
+     */
+    @TableField(value = "success_phone")
+    private String successPhone;
 
     /**
      * 对账清单凭证

+ 11 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpLedgerTrade.java

@@ -107,6 +107,17 @@ public class KwpLedgerTrade {
      */
     @TableField(value = "audit_phone")
     private String auditPhone;
+    /**
+     * 财务联系人(销售方)
+     */
+    @TableField(value = "success_user")
+    private String successUser;
+
+    /**
+     * 财务联系人电话(销售方)
+     */
+    @TableField(value = "success_phone")
+    private String successPhone;
 
     /**
      * 生成时间

+ 4 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/ILedger.java

@@ -27,4 +27,8 @@ public interface ILedger {
 
 
     void setStatusLabel(String statusLabel);
+
+    Long getCreateBy();
+
+    void setCreateByName(String createByName);
 }

+ 5 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCarrierDto.java

@@ -137,6 +137,11 @@ public class LedgerCarrierDto implements ILedger {
      */
     private String phone;
     private String firmName;
+    /**
+     * 创建人
+     */
+    private Long createBy;
+    private String createByName;
 
     /**
      * 订单数量

+ 5 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerLogisticsDto.java

@@ -116,7 +116,11 @@ public class LedgerLogisticsDto implements ILedger {
      */
     private Integer status;
     private String statusLabel;
-
+    /**
+     * 创建人
+     */
+    private Long createBy;
+    private String createByName;
     /**
      * 客户联系人
      */

+ 10 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerPurchaseDto.java

@@ -78,14 +78,14 @@ public class LedgerPurchaseDto implements ILedger {
     private BigDecimal actualPrice;
 
     /**
-     * 对账审核人电话
+     * 对账完成人电话(销售方)
      */
-    private String auditPhone;
+    private String successPhone;
 
     /**
-     * 对账审核人名称
+     * 对账完成人名称(销售方)
      */
-    private String auditUser;
+    private String successUser;
 
     /**
      * 对账清单凭证
@@ -116,6 +116,12 @@ public class LedgerPurchaseDto implements ILedger {
     private String phone;
     private String firmName;
 
+    /**
+     * 创建人
+     */
+    private Long createBy;
+    private String createByName;
+
     /**
      * 订单数量
      */

+ 5 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerSellDto.java

@@ -115,6 +115,11 @@ public class LedgerSellDto implements ILedger {
     private String contacts;
     private String phone;
     private String firmName;
+    /**
+     * 创建人
+     */
+    private Long createBy;
+    private String createByName;
 
     /**
      * 订单数量

+ 9 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerShipperDto.java

@@ -76,14 +76,14 @@ public class LedgerShipperDto implements ILedger {
      */
     private BigDecimal actualPrice;
     /**
-     * 对账审核人电话
+     * 对账审核人电话(承运方)
      */
-    private String auditPhone;
+    private String successPhone;
 
     /**
-     * 对账审核人名称
+     * 对账审核人名称(承运方)
      */
-    private String auditUser;
+    private String successUser;
     /**
      * 对账清单凭证
      */
@@ -119,6 +119,11 @@ public class LedgerShipperDto implements ILedger {
      */
     private String phone;
     private String firmName;
+    /**
+     * 创建人
+     */
+    private Long createBy;
+    private String createByName;
 
     /**
      * 订单数量

+ 2 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerTradeDto.java

@@ -114,7 +114,8 @@ public class LedgerTradeDto implements ILedger {
     private String contacts;
     private String phone;
     private String firmName;
-
+    private Long createBy;
+    private String createByName;
     /**
      * 订单数量
      */

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementPurchaseDto.java

@@ -58,14 +58,14 @@ public class SettlementPurchaseDto implements ISettlement {
     private Date receiptTime;
 
     /**
-     * 对账销售财务联系人名称
+     * 对账采购财务联系人名称
      */
-    private String successUser;
+    private String auditUser;
 
     /**
-     * 对账销售财务联系人电话
+     * 对账采购财务联系人电话
      */
-    private String successPhone;
+    private String auditPhone;
     /**
      * 交易方式
      */

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementSellDto.java

@@ -57,14 +57,14 @@ public class SettlementSellDto implements ISettlement {
     private Date receiptTime;
 
     /**
-     * 对账采购财务联系人名称
+     * 对账销售财务联系人名称
      */
-    private String auditUser;
+    private String successUser;
 
     /**
-     * 对账采购财务联系人电话
+     * 对账销售财务联系人电话
      */
-    private String auditPhone;
+    private String successPhone;
 
     /**
      * 交易方式(预付款、货到付款)

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/AddWalletReq.java

@@ -18,7 +18,7 @@ import java.math.BigDecimal;
 @Setter
 public class AddWalletReq extends BasePara implements MoneyChange {
     /**
-     * 支付通道字典值
+     * 支付通道 huifu
      */
     @NotBlank(message = "支付通道不能为空")
     private String channel;

+ 23 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashPageReq.java

@@ -0,0 +1,23 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.core.model.vo.BasePara;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 提现记录
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class CashPageReq extends BasePara {
+    /**
+     * 支付通道 huifu
+     */
+    private String channel;
+
+    private String entName;
+
+}

+ 7 - 5
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashWalletReq.java

@@ -1,6 +1,5 @@
 package com.sckw.payment.model.vo.req;
 
-import com.sckw.core.model.vo.BasePara;
 import com.sckw.payment.model.vo.res.MoneyChange;
 import jakarta.validation.constraints.Digits;
 import jakarta.validation.constraints.NotBlank;
@@ -19,15 +18,18 @@ import java.math.BigDecimal;
  */
 @Getter
 @Setter
-public class CashWalletReq extends BasePara implements MoneyChange {
+public class CashWalletReq implements MoneyChange {
     /**
-     * 支付通道字典值
+     * 支付通道 huifu
      */
     @NotBlank(message = "支付通道不能为空")
     private String channel;
 
-    @NotBlank(message = "合作企业不能为空")
-    private String entId;
+    @NotBlank(message = "uid不能为空")
+    private String uid;
+
+    @NotBlank(message = "filter不能为空")
+    private String filter;
 
     @Positive(message = "提现金额必须大于0")
     @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)

+ 23 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayReq.java

@@ -0,0 +1,23 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.core.model.vo.BasePara;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 预付请求参数
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class PrePayReq extends BasePara {
+    /**
+     * 支付通道 1
+     */
+    private String channel;
+
+    private String entName;
+
+}

+ 38 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/RefundReq.java

@@ -0,0 +1,38 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.payment.model.vo.res.MoneyChange;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 退款
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class RefundReq  implements MoneyChange {
+    /**
+     * 支付通道字典值
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    @NotBlank(message = "合作企业不能为空")
+    private String entId;
+
+    @Positive(message = "提现金额必须大于0")
+    @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)
+    private BigDecimal money;
+
+    @Size(message = "备注不能超过200字")
+    private String remark;
+
+}

+ 8 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -31,6 +31,7 @@ import com.sckw.payment.model.vo.res.LedgerLogisticsDetailVo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.api.dubbo.TransportDubboService;
 import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
 import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
@@ -89,6 +90,11 @@ public class KwpLedgerLogisticsService extends AbsLedger {
             logisticsDto.setTaxRateLabel(taxRateMap.get(String.valueOf(taxRate)));
 
             logisticsDto.setStatusLabel(LedgerEnum.getDesc(logisticsDto.getStatus()));
+
+            UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(logisticsDto.getCreateBy());
+            if (Objects.nonNull(userCacheResDto)) {
+                logisticsDto.setCreateByName(userCacheResDto.getName());
+            }
         }
     }
 
@@ -491,6 +497,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
             receiptTime = LocalDateTime.of(ledgerReq.getReceiptTime(), LocalTime.MIN);
             kwpLedgerLogistics.setReceiptTime(receiptTime);
         }
+        kwpLedgerLogistics.setSuccessPhone(ledgerReq.getSuccessPhone());
+        kwpLedgerLogistics.setSuccessUser(ledgerReq.getSuccessUser());
         kwpLedgerLogistics.setStatus(LedgerEnum.SUCCESS.getStatus());
         kwpLedgerLogistics.setUpdateBy(LoginUserHolder.getUserId());
         kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());

+ 8 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -27,6 +27,7 @@ import com.sckw.payment.model.vo.res.LedgerTradeDetailVo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import io.seata.spring.annotation.GlobalTransactional;
 import jakarta.annotation.Resource;
 import lombok.RequiredArgsConstructor;
@@ -86,6 +87,10 @@ public class KwpLedgerTradeService extends AbsLedger {
             tradeDto.setTaxRateLabel(taxRateMap.get(String.valueOf(taxRate)));
 
             tradeDto.setStatusLabel(LedgerEnum.getDesc(tradeDto.getStatus()));
+            UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(tradeDto.getCreateBy());
+            if (Objects.nonNull(userCacheResDto)) {
+                tradeDto.setCreateByName(userCacheResDto.getName());
+            }
         }
     }
 
@@ -500,6 +505,8 @@ public class KwpLedgerTradeService extends AbsLedger {
             receiptTime = LocalDateTime.of(ledgerReq.getReceiptTime(), LocalTime.MIN);
             kwpLedgerTrade.setReceiptTime(receiptTime);
         }
+        kwpLedgerTrade.setSuccessPhone(ledgerReq.getSuccessPhone());
+        kwpLedgerTrade.setSuccessUser(ledgerReq.getSuccessUser());
         kwpLedgerTrade.setStatus(LedgerEnum.SUCCESS.getStatus());
         kwpLedgerTrade.setUpdateTime(LocalDateTime.now());
         tradeMapper.updateById(kwpLedgerTrade);
@@ -757,7 +764,7 @@ public class KwpLedgerTradeService extends AbsLedger {
      * @return
      */
     public List<String> checkOrder(Long entId, Long entTarget) {
-        return tradeMapper.selectJoin(entId,entTarget);
+        return tradeMapper.selectJoin(entId, entTarget);
     }
 
     /**

+ 27 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpWalletRelationService.java

@@ -38,7 +38,7 @@ public class KwpWalletRelationService {
         if (Objects.isNull(entId)) {
             return null;
         }
-        String uid = (String) redisTemplate.opsForHash().get(RedisConstant.WALLET, String.valueOf(entId));
+        String uid = (String) redisTemplate.opsForHash().get(RedisConstant.WALLET_ENT, String.valueOf(entId));
         if (StringUtils.isNotBlank(uid)) {
             return uid;
         }
@@ -49,10 +49,35 @@ public class KwpWalletRelationService {
             return null;
         }
         uid = kwpWalletRelation.getUid();
-        redisTemplate.opsForHash().put(RedisConstant.WALLET, String.valueOf(entId), uid);
+        redisTemplate.opsForHash().put(RedisConstant.WALLET_ENT, String.valueOf(entId), uid);
         return uid;
     }
 
+    /**
+     * 通过中台uid反查关联的企业
+     *
+     * @param uid 中台uid
+     * @return
+     */
+    public Long getEnt(String uid) {
+        if (StringUtils.isBlank(uid)) {
+            return null;
+        }
+        Long entId = (Long) redisTemplate.opsForHash().get(RedisConstant.WALLET_UID, uid);
+        if (Objects.nonNull(entId)) {
+            return entId;
+        }
+        KwpWalletRelation kwpWalletRelation = relationMapper.selectOne(new LambdaQueryWrapper<KwpWalletRelation>()
+                .eq(KwpWalletRelation::getUid, uid)
+                .eq(KwpWalletRelation::getDelFlag, 0).last("limit 1"));
+        if (Objects.isNull(kwpWalletRelation)) {
+            return null;
+        }
+        entId = kwpWalletRelation.getEntId();
+        redisTemplate.opsForHash().put(RedisConstant.WALLET_UID, uid, entId);
+        return entId;
+    }
+
     /**
      * 保存关联信息
      *

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java

@@ -452,7 +452,7 @@ public class PayCenterService {
      * @param filter
      * @return
      */
-    public R<Object> transfer(String uid, ChannelEnum channel, Long money, String filter) {
+    public R<Object> transfer(String uid, String filter, ChannelEnum channel, Long money) {
         String sync = postHttp(PayCenterEnum.TRANSFER, new HashMap<>() {{
             put("uid", uid);
             put("channel", channel);

+ 324 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -0,0 +1,324 @@
+package com.sckw.payment.service;
+
+import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.page.PageRes;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.payment.api.model.constant.ChannelEnum;
+import com.sckw.payment.api.model.dto.Order;
+import com.sckw.payment.api.model.dto.WalletDto;
+import com.sckw.payment.api.model.dto.common.R;
+import com.sckw.payment.api.model.dto.page.CashPage;
+import com.sckw.payment.api.model.dto.page.PrePayIndexPage;
+import com.sckw.payment.model.vo.req.*;
+import com.sckw.payment.model.vo.res.FundVo;
+import com.sckw.payment.model.vo.res.WalletDetail;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 钱包
+ *
+ * @author xucaiqin
+ * @date 2023-08-28 15:38:53
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class WalletService {
+    private final PayCenterService payCenterService;
+    private final KwpWalletRelationService walletRelationService;
+    private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 2, TimeUnit.MINUTES, new LinkedBlockingQueue<>(12));
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
+    /**
+     * 查询企业钱包总览信息
+     *
+     * @return
+     */
+    public WalletDetail walletOverview() {
+        Long entId = LoginUserHolder.getEntId();
+        String relation = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(relation)) {
+            throw new BusinessException("暂未开通电子钱包");
+        }
+        R<List<WalletDto>> wallet = payCenterService.wallet(relation, null, "");
+        long sum = 0;
+        if (wallet.getStatus()) {
+            List<WalletDto> data = CollectionUtils.isEmpty(wallet.getData()) ? new ArrayList<>() : wallet.getData();
+            for (WalletDto datum : data) {
+                sum += datum.getMoney();
+            }
+        }
+        return new WalletDetail(LoginUserHolder.getEntName(), String.valueOf(sum), String.valueOf(sum / 100.0D), 0);
+    }
+
+    /**
+     * 查询资金明细
+     *
+     * @return
+     */
+    public Object walletDetail(WalletDetailReq walletDetailReq) {
+        Long entId = LoginUserHolder.getEntId();
+        String entName = walletDetailReq.getEntName();
+        //todo-xcq 确认下拉选规则参数
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(walletDetailReq.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(walletDetailReq.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("支付通道不存在");
+            }
+        }
+        //查询我方企业开通的渠道
+        String relation = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(relation)) {
+            throw new BusinessException("暂未开通电子钱包");
+        }
+        List<WalletDto> res = new ArrayList<>();
+        List<Long> list = new ArrayList<>();
+        //筛选企业名称
+        if (StringUtils.isNotBlank(entName)) {
+            List<EntCacheResDto> entCacheResDto = remoteSystemService.queryEntCacheByName(entName);
+            //未筛选出数据
+            if (CollectionUtils.isEmpty(entCacheResDto)) {
+                return PageRes.handPage(walletDetailReq.getPage(), walletDetailReq.getPageSize(), new ArrayList<>());
+            }
+            list = entCacheResDto.stream().map(EntCacheResDto::getId).toList();
+        }
+
+        //搜索指定往来单位
+        if (!CollectionUtils.isEmpty(list)) {
+            for (Long aLong : list) {
+                R<List<WalletDto>> wallet = payCenterService.wallet(relation, channelEnum, String.valueOf(aLong));
+                if (wallet.getStatus()) {
+                    List<WalletDto> data = wallet.getData();
+                    res.addAll(data);
+                }
+            }
+        } else {
+            //不搜索往来单位
+            R<List<WalletDto>> wallet = payCenterService.wallet(relation, channelEnum, "");
+            if (wallet.getStatus()) {
+                List<WalletDto> data = wallet.getData();
+                res.addAll(data);
+            }
+        }
+        List<FundVo> vo = new ArrayList<>();
+        FundVo fundVo;
+
+        //组装res数据
+        for (WalletDto re : res) {
+            fundVo = new FundVo();
+            BeanUtils.copyProperties(re, fundVo);
+            fundVo.setChannelLabel(ChannelEnum.getDesc(re.getChannel()));
+            vo.add(fundVo);
+        }
+        return PageRes.handPage(walletDetailReq.getPage(), walletDetailReq.getPageSize(), vo);
+    }
+
+
+    /**
+     * 新增账目
+     *
+     * @return
+     */
+    public Object addWallet(AddWalletReq addWalletReq) {
+        Long entId1 = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId1);
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("您暂未开通电子钱包");
+        }
+        String entId = addWalletReq.getEntId();
+        String filter = walletRelationService.getRelation(Long.parseLong(entId));
+        if (StringUtils.isBlank(filter)) {
+            throw new BusinessException("合作单位暂未开通电子钱包");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByValue(addWalletReq.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不能为空");
+        }
+
+        //1.开通钱包
+        R<Object> objectR = payCenterService.walletIndex(uid, channelEnum, filter, "");
+        if (!objectR.getStatus()) {
+            throw new BusinessException(StringUtils.isBlank(objectR.getMsg()) ? "钱包开通失败" : objectR.getMsg());
+        }
+        //2.发起预支付
+        R<Order> orderR = payCenterService.advancePayApply("", channelEnum, filter, addWalletReq.bigMoney(addWalletReq.getMoney()));
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isBlank(orderR.getMsg()) ? "预支付失败" : orderR.getMsg());
+        }
+        return orderR.getData();
+    }
+
+    /**
+     * 账目充值
+     *
+     * @return
+     */
+    public Object addWalletMoney(AddWalletReq addWalletReq) {
+        Long entId1 = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId1);
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("您暂未开通电子钱包");
+        }
+        String entId = addWalletReq.getEntId();
+        String filter = walletRelationService.getRelation(Long.parseLong(entId));
+        if (StringUtils.isBlank(filter)) {
+            throw new BusinessException("合作单位暂未开通电子钱包");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByValue(addWalletReq.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不能为空");
+        }
+        //发起预支付
+        R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, filter, addWalletReq.bigMoney(addWalletReq.getMoney()));
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isBlank(orderR.getMsg()) ? "预支付失败" : orderR.getMsg());
+        }
+        return orderR.getData();
+    }
+
+    /**
+     * 提现
+     * 1.余额转出
+     * 2.申请提现
+     *
+     * @return
+     */
+    public Object cashOUt(CashWalletReq cashWalletReq) {
+        ChannelEnum byChannel = ChannelEnum.getByChannel(cashWalletReq.getChannel());
+        //余额转出
+        R<Object> transfer = payCenterService.transfer(cashWalletReq.getUid(), cashWalletReq.getFilter(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()));
+        if (!transfer.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(transfer.getMsg()) ? transfer.getMsg() : "提现异常");
+        }
+        R<Order> orderR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "申请提现异常");
+        }
+        return orderR.getData();
+    }
+
+    /**
+     * 转账
+     *
+     * @return
+     */
+    public Object transfer() {
+        return null;
+    }
+
+
+    /**
+     * 提现记录
+     *
+     * @return
+     */
+    public Object cashList(CashPageReq cashPageReq) {
+        Long entId = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(uid)) {
+            return null;
+        }
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(cashPageReq.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(cashPageReq.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("选择渠道异常");
+            }
+        }
+        String entName = cashPageReq.getEntName();
+        if (StringUtils.isNotBlank(entName)) {
+            //todo 转换企业名称为filter
+
+        }
+        //查询中台接口
+        R<CashPage> cashPageR = payCenterService.withdrawIndex(uid, channelEnum, cashPageReq.getPage(), cashPageReq.getPageSize());
+        if (!cashPageR.getStatus()) {
+            return null;
+        }
+        //组装数据
+        return cashPageR.getData();
+    }
+
+    /**
+     * 预付记录
+     *
+     * @return
+     */
+    public Object prePayList(PrePayReq prePayReq) {
+        Long entId = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(uid)) {
+            return null;
+        }
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(prePayReq.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(prePayReq.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("选择渠道异常");
+            }
+        }
+        String entName = prePayReq.getEntName();
+        if (StringUtils.isNotBlank(entName)) {
+            //todo 转换企业名称为 filter
+
+        }
+        //
+        R<PrePayIndexPage> prePayIndexPageR = payCenterService.advancePayIndex(uid, channelEnum, "", prePayReq.getPage(), prePayReq.getPageSize());
+
+        return null;
+    }
+
+    /**
+     * 新增预付
+     *
+     * @return
+     */
+    public Object addPrePay() {
+        return null;
+    }
+
+    /**
+     * 预付追加
+     *
+     * @return
+     */
+    public Object prePayAppend() {
+        return null;
+    }
+
+    /**
+     * 申请退款
+     *
+     * @return
+     */
+    public Object applyRefund(RefundReq refundReq) {
+        return null;
+    }
+
+    /**
+     * 发起退款
+     *
+     * @return
+     */
+    public Object launchRefund() {
+        return null;
+    }
+
+}

+ 35 - 4
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -18,6 +18,8 @@
         <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
         <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
         <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
+        <result column="success_user" jdbcType="VARCHAR" property="successUser"/>
+        <result column="success_phone" jdbcType="VARCHAR" property="successPhone"/>
         <result column="url" jdbcType="VARCHAR" property="url"/>
         <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
         <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
@@ -46,6 +48,8 @@
         actual_price,
         audit_user,
         audit_phone,
+        success_user,
+        success_phone,
         url,
         generate_time,
         receipt_time,
@@ -72,11 +76,14 @@
         kll.actual_price  actualPrice,
         kll.audit_phone   auditPhone,
         kll.audit_user    auditUser,
+        kll.success_phone successPhone,
+        kll.success_user  successUser,
         kll.url,
         kll.generate_time generateTime,
         kll.receipt_time  receiptTime,
         kll.remark,
         kll.status,
+        kll.create_by createBy,
         kllu.top_ent_id   checkEntId,
         kllu.contacts,
         kllu.phone,
@@ -84,13 +91,37 @@
         kll.order_count   orderCount
     </sql>
     <select id="shipperSelect" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
-        select
-        <include refid="list_col"/>
+        select kll.id,
+               kll.l_ledger_no   lLedgerNo,
+               kll.name,
+               kll.start_time    startTime,
+               kll.end_time      endTime,
+               kll.tax_rate      taxRate,
+               kll.trading,
+               kll.total_price   totalPrice,
+               kll.ex_tax_price  exTaxPrice,
+               kll.settle_price  settlePrice,
+               kll.actual_price  actualPrice,
+               kll.success_phone successPhone,
+               kll.success_user  successUser,
+               kll.url,
+               kll.generate_time generateTime,
+               kll.receipt_time  receiptTime,
+               kll.remark,
+               kll.status,
+               kll.create_by     createBy,
+               kllu.top_ent_id   checkEntId,
+               kllu.contacts,
+               kllu.phone,
+               kllu.firm_name    firmName,
+               kll.order_count   orderCount
         from kwp_ledger_logistics kll
                  inner join kwp_ledger_logistics_unit kllu
-                            on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
+                            on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
+                               kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
                  inner join kwp_ledger_logistics_unit kllu2
-                            on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
+                            on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
+                               kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             kll.del_flag = 0
               and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}

+ 8 - 2
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -18,6 +18,8 @@
         <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
         <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
         <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
+        <result column="success_user" jdbcType="VARCHAR" property="successUser"/>
+        <result column="success_phone" jdbcType="VARCHAR" property="successPhone"/>
         <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
         <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
         <result column="url" jdbcType="VARCHAR" property="url"/>
@@ -46,6 +48,8 @@
         actual_price,
         audit_user,
         audit_phone,
+        success_user,
+        success_phone,
         generate_time,
         receipt_time,
         url,
@@ -77,6 +81,7 @@
         klt.receipt_time  receiptTime,
         klt.remark,
         klt.status,
+        klt.create_by     createBy,
         kltu.contacts,
         kltu.phone,
         kltu.firm_name    firmName,
@@ -94,12 +99,13 @@
         klt.ex_tax_price  exTaxPrice,
         klt.settle_price  settlePrice,
         klt.actual_price  actualPrice,
-        klt.audit_phone   auditPhone,
-        klt.audit_user    auditUser,
+        klt.success_phone   successPhone,
+        klt.success_user    successUser,
         klt.url,
         klt.generate_time generateTime,
         klt.receipt_time  receiptTime,
         klt.remark,
+        klt.create_by     createBy,
         klt.status,
         kltu.contacts,
         kltu.phone,

+ 16 - 16
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml

@@ -78,10 +78,10 @@
                cast(kst.actual_price as char)                     actualPrice,
                cast(kst.total_price as char)                      totalPrice,
                cast((kst.total_price - kst.actual_price) as char) waitPrice,
-               kst.audit_user,
-               kst.audit_phone,
-               kst.success_user,
-               kst.success_phone,
+               kst.audit_user                                     auditUser,
+               kst.audit_phone                                    auditPhone,
+               kst.success_user                                   successUser,
+               kst.success_phone                                  successPhone,
                kst.create_time,
                kst.t_ledger_id,
                klt.id                                             ledgerId,
@@ -204,10 +204,10 @@
                cast(kst.actual_price as char)                     actualPrice,
                cast(kst.total_price as char)                      totalPrice,
                cast((kst.total_price - kst.actual_price) as char) waitPrice,
-               kst.audit_user,
-               kst.audit_phone,
-               kst.success_user,
-               kst.success_phone,
+               kst.audit_user                                     auditUser,
+               kst.audit_phone                                    auditPhone,
+               kst.success_user                                   successUser,
+               kst.success_phone                                  successPhone,
                kst.create_time,
                kst.t_ledger_id,
                klt.id                                             ledgerId,
@@ -234,10 +234,10 @@
                cast(kst.actual_price as char)                     actualPrice,
                cast(kst.total_price as char)                      totalPrice,
                cast((kst.total_price - kst.actual_price) as char) waitPrice,
-               kst.audit_user,
-               kst.audit_phone,
-               kst.success_user,
-               kst.success_phone,
+               kst.audit_user                                     auditUser,
+               kst.audit_phone                                    auditPhone,
+               kst.success_user                                   successUser,
+               kst.success_phone                                  successPhone,
                kst.create_time,
                kst.t_ledger_id,
                klt.id                                             ledgerId,
@@ -278,10 +278,10 @@
                cast(kst.actual_price as char)                     actualPrice,
                cast(kst.total_price as char)                      totalPrice,
                cast((kst.total_price - kst.actual_price) as char) waitPrice,
-               kst.audit_user,
-               kst.audit_phone,
-               kst.success_user,
-               kst.success_phone,
+               kst.audit_user                                     auditUser,
+               kst.audit_phone                                    auditPhone,
+               kst.success_user                                   successUser,
+               kst.success_phone                                  successPhone,
                kst.create_time,
                kst.t_ledger_id,
                klt.id                                             ledgerId,

+ 5 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -202,6 +202,11 @@ public class KwTransportService {
                 statuses.add(CarWaybillEnum.REVOKED.getCode().longValue());
                 statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode().longValue());
                 criteria.and("status").in(statuses);
+            } else if (query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode()))) {
+                List<Long> statuses = new ArrayList<>();
+                statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode().longValue());
+                statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode().longValue());
+                criteria.and("status").in(statuses);
             } else if (!query.getStatus().equals("all")) {
                 criteria.and("status").is(Integer.valueOf(query.getStatus()));
             }

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java

@@ -306,7 +306,7 @@ public class AcceptCarriageOrderController {
      * @return
      */
     @RequestMapping(value = "/commitAcceptCarriageOrderFinish", method = RequestMethod.POST)
-    public HttpResult commitAcceptCarriageOrderFinish(@Validated @RequestBody OrderFinishDTO orderFinishDTO) {
+    public HttpResult commitAcceptCarriageOrderFinish(@Valid @RequestBody OrderFinishDTO orderFinishDTO) {
         try {
             return acceptCarriageOrderService.commitAcceptCarriageOrderFinish(orderFinishDTO);
         } catch (Exception e) {

+ 2 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java

@@ -149,11 +149,11 @@ public class KwtWaybillOrderController {
     }
 
     /**
-     * 查询已排量、待运量数据
+     * 派车-查询已派车量、待运量数据
      * @param orderId
      * @return
      */
-    @RequestMapping(name = "查询已量、待运量数据",path = "/getLogisticsAmountByOrderId",method = RequestMethod.GET)
+    @RequestMapping(name = "查询已派车量、待运量数据",path = "/getLogisticsAmountByOrderId",method = RequestMethod.GET)
     public HttpResult getLogisticsAmountByOrderId(@NotBlank @RequestParam("orderId") String orderId){
         log.info("查询已排量、待运量数据 query :{}",orderId);
         try {

+ 6 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WayBillDetailDTO.java

@@ -146,10 +146,15 @@ public class WayBillDetailDTO{
     private String unloadDetailAddress;
 
     /**
-     * 承运企业
+     * 托运企业名称
      */
     private String checkFirmName;
 
+    /**
+     * 承运企业
+     */
+    private String carrierFirmName;
+
     /**
      * 运单状态
      */

+ 23 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/OrderDetailVO.java

@@ -64,6 +64,11 @@ public class OrderDetailVO {
      */
     private BigDecimal deduct;
 
+    /**
+     * 扣亏损值
+     */
+    private String deductLabel;
+
     /**
      * 商品名称
      */
@@ -76,10 +81,21 @@ public class OrderDetailVO {
      * 合理亏损
      */
     private BigDecimal loss;
+
+    /**
+     * 合理亏损
+     */
+    private String lossLabel;
     /**
      * 任务总量
      */
     private BigDecimal number;
+
+    /**
+     * 任务总量
+     */
+    private String numberLabel;
+
     /**
      * 订单金额
      */
@@ -92,6 +108,13 @@ public class OrderDetailVO {
      * 运价
      */
     private BigDecimal price;
+
+
+    /**
+     * 运价方式
+     */
+    private String priceLabel;
+
     /**
      * 计划结束时间
      */

+ 11 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillTicketVO.java

@@ -38,4 +38,15 @@ public class WaybillTicketVO {
      * 卸货重量
      */
     private String unloadWeight;
+
+    /**
+     * 亏吨重量
+     */
+    private String deficitAmount;
+
+    /**
+     * 扣亏量(合理损耗-(实装-实卸))-单位
+     */
+    private String deficitRealAmount;
+
 }

+ 52 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -1279,8 +1279,11 @@ public class AcceptCarriageOrderService {
 //            throw new BusinessException("完结订单,实装量不能大于分配量");
 //        }
         BigDecimal amount = logisticsOrder.getAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getAmount();
-        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0){
-            throw new BusinessException("完结订单,实装量不能大于分配量");
+        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0) {
+            throw new BusinessException("完结订单,装货量不能大于运输总量");
+        }
+        if (orderFinishDTO.getUnloadAmount().compareTo(orderFinishDTO.getLoadAmount()) > 0) {
+            throw new BusinessException("完结订单,填写卸货量不能大于装货量");
         }
         /**订单状态验证*/
         if (!LogisticsOrderEnum.WAIT_DELIVERY.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))
@@ -1646,6 +1649,53 @@ public class AcceptCarriageOrderService {
         orderDetailVO.setScheduleStartTime(logisticsOrder.getStartTime() == null ? null : logisticsOrder.getStartTime());
         orderDetailVO.setScheduleEndTime(logisticsOrder.getEndTime() == null ? null : logisticsOrder.getEndTime());
         orderDetailVO.setPerformanceAmount(logisticsOrder.getLoadAmount() == null ? null : logisticsOrder.getLoadAmount());
+        if (logisticsOrder.getSettlementCycle() != null) {
+            Map<String, SysDictResDto> dtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.SETTLEMENT_CYCLE.getType());
+            orderDetailVO.setSettlementCycleLabel(dtoMap.isEmpty() ? null :
+                    (dtoMap.get(String.valueOf(logisticsOrder.getSettlementCycle())) == null ? null : dtoMap.get(String.valueOf(logisticsOrder.getSettlementCycle())).getLabel()));
+        }
+        orderDetailVO.setBillingMode(logisticsOrder.getBillingMode());
+        if (logisticsOrder.getBillingMode() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.CHARGING_TYPE.getType());
+            orderDetailVO.setBillingModeLabel(dictResDtoMap.isEmpty() ? null :
+                    (dictResDtoMap.get(logisticsOrder.getBillingMode()) == null ? null : dictResDtoMap.get(logisticsOrder.getBillingMode()).getLabel()));
+        }
+        if (logisticsOrder.getPayment() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
+            if (dictResDtoMap.isEmpty()) {
+                orderDetailVO.setPaymentLabel(null);
+            } else {
+                if (dictResDtoMap.get(logisticsOrder.getPayment().toString()) != null) {
+                    orderDetailVO.setPaymentLabel(dictResDtoMap.get(logisticsOrder.getPayment().toString()).getLabel());
+                }
+            }
+        }
+        if (orderDetailVO.getSigningWay() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.SIGNING_TYPE.getType());
+            if (dictResDtoMap.isEmpty()) {
+                orderDetailVO.setPaymentLabel(null);
+            } else {
+                if (dictResDtoMap.get(orderDetailVO.getSigningWay().toString()) != null) {
+                    orderDetailVO.setSigningWayLabel(dictResDtoMap.get(orderDetailVO.getSigningWay().toString()).getLabel());
+                }
+            }
+        }
+        if (logisticsOrder.getGoodsPriceUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), logisticsOrder.getGoodsPriceUnit());
+            orderDetailVO.setDeductLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getLossUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.TAX_RATE_TYPE.getType(), logisticsOrder.getLossUnit());
+            orderDetailVO.setLossLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getUnit()!=null){
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.UNIT_TYPE.getType(), logisticsOrder.getUnit());
+            orderDetailVO.setNumberLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getPriceType() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), String.valueOf(logisticsOrder.getPriceType()));
+            orderDetailVO.setPriceLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
         return HttpResult.ok(orderDetailVO);
     }
 

+ 5 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java

@@ -741,8 +741,11 @@ public class ConsignOrderService {
 //            throw new BusinessException("完结订单,实装量不能大于分配量");
 //        }
         BigDecimal amount = logisticsOrder.getAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getAmount();
-        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0){
-            throw new BusinessException("完结订单,实装量不能大于分配量");
+        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0) {
+            throw new BusinessException("完结订单,装货量不能大于运输总量");
+        }
+        if (orderFinishDTO.getUnloadAmount().compareTo(orderFinishDTO.getLoadAmount()) > 0) {
+            throw new BusinessException("完结订单,填写卸货量不能大于装货量");
         }
         /**订单状态验证*/
         if (!LogisticsOrderEnum.WAIT_DELIVERY.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))

+ 6 - 7
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -2319,15 +2319,14 @@ public class KwtWaybillOrderService {
         BigDecimal subcontractAmount = kwtLogisticsOrder.getSubcontractAmount() == null ? new BigDecimal("0.00") : kwtLogisticsOrder.getSubcontractAmount();
         BigDecimal waitDistributionAmount = amount.subtract(entrustAmount).subtract(subcontractAmount);
         Map<String, Map> map = new HashMap(NumberConstant.SIXTEEN);
-        //效的车辆运单状态(其他状态不参与统计中)
+        //效的车辆运单状态(其他状态不参与统计中)
         List<Long> statusList = new ArrayList<>();
+        statusList.add(CarWaybillEnum.PENDING_ORDER.getCode().longValue());
         statusList.add(CarWaybillEnum.PENDING_VEHICLE.getCode().longValue());
-        statusList.add(CarWaybillEnum.EXIT_COMPLETED.getCode().longValue());
-        statusList.add(CarWaybillEnum.WAIT_LOADING.getCode().longValue());
-        statusList.add(CarWaybillEnum.COMPLETION_LOADING.getCode().longValue());
-        statusList.add(CarWaybillEnum.WAIT_UNLOADING.getCode().longValue());
-        statusList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode().longValue());
-        statusList.add(CarWaybillEnum.APPROVAL_PASS.getCode().longValue());
+        statusList.add(CarWaybillEnum.REJECT_ORDER.getCode().longValue());
+        statusList.add(CarWaybillEnum.REFUSE_TRAFFIC.getCode().longValue());
+        statusList.add(CarWaybillEnum.REVOKED.getCode().longValue());
+        statusList.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode().longValue());
         //趟次
         Map<String, Object> tripMap = waybillOrderDao.selectOrderByOrderId(Long.parseLong(orderId), 1, statusList);
         tripMap.put("waitDistributionAmount",waitDistributionAmount);

+ 5 - 6
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -1170,13 +1170,12 @@ public class LogisticsConsignmentService {
         if (logisticsOrder == null) {
             throw new BusinessException("采购订单-完结订单-物流单据不存在!");
         }
-//        BigDecimal totalLoadAmount = logisticsOrder.getTotalLoadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getTotalLoadAmount();
-//        if (totalLoadAmount.compareTo(orderFinishDTO.getLoadAmount()) < 0) {
-//            throw new BusinessException("完结订单,实装量不能大于分配量");
-//        }
         BigDecimal amount = logisticsOrder.getAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getAmount();
-        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0){
-            throw new BusinessException("完结订单,实装量不能大于分配量");
+        if (amount.compareTo(orderFinishDTO.getLoadAmount()) < 0) {
+            throw new BusinessException("完结订单,装货量不能大于运输总量");
+        }
+        if (orderFinishDTO.getUnloadAmount().compareTo(orderFinishDTO.getLoadAmount()) > 0) {
+            throw new BusinessException("完结订单,填写卸货量不能大于装货量");
         }
         /**订单状态验证*/
         if (!LogisticsOrderEnum.WAIT_DELIVERY.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))

+ 22 - 6
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -210,8 +210,8 @@ public class TransportCommonService {
         orderDetailVO.setScheduleStartTime(logisticsOrder.getStartTime() == null ? null : logisticsOrder.getStartTime());
         orderDetailVO.setScheduleEndTime(logisticsOrder.getEndTime() == null ? null : logisticsOrder.getEndTime());
         orderDetailVO.setPerformanceAmount(logisticsOrder.getLoadAmount() == null ? null : logisticsOrder.getLoadAmount());
-        orderDetailVO.setTotalLoadAmount(logisticsOrder.getTotalLoadAmount());
-        orderDetailVO.setTotalUnloadAmount(logisticsOrder.getTotalUnloadAmount());
+        orderDetailVO.setTotalLoadAmount(logisticsOrder.getTotalLoadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getTotalLoadAmount());
+        orderDetailVO.setTotalUnloadAmount(logisticsOrder.getTotalUnloadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getTotalUnloadAmount());
         orderDetailVO.setCreateTime(logisticsOrder.getCreateTime());
         orderDetailVO.setPayment(logisticsOrder.getPayment());
         if (logisticsOrder.getPayment() != null) {
@@ -219,8 +219,8 @@ public class TransportCommonService {
             if (dictResDtoMap.isEmpty()) {
                 orderDetailVO.setPaymentLabel(null);
             } else {
-                if (dictResDtoMap.get(logisticsOrder.getPayment()) != null) {
-                    orderDetailVO.setPaymentLabel(dictResDtoMap.get(logisticsOrder.getPayment()).getLabel());
+                if (dictResDtoMap.get(logisticsOrder.getPayment().toString()) != null) {
+                    orderDetailVO.setPaymentLabel(dictResDtoMap.get(logisticsOrder.getPayment().toString()).getLabel());
                 }
             }
         }
@@ -229,11 +229,27 @@ public class TransportCommonService {
             if (dictResDtoMap.isEmpty()) {
                 orderDetailVO.setPaymentLabel(null);
             } else {
-                if (dictResDtoMap.get(orderDetailVO.getSigningWay()) != null) {
-                    orderDetailVO.setSigningWayLabel(dictResDtoMap.get(orderDetailVO.getSigningWay()).getLabel());
+                if (dictResDtoMap.get(String.valueOf(orderDetailVO.getSigningWay())) != null) {
+                    orderDetailVO.setSigningWayLabel(dictResDtoMap.get(orderDetailVO.getSigningWay().toString()).getLabel());
                 }
             }
         }
+        if (logisticsOrder.getGoodsPriceUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), logisticsOrder.getGoodsPriceUnit());
+            orderDetailVO.setDeductLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getLossUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.TAX_RATE_TYPE.getType(), logisticsOrder.getLossUnit());
+            orderDetailVO.setLossLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.UNIT_TYPE.getType(), logisticsOrder.getUnit());
+            orderDetailVO.setNumberLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getPriceType() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), String.valueOf(logisticsOrder.getPriceType()));
+            orderDetailVO.setPriceLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
         orderDetailVO.setRemark(logisticsOrder.getRemark());
         /**亏吨量/吨->装货量-卸货量
          * 合理损耗值=装货量*合理损耗

+ 31 - 14
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java

@@ -117,6 +117,8 @@ public class WaybillManagementService {
             wayBillDetailDTO.setUnloadDetailAddress(info.getUnloadCityName().concat(info.getUnloadDetailAddress()));
             wayBillDetailDTO.setLoadName(info.getLoadName());
             wayBillDetailDTO.setUnloadName(info.getUnloadName());
+            wayBillDetailDTO.setCarrierFirmName(info.getCarrierFirmName());
+            wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
             // 计费方式
             KwtLogisticsOrder kwtLogisticsOrder = kwtLogisticsOrderMapper.selectById(info.getLOrderId());
             if(!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
@@ -151,9 +153,16 @@ public class WaybillManagementService {
             waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
             waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
             waybillTicketVO.setUnloadUrl(String.valueOf(info.getUnloadUrls()));
+            waybillTicketVO.setDeficitAmount(String.valueOf(info.getDeficitAmount()));
+            BigDecimal deficitLoss = info.getLoss() == null ? BigDecimal.valueOf(0) : info.getLoss();
+            BigDecimal deficitAmount = info.getDeficitAmount() == null ? BigDecimal.valueOf(0) : info.getDeficitAmount();
+            BigDecimal deficitRealAmount = BigDecimal.valueOf(0);
+            if(deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
+                deficitRealAmount = deficitLoss.subtract(deficitAmount);
+            }
+            waybillTicketVO.setDeficitRealAmount(deficitRealAmount.toString());
 //            waybillBoardListVO.setLoadUrls(sckwWaybillOrder.getLoadUrls() != null ? FileUtils.getOSSAddressPrefix() + sckwWaybillOrder.getLoadUrls() : null);
 //            waybillBoardListVO.setUnloadUrls(sckwWaybillOrder.getUnloadUrls() != null ? FileUtils.getOSSAddressPrefix() + sckwWaybillOrder.getUnloadUrls() : null);
-
         }
         List<Integer> statuses = initWaybillIndexStatus();
         // 初始化各状态
@@ -294,7 +303,7 @@ public class WaybillManagementService {
             statusVOS.add(waybillStatusVO);
         });
 
-        Criteria criteria = buildWaybillIndexQuery(query, statuses);
+        Criteria criteria = buildWaybillIndexQuery(query);
         Query queryFormat = new Query(criteria);
         long total = mongoTemplate.count(queryFormat, SckwWaybillOrder.class);
         queryFormat.with(PageRequest.of(query.getPage() - 1, query.getPageSize(),
@@ -392,10 +401,9 @@ public class WaybillManagementService {
     /**
      * 运单看板 查询条件构造
      * @param query
-     * @param statuses
      * @return
      */
-    public Criteria buildWaybillIndexQuery(WaybillOrderDTO query,List<Integer> statuses) {
+    public Criteria buildWaybillIndexQuery(WaybillOrderDTO query) {
         Criteria criteria = new Criteria();
         criteria.and("entId").is(LoginUserHolder.getEntId());
         criteria.and("delFlag").is(NumberConstant.ZERO);
@@ -404,12 +412,18 @@ public class WaybillManagementService {
         if (CollectionUtils.isNotEmpty(wOrderIds)) {
             Criteria.where("wOrderId").in(wOrderIds);
         }
-
-        if (StringUtils.isNotBlank(query.getStatus()) && !query.getStatus().equals("all")) {
-            criteria.and("status").is(Integer.valueOf(query.getStatus()));
-        } else {
-            criteria.and("status").in(statuses);
+        if (StringUtils.isNotBlank(query.getStatus())){
+            if (query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode()))) {
+                List<Integer> _statuses = new ArrayList<>();
+                _statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
+                _statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
+                criteria.and("status").in(_statuses);
+            }
+            if (!query.getStatus().equals("all")) {
+                criteria.and("status").is(Integer.valueOf(query.getStatus()));
+            }
         }
+
         // 装载时间
         if (Objects.nonNull(query.getStartLoadTime()) && Objects.nonNull(query.getEndLoadTime())) {
             criteria.and("loadTime").gte(query.getStartLoadTime()).lte(DateUtil.offsetDay(query.getEndLoadTime(), 1));
@@ -476,7 +490,7 @@ public class WaybillManagementService {
      */
     public HttpResult waybillIndexStatistics(WaybillOrderDTO query){
         List<Integer> statuses = initWaybillIndexStatus();
-        Criteria criteria = buildWaybillIndexQuery(query, statuses);
+        Criteria criteria = buildWaybillIndexQuery(query);
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
                 Aggregation.group("status").count().as("total"),
@@ -484,12 +498,12 @@ public class WaybillManagementService {
         );
         AggregationResults<TableTops> outputTypeCount = mongoTemplate.aggregate(aggregation, SckwWaybillOrder.class, TableTops.class);
         List<TableTops> results = outputTypeCount.getMappedResults();
-
+        Integer allTotal = 0;
         Map<String, TableTops> listMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         TableTops topTotal = new TableTops();
         topTotal.setName("全部");
         topTotal.setValue("all");
-        topTotal.setTotal(0);
+        topTotal.setTotal(allTotal);
         listMap.put("all", topTotal);
         statuses.forEach(e -> {
             TableTops top = new TableTops();
@@ -500,10 +514,13 @@ public class WaybillManagementService {
         });
         if(CollectionUtils.isNotEmpty(results)) {
             for(TableTops result: results) {
-                listMap.get(result.getValue()).setTotal(result.getTotal());
+                if(listMap.containsKey(result.getValue())) {
+                    listMap.get(result.getValue()).setTotal(result.getTotal());
+                }
+                allTotal += result.getTotal();
             }
         }
-        listMap.get("all").setTotal(listMap.values().parallelStream().mapToInt(e -> e.getTotal()).sum());
+        listMap.get("all").setTotal(allTotal);
         return HttpResult.ok(listMap.values());
     }
 

+ 1 - 1
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

@@ -453,7 +453,7 @@
         l_order_id = #{orderId}
         AND type = #{type} and del_flag = 0
         <if test="statusList != null and statusList.size() > 0">
-            and status in
+            and status not in
             <foreach collection="statusList" open="(" close=")" separator="," item="item">
                 #{item}
             </foreach>