From bac30d47b770f542ac167128c3f679942d0dbee8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 25 Oct 2021 10:04:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=9C=B0=E5=9D=80=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/service/order/impl/PayOrderCoreServiceImpl.java | 9 +++++---- .../modules/pay/controller/order/PayOrderController.java | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java index 17f7885fb..b2418dbef 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java @@ -130,7 +130,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { // 商户相关字段 unifiedOrderReqDTO.setMerchantOrderId(order.getMerchantOrderId()) .setSubject(order.getSubject()).setBody(order.getBody()) - .setNotifyUrl(genChannelPayNotifyUrl(reqDTO.getChannelCode())); + .setNotifyUrl(genChannelPayNotifyUrl(channel)); // 订单相关字段 unifiedOrderReqDTO.setAmount(order.getAmount()).setExpireTime(order.getExpireTime()); CommonResult unifiedOrderResult = client.unifiedOrder(unifiedOrderReqDTO); @@ -145,12 +145,13 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { /** * 根据支付渠道的编码,生成支付渠道的回调地址 * - * @param channelCode 支付渠道的编码 + * @param channel 支付渠道 * @return 支付渠道的回调地址 */ - private String genChannelPayNotifyUrl(String channelCode) { + private String genChannelPayNotifyUrl(PayChannelDO channel) { // _ 转化为 - 的原因,是因为 URL 我们统一采用中划线的原则 - return payProperties.getPayNotifyUrl() + "/" + StrUtil.replace(channelCode, "_", "-"); + return payProperties.getPayNotifyUrl() + "/" + StrUtil.replace(channel.getCode(), "_", "-") + + "/" + channel.getId(); } private String generateOrderExtensionNo() { diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java index 8f8dad0f1..aae04ece8 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java @@ -49,9 +49,10 @@ public class PayOrderController { // ========== 支付渠道的回调 ========== - @PostMapping("/notify/wx-pub") + @PostMapping("/notify/wx-pub/{channelId}") @ApiOperation("通知微信公众号的结果") - public String notifyWxPayOrder(@RequestBody String xmlData) { + public String notifyWxPayOrder(@PathVariable("channelId") Long channelId, + @RequestBody String xmlData) { System.out.println(xmlData); return "success"; }