Commit 3aa9ea997ba4f25e7c518c5b7bdab32327b9236a
1 parent
d886f819
fix: 【mall】修正分销提现时,金额计算逻辑带上手续费,确保转账金额与实际提现金额一致
Showing
1 changed file
with
6 additions
and
4 deletions
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java
| @@ -147,9 +147,10 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -147,9 +147,10 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 147 | userAccount = wallet.getId().toString(); | 147 | userAccount = wallet.getId().toString(); |
| 148 | } | 148 | } |
| 149 | // 1.2 构建请求 | 149 | // 1.2 构建请求 |
| 150 | + Integer transferPrice = withdraw.getPrice() - withdraw.getFeePrice(); // 计算实际转账金额(提现金额 - 手续费) | ||
| 150 | PayTransferCreateReqDTO transferReqDTO = new PayTransferCreateReqDTO() | 151 | PayTransferCreateReqDTO transferReqDTO = new PayTransferCreateReqDTO() |
| 151 | .setAppKey(tradeOrderProperties.getPayAppKey()).setChannelCode(channelCode) | 152 | .setAppKey(tradeOrderProperties.getPayAppKey()).setChannelCode(channelCode) |
| 152 | - .setMerchantTransferId(withdraw.getId().toString()).setSubject("佣金提现").setPrice(withdraw.getPrice()) | 153 | + .setMerchantTransferId(withdraw.getId().toString()).setSubject("佣金提现").setPrice(transferPrice) |
| 153 | .setUserAccount(userAccount).setUserName(userName).setUserIp(getClientIP()) | 154 | .setUserAccount(userAccount).setUserName(userName).setUserIp(getClientIP()) |
| 154 | .setUserId(withdraw.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) // 用户信息 | 155 | .setUserId(withdraw.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) // 用户信息 |
| 155 | .setChannelExtras(channelExtras); | 156 | .setChannelExtras(channelExtras); |
| @@ -280,9 +281,10 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -280,9 +281,10 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 280 | throw exception(BROKERAGE_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_STATUS_NOT_SUCCESS_OR_CLOSED); | 281 | throw exception(BROKERAGE_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_STATUS_NOT_SUCCESS_OR_CLOSED); |
| 281 | } | 282 | } |
| 282 | // 2.2 校验转账金额一致 | 283 | // 2.2 校验转账金额一致 |
| 283 | - if (ObjectUtil.notEqual(payTransfer.getPrice(), withdraw.getPrice())) { | ||
| 284 | - log.error("[validateBrokerageTransferStatusCanUpdate][withdraw({}) payTransfer({}) 转账金额不匹配,请进行处理!withdraw 数据是:{},payTransfer 数据是:{}]", | ||
| 285 | - withdraw.getId(), payTransferId, JsonUtils.toJsonString(withdraw), JsonUtils.toJsonString(payTransfer)); | 284 | + Integer expectedTransferPrice = withdraw.getPrice() - withdraw.getFeePrice(); // 转账金额 = 提现金额 - 手续费 |
| 285 | + if (ObjectUtil.notEqual(payTransfer.getPrice(), expectedTransferPrice)) { | ||
| 286 | + log.error("[validateBrokerageTransferStatusCanUpdate][withdraw({}) payTransfer({}) 转账金额不匹配,请进行处理!withdraw 数据是:{},payTransfer 数据是:{},期望转账金额:{}]", | ||
| 287 | + withdraw.getId(), payTransferId, JsonUtils.toJsonString(withdraw), JsonUtils.toJsonString(payTransfer), expectedTransferPrice); | ||
| 286 | throw exception(BROKERAGE_WITHDRAW_UPDATE_STATUS_FAIL_PAY_PRICE_NOT_MATCH); | 288 | throw exception(BROKERAGE_WITHDRAW_UPDATE_STATUS_FAIL_PAY_PRICE_NOT_MATCH); |
| 287 | } | 289 | } |
| 288 | // 2.3 校验转账订单匹配 | 290 | // 2.3 校验转账订单匹配 |