From 19b574fd4b9f4a6fdcb1cb80f3c326792b9a7125 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 4 Jan 2022 23:47:31 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=20=E9=80=80=E6=AC=BE=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/pay/dal/dataobject/order/PayRefundDO.java | 1 + .../service/order/impl/PayRefundCoreServiceImpl.java | 11 +++++++---- .../core/client/impl/alipay/AbstractAlipayClient.java | 7 +++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java index 1886117c7..fc897a5e0 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java @@ -98,6 +98,7 @@ public class PayRefundDO extends BaseDO { * 退款单请求号,根据规则生成 * 例如说,R202109181134287570000 */ + // TODO @jason:merchantRefundNo =》merchantRefundOId private String merchantRefundNo; /** diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java index f1921667e..944c62aa6 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java @@ -101,7 +101,8 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { } //可以重复提交,保证 退款请求号 一致,由渠道保证幂等 }else { - //成功,插入退款单 状态为生成.没有和渠道交互 + // 成功,插入退款单 状态为生成.没有和渠道交互 + // TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下; payRefundDO = PayRefundDO.builder().channelOrderNo(order.getChannelOrderNo()) .appId(order.getAppId()) .channelOrderNo(order.getChannelOrderNo()) @@ -123,6 +124,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .build(); payRefundCoreMapper.insert(payRefundDO); } + // TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下; PayRefundUnifiedReqDTO unifiedReqDTO = new PayRefundUnifiedReqDTO(); unifiedReqDTO.setUserIp(req.getUserIp()) .setAmount(req.getAmount()) @@ -132,10 +134,11 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .setReason(req.getReason()); // 向渠道发起退款申请 PayCommonResult refundUnifiedResult = client.unifiedRefund(unifiedReqDTO); - //检查是否失败,失败抛出业务异常。 - //TODO 渠道的异常记录 + // 检查是否失败,失败抛出业务异常。 + // TODO 渠道的异常记录。 + // TODO @jason:可以先打个 warn log 哈; refundUnifiedResult.checkError(); - //成功在 退款回调中处理 + // 成功在 退款回调中处理 return PayRefundRespDTO.builder().refundId(payRefundDO.getId()).build(); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java index 76d929da1..7cb24145a 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java @@ -118,12 +118,11 @@ public abstract class AbstractAlipayClient extends AbstractPayClient