fix:【pay】支付钱包退款时,merchantRefundId 传递不正确的问题

This commit is contained in:
YunaiV 2025-12-13 11:40:26 +08:00
parent bfff8f5ec4
commit 32e9c17f12
3 changed files with 6 additions and 7 deletions

View File

@ -51,7 +51,7 @@ public class PayWalletRechargeController {
public CommonResult<Boolean> updateWalletRechargeRefunded(@RequestBody PayRefundNotifyReqDTO notifyReqDTO) { public CommonResult<Boolean> updateWalletRechargeRefunded(@RequestBody PayRefundNotifyReqDTO notifyReqDTO) {
walletRechargeService.updateWalletRechargeRefunded( walletRechargeService.updateWalletRechargeRefunded(
Long.valueOf(notifyReqDTO.getMerchantOrderId()), Long.valueOf(notifyReqDTO.getMerchantOrderId()),
Long.valueOf(notifyReqDTO.getMerchantRefundId()), notifyReqDTO.getMerchantRefundId(),
notifyReqDTO.getPayRefundId()); notifyReqDTO.getPayRefundId());
return success(true); return success(true);
} }

View File

@ -56,9 +56,9 @@ public interface PayWalletRechargeService {
* 更新钱包充值记录为已退款 * 更新钱包充值记录为已退款
* *
* @param id 钱包充值记录编号 * @param id 钱包充值记录编号
* @param refundId 钱包充值退款编号实际和 id 相同 * @param refundId 钱包充值退款编号格式{id}-refund
* @param payRefundId 退款单id * @param payRefundId 退款单id
*/ */
void updateWalletRechargeRefunded(Long id, Long refundId, Long payRefundId); void updateWalletRechargeRefunded(Long id, String refundId, Long payRefundId);
} }

View File

@ -220,9 +220,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateWalletRechargeRefunded(Long id, Long refundId, Long payRefundId) { public void updateWalletRechargeRefunded(Long id, String refundId, Long payRefundId) {
// 1.1 获取钱包充值记录 // 1.1 获取钱包充值记录
// 说明因为 id refundId 是相同的所以直接使用 id 查询即可
PayWalletRechargeDO walletRecharge = walletRechargeMapper.selectById(id); PayWalletRechargeDO walletRecharge = walletRechargeMapper.selectById(id);
if (walletRecharge == null) { if (walletRecharge == null) {
log.error("[updateWalletRechargerPaid][钱包充值记录不存在,钱包充值记录 id({})]", id); log.error("[updateWalletRechargerPaid][钱包充值记录不存在,钱包充值记录 id({})]", id);
@ -274,8 +273,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
walletRecharge.getId(), payRefundId, toJsonString(walletRecharge), toJsonString(payRefund)); walletRecharge.getId(), payRefundId, toJsonString(walletRecharge), toJsonString(payRefund));
throw exception(WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH); throw exception(WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH);
} }
// 2.3 校验退款订单商户单是否匹配 // 2.3 校验退款订单商户退款单是否匹配
if (notEqual(payRefund.getMerchantRefundId(), walletRecharge.getId().toString())) { if (notEqual(payRefund.getMerchantRefundId(), walletRecharge.getId() + "-refund")) {
log.error("[validateWalletRechargeCanRefunded][钱包({}) 退款单不匹配({})请进行处理payRefund 数据是:{}]", log.error("[validateWalletRechargeCanRefunded][钱包({}) 退款单不匹配({})请进行处理payRefund 数据是:{}]",
walletRecharge.getId(), payRefundId, toJsonString(payRefund)); walletRecharge.getId(), payRefundId, toJsonString(payRefund));
throw exception(WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR); throw exception(WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR);