From fe8871b5f150df9ee43d828a11da5f47685991d6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 10 May 2025 11:48:29 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90MALL=20=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E3=80=91=E4=BD=A3=E9=87=91=E6=8F=90=E7=8E=B0=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8F=90=E7=8E=B0=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8F=91=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/withdraw/BrokerageWithdrawRespVO.java | 3 +++ .../mysql/brokerage/BrokerageWithdrawMapper.java | 8 ++++---- .../brokerage/BrokerageWithdrawServiceImpl.java | 13 +++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRespVO.java index 0abd77e69a..4096dd9514 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRespVO.java @@ -16,6 +16,9 @@ public class BrokerageWithdrawRespVO extends BrokerageWithdrawBaseVO { @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161") private Long id; + @Schema(description = "转账错误提示", example = "余额不足") + private String transferErrorMsg; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java index 83513ef7f5..71828f7c08 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java @@ -28,17 +28,17 @@ public interface BrokerageWithdrawMapper extends BaseMapperX() .eq(BrokerageWithdrawDO::getId, id) - .eq(BrokerageWithdrawDO::getStatus, status)); + .eq(BrokerageWithdrawDO::getStatus, whereStatus)); } default List selectCountAndSumPriceByUserIdAndStatus(Collection userIds, diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java index ebc75fa65f..4df5f3e085 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java @@ -86,15 +86,24 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { public void auditBrokerageWithdraw(Long id, BrokerageWithdrawStatusEnum status, String auditReason, String userIp) { // 1.1 校验存在 BrokerageWithdrawDO withdraw = validateBrokerageWithdrawExists(id); + // 1.2 特殊:【重新转账】如果是提现失败,并且状态是审核中,那么更新状态为审核中,并且清空 transferErrorMsg + if (BrokerageWithdrawStatusEnum.WITHDRAW_FAIL.getStatus().equals(withdraw.getStatus())) { + int updateCount = brokerageWithdrawMapper.updateByIdAndStatus(id, withdraw.getStatus(), + new BrokerageWithdrawDO().setStatus(BrokerageWithdrawStatusEnum.AUDITING.getStatus()).setTransferErrorMsg("")); + if (updateCount == 0) { + throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); + } + withdraw.setStatus(BrokerageWithdrawStatusEnum.AUDITING.getStatus()).setTransferErrorMsg(""); + } // 1.2 校验状态为审核中 if (ObjectUtil.notEqual(BrokerageWithdrawStatusEnum.AUDITING.getStatus(), withdraw.getStatus())) { throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); } // 2. 更新状态 - int rows = brokerageWithdrawMapper.updateByIdAndStatus(id, BrokerageWithdrawStatusEnum.AUDITING.getStatus(), + int updateCount = brokerageWithdrawMapper.updateByIdAndStatus(id, withdraw.getStatus(), new BrokerageWithdrawDO().setStatus(status.getStatus()).setAuditReason(auditReason).setAuditTime(LocalDateTime.now())); - if (rows == 0) { + if (updateCount == 0) { throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); }