xucaiqin hace 1 día
padre
commit
e6cf941234

+ 4 - 17
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/context/LoginEntHolder.java

@@ -1,6 +1,5 @@
 package com.sckw.core.web.context;
 
-import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.model.LoginEntInfo;
 
 /**
@@ -74,23 +73,11 @@ public class LoginEntHolder {
         return LONGIN_ENT_HOLDER.get() == null ? null : LONGIN_ENT_HOLDER.get().getStatus();
     }
 
-    /**
-     * 专场标识
-     * @author zhaokang
-     * @Date 2020/04/13 0021
-     */
-    public static String getSpecial(){
-        return LONGIN_ENT_HOLDER.get() == null ? null : LONGIN_ENT_HOLDER.get().getSpecial();
-    }
 
-    /**
-     * 是否主平台(不属于专场)
-     * @author zk
-     * @Date 2023/12/17 0021
-     */
-    public static boolean getMainPlatform(){
-        String pecial = getSpecial();
-        return StringUtils.isNotBlank(pecial);
+    public static String getEntTypes(){
+        return LONGIN_ENT_HOLDER.get() == null ? "" : LONGIN_ENT_HOLDER.get().getEntTypes();
     }
 
+
+
 }

+ 67 - 0
sckw-modules/sckw-payment/deploy.sh

@@ -0,0 +1,67 @@
+#!/bin/bash
+
+set -e
+
+#echo "USER=$USER"
+#echo "HOME=$HOME"
+
+#ls -al ~/.ssh
+#cat ~/.ssh/config
+
+# ======================
+# 基础配置(每个服务改这里)
+# ======================
+REMOTE_HOST="test"
+
+DOCKER_NAME="sckw-ng-payment"
+SERVICE_NAME="sckw-payment"
+
+
+PROJECT_DIR="/mnt/d/Desk/Project/sckw-service-platform"
+DEPLOY_DIR="/www/wwwroot/sckw-ng-platform"
+JAR_NAME="${SERVICE_NAME}-1.1.0.jar"
+
+# ======================
+# 1. Maven构建
+# ======================
+echo "👉 [1/4] Maven build..."
+
+cd ${PROJECT_DIR}
+
+mvn clean package -pl sckw-modules/${SERVICE_NAME} -am -DskipTests -P test
+
+echo "✔ build success"
+
+# ======================
+# 2. 找jar包
+# ======================
+echo "👉 [2/4] locate jar..."
+
+JAR_PATH=${PROJECT_DIR}/sckw-modules/${SERVICE_NAME}/target/${JAR_NAME}
+
+echo "jar: ${JAR_PATH}"
+
+# ======================
+# 3. SCP上传
+# ======================
+echo "👉 [3/4] upload to server..."
+ls -lh ${JAR_PATH}
+
+scp ${JAR_PATH} ${REMOTE_HOST}:${DEPLOY_DIR}/${DOCKER_NAME}/
+
+# ======================
+# 4. 重启 docker compose
+# ======================
+echo "👉 [4/4] restart container..."
+
+
+ssh ${REMOTE_HOST} << EOF
+cd ${DEPLOY_DIR}
+docker compose up -d --build ${DOCKER_NAME}
+EOF
+
+ssh ${REMOTE_HOST} << EOF
+docker logs --tail=40 ${DOCKER_NAME}
+EOF
+
+echo "🎉 deploy finished: ${SERVICE_NAME}"

+ 18 - 20
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletPayableController.java

