From 3770a85a78c8f6fcc60ea102e34a141ffebd2999 Mon Sep 17 00:00:00 2001 From: DaxPay Date: Wed, 26 Jun 2024 19:43:37 +0800 Subject: [PATCH] =?UTF-8?q?perf=20=E4=B8=80=E4=BA=9B=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/daxpay/single/sdk/code/AllocReceiverTypeEnum.java | 4 ++-- .../controller/allocation/AllocationReceiverController.java | 3 +++ .../cn/daxpay/single/core/code/AllocReceiverTypeEnum.java | 2 +- .../core/channel/alipay/service/AliPayCallbackService.java | 2 +- .../core/channel/alipay/service/AliPayCloseService.java | 2 +- .../service/core/notice/entity/ClientNoticeRecord.java | 2 +- .../strategy/receiver/AliPayAllocationReceiverStrategy.java | 2 +- .../service/core/payment/close/service/PayCloseService.java | 5 +++++ 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/AllocReceiverTypeEnum.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/AllocReceiverTypeEnum.java index 713345268..c67b33d88 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/AllocReceiverTypeEnum.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/AllocReceiverTypeEnum.java @@ -16,9 +16,9 @@ import java.util.List; @AllArgsConstructor public enum AllocReceiverTypeEnum { /** 个人 */ - WX_PERSONAL("wx_personal", "个人"), + WX_PERSONAL("wx_personal", "openId"), /** 商户 */ - WX_MERCHANT("wx_merchant", "商户"), + WX_MERCHANT("wx_merchant", "商户号"), /** userId 以2088开头的纯16位数字 */ ALI_USER_ID("ali_user_id", "用户ID"), diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java index dad0fcb7f..07b3903bd 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java @@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import java.time.LocalDateTime; import java.util.List; /** @@ -67,6 +68,7 @@ public class AllocationReceiverController { @Operation(summary = "添加") @PostMapping("/add") public ResResult add(@RequestBody AllocReceiverAddParam param){ + param.setReqTime(LocalDateTime.now()); ValidationUtil.validateParam(param); receiverService.addAndSync(param); return Res.ok(); @@ -76,6 +78,7 @@ public class AllocationReceiverController { @Operation(summary = "删除") @PostMapping("/delete") public ResResult delete(@RequestBody AllocReceiverRemoveParam param){ + param.setReqTime(LocalDateTime.now()); ValidationUtil.validateParam(param); receiverService.remove(param); return Res.ok(); diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/core/code/AllocReceiverTypeEnum.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/core/code/AllocReceiverTypeEnum.java index d7db93748..444a779e6 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/core/code/AllocReceiverTypeEnum.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/core/code/AllocReceiverTypeEnum.java @@ -19,7 +19,7 @@ public enum AllocReceiverTypeEnum { /** 个人 */ WX_PERSONAL("wx_personal","PERSONAL_OPENID", "个人"), /** 商户 */ - WX_MERCHANT("wx_merchant","MERCHANT_ID", "商户"), + WX_MERCHANT("wx_merchant","MERCHANT_ID", "商户号"), /** userId 以2088开头的纯16位数字 */ ALI_USER_ID("ali_user_id","userId", "用户ID"), diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCallbackService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCallbackService.java index d14b948c4..2288f2c49 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCallbackService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCallbackService.java @@ -157,7 +157,7 @@ public class AliPayCallbackService { public void resolveRefundData() { CallbackLocal callback = PaymentContextLocal.get().getCallbackInfo(); Map callbackParam = callback.getCallbackParam(); - // 退款订单Id + // 退款订单号 callback.setTradeNo(callbackParam.get(OUT_BIZ_NO)); // 退款状态 callback.setOutStatus(callbackParam.get(TRADE_STATUS)); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCloseService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCloseService.java index a55ad665f..81822a7d9 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCloseService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayCloseService.java @@ -122,7 +122,7 @@ public class AliPayCloseService { } // 其他状态 else { - throw new TradeStatusErrorException("当前交易状态不支持关闭操作, 请对订单同步状态后再进行操作"); + throw new TradeStatusErrorException("当前交易无法关闭操作, 请对订单同步状态后再进行操作"); } } } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/notice/entity/ClientNoticeRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/notice/entity/ClientNoticeRecord.java index cba2d2c2e..fd2e97b1f 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/notice/entity/ClientNoticeRecord.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/notice/entity/ClientNoticeRecord.java @@ -31,7 +31,7 @@ public class ClientNoticeRecord extends MpCreateEntity implements EntityBaseFunc private Long taskId; /** 请求次数 */ - @DbColumn(comment = "请求次数", length = 3, isNull = false) + @DbColumn(comment = "请求次数", length = 3) private Integer reqCount; /** 发送是否成功 */ diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/strategy/receiver/AliPayAllocationReceiverStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/strategy/receiver/AliPayAllocationReceiverStrategy.java index 4e7fe0c9f..607e48e8a 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/strategy/receiver/AliPayAllocationReceiverStrategy.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/strategy/receiver/AliPayAllocationReceiverStrategy.java @@ -38,7 +38,7 @@ public class AliPayAllocationReceiverStrategy extends AbsAllocationReceiverStrat */ @Override public String getChannel() { - return PayChannelEnum.WECHAT.getCode(); + return PayChannelEnum.ALI.getCode(); } /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/close/service/PayCloseService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/close/service/PayCloseService.java index 04ded5b0f..4ec6175b4 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/close/service/PayCloseService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/close/service/PayCloseService.java @@ -3,6 +3,7 @@ package cn.daxpay.single.service.core.payment.close.service; import cn.bootx.platform.common.core.exception.RepetitiveOperationException; import cn.daxpay.single.core.code.PayStatusEnum; import cn.daxpay.single.core.exception.OperationFailException; +import cn.daxpay.single.core.exception.PayFailureException; import cn.daxpay.single.core.exception.TradeNotExistException; import cn.daxpay.single.core.exception.TradeStatusErrorException; import cn.daxpay.single.core.param.payment.pay.PayCloseParam; @@ -85,6 +86,10 @@ public class PayCloseService { log.error("关闭订单失败:", e); // 记录关闭失败的记录 this.saveRecord(payOrder, false, e.getMessage()); + result.setCode(1).setMsg(e.getMessage()); + if (e instanceof PayFailureException){ + throw e; + } throw new OperationFailException("关闭订单失败"); } }