Просмотр исходного кода

结算-物流运费相关除新增确认"线下付款"外开发完成

sptkw 2 лет назад
Родитель
Сommit
469058aa83

+ 8 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementLogisticsController.java

@@ -7,11 +7,13 @@ import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.dto.SettlementLogisticsDto;
 import com.sckw.payment.model.vo.req.SettlementReq;
+import com.sckw.payment.model.vo.req.SettlementWalletReq;
 import com.sckw.payment.model.vo.res.SettlementLogisticsVo;
 import com.sckw.payment.service.KwpSettlementLogisticsService;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
@@ -26,6 +28,7 @@ import java.util.stream.Collectors;
  * @date 2023-07-18 16:34
  */
 @RestController
+@Slf4j
 @RequestMapping(name = "结算-物流运费订单", path = "/kwpSettlementLogistics")
 public class KwpSettlementLogisticsController {
 
@@ -38,6 +41,11 @@ public class KwpSettlementLogisticsController {
         return HttpResult.ok(kwpSettlementLogisticsService.pageSelectCollection(settlementReq));
     }
 
+//    @PostMapping(name = "物流-电子钱 -列表", path = "testpageSelectCollection")
+//    public HttpResult testpageSelectCollection(@RequestBody @Valid SettlementReq settlementReq) {
+//       System.out.println(settlementReq.getIds());
+//        return HttpResult.ok(settlementReq);
+//    }
     @PostMapping(name = "运费收款-物流订单各状态列表总数", path = "getCountListCollection")
     public HttpResult getCountListCollection(@RequestBody @Valid SettlementReq settlementReq) {
         return HttpResult.ok(kwpSettlementLogisticsService.getCountListCollection(settlementReq));

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementWalletController.java

@@ -1,13 +1,13 @@
 package com.sckw.payment.controller;
 
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.payment.model.vo.req.SettlementReq;
 import com.sckw.payment.model.vo.req.SettlementWalletReq;
 import com.sckw.payment.service.KwpSettlementWalletService;
 import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+
 /**
  * 结算-电子钱包结算记录(交易订单结算/物流订单结算)
  *
@@ -40,7 +40,7 @@ public class KwpSettlementWalletController {
      * @date 2023-07-25 09:55
      */
     @GetMapping(name = "物流-电子钱包付款(货到付款)结算记录-新增", path = "confirmLogisticsPayment")
-    public HttpResult confirmLogisticsPayment(@RequestParam("id") Long id, @RequestParam("price") Float price) {
+    public HttpResult confirmLogisticsPayment(@RequestParam("id") Long id, @RequestParam("price") BigDecimal price) {
         return HttpResult.ok(kwpSettlementWalletService.confirmLogisticsPayment(id, price));
     }
 
@@ -59,7 +59,7 @@ public class KwpSettlementWalletController {
      * @date 2023-07-25 09:55
      */
     @GetMapping(name = "销售-付款确认-(新增电子钱包记录-采购货到付款)", path = "confirmTradePayment")
-    public HttpResult confirmTradePayment(@RequestParam("id") Long id, @RequestParam("price") Float price) {
+    public HttpResult confirmTradePayment(@RequestParam("id") Long id, @RequestParam("price") BigDecimal price) {
         return HttpResult.ok(kwpSettlementWalletService.confirmTradePayment(id, price));
     }
 

+ 14 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpSettlementLogistics.java

@@ -13,6 +13,7 @@ import java.time.LocalDateTime;
 
 /**
  * 结算-物流订单
+ *
  * @author xucaiqin
  * @date 2023-07-10 16:42:20
  */
@@ -45,6 +46,9 @@ public class KwpSettlementLogistics {
     @TableField(value = "sl_order_no")
     private String slOrderNo;
 
+    /**
+     * 名称
+     */
     @TableField(value = "`name`")
     private String name;
 
@@ -97,17 +101,26 @@ public class KwpSettlementLogistics {
     private String successPhone;
 
     /**
-     * 状态(待回款、部分回款、全部回款、回退
+     * 状态(1待结算2部分结算3全部结算
      */
     @TableField(value = "`status`")
     private Integer status;
 
+    /**
+     * 创建人
+     */
     @TableField(value = "create_by")
     private Long createBy;
 
+    /**
+     * 创建时间
+     */
     @TableField(value = "create_time")
     private LocalDateTime createTime;
 
+    /**
+     * 更新人
+     */
     @TableField(value = "update_by")
     private Long updateBy;
 

+ 48 - 66
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpSettlementWallet.java

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
+
+import lombok.Data;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
@@ -18,9 +21,14 @@ import lombok.ToString;
  */
 @Getter
 @Setter
+@Data
 @ToString
 @TableName(value = "kwp_settlement_wallet")
 public class KwpSettlementWallet {
+
+    /**
+     * 主键
+     */
     @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
@@ -31,27 +39,45 @@ public class KwpSettlementWallet {
     private Long entId;
 
     /**
-     * 交易订单id(kwo_trade_order)
+     * 结算id(交易订单结算/物流订单结算)
+     */
+    @TableField(value = "settlement_id")
+    private Long settlementId;
+
+    /**
+     * 1-物流 2-交易
+     */
+    @TableField(value = "order_type")
+    private Integer orderType;
+
+    /**
+     * 线上渠道 1-huifu
      */
-    @TableField(value = "order_id")
-    private Long orderId;
+    @TableField(value = "channel")
+    private Integer channel;
 
     /**
-     * 企业电子钱包id(kwp_wallet_ent 主键)
+     * 回款时间
      */
-    @TableField(value = "wallet_id")
-    private Long walletId;
+    @TableField(value = "pay_time")
+    private LocalDateTime payTime;
 
     /**
      * 金额
      */
-    @TableField(value = "price")
-    private BigDecimal price;
+    @TableField(value = "pay_price")
+    private BigDecimal payPrice;
 
     /**
-     * 类型(0付款、1退款)
+     * 剩余待付金额
      */
-    @TableField(value = "`type`")
+    @TableField(value = "topay_price")
+    private BigDecimal topayPrice;
+
+    /**
+     * 类型(1预付款、2货到付款)
+     */
+    @TableField(value = "type")
     private Integer type;
 
     /**
@@ -61,17 +87,26 @@ public class KwpSettlementWallet {
     private String remark;
 
     /**
-     * 状态(0扣款、1结算、2异常、
+     * 状态(1正常 、2异常
      */
-    @TableField(value = "`status`")
+    @TableField(value = "status")
     private Integer status;
 
+    /**
+     * 创建人
+     */
     @TableField(value = "create_by")
     private Long createBy;
 
+    /**
+     * 创建时间
+     */
     @TableField(value = "create_time")
     private LocalDateTime createTime;
 
+    /**
+     * 更新人
+     */
     @TableField(value = "update_by")
     private Long updateBy;
 
@@ -86,58 +121,5 @@ public class KwpSettlementWallet {
      */
     @TableField(value = "del_flag")
     private Integer delFlag;
-    private String settlementId;
-    private String orderType;
-    private String channel;
-    private String payTime;
-    private String payPrice;
-    private String topayPrice;
-
-    public String getTopayPrice() {
-        return topayPrice;
-    }
-
-    public void setTopayPrice(String topayPrice) {
-        this.topayPrice = topayPrice;
-    }
-
-    public String getPayPrice() {
-        return payPrice;
-    }
-
-    public void setPayPrice(String payPrice) {
-        this.payPrice = payPrice;
-    }
-
-    public String getPayTime() {
-        return payTime;
-    }
-
-    public void setPayTime(String payTime) {
-        this.payTime = payTime;
-    }
-
-    public String getChannel() {
-        return channel;
-    }
-
-    public void setChannel(String channel) {
-        this.channel = channel;
-    }
-
-    public String getOrderType() {
-        return orderType;
-    }
-
-    public void setOrderType(String orderType) {
-        this.orderType = orderType;
-    }
-
-    public String getSettlementId() {
-        return settlementId;
-    }
-
-    public void setSettlementId(String settlementId) {
-        this.settlementId = settlementId;
-    }
+
 }

+ 47 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/SettlementOrderTypeEnum.java

@@ -0,0 +1,47 @@
+package com.sckw.payment.model.constant;
+
+/**
+ * @author Aick Spt
+ * @date 2023-07-27 12:49
+ */
+public enum SettlementOrderTypeEnum {
+        LOGISTICS(1, "物流"),
+        TRADE(2, "贸易");
+
+        private int status;
+        private String desc;
+
+    SettlementOrderTypeEnum(int status, String desc) {
+            this.status = status;
+            this.desc = desc;
+        }
+
+        public int getStatus() {
+            return status;
+        }
+
+        public void setStatus(int status) {
+            this.status = status;
+        }
+
+        public String getDesc() {
+            return desc;
+        }
+
+        public void setDesc(String desc) {
+            this.desc = desc;
+        }
+
+        // 添加静态方法,根据 status 获取对应的 desc
+        public static String getStatusDesc(int status) {
+            for (SettlementOrderTypeEnum settlementOrderTypeEnum : values()) {
+                if (settlementOrderTypeEnum.getStatus() == status) {
+                    return settlementOrderTypeEnum.getDesc();
+                }
+            }
+            return null; // 可根据实际需求返回默认值或其他处理
+        }
+
+
+    }
+

+ 47 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/WalletChannelEnum.java

@@ -0,0 +1,47 @@
+package com.sckw.payment.model.constant;
+
+/**
+ * @author Aick Spt
+ * @date 2023-07-27 12:54
+ */
+public enum WalletChannelEnum {
+    HF(1, "huifu"),//汇付
+    XS(2, "xinsheng"),//新生
+    ZX(3, "zhongxin");//中信
+
+    private int status;
+    private String desc;
+
+    WalletChannelEnum(int status, String desc) {
+        this.status = status;
+        this.desc = desc;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    // 添加静态方法,根据 status 获取对应的 desc
+    public static String getStatusDesc(int status) {
+        for (WalletChannelEnum walletChannelEnum : values()) {
+            if (walletChannelEnum.getStatus() == status) {
+                return walletChannelEnum.getDesc();
+            }
+        }
+        return null; // 可根据实际需求返回默认值或其他处理
+    }
+
+
+}

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

@@ -1,7 +1,10 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.payment.model.KwpSettlementLogistics;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 import java.math.BigDecimal;
@@ -13,6 +16,8 @@ import java.util.Date;
  */
 @Getter
 @Setter
+@NoArgsConstructor
+@AllArgsConstructor
 public class SettlementLogisticsDto {
     /**
      * 主键

+ 137 - 33
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java

@@ -5,11 +5,18 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.IdWorker;
+import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
+import com.sckw.payment.dao.KwpSettlementTradeMapper;
 import com.sckw.payment.dao.KwpSettlementWalletMapper;
+import com.sckw.payment.model.KwpSettlementLogistics;
+import com.sckw.payment.model.KwpSettlementTrade;
 import com.sckw.payment.model.KwpSettlementWallet;
 import com.sckw.payment.model.constant.SettlementEnum;
+import com.sckw.payment.model.constant.SettlementOrderTypeEnum;
 import com.sckw.payment.model.constant.SettlementWalletPayTypeEnum;
+import com.sckw.payment.model.constant.WalletChannelEnum;
 import com.sckw.payment.model.dto.SettlementLogisticsDto;
+import com.sckw.payment.model.dto.SettlementTradeDto;
 import com.sckw.payment.model.dto.SettlementWalletDto;
 import com.sckw.payment.model.vo.req.SettlementWalletReq;
 import com.sckw.payment.model.vo.res.SettlementWalletVo;
@@ -17,8 +24,11 @@ import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -34,8 +44,14 @@ public class KwpSettlementWalletService {
 
     private final KwpSettlementWalletMapper settlementWalletMapper;
 
+    private final KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
+
     private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
 
+    private final KwpSettlementTradeService kwpSettlementTradeService;
+
+    private final KwpSettlementTradeMapper kwpSettlementTradeMapper;
+
     /**
      * 物流-电子钱包付款(货到付款)结算记录-列表
      *
@@ -91,35 +107,73 @@ public class KwpSettlementWalletService {
      * @return InsertId
      * @author Aick Spt
      * @date 2023-07-20 14:23
+     * <p>
+     * Transactional// isolation:事务的隔离级别,此处使用后端数据库的默认隔离级别, propagation: 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中(常见)。(rollbackFor = Exception.class, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
      */
-    public Integer confirmLogisticsPayment(Long id, Float price) {
-        log.info("接收到数据,开始物流-电子钱包付款(货到付款)结算记录-新增,待完善");
-        //todo 待完善
+    @Transactional
+    public Integer confirmLogisticsPayment(Long id, BigDecimal price) {
         //先查询出结算单情况
-        SettlementLogisticsDto settlementLogistics = kwpSettlementLogisticsService.detailPayment(id);
-        log.info(String.valueOf(settlementLogistics));
+        SettlementLogisticsDto settlementLogisticsDto = kwpSettlementLogisticsService.detailPayment(id);
+        log.info(String.valueOf(settlementLogisticsDto));
         //检查结算单状态和所差金额
-        if (settlementLogistics == null) {
+        if (settlementLogisticsDto == null) {
             log.error("非法请求,查无数据:" + id);
             throw new BusinessException("非法请求运费结算参数ID");
         }
-        if (settlementLogistics.getStatus() == SettlementEnum.ALL_PAYMENT.getStatus()) {
+        if (settlementLogisticsDto.getStatus() == SettlementEnum.ALL_PAYMENT.getStatus()) {
             log.error("非法请求,该订单已结算完成:" + id);
             throw new BusinessException("该订单已结算完成,无法操作");
         }
+        BigDecimal remainingReceivables = settlementLogisticsDto.getTotalPrice();
+        if (settlementLogisticsDto.getActualPrice() != null) {//剩余金额
+            remainingReceivables = settlementLogisticsDto.getTotalPrice().subtract(settlementLogisticsDto.getActualPrice());
+        }
 
-        //对比金额
-
+        if (remainingReceivables.compareTo(price) < 0) {//-1表示小于,0是等于,1是大于
+            log.error("本次结算输入金额比剩余付款金额大:ID:" + id + " 剩余金额:" + remainingReceivables + " 本次输入金额:" + price);
+            throw new BusinessException("参数错误:输入金额过大 " + price + " 剩余金额最大值:" + remainingReceivables);
+        }
         //累加入库结算单
-
-        //扣费电子钱包
-
-        //新增电子钱包结算记录
-        KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
-        kwpSettlementWallet.setId(new IdWorker(1).nextId());
-        //todo 待完善
-        settlementWalletMapper.insert(kwpSettlementWallet);
-        return settlementWalletMapper.confirmLogisticsPayment(id, price);
+        KwpSettlementLogistics settlementLogistics1 = new KwpSettlementLogistics();
+        settlementLogistics1.setId(settlementLogisticsDto.getId());
+        settlementLogistics1.setUpdateTime(LocalDateTime.now());
+        if (remainingReceivables.compareTo(price) == 0) {//全部结算
+            settlementLogistics1.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
+        }
+        if (remainingReceivables.compareTo(price) > 0) {//部分结算
+            settlementLogistics1.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
+        }
+        BigDecimal actualPrice = settlementLogisticsDto.getActualPrice();
+        settlementLogistics1.setActualPrice((actualPrice == null) ? price : actualPrice.add(price));
+        int upInt = kwpSettlementLogisticsMapper.updateById(settlementLogistics1);
+        if (upInt > 0) {
+            //新增一条电子钱包结算记录
+            remainingReceivables = remainingReceivables.subtract(price);
+            KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
+            kwpSettlementWallet.setId(new IdWorker(1).nextId());
+            kwpSettlementWallet.setEntId(settlementLogisticsDto.getEntId());
+            kwpSettlementWallet.setSettlementId(settlementLogisticsDto.getId());
+            kwpSettlementWallet.setOrderType(SettlementOrderTypeEnum.LOGISTICS.getStatus());
+            kwpSettlementWallet.setChannel(WalletChannelEnum.HF.getStatus());//先用数字默认定义为1
+            kwpSettlementWallet.setPayTime(LocalDateTime.now());
+            kwpSettlementWallet.setPayPrice(price);
+            kwpSettlementWallet.setTopayPrice(remainingReceivables);
+            kwpSettlementWallet.setType(SettlementWalletPayTypeEnum.CASH_ON_DELIVERY.getStatus());
+            kwpSettlementWallet.setRemark("");
+            kwpSettlementWallet.setStatus(1);
+            kwpSettlementWallet.setCreateBy(1L);//todo 待处理明确创建人
+            kwpSettlementWallet.setCreateTime(LocalDateTime.now());
+            kwpSettlementWallet.setUpdateBy(1L);//todo 待处理明确更新人
+            kwpSettlementWallet.setUpdateTime(LocalDateTime.now());
+            kwpSettlementWallet.setDelFlag(0);
+            Integer insertKwpSettlementWallet = settlementWalletMapper.insert(kwpSettlementWallet);
+
+            //物流货到付款电子钱包逻辑
+            //todo 待处理费电子钱包逻辑
+
+            return insertKwpSettlementWallet;
+        }
+        return null;
     }
 
     public PageRes<SettlementWalletVo> pageListTradePayment(SettlementWalletReq settlementWalletReq) {
@@ -151,25 +205,75 @@ public class KwpSettlementWalletService {
     }
 
 
-    public Integer confirmTradePayment(Long id, Float price) {
-        log.info("接收到数据,开始物流-销售-付款确认-(新增电子钱包记录-采购货到付款)-新增,待完善");
-        //todo 待完善
+    /**
+     * 销售-付款确认-(新增电子钱包记录-采购货到付款)
+     *
+     * @author Aick Spt
+     * @date 2023-07-27 16:13
+     */
+    public Integer confirmTradePayment(Long id, BigDecimal price) {
         //先查询出结算单情况
-
+        SettlementTradeDto settlementTradeDto = kwpSettlementTradeService.detailPayment(id);
+        log.info(String.valueOf(settlementTradeDto));
         //检查结算单状态和所差金额
+        if (settlementTradeDto == null) {
+            log.error("非法请求,查无数据:" + id);
+            throw new BusinessException("非法请求运费结算参数ID");
+        }
+        if (settlementTradeDto.getStatus() == SettlementEnum.ALL_PAYMENT.getStatus()) {
+            log.error("非法请求,该订单已结算完成:" + id);
+            throw new BusinessException("该订单已结算完成,无法操作");
+        }
+        BigDecimal remainingReceivables = settlementTradeDto.getTotalPrice();
+        if (settlementTradeDto.getActualPrice() != null) {//剩余金额
+            remainingReceivables = settlementTradeDto.getTotalPrice().subtract(settlementTradeDto.getActualPrice());
+        }
 
-        //对比金额
-
+        if (remainingReceivables.compareTo(price) < 0) {//-1表示小于,0是等于,1是大于
+            log.error("本次结算输入金额比剩余付款金额大:ID:" + id + " 剩余金额:" + remainingReceivables + " 本次输入金额:" + price);
+            throw new BusinessException("参数错误:输入金额过大 " + price + " 剩余金额最大值:" + remainingReceivables);
+        }
         //累加入库结算单
-
-        //扣费电子钱包
-
-        //新增电子钱包结算记录
-        KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
-        kwpSettlementWallet.setId(new IdWorker(1).nextId());
-        //todo 待完善
-        settlementWalletMapper.insert(kwpSettlementWallet);
-        return settlementWalletMapper.confirmLogisticsPayment(id, price);
+        KwpSettlementTrade kwpSettlementTrade = new KwpSettlementTrade();
+        kwpSettlementTrade.setId(settlementTradeDto.getId());
+        kwpSettlementTrade.setUpdateTime(LocalDateTime.now());
+        if (remainingReceivables.compareTo(price) == 0) {//全部结算
+            kwpSettlementTrade.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
+        }
+        if (remainingReceivables.compareTo(price) > 0) {//部分结算
+            kwpSettlementTrade.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
+        }
+        BigDecimal actualPrice = settlementTradeDto.getActualPrice();
+        kwpSettlementTrade.setActualPrice((actualPrice == null) ? price : actualPrice.add(price));
+        int upInt = kwpSettlementTradeMapper.updateById(kwpSettlementTrade);
+        if (upInt > 0) {
+            //新增一条电子钱包结算记录
+            remainingReceivables = remainingReceivables.subtract(price);
+            KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
+            kwpSettlementWallet.setId(new IdWorker(1).nextId());
+            kwpSettlementWallet.setEntId(settlementTradeDto.getEntId());
+            kwpSettlementWallet.setSettlementId(settlementTradeDto.getId());
+            kwpSettlementWallet.setOrderType(SettlementOrderTypeEnum.LOGISTICS.getStatus());
+            kwpSettlementWallet.setChannel(WalletChannelEnum.HF.getStatus());//先用数字默认定义为1
+            kwpSettlementWallet.setPayTime(LocalDateTime.now());
+            kwpSettlementWallet.setPayPrice(price);
+            kwpSettlementWallet.setTopayPrice(remainingReceivables);
+            kwpSettlementWallet.setType(SettlementWalletPayTypeEnum.CASH_ON_DELIVERY.getStatus());
+            kwpSettlementWallet.setRemark("");
+            kwpSettlementWallet.setStatus(1);
+            kwpSettlementWallet.setCreateBy(1L);//todo 待处理明确创建人
+            kwpSettlementWallet.setCreateTime(LocalDateTime.now());
+            kwpSettlementWallet.setUpdateBy(1L);//todo 待处理明确更新人
+            kwpSettlementWallet.setUpdateTime(LocalDateTime.now());
+            kwpSettlementWallet.setDelFlag(0);
+            Integer insertKwpSettlementWallet = settlementWalletMapper.insert(kwpSettlementWallet);
+
+            //物流货到付款电子钱包逻辑
+            //todo 待处理费电子钱包逻辑
+
+            return insertKwpSettlementWallet;
+        }
+        return null;
     }
 
     public PageRes<SettlementWalletVo> pageListTradeCollection(SettlementWalletReq settlementWalletReq) {