@@ -70,7 +70,7 @@ public class WalletPayableController  {
     @PostMapping("/payableList")
     public BaseResult<PageDataResult<WalletPayableRes>> payableList(@RequestBody @Validated WalletPayableQuery query) {
         PageInfo<WalletPayableRes> list = new PageInfo<>(Collections.emptyList());
-        String entTypes = LoginEntHolder.get().getEntTypes();
+        String entTypes = LoginEntHolder.getEntTypes();
         if(EntTypeEnum.consign(entTypes)){
             query.setFreightType(1);
         } else if (EntTypeEnum.carrier(entTypes)) {
@@ -90,7 +90,7 @@ public class WalletPayableController  {
     public BaseResult<List<TradeEntInfoResVo>> queryTradeEntIds(){
         TradeEntListQueryFeignDto queryFeignDto = new TradeEntListQueryFeignDto();
         queryFeignDto.setCurEntId(LoginEntHolder.getEntId());
-        String entTypes = LoginEntHolder.get().getEntTypes();
+        String entTypes = LoginEntHolder.getEntTypes();
         if (entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
             queryFeignDto.setTradeEntType(EntTypeEnum.PURCHASER.getCode());
         } else if (entTypes.contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
@@ -140,16 +140,27 @@ public class WalletPayableController  {
 
     /**
      * 申请付款
-     *
-     * @return ModelAndView
      */
-
-
     @Operation(summary = "申请付款")
     @PostMapping("/applyPay")
     public BaseResult<Object> applyPay(@RequestBody @Validated WalletPayableApplyPayDto applyPayDto) {
         return BaseResult.success(walletPayableService.applyPay(applyPayDto));
     }
+    /**
+     * 运费确认付款
+     */
+    @Operation(summary = "运费确认付款")
+    @PostMapping("/confirmPay")
+    public BaseResult<WalletPayAddRes> confirmPay(@RequestBody @Validated WalletPayableConfirmPayDto confirmPayDto) {
+        return  walletPayableService.confirmPay(confirmPayDto);
+    }
+
+
+    @Operation(summary = "获取付款信息")
+    @GetMapping("/getPayInfo")
+    public BaseResult<WalletPayAddRes> getPayInfo(@RequestParam("id") Long id) {
+        return walletPayableService.getPayInfo(id);
+    }
 
     /**
      * 查询申请付款记录列表
@@ -161,15 +172,7 @@ public class WalletPayableController  {
         return BaseResult.success(payableApplyRes);
     }
 
-    /**
-     * 运费确认付款
-     *
-     */
-    @Operation(summary = "运费确认付款")
-    @PostMapping("/confirmPay")
-    public BaseResult<WalletPayAddRes> confirmPay(@RequestBody @Validated WalletPayableConfirmPayDto confirmPayDto) {
-        return  walletPayableService.confirmPay(confirmPayDto);
-    }
+
 
     @Operation(description = "分页查询运费支付记录列表")
     @PostMapping("/payList")
@@ -178,11 +181,6 @@ public class WalletPayableController  {
         return BaseResult.success(PageDataResult.of(list));
     }
 
-    @Operation(summary = "付款")
-    @GetMapping("/getPayInfo")
-    public BaseResult<WalletPayAddRes> getPayInfo(@RequestParam("id") Long id) {
-        return walletPayableService.getPayInfo(id);
-    }
 
     /**
      * 运费到账回调接口

+ 2 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/enums/PayStatusEnum.java

@@ -31,10 +31,10 @@ public enum PayStatusEnum {
      * @param code 编码
      * @return 枚举值
      */
-    public static PayStatusEnum getByCode(Integer code) {
+    public static String getByCode(Integer code) {
         for (PayStatusEnum status : values()) {
             if (status.getCode().equals(code)) {
-                return status;
+                return status.getName();
             }
         }
         return null;

+ 5 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/mapper/WalletPayableMapper.java

@@ -1,5 +1,6 @@
 package com.sckw.payment.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.payment.entity.WalletPayable;
 import com.sckw.payment.pojo.vo.req.WalletPayableQuery;
 import com.sckw.payment.pojo.vo.res.WalletPayableSummary;
@@ -12,10 +13,10 @@ import java.util.List;
  * 待付运费清单Mapper接口
  *
  * @author tangys
- * @since  2026-01-06 10:30:54
+ * @since 2026-01-06 10:30:54
  */
 @Mapper
-public interface WalletPayableMapper {
+public interface WalletPayableMapper extends BaseMapper<WalletPayable> {
     /**
      * 分页查询待付运费清单列表
      *
@@ -75,13 +76,13 @@ public interface WalletPayableMapper {
     /**
      * 批量逻辑删除待付运费清单
      *
-     * @param idList 待付运费清单主键id列表
+     * @param idList   待付运费清单主键id列表
      * @param updateBy 登录用户名
      * @return 结果数据
      */
     int deleteWalletPayableLogicByIds(@Param("idList") List<Long> idList, @Param("updateBy") Long updateBy);
 
-    WalletPayable selectByConsignAndCarrier(@Param("consignEntId") Long consignEntId,@Param("carrierEntId") Long carrierEntId);
+    WalletPayable selectByConsignAndCarrier(@Param("consignEntId") Long consignEntId, @Param("carrierEntId") Long carrierEntId);
 
     WalletPayableSummary selectPayableSummary(WalletPayableQuery query);
 }

+ 4 - 7
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/impl/WalletAgentService.java

@@ -412,8 +412,7 @@ public class WalletAgentService extends ServiceImpl<WalletAgentMapper, WalletAge
         pageInfo = ((Page<WalletAgentRecord>) list).toPageInfo(e -> {
             WalletAgentRecordRes res = new WalletAgentRecordRes();
             BeanUtils.copyProperties(e, res);
-            PayStatusEnum statusEnum = PayStatusEnum.getByCode(e.getStatus());
-            res.setStatusDesc(statusEnum == null ? "" : statusEnum.getName());
+            res.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()));
             WalletAgent agent = finalAgentMap.get(e.getAgentId());
             Long tradeEntId = agent == null ? null : (proxy ? agent.getSupEntId() : agent.getAgtEntId());
             res.setTradeEntId(tradeEntId);
@@ -510,7 +509,7 @@ public class WalletAgentService extends ServiceImpl<WalletAgentMapper, WalletAge
         payReq.setFilter(getUid(walletAgent.getAgtEntId()));
         payReq.setOrderNo(orderNo);
         payReq.setAmt(payDto.getPayAmount().toString());
-        payReq.setNoticeUrl(applicationProperties.getCharge());
+        payReq.setNoticeUrl(applicationProperties.getCharge3());
         payReq.setRemark(payDto.getRemark());
 
         R<PayRes> pay;
@@ -750,8 +749,7 @@ public class WalletAgentService extends ServiceImpl<WalletAgentMapper, WalletAge
         LambdaQueryWrapper<WalletAgentRecord> wrapper = Wrappers.lambdaQuery(WalletAgentRecord.class)
                 .eq(WalletAgentRecord::getDelFlag, 0)
                 .eq(WalletAgentRecord::getAgentId, agentId)
-                .orderByAsc(WalletAgentRecord::getStatus)
-                .orderByDesc(WalletAgentRecord::getCreateTime, WalletAgentRecord::getId);
+                .orderByDesc(WalletAgentRecord::getId);
         List<WalletAgentRecord> list = walletAgentRecordMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(list)) {
             return BaseResult.success(new ArrayList<>());
@@ -769,8 +767,7 @@ public class WalletAgentService extends ServiceImpl<WalletAgentMapper, WalletAge
         List<WalletAgentRecordRes> resList = list.stream().map(e -> {
             WalletAgentRecordRes res = new WalletAgentRecordRes();
             BeanUtils.copyProperties(e, res);
-            PayStatusEnum statusEnum = PayStatusEnum.getByCode(e.getStatus());
-            res.setStatusDesc(statusEnum == null ? "" : statusEnum.getName());
+            res.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()));
             res.setCreateTime(toDate(e.getCreateTime()));
             res.setTradeEntId(tradeEntId);
             res.setTradeEntName(finalTradeEntName);

+ 2 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/impl/WalletPayableBalanceServiceImpl.java

@@ -15,6 +15,7 @@ import com.sckw.payment.pojo.vo.res.WalletPayableBalanceRes;
 import com.sckw.payment.service.IWalletPayableBalanceService;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,6 +32,7 @@ import java.util.stream.Collectors;
  * @author tangys
  * @since  2026-01-12 16:24:22
  */
+@Slf4j
 @Service
 public class WalletPayableBalanceServiceImpl implements IWalletPayableBalanceService {
 

+ 135 - 37
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/impl/WalletPayableServiceImpl.java

@@ -1,34 +1,48 @@
 package com.sckw.payment.service.impl;
 
+import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
 import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.vo.FileInfoVO;
 import com.sckw.core.utils.PageUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.BaseResult;
+import com.sckw.file.api.dubbo.RemoteFileService;
+import com.sckw.payment.api.model.dto.common.R;
+import com.sckw.payment.config.ApplicationProperties;
 import com.sckw.payment.entity.*;
 import com.sckw.payment.enums.ExecutionStatusEnum;
 import com.sckw.payment.enums.OrderTypeEnum;
 import com.sckw.payment.enums.PayStatusEnum;
 import com.sckw.payment.enums.TransactionTypeEnum;
 import com.sckw.payment.mapper.*;
+import com.sckw.payment.pojo.dto.CustomSettleDto;
+import com.sckw.payment.pojo.dto.CustomSettleRes;
+import com.sckw.payment.pojo.dto.DivideDto;
 import com.sckw.payment.pojo.vo.PayRes;
 import com.sckw.payment.pojo.vo.req.*;
 import com.sckw.payment.pojo.vo.res.*;
 import com.sckw.payment.service.IWalletPayableService;
+import com.sckw.payment.service.PayXwService;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -39,9 +53,9 @@ import java.util.stream.Collectors;
  * @author tangys
  * @since 2026-01-06 11:03:35
  */
+@Slf4j
 @Service
 public class WalletPayableServiceImpl implements IWalletPayableService {
-    private static final Logger logger = LoggerFactory.getLogger(WalletPayableServiceImpl.class);
 
     @Autowired
     private WalletPayableMapper walletPayableMapper;
@@ -49,20 +63,27 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
     private WalletPayableBalanceMapper walletPayableBalanceMapper;
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
     private RemoteSystemService remoteSystemService;
-
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteFileService remoteFileService;
     @Autowired
     private WalletBusinessFileMapper businessFileMapper;
-
+    @Resource
+    private ApplicationProperties applicationProperties;
+    @Resource
+    private KwpWalletSplitMapper kwpWalletSplitMapper;
     @Autowired
     private WalletPayableApplyMapper walletPayableApplyMapper;
-
+    @Resource
+    private PayXwService payXwService;
     @Autowired
     private WalletPayablePayMapper walletPayablePayMapper;
+    @Autowired
+    private KwpWalletMapper kwpWalletMapper;
 
     @Override
     public PageInfo<WalletPayableRes> selectWalletPayableList(WalletPayableQuery query) {
         PageInfo<WalletPayableRes> pageInfo = new PageInfo<>(new ArrayList<>());
-        query.setCurEntId(LoginUserHolder.getUserId());
+        query.setCurEntId(LoginUserHolder.getEntId());
         PageUtils.startPage(query);
         List<WalletPayable> walletPayables = walletPayableMapper.selectWalletPayableList(query);
         if (!CollectionUtils.isEmpty(walletPayables)) {
@@ -75,7 +96,7 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
             }).toList();
             List<EntCacheResDto> entInfos = remoteSystemService.queryEntCacheByIds(tradeEntIdList);
             Map<Long, String> entNameMap;
-            if(!CollectionUtils.isEmpty(entInfos)){
+            if (!CollectionUtils.isEmpty(entInfos)) {
                 entNameMap = entInfos.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName));
             } else {
                 entNameMap = new HashMap<>();
@@ -113,6 +134,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
                 WalletBusinessFile file = new WalletBusinessFile();
                 file.setBusinessId(payableBalance.getId());
                 file.setFilePath(e);
+                file.setCreateBy(LoginUserHolder.getUserId());
+                file.setCreateTime(new Date());
                 list.add(file);
             });
             businessFileMapper.insertBatch(list);
@@ -122,7 +145,7 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
 
     private int manualEntryFreight(WalletPayable payable, WalletPayableManualDto payableManualDto) {
         // 查询是否存在待待付/代收运费
-        WalletPayable existedPayable = walletPayableMapper.selectByConsignAndCarrier(payableManualDto.getTradeEntId(), LoginUserHolder.get().getEntId());
+        WalletPayable existedPayable = walletPayableMapper.selectByConsignAndCarrier(payableManualDto.getTradeEntId(), LoginUserHolder.getEntId());
         int result = 0;
         if (existedPayable != null) {
             // 如果存在,则更新待待付/代收运费
@@ -140,9 +163,11 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
             if (Objects.equals(payableManualDto.getFreightType(), 1)) {
                 //待付/代收运费
                 payable.setConsignEntId(payableManualDto.getTradeEntId());
-                payable.setCarrierEntId(LoginUserHolder.get().getEntId());
+                payable.setCarrierEntId(LoginUserHolder.getEntId());
                 payable.setFreight(payableManualDto.getTradeAmount());
                 payable.setTradingFreight(BigDecimal.ZERO);
+                payable.setCreateBy(LoginUserHolder.getUserId());
+                payable.setCreateTime(new Date());
                 payable.setPayingFreight(BigDecimal.ZERO);
                 result = walletPayableMapper.insertWalletPayable(payable);
             }
@@ -152,10 +177,10 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
 
     private WalletPayableBalance buildWalletManualPayableBalance(WalletPayable payable, WalletPayableManualDto payableManualDto) {
         WalletPayableBalance payableBalance = new WalletPayableBalance();
-        payableBalance.setOrderNo("f" + System.currentTimeMillis());
+        payableBalance.setOrderNo(IdUtil.getSnowflakeNextIdStr());
         payableBalance.setOrderType(OrderTypeEnum.PAYMENT_ORDER.getCode());
         payableBalance.setConsignEntId(payableManualDto.getTradeEntId());
-        payableBalance.setCarrierEntId(LoginUserHolder.get().getEntId());
+        payableBalance.setCarrierEntId(LoginUserHolder.getEntId());
         payableBalance.setTradeType(TransactionTypeEnum.MANUAL_ENTRY.getCode());
         payableBalance.setTradeAmount(payableManualDto.getTradeAmount());
         payableBalance.setFreight(payable.getFreight());
@@ -164,6 +189,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         payableBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
         payableBalance.setRemark(payableManualDto.getRemark());
         payableBalance.setVoucherFlag(CollectionUtils.isEmpty(payableManualDto.getVoucherFiles()) ? 0 : 1);
+        payableBalance.setCreateBy(LoginUserHolder.getUserId());
+        payableBalance.setCreateTime(new Date());
         return payableBalance;
     }
 
@@ -179,6 +206,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
             payable.setCarrierEntId(payableAddDto.getCarriageEntId());
             payable.setFreight(payableAddDto.getTradeAmount());
             payable.setTradingFreight(payableAddDto.getTradeAmount());
+            payable.setCreateTime(new Date());
+            payable.setCreateBy(LoginUserHolder.getUserId());
             payable.setPayingFreight(payableAddDto.getTradeAmount());
             result = walletPayableMapper.insertWalletPayable(payable);
         }
@@ -198,7 +227,7 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         //待付运费清单处理
         if (Objects.equals(payableUpdateDto.getTradeType(), TransactionTypeEnum.FREEZE.getCode())) {
             //冻结
-            if(payableUpdateDto.getTradeAmount() == null){
+            if (payableUpdateDto.getTradeAmount() == null) {
                 throw new BusinessException("交易金额不能为空");
             }
             existedPayable.setTradingFreight(existedPayable.getTradingFreight().add(payableUpdateDto.getTradeAmount()));
@@ -214,7 +243,7 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
             payableUpdateDto.setTradeAmount(payableBalance.getTradeAmount());
         } else if (Objects.equals(payableUpdateDto.getTradeType(), TransactionTypeEnum.CONSUME.getCode())) {
             //消费
-            if(payableUpdateDto.getTradeAmount() == null){
+            if (payableUpdateDto.getTradeAmount() == null) {
                 throw new BusinessException("交易金额不能为空");
             }
             existedPayable.setFreight(existedPayable.getFreight().add(payableUpdateDto.getTradeAmount()));
@@ -241,6 +270,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         payableBalance.setPayingFreight(payable.getPayingFreight());
         payableBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
         payableBalance.setRemark(payableAddDto.getRemark());
+        payableBalance.setCreateBy(LoginUserHolder.getUserId());
+        payableBalance.setCreateTime(new Date());
         return payableBalance;
     }
 
@@ -281,6 +312,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         payableBalance.setFreight(payable.getFreight());
         payableBalance.setPayingFreight(payable.getPayingFreight());
         payableBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
+        payableBalance.setCreateBy(LoginUserHolder.getUserId());
+        payableBalance.setCreateTime(new Date());
         payableBalance.setRemark(freightApply.getRemark());
         return payableBalance;
     }
@@ -288,9 +321,11 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
     private WalletPayableApply buildWalletPayableApply(WalletPayable payable, WalletPayableApplyPayDto applyPayDto) {
         WalletPayableApply apply = new WalletPayableApply();
         apply.setPayableId(payable.getId());
-        apply.setOrderNo("f" + System.currentTimeMillis());
+        apply.setOrderNo(IdUtil.getSnowflakeNextIdStr());
         apply.setApplyAmount(applyPayDto.getApplyAmount());
         apply.setRemark(applyPayDto.getRemark());
+        apply.setCreateBy(LoginUserHolder.getUserId());
+        apply.setCreateTime(new Date());
         return apply;
     }
 
@@ -343,7 +378,7 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
             pageInfo = ((Page<WalletPayablePay>) payablePays).toPageInfo(e -> {
                 WalletPayablePayRes freightRecordRes = new WalletPayablePayRes();
                 BeanUtils.copyProperties(e, freightRecordRes);
-                freightRecordRes.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()).getName());
+                freightRecordRes.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()));
                 return freightRecordRes;
             });
         }
@@ -363,22 +398,18 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         walletPayAddRes.setSettleAcctNo(data.getSettleAcct());
         walletPayAddRes.setAmount(new BigDecimal(data.getAmt()));
         walletPayAddRes.setBankName("新网银行");
-        return BaseResult.success(generateWalletPayAddRes(payablePay));
+        return BaseResult.success(walletPayAddRes);
     }
 
-
-    private WalletPayAddRes generateWalletPayAddRes(WalletPayablePay walletPayablePay) {
-        //todo 获取打款账户信息
-        //根据供应商企业id查询银行账户信息
-//        Long supEntId = prepaid.getSupEntId();
-
-        WalletPayAddRes res = new WalletPayAddRes();
-        res.setOrderNo(walletPayablePay.getOrderNo());
-        res.setSettleAcctName("xxx");
-        res.setSettleAcctNo("xxx");
-        res.setAmount(walletPayablePay.getApplyAmount());
-        res.setBankName("xxx");
-        return res;
+    private String getUid(Long id) {
+        if (Objects.isNull(id)) {
+            return null;
+        }
+        KwpWallet kwpWallet = kwpWalletMapper.selectOne(Wrappers.lambdaQuery(KwpWallet.class).eq(KwpWallet::getEntId, id).eq(KwpWallet::getStatus, 2).eq(KwpWallet::getDelFlag, 0));
+        if (Objects.isNull(kwpWallet)) {
+            return null;
+        }
+        return kwpWallet.getUid();
     }
 
     //构建支付记录
@@ -386,25 +417,91 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         WalletPayablePay payablePay = new WalletPayablePay();
         payablePay.setPayableId(payableApply.getPayableId());
         payablePay.setApplyOrderNo(payableApply.getOrderNo());
-        payablePay.setOrderNo("f" + System.currentTimeMillis());
+        payablePay.setOrderNo(IdUtil.getSnowflakeNextIdStr());
         payablePay.setApplyAmount(payableApply.getApplyAmount().subtract(payableApply.getPayingAmount().add(payableApply.getReceivedAmount())));
         payablePay.setReceivedAmount(BigDecimal.ZERO);
+        payablePay.setCreateBy(LoginUserHolder.getUserId());
+        payablePay.setCreateTime(new Date());
         return payablePay;
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void receivedCallback(ReceivedCallbackDto receivedCallbackDto) {
-        //1.todo 修改在线钱包金额
-        //2.todo 插入在线钱包明细
-        //3.修改支付记录到账金额和状态
+        log.info("运费到账回调接口 {}", JSONObject.toJSONString(receivedCallbackDto));
         WalletPayablePay walletPayablePay = walletPayablePayMapper.selectWalletPayablePayByOrderNo(receivedCallbackDto.getPayOrderNo());
         if (walletPayablePay == null) {
-            throw new BusinessException("支付记录不存在");
+            throw new BusinessException("运费支付记录不存在");
         }
         walletPayablePay.setReceivedAmount(receivedCallbackDto.getTranAmt());
         walletPayablePay.setStatus(1);
         walletPayablePayMapper.updateWalletPayablePay(walletPayablePay);
-        //4.修改申请记录支付中=0,到账金额,判断申请金额是否等于到账金额,等于则修改状态为已完成
+
+        WalletPayable walletPayable = walletPayableMapper.selectById(walletPayablePay.getPayableId());
+
+        CustomSettleDto customSettleDto = new CustomSettleDto();
+
+        KwpWalletSplit kwpWalletSplit = new KwpWalletSplit();
+        try {
+            // 新增清分订单,清分成功后,增加可提现余额
+            customSettleDto.setUid(getUid(walletPayable.getConsignEntId()));
+            customSettleDto.setAmt(String.valueOf(receivedCallbackDto.getTranAmt()));
+            customSettleDto.setMchtFee("0.00");
+            customSettleDto.setNoticeUrl(applicationProperties.getSplit());
+            customSettleDto.setSummery("");
+            customSettleDto.setRemark("清分");
+            DivideDto divideDto = new DivideDto();
+            divideDto.setAmt(String.valueOf(receivedCallbackDto.getTranAmt()));
+            divideDto.setFilter(getUid(walletPayable.getCarrierEntId()));
+            customSettleDto.setDivide(Lists.newArrayList(divideDto));
+
+            R<CustomSettleRes> split = payXwService.split(customSettleDto);
+            kwpWalletSplit.setStatus(1);
+            if (split.getCode() != 200) {
+                log.error("清分失败 {}", JSONObject.toJSONString(split));
+                kwpWalletSplit.setStatus(3);
+            }
+            CustomSettleRes data = split.getData();
+            kwpWalletSplit.setFromEnt(walletPayable.getConsignEntId());
+            kwpWalletSplit.setToEnt(walletPayable.getCarrierEntId());
+            kwpWalletSplit.setPayOrderNo(receivedCallbackDto.getPayOrderNo());
+            kwpWalletSplit.setOrderNo(Objects.nonNull(data) ? data.getTxnNo() : "-");
+            kwpWalletSplit.setAction(1);
+            kwpWalletSplit.setMoney(receivedCallbackDto.getTranAmt());
+            kwpWalletSplit.setRemark("");
+            kwpWalletSplit.setCreateBy(LoginUserHolder.getUserId());
+            kwpWalletSplit.setCreateTime(LocalDateTime.now());
+            kwpWalletSplit.setUpdateBy(LoginUserHolder.getUserId());
+            kwpWalletSplit.setUpdateTime(LocalDateTime.now());
+            kwpWalletSplit.setDelFlag(0);
+        } catch (Exception e) {
+            log.error("清分异常 {} 异常信息 {}", JSONObject.toJSONString(customSettleDto), e.getMessage());
+        } finally {
+            kwpWalletSplitMapper.insert(kwpWalletSplit);
+        }
+
+        WalletBusinessFile walletBusinessFile = new WalletBusinessFile();
+        try {
+            walletBusinessFile.setBusinessId(walletPayablePay.getId());
+            walletBusinessFile.setRemark("");
+            walletBusinessFile.setStatus(0);
+            walletBusinessFile.setDelFlag(0);
+            walletBusinessFile.setCreateBy(LoginUserHolder.getUserId());
+            walletBusinessFile.setCreateTime(new Date());
+            walletBusinessFile.setUpdateBy(LoginUserHolder.getUserId());
+            walletBusinessFile.setUpdateTime(new Date());
+            MultipartFile file = receivedCallbackDto.getFile();
+            BaseResult<FileInfoVO> httpResult = remoteFileService.fileUpload(file);
+            if (HttpStatus.SUCCESS_CODE == httpResult.getCode()) {
+                FileInfoVO data = httpResult.getData();
+                walletBusinessFile.setFilePath(Objects.nonNull(data) ? data.getFileAbsolutePath() : "");
+            }
+        } catch (Exception e) {
+            log.error("支付凭证文件写入异常 {}", e.getMessage());
+        } finally {
+            businessFileMapper.insert(walletBusinessFile);
+        }
+
         WalletPayableApply payableApply = walletPayableApplyMapper.selectWalletPayableApplyByOrderNo(walletPayablePay.getApplyOrderNo());
         payableApply.setPayingAmount(BigDecimal.ZERO);
         payableApply.setReceivedAmount(payableApply.getReceivedAmount().add(receivedCallbackDto.getTranAmt()));
@@ -413,7 +510,6 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         }
         walletPayableApplyMapper.updateWalletPayableApply(payableApply);
         //5.运费清单付款中金额扣减
-        WalletPayable walletPayable = walletPayableMapper.selectWalletPayableById(walletPayablePay.getPayableId());
         walletPayable.setPayingFreight(walletPayable.getPayingFreight().subtract(receivedCallbackDto.getTranAmt()));
         walletPayableMapper.updateWalletPayable(walletPayable);
         //6.运费明细插入记录
@@ -432,6 +528,8 @@ public class WalletPayableServiceImpl implements IWalletPayableService {
         payableBalance.setFreight(payable.getFreight());
         payableBalance.setTradingFreight(payable.getTradingFreight());
         payableBalance.setPayingFreight(payable.getPayingFreight());
+        payableBalance.setCreateTime(new Date());
+        payableBalance.setCreateBy(LoginUserHolder.getUserId());
         payableBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
         return payableBalance;
     }

+ 2 - 7
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/impl/WalletPrepaidBalanceServiceImpl.java

@@ -10,16 +10,14 @@ import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.payment.entity.WalletPrepaidBalance;
 import com.sckw.payment.enums.ExecutionStatusEnum;
 import com.sckw.payment.enums.TransactionTypeEnum;
-import com.sckw.payment.mapper.WalletBusinessFileMapper;
 import com.sckw.payment.mapper.WalletPrepaidBalanceMapper;
 import com.sckw.payment.pojo.vo.req.WalletPrepaidBalanceQuery;
 import com.sckw.payment.pojo.vo.res.WalletPrepaidBalanceRes;
 import com.sckw.payment.service.IWalletPrepaidBalanceService;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -34,18 +32,15 @@ import java.util.stream.Collectors;
  * @author tangys
  * @since  2026-01-12 16:24:22
  */
+@Slf4j
 @Service
 public class WalletPrepaidBalanceServiceImpl implements IWalletPrepaidBalanceService {
-    private static final Logger logger = LoggerFactory.getLogger(WalletPrepaidBalanceServiceImpl.class);
 
     @Autowired
     private WalletPrepaidBalanceMapper walletPrepaidBalanceMapper;
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
     private RemoteSystemService remoteSystemService;
 
-    @Autowired
-    private WalletBusinessFileMapper businessFileMapper;
-
     @Override
     public PageInfo<WalletPrepaidBalanceRes> selectWalletPrepaidBalanceList(WalletPrepaidBalanceQuery query) {
         PageInfo<WalletPrepaidBalanceRes> pageInfo = new PageInfo<>(new ArrayList<>());

+ 14 - 6
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/impl/WalletPrepaidServiceImpl.java

@@ -162,12 +162,12 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
     }
 
     public WalletPrepaid queryPrepaidBalance(Long supEntId) {
-        return walletPrepaidMapper.selectByProEntIdAndSupEntId(LoginUserHolder.get().getEntId(), supEntId);
+        return walletPrepaidMapper.selectByProEntIdAndSupEntId(LoginUserHolder.getEntId(), supEntId);
     }
 
     private int manualEntryPrepaid(WalletPrepaid walletPrepaid, WalletPrepaidManualDto manualEntryDto) {
         // 查询是否存在待履约/预付数据
-        WalletPrepaid existedPrepaid = walletPrepaidMapper.selectByProEntIdAndSupEntId(manualEntryDto.getTradeEntId(), LoginUserHolder.get().getEntId());
+        WalletPrepaid existedPrepaid = walletPrepaidMapper.selectByProEntIdAndSupEntId(manualEntryDto.getTradeEntId(), LoginUserHolder.getEntId());
         int result;
         if (existedPrepaid != null) {
             // 如果存在,则更新待履约/预付金额
@@ -176,7 +176,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
             BeanUtils.copyProperties(existedPrepaid, walletPrepaid);
         } else {
             // 如果不存在,则新增一条待履约/预付数据
-            walletPrepaid.setSupEntId(LoginUserHolder.get().getEntId());
+            walletPrepaid.setSupEntId(LoginUserHolder.getEntId());
             walletPrepaid.setProEntId(manualEntryDto.getTradeEntId());
             walletPrepaid.setPreBalance(manualEntryDto.getTradeAmount());
             result = walletPrepaidMapper.insertWalletPrepaid(walletPrepaid);
@@ -189,7 +189,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         WalletPrepaidBalance prepaidBalance = new WalletPrepaidBalance();
         prepaidBalance.setOrderNo("p" + System.currentTimeMillis());
         prepaidBalance.setOrderType(OrderTypeEnum.PREPAYMENT_ORDER.getCode());
-        prepaidBalance.setSupEntId(LoginUserHolder.get().getEntId());
+        prepaidBalance.setSupEntId(LoginUserHolder.getEntId());
         prepaidBalance.setProEntId(manualEntryDto.getTradeEntId());
         prepaidBalance.setTradeType(TransactionTypeEnum.MANUAL_ENTRY.getCode());
         prepaidBalance.setTradeAmount(manualEntryDto.getTradeAmount());
@@ -199,6 +199,8 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         prepaidBalance.setRemark(manualEntryDto.getRemark());
         prepaidBalance.setVoucherFlag(CollectionUtils.isEmpty(manualEntryDto.getVoucherFiles()) ? 0 : 1);
         prepaidBalance.setDelFlag(0);
+        prepaidBalance.setCreateBy(LoginUserHolder.getUserId());
+        prepaidBalance.setCreateTime(new Date());
         return prepaidBalance;
     }
 
@@ -275,7 +277,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
             pageInfo = ((Page<WalletPrepaidRecord>) prepaidRecords).toPageInfo(e -> {
                 WalletPrepaidRecordRes prepaidRecordRes = new WalletPrepaidRecordRes();
                 BeanUtils.copyProperties(e, prepaidRecordRes);
-                prepaidRecordRes.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()).getName());
+                prepaidRecordRes.setStatusDesc(PayStatusEnum.getByCode(e.getStatus()));
                 return prepaidRecordRes;
             });
         }
@@ -325,6 +327,8 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         BeanUtils.copyProperties(prepaidAddDto, prepaidRecord);
         prepaidRecord.setOrderNo(payReq.getOrderNo());
         prepaidRecord.setData(JSONObject.toJSONString(pay.getData()));
+        prepaidRecord.setCreateBy(LoginUserHolder.getUserId());
+        prepaidRecord.setCreateTime(new Date());
         walletPrepaidRecordMapper.insertWalletPrepaidRecord(prepaidRecord);
         WalletPayAddRes walletPayAddRes = new WalletPayAddRes();
         PayRes data = pay.getData();
@@ -408,7 +412,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         }
         WalletBusinessFile walletBusinessFile = new WalletBusinessFile();
         try {
-            walletBusinessFile.setBusinessId(kwpWalletSplit.getId());
+            walletBusinessFile.setBusinessId(walletPrepaid.getId());
             walletBusinessFile.setRemark("");
             walletBusinessFile.setStatus(0);
             walletBusinessFile.setDelFlag(0);
@@ -524,6 +528,8 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         prepaidBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
         prepaidBalance.setRemark(prepaidDto.getRemark());
         prepaidBalance.setVoucherFlag(0);
+        prepaidBalance.setCreateBy(LoginUserHolder.getUserId());
+        prepaidBalance.setCreateTime(new Date());
         return prepaidBalance;
     }
 
@@ -538,6 +544,8 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
         prepaidBalance.setPreBalance(walletPrepaid.getPreBalance());
         prepaidBalance.setTradingAmount(walletPrepaid.getTradingAmount());
         prepaidBalance.setStatus(ExecutionStatusEnum.SUCCESS.getCode());
+        prepaidBalance.setCreateBy(LoginUserHolder.getUserId());
+        prepaidBalance.setCreateTime(new Date());
         return prepaidBalance;
     }
 

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

@@ -39,10 +39,10 @@
         SELECT 1
         FROM wallet_payable_apply wpp
         WHERE wp.id=wpp.payable_id
-        AND wpp.status = 0 -- 这里判断 b 表的 target_field 是否为指定值
+        AND wpp.status = 0
         ) THEN 1
         ELSE 0
-        END AS existsApply  -- 标识字段,存在为 1,不存在为 0
+        END AS existsApply
         FROM wallet_payable wp WHERE wp.DEL_FLAG = '0'
         <choose>
             <when test="freightType == 1">