Commit 4acada62d35253bcda4bf23e65a8e7c0fd206e3f

Authored by YunaiV
1 parent 75633aa8

完成支付回调的逻辑

Showing 33 changed files with 427 additions and 75 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/logger/InfApiAccessLogConvert.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.adminserver.modules.infra.convert.logger; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.adminserver.modules.infra.convert.logger;
2 2
3 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 3 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO;  
6 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; 5 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO;
7 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO; 6 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO;
8 import org.mapstruct.Mapper; 7 import org.mapstruct.Mapper;
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/social/impl/SysSocialServiceImpl.java
@@ -19,9 +19,9 @@ import me.zhyd.oauth.request.AuthRequest; @@ -19,9 +19,9 @@ import me.zhyd.oauth.request.AuthRequest;
19 import me.zhyd.oauth.utils.AuthStateUtils; 19 import me.zhyd.oauth.utils.AuthStateUtils;
20 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
21 import org.springframework.transaction.annotation.Transactional; 21 import org.springframework.transaction.annotation.Transactional;
  22 +import org.springframework.validation.annotation.Validated;
22 23
23 import javax.annotation.Resource; 24 import javax.annotation.Resource;
24 -import javax.validation.Valid;  
25 import java.util.List; 25 import java.util.List;
26 import java.util.Objects; 26 import java.util.Objects;
27 27
@@ -36,7 +36,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString @@ -36,7 +36,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
36 * @author 芋道源码 36 * @author 芋道源码
37 */ 37 */
38 @Service 38 @Service
39 -@Valid 39 +@Validated
40 @Slf4j 40 @Slf4j
41 public class SysSocialServiceImpl implements SysSocialService { 41 public class SysSocialServiceImpl implements SysSocialService {
42 42
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/logger/InfApiAccessLogServiceImplTest.java
1 package cn.iocoder.yudao.adminserver.modules.infra.service.logger; 1 package cn.iocoder.yudao.adminserver.modules.infra.service.logger;
2 2
3 -import cn.hutool.core.util.RandomUtil;  
4 import cn.iocoder.yudao.adminserver.BaseDbUnitTest; 3 import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
6 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 5 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
7 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; 6 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
8 import cn.iocoder.yudao.framework.common.pojo.PageResult; 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
9 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO;  
10 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; 8 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO;
11 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; 9 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO;
12 import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiAccessLogMapper; 10 import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiAccessLogMapper;
@@ -19,7 +17,6 @@ import org.springframework.context.annotation.Import; @@ -19,7 +17,6 @@ import org.springframework.context.annotation.Import;
19 import javax.annotation.Resource; 17 import javax.annotation.Resource;
20 import java.util.Date; 18 import java.util.Date;
21 import java.util.List; 19 import java.util.List;
22 -import java.util.concurrent.Future;  
23 20
24 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 21 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
25 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; 22 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/logger/InfApiErrorLogServiceImplTest.java
1 package cn.iocoder.yudao.adminserver.modules.infra.service.logger; 1 package cn.iocoder.yudao.adminserver.modules.infra.service.logger;
2 2
3 -import cn.hutool.core.util.RandomUtil;  
4 import cn.iocoder.yudao.adminserver.BaseDbUnitTest; 3 import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; 4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
6 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 5 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
7 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO;  
9 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; 7 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogExportReqVO;
10 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; 8 import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogPageReqVO;
11 import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiErrorLogMapper; 9 import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiErrorLogMapper;
@@ -19,7 +17,6 @@ import org.springframework.context.annotation.Import; @@ -19,7 +17,6 @@ import org.springframework.context.annotation.Import;
19 import javax.annotation.Resource; 17 import javax.annotation.Resource;
20 import java.util.Date; 18 import java.util.Date;
21 import java.util.List; 19 import java.util.List;
22 -import java.util.concurrent.Future;  
23 20
24 import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; 21 import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
25 import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_PROCESSED; 22 import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_PROCESSED;
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/convert/logger/InfApiAccessLogCoreConvert.java
1 package cn.iocoder.yudao.coreservice.modules.infra.convert.logger; 1 package cn.iocoder.yudao.coreservice.modules.infra.convert.logger;
2 2
3 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO; 3 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
5 import org.mapstruct.Mapper; 5 import org.mapstruct.Mapper;
6 import org.mapstruct.factory.Mappers; 6 import org.mapstruct.factory.Mappers;
@@ -10,6 +10,6 @@ public interface InfApiAccessLogCoreConvert { @@ -10,6 +10,6 @@ public interface InfApiAccessLogCoreConvert {
10 10
11 InfApiAccessLogCoreConvert INSTANCE = Mappers.getMapper(InfApiAccessLogCoreConvert.class); 11 InfApiAccessLogCoreConvert INSTANCE = Mappers.getMapper(InfApiAccessLogCoreConvert.class);
12 12
13 - InfApiAccessLogDO convert(ApiAccessLogCreateDTO bean); 13 + InfApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean);
14 14
15 } 15 }
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/convert/logger/InfApiErrorLogCoreConvert.java
1 package cn.iocoder.yudao.coreservice.modules.infra.convert.logger; 1 package cn.iocoder.yudao.coreservice.modules.infra.convert.logger;
2 2
3 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO; 3 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; 4 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
5 import org.mapstruct.Mapper; 5 import org.mapstruct.Mapper;
6 import org.mapstruct.factory.Mappers; 6 import org.mapstruct.factory.Mappers;
@@ -10,6 +10,6 @@ public interface InfApiErrorLogCoreConvert { @@ -10,6 +10,6 @@ public interface InfApiErrorLogCoreConvert {
10 10
11 InfApiErrorLogCoreConvert INSTANCE = Mappers.getMapper(InfApiErrorLogCoreConvert.class); 11 InfApiErrorLogCoreConvert INSTANCE = Mappers.getMapper(InfApiErrorLogCoreConvert.class);
12 12
13 - InfApiErrorLogDO convert(ApiErrorLogCreateDTO bean); 13 + InfApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean);
14 14
15 } 15 }
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java
1 package cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl; 1 package cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl;
2 2
3 import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiAccessLogCoreConvert; 3 import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiAccessLogCoreConvert;
4 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO; 4 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; 6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper;
7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiAccessLogCoreService; 7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiAccessLogCoreService;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
9 import org.springframework.scheduling.annotation.Async; 9 import org.springframework.scheduling.annotation.Async;
10 -import org.springframework.scheduling.annotation.AsyncResult;  
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 import org.springframework.validation.annotation.Validated; 11 import org.springframework.validation.annotation.Validated;
13 12
14 import javax.annotation.Resource; 13 import javax.annotation.Resource;
15 -import java.util.concurrent.Future;  
16 14
17 /** 15 /**
18 * API 访问日志 Service 实现类 16 * API 访问日志 Service 实现类
@@ -29,7 +27,7 @@ public class InfApiAccessLogCoreServiceImpl implements InfApiAccessLogCoreServic @@ -29,7 +27,7 @@ public class InfApiAccessLogCoreServiceImpl implements InfApiAccessLogCoreServic
29 27
30 @Override 28 @Override
31 @Async 29 @Async
32 - public void createApiAccessLogAsync(ApiAccessLogCreateDTO createDTO) { 30 + public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) {
33 InfApiAccessLogDO apiAccessLog = InfApiAccessLogCoreConvert.INSTANCE.convert(createDTO); 31 InfApiAccessLogDO apiAccessLog = InfApiAccessLogCoreConvert.INSTANCE.convert(createDTO);
34 apiAccessLogMapper.insert(apiAccessLog); 32 apiAccessLogMapper.insert(apiAccessLog);
35 } 33 }
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java
@@ -5,15 +5,13 @@ import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiEr @@ -5,15 +5,13 @@ import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiEr
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; 5 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper;
6 import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; 6 import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiErrorLogCoreService; 7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiErrorLogCoreService;
8 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO; 8 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
9 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
10 import org.springframework.scheduling.annotation.Async; 10 import org.springframework.scheduling.annotation.Async;
11 -import org.springframework.scheduling.annotation.AsyncResult;  
12 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
13 import org.springframework.validation.annotation.Validated; 12 import org.springframework.validation.annotation.Validated;
14 13
15 import javax.annotation.Resource; 14 import javax.annotation.Resource;
16 -import java.util.concurrent.Future;  
17 15
18 /** 16 /**
19 * API 错误日志 Service 实现类 17 * API 错误日志 Service 实现类
@@ -30,7 +28,7 @@ public class InfApiErrorLogCoreServiceImpl implements InfApiErrorLogCoreService @@ -30,7 +28,7 @@ public class InfApiErrorLogCoreServiceImpl implements InfApiErrorLogCoreService
30 28
31 @Override 29 @Override
32 @Async 30 @Async
33 - public void createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) { 31 + public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) {
34 InfApiErrorLogDO apiErrorLog = InfApiErrorLogCoreConvert.INSTANCE.convert(createDTO); 32 InfApiErrorLogDO apiErrorLog = InfApiErrorLogCoreConvert.INSTANCE.convert(createDTO);
35 apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); 33 apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus());
36 apiErrorLogMapper.insert(apiErrorLog); 34 apiErrorLogMapper.insert(apiErrorLog);
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyLogDO.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum;
  4 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +/**
  11 + * 商户支付、退款等的通知 Log
  12 + * 每次通知时,都会在该表中,记录一次 Log,方便排查问题
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@TableName("pay_notify_log")
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@Accessors(chain = true)
  20 +public class PayNotifyLogDO extends BaseDO {
  21 +
  22 + /**
  23 + * 日志编号,自增
  24 + */
  25 + private Long id;
  26 + /**
  27 + * 通知编号
  28 + *
  29 + * 关联 {@link PayNotifyTaskDO#getId()}
  30 + */
  31 + private Long notifyId;
  32 + /**
  33 + * 当前通知次数
  34 + */
  35 + private Integer notifyTimes;
  36 + /**
  37 + * 请求参数
  38 + */
  39 + private String request;
  40 + /**
  41 + * 响应结果
  42 + */
  43 + private String response;
  44 + /**
  45 + * 状态
  46 + *
  47 + * 外键 {@link PayNotifyStatusEnum}
  48 + */
  49 + private Integer status;
  50 +
  51 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyTaskDO.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
  4 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO;
  5 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
  6 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO;
  7 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum;
  8 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum;
  9 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  10 +import com.baomidou.mybatisplus.annotation.TableName;
  11 +import lombok.Data;
  12 +import lombok.EqualsAndHashCode;
  13 +import lombok.experimental.Accessors;
  14 +
  15 +import java.util.Date;
  16 +
  17 +/**
  18 + * 商户支付、退款等的通知
  19 + * 在支付系统收到支付渠道的支付、退款的结果后,需要不断的通知到业务系统,直到成功。
  20 + *
  21 + * @author 芋道源码
  22 + */
  23 +@TableName("pay_notify_task")
  24 +@Data
  25 +@EqualsAndHashCode(callSuper = true)
  26 +@Accessors(chain = true)
  27 +public class PayNotifyTaskDO extends BaseDO {
  28 +
  29 + /**
  30 + * 通知频率,单位为秒。
  31 + *
  32 + * 算上首次的通知,实际是一共 1 + 8 = 9 次。
  33 + */
  34 + public static final Integer[] NOTIFY_FREQUENCY = new Integer[]{
  35 + 15, 15, 30, 180,
  36 + 1800, 1800, 1800, 3600
  37 + };
  38 +
  39 + /**
  40 + * 编号,自增
  41 + */
  42 + private Long id;
  43 + /**
  44 + * 商户编号
  45 + *
  46 + * 关联 {@link PayMerchantDO#getId()}
  47 + */
  48 + private Long merchantId;
  49 + /**
  50 + * 应用编号
  51 + *
  52 + * 关联 {@link PayAppDO#getId()}
  53 + */
  54 + private Long appId;
  55 + /**
  56 + * 通知类型
  57 + *
  58 + * 外键 {@link PayNotifyTypeEnum}
  59 + */
  60 + private Integer type;
  61 + /**
  62 + * 数据编号,根据不同 type 进行关联:
  63 + *
  64 + * 1. {@link PayNotifyTypeEnum#ORDER} 时,关联 {@link PayOrderDO#getId()}
  65 + * 2. {@link PayNotifyTypeEnum#REFUND} 时,关联 {@link PayRefundDO#getId()}
  66 + */
  67 + private Long dataId;
  68 + /**
  69 + * 商户订单编号
  70 + */
  71 + private String merchantOrderId;
  72 + /**
  73 + * 通知状态
  74 + *
  75 + * 外键 {@link PayNotifyStatusEnum}
  76 + */
  77 + private Integer status;
  78 + /**
  79 + * 下一次通知时间
  80 + */
  81 + private Date nextNotifyTime;
  82 + /**
  83 + * 最后一次执行时间
  84 + */
  85 + private Date lastExecuteTime;
  86 + /**
  87 + * 当前通知次数
  88 + */
  89 + private Integer notifyTimes;
  90 + /**
  91 + * 最大可通知次数
  92 + */
  93 + private Integer maxNotifyTimes;
  94 + /**
  95 + * 通知地址
  96 + */
  97 + private String notifyUrl;
  98 +
  99 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayNotifyDO.java deleted
1 -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order;  
2 -  
3 -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;  
4 -import lombok.Data;  
5 -  
6 -/**  
7 - * 商户支付、退款等的通知  
8 - * 在支付系统收到支付渠道的支付、退款的结果后,需要不断的通知到业务系统,直到成功。  
9 - * TODO 芋艿:待完善  
10 - *  
11 - * @author 芋道源码  
12 - */  
13 -@Data  
14 -public class PayNotifyDO extends BaseDO {  
15 -}  
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/package-info.java deleted
1 -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject;  
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
  4 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyTaskDO;
  5 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  6 +import org.apache.ibatis.annotations.Mapper;
  7 +
  8 +@Mapper
  9 +public interface PayNotifyTaskCoreMapper extends BaseMapperX<PayNotifyTaskDO> {
  10 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderExtensionCoreMapper.java
@@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Mapper; @@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Mapper;
8 @Mapper 8 @Mapper
9 public interface PayOrderExtensionCoreMapper extends BaseMapperX<PayOrderExtensionDO> { 9 public interface PayOrderExtensionCoreMapper extends BaseMapperX<PayOrderExtensionDO> {
10 10
11 - default PayOrderExtensionDO selectByOrderExtensionNo(String orderExtensionNo) {  
12 - return selectOne("order_extension_no", orderExtensionNo); 11 + default PayOrderExtensionDO selectByNo(String no) {
  12 + return selectOne("no", no);
13 } 13 }
14 14
15 default int updateByIdAndStatus(Long id, Integer status, PayOrderExtensionDO update) { 15 default int updateByIdAndStatus(Long id, Integer status, PayOrderExtensionDO update) {
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyStatusEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.enums.notify;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * 支付通知状态枚举
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +@Getter
  12 +@AllArgsConstructor
  13 +public enum PayNotifyStatusEnum {
  14 +
  15 + WAITING(1, "等待通知"),
  16 + SUCCESS(2, "通知成功"),
  17 + FAILURE(3, "通知失败"), // 多次尝试,彻底失败
  18 + REQUEST_SUCCESS(4, "请求成功,但是结果失败"),
  19 + REQUEST_FAILURE(5, "请求失败"),
  20 +
  21 + ;
  22 +
  23 + /**
  24 + * 状态
  25 + */
  26 + private final Integer status;
  27 + /**
  28 + * 名字
  29 + */
  30 + private final String name;
  31 +
  32 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.enums.notify;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * 支付通知类型
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +@Getter
  12 +@AllArgsConstructor
  13 +public enum PayNotifyTypeEnum {
  14 +
  15 + ORDER(1, "支付单"),
  16 + REFUND(2, "退款单"),
  17 + ;
  18 +
  19 + /**
  20 + * 类型
  21 + */
  22 + private final Integer type;
  23 + /**
  24 + * 名字
  25 + */
  26 + private final String name;
  27 +
  28 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayChannelCoreService.java
@@ -20,6 +20,16 @@ public interface PayChannelCoreService { @@ -20,6 +20,16 @@ public interface PayChannelCoreService {
20 * 20 *
21 * 如果不合法,抛出 {@link ServiceException} 业务异常 21 * 如果不合法,抛出 {@link ServiceException} 业务异常
22 * 22 *
  23 + * @param id 渠道编号
  24 + * @return 渠道信息
  25 + */
  26 + PayChannelDO validPayChannel(Long id);
  27 +
  28 + /**
  29 + * 支付渠道的合法性
  30 + *
  31 + * 如果不合法,抛出 {@link ServiceException} 业务异常
  32 + *
23 * @param appId 应用编号 33 * @param appId 应用编号
24 * @param code 支付渠道 34 * @param code 支付渠道
25 * @return 渠道信息 35 * @return 渠道信息
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayChannelCoreServiceImpl.java
@@ -96,15 +96,26 @@ public class PayChannelCoreServiceImpl implements PayChannelCoreService { @@ -96,15 +96,26 @@ public class PayChannelCoreServiceImpl implements PayChannelCoreService {
96 } 96 }
97 97
98 @Override 98 @Override
  99 + public PayChannelDO validPayChannel(Long id) {
  100 + PayChannelDO channel = payChannelCoreMapper.selectById(id);
  101 + this.validPayChannel(channel);
  102 + return channel;
  103 + }
  104 +
  105 + @Override
99 public PayChannelDO validPayChannel(Long appId, String code) { 106 public PayChannelDO validPayChannel(Long appId, String code) {
100 PayChannelDO channel = payChannelCoreMapper.selectByAppIdAndCode(appId, code); 107 PayChannelDO channel = payChannelCoreMapper.selectByAppIdAndCode(appId, code);
  108 + this.validPayChannel(channel);
  109 + return channel;
  110 + }
  111 +
  112 + private void validPayChannel(PayChannelDO channel) {
101 if (channel == null) { 113 if (channel == null) {
102 throw exception(PAY_CHANNEL_NOT_FOUND); 114 throw exception(PAY_CHANNEL_NOT_FOUND);
103 } 115 }
104 if (CommonStatusEnum.DISABLE.getStatus().equals(channel.getStatus())) { 116 if (CommonStatusEnum.DISABLE.getStatus().equals(channel.getStatus())) {
105 throw exception(PayErrorCodeCoreConstants.PAY_CHANNEL_IS_DISABLE); 117 throw exception(PayErrorCodeCoreConstants.PAY_CHANNEL_IS_DISABLE);
106 } 118 }
107 - return channel;  
108 } 119 }
109 120
110 } 121 }
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/PayNotifyCoreService.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.service.notify;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO;
  4 +
  5 +import javax.validation.Valid;
  6 +
  7 +/**
  8 + * 支付通知 Core Service 接口
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +public interface PayNotifyCoreService {
  13 +
  14 + /**
  15 + * 创建支付通知任务
  16 + *
  17 + * @param reqDTO 任务信息
  18 + */
  19 + void createPayNotifyTask(@Valid PayNotifyTaskCreateReqDTO reqDTO);
  20 +
  21 + /**
  22 + * 执行支付通知
  23 + *
  24 + * 注意,该方法提供给定时任务调用。目前是 yudao-admin-server 进行调用
  25 + */
  26 + void executeNotify();
  27 +
  28 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Builder;
  5 +import lombok.Data;
  6 +import lombok.NoArgsConstructor;
  7 +
  8 +import javax.validation.constraints.NotNull;
  9 +
  10 +/**
  11 + * 支付通知创建 DTO
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Data
  16 +@Builder
  17 +@NoArgsConstructor
  18 +@AllArgsConstructor
  19 +public class PayNotifyTaskCreateReqDTO {
  20 +
  21 + /**
  22 + * 类型
  23 + */
  24 + @NotNull(message = "类型不能为空")
  25 + private Integer type;
  26 + /**
  27 + * 数据编号
  28 + */
  29 + @NotNull(message = "数据编号不能为空")
  30 + private Long dataId;
  31 +
  32 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.pay.service.notify.impl;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyTaskDO;
  4 +import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
  5 +import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify.PayNotifyTaskCoreMapper;
  6 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum;
  7 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum;
  8 +import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService;
  9 +import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO;
  10 +import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService;
  11 +import lombok.extern.slf4j.Slf4j;
  12 +import org.springframework.context.annotation.Lazy;
  13 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import javax.annotation.Resource;
  17 +import javax.validation.Valid;
  18 +import java.util.Date;
  19 +import java.util.Objects;
  20 +
  21 +/**
  22 + * 支付通知 Core Service 实现类
  23 + *
  24 + * @author 芋道源码
  25 + */
  26 +@Service
  27 +@Valid
  28 +@Slf4j
  29 +public class PayNotifyCoreServiceImpl implements PayNotifyCoreService {
  30 +
  31 + @Resource
  32 + @Lazy // 循环依赖,避免报错
  33 + private PayOrderCoreService payOrderCoreService;
  34 +
  35 + @Resource
  36 + private PayNotifyTaskCoreMapper payNotifyTaskCoreMapper;
  37 +
  38 + @Resource
  39 + private ThreadPoolTaskExecutor threadPoolTaskExecutor; // TODO 芋艿:未来提供独立的线程池
  40 +
  41 + @Override
  42 + public void createPayNotifyTask(PayNotifyTaskCreateReqDTO reqDTO) {
  43 + PayNotifyTaskDO task = new PayNotifyTaskDO();
  44 + task.setType(reqDTO.getType()).setDataId(reqDTO.getDataId());
  45 + task.setStatus(PayNotifyStatusEnum.WAITING.getStatus()).setNextNotifyTime(new Date())
  46 + .setNotifyTimes(0).setMaxNotifyTimes(PayNotifyTaskDO.NOTIFY_FREQUENCY.length + 1);
  47 + // 补充 merchantId + appId + notifyUrl 字段
  48 + if (Objects.equals(task.getType(), PayNotifyTypeEnum.ORDER.getType())) {
  49 + PayOrderDO order = payOrderCoreService.getPayOrder(task.getDataId()); // 不进行非空判断,有问题直接异常
  50 + task.setMerchantId(order.getMerchantId()).setAppId(order.getAppId()).
  51 + setMerchantOrderId(order.getMerchantOrderId()).setNotifyUrl(order.getNotifyUrl());
  52 + } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.REFUND.getType())) {
  53 + // TODO 芋艿,需要实现下哈
  54 + throw new UnsupportedOperationException("需要实现");
  55 + }
  56 +
  57 + // 执行插入
  58 + payNotifyTaskCoreMapper.insert(task);
  59 + }
  60 +
  61 + @Override
  62 + public void executeNotify() {
  63 +
  64 + }
  65 +
  66 +}
yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java
@@ -10,10 +10,13 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; @@ -10,10 +10,13 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
10 import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; 10 import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
11 import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; 11 import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper;
12 import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderExtensionCoreMapper; 12 import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderExtensionCoreMapper;
  13 +import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum;
13 import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; 14 import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum;
14 import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; 15 import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum;
15 import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayAppCoreService; 16 import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayAppCoreService;
16 import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreService; 17 import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreService;
  18 +import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService;
  19 +import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO;
17 import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService; 20 import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService;
18 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO; 21 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO;
19 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; 22 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO;
@@ -27,6 +30,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderNotifyRespDTO; @@ -27,6 +30,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderNotifyRespDTO;
27 import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; 30 import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO;
28 import lombok.extern.slf4j.Slf4j; 31 import lombok.extern.slf4j.Slf4j;
29 import org.springframework.stereotype.Service; 32 import org.springframework.stereotype.Service;
  33 +import org.springframework.transaction.annotation.Transactional;
30 import org.springframework.validation.annotation.Validated; 34 import org.springframework.validation.annotation.Validated;
31 35
32 import javax.annotation.Resource; 36 import javax.annotation.Resource;
@@ -53,6 +57,8 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -53,6 +57,8 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
53 private PayAppCoreService payAppCoreService; 57 private PayAppCoreService payAppCoreService;
54 @Resource 58 @Resource
55 private PayChannelCoreService payChannelCoreService; 59 private PayChannelCoreService payChannelCoreService;
  60 + @Resource
  61 + private PayNotifyCoreService payNotifyCoreService;
56 62
57 @Resource 63 @Resource
58 private PayClientFactory payClientFactory; 64 private PayClientFactory payClientFactory;
@@ -129,7 +135,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -129,7 +135,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
129 // 调用三方接口 135 // 调用三方接口
130 PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderCoreConvert.INSTANCE.convert2(reqDTO); 136 PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderCoreConvert.INSTANCE.convert2(reqDTO);
131 // 商户相关字段 137 // 商户相关字段
132 - unifiedOrderReqDTO.setMerchantOrderId(order.getMerchantOrderId()) 138 + unifiedOrderReqDTO.setMerchantOrderId(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性!
133 .setSubject(order.getSubject()).setBody(order.getBody()) 139 .setSubject(order.getSubject()).setBody(order.getBody())
134 .setNotifyUrl(genChannelPayNotifyUrl(channel)); 140 .setNotifyUrl(genChannelPayNotifyUrl(channel));
135 // 订单相关字段 141 // 订单相关字段
@@ -174,12 +180,13 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -174,12 +180,13 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
174 } 180 }
175 181
176 @Override 182 @Override
  183 + @Transactional
177 public void notifyPayOrder(Long channelId, String channelCode, String notifyData) throws Exception { 184 public void notifyPayOrder(Long channelId, String channelCode, String notifyData) throws Exception {
178 // TODO 芋艿,记录回调日志 185 // TODO 芋艿,记录回调日志
179 log.info("[notifyPayOrder][channelId({}) 回调数据({})]", channelId, notifyData); 186 log.info("[notifyPayOrder][channelId({}) 回调数据({})]", channelId, notifyData);
180 187
181 // 校验支付渠道是否有效 188 // 校验支付渠道是否有效
182 - PayChannelDO channel = payChannelCoreService.validPayChannel(channelId, channelCode); 189 + PayChannelDO channel = payChannelCoreService.validPayChannel(channelId);
183 // 校验支付客户端是否正确初始化 190 // 校验支付客户端是否正确初始化
184 PayClient client = payClientFactory.getPayClient(channel.getId()); 191 PayClient client = payClientFactory.getPayClient(channel.getId());
185 if (client == null) { 192 if (client == null) {
@@ -191,7 +198,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -191,7 +198,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
191 198
192 // TODO 芋艿,先最严格的校验。即使调用方重复调用,实际哪个订单已经被重复回调的支付,也返回 false 。也没问题,因为实际已经回调成功了。 199 // TODO 芋艿,先最严格的校验。即使调用方重复调用,实际哪个订单已经被重复回调的支付,也返回 false 。也没问题,因为实际已经回调成功了。
193 // 1.1 查询 PayOrderExtensionDO 200 // 1.1 查询 PayOrderExtensionDO
194 - PayOrderExtensionDO orderExtension = payOrderExtensionCoreMapper.selectByOrderExtensionNo( 201 + PayOrderExtensionDO orderExtension = payOrderExtensionCoreMapper.selectByNo(
195 notifyRespDTO.getOrderExtensionNo()); 202 notifyRespDTO.getOrderExtensionNo());
196 if (orderExtension == null) { 203 if (orderExtension == null) {
197 throw exception(PAY_ORDER_EXTENSION_NOT_FOUND); 204 throw exception(PAY_ORDER_EXTENSION_NOT_FOUND);
@@ -200,7 +207,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -200,7 +207,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
200 throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING); 207 throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
201 } 208 }
202 // 1.2 更新 PayOrderExtensionDO 209 // 1.2 更新 PayOrderExtensionDO
203 - int updateCounts = payOrderExtensionCoreMapper.updateByIdAndStatus(orderExtension.getOrderId(), 210 + int updateCounts = payOrderExtensionCoreMapper.updateByIdAndStatus(orderExtension.getId(),
204 PayOrderStatusEnum.WAITING.getStatus(), PayOrderExtensionDO.builder().id(orderExtension.getId()) 211 PayOrderStatusEnum.WAITING.getStatus(), PayOrderExtensionDO.builder().id(orderExtension.getId())
205 .status(PayOrderStatusEnum.SUCCESS.getStatus()).channelNotifyData(notifyData).build()); 212 .status(PayOrderStatusEnum.SUCCESS.getStatus()).channelNotifyData(notifyData).build());
206 if (updateCounts == 0) { // 校验状态,必须是待支付 213 if (updateCounts == 0) { // 校验状态,必须是待支付
@@ -219,15 +226,17 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @@ -219,15 +226,17 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
219 // 2.2 更新 PayOrderDO 226 // 2.2 更新 PayOrderDO
220 updateCounts = payOrderCoreMapper.updateByIdAndStatus(order.getId(), PayOrderStatusEnum.WAITING.getStatus(), 227 updateCounts = payOrderCoreMapper.updateByIdAndStatus(order.getId(), PayOrderStatusEnum.WAITING.getStatus(),
221 PayOrderDO.builder().status(PayOrderStatusEnum.SUCCESS.getStatus()).channelId(channelId).channelCode(channelCode) 228 PayOrderDO.builder().status(PayOrderStatusEnum.SUCCESS.getStatus()).channelId(channelId).channelCode(channelCode)
222 - .successTime(notifyRespDTO.getSuccessTime()).notifyTime(new Date())  
223 - .successExtensionId(orderExtension.getId()).build()); 229 + .successTime(notifyRespDTO.getSuccessTime()).successExtensionId(orderExtension.getId())
  230 + .channelOrderNo(notifyRespDTO.getChannelOrderNo()).channelUserId(notifyRespDTO.getChannelUserId())
  231 + .notifyTime(new Date()).build());
224 if (updateCounts == 0) { // 校验状态,必须是待支付 232 if (updateCounts == 0) { // 校验状态,必须是待支付
225 throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); 233 throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
226 } 234 }
227 log.info("[notifyPayOrder][支付订单({}) 更新为已支付]", order.getId()); 235 log.info("[notifyPayOrder][支付订单({}) 更新为已支付]", order.getId());
228 236
229 // 3. 插入支付通知记录 237 // 3. 插入支付通知记录
230 -// payNotifyService.addPayTransactionNotifyTask(order, orderExtension); 238 + payNotifyCoreService.createPayNotifyTask(PayNotifyTaskCreateReqDTO.builder()
  239 + .type(PayNotifyTypeEnum.ORDER.getType()).dataId(order.getId()).build());
231 } 240 }
232 241
233 } 242 }
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java
@@ -5,14 +5,13 @@ import cn.iocoder.yudao.coreservice.BaseDbUnitTest; @@ -5,14 +5,13 @@ import cn.iocoder.yudao.coreservice.BaseDbUnitTest;
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; 6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper;
7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiAccessLogCoreServiceImpl; 7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiAccessLogCoreServiceImpl;
8 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO; 8 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
9 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 9 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
10 import cn.iocoder.yudao.framework.test.core.util.RandomUtils; 10 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
11 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.Test;
12 import org.springframework.context.annotation.Import; 12 import org.springframework.context.annotation.Import;
13 13
14 import javax.annotation.Resource; 14 import javax.annotation.Resource;
15 -import java.util.concurrent.Future;  
16 15
17 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 16 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
18 import static org.junit.jupiter.api.Assertions.assertNotNull; 17 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -32,7 +31,7 @@ public class InfApiAccessLogCoreServiceTest extends BaseDbUnitTest { @@ -32,7 +31,7 @@ public class InfApiAccessLogCoreServiceTest extends BaseDbUnitTest {
32 @Test 31 @Test
33 public void testCreateApiAccessLogAsync() { 32 public void testCreateApiAccessLogAsync() {
34 // 准备参数 33 // 准备参数
35 - ApiAccessLogCreateDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateDTO.class, 34 + ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class,
36 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); 35 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
37 36
38 // 调用 37 // 调用
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.coreservice.BaseDbUnitTest; @@ -5,7 +5,7 @@ import cn.iocoder.yudao.coreservice.BaseDbUnitTest;
5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; 5 import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; 6 import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper;
7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiErrorLogCoreServiceImpl; 7 import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiErrorLogCoreServiceImpl;
8 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO; 8 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
9 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 9 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
10 import cn.iocoder.yudao.framework.test.core.util.RandomUtils; 10 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
11 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.Test;
@@ -31,7 +31,7 @@ public class InfApiErrorLogCoreServiceTest extends BaseDbUnitTest { @@ -31,7 +31,7 @@ public class InfApiErrorLogCoreServiceTest extends BaseDbUnitTest {
31 @Test 31 @Test
32 public void testCreateApiErrorLogAsync() { 32 public void testCreateApiErrorLogAsync() {
33 // 准备参数 33 // 准备参数
34 - ApiErrorLogCreateDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateDTO.class, 34 + ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class,
35 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); 35 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
36 36
37 // 调用 37 // 调用
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java
1 package cn.iocoder.yudao.framework.pay.core.client.dto; 1 package cn.iocoder.yudao.framework.pay.core.client.dto;
2 2
3 import lombok.AllArgsConstructor; 3 import lombok.AllArgsConstructor;
  4 +import lombok.Builder;
4 import lombok.Data; 5 import lombok.Data;
5 import lombok.NoArgsConstructor; 6 import lombok.NoArgsConstructor;
6 7
@@ -12,6 +13,7 @@ import java.util.Date; @@ -12,6 +13,7 @@ import java.util.Date;
12 * @author 芋道源码 13 * @author 芋道源码
13 */ 14 */
14 @Data 15 @Data
  16 +@Builder
15 @NoArgsConstructor 17 @NoArgsConstructor
16 @AllArgsConstructor 18 @AllArgsConstructor
17 public class PayOrderNotifyRespDTO { 19 public class PayOrderNotifyRespDTO {
@@ -21,11 +23,15 @@ public class PayOrderNotifyRespDTO { @@ -21,11 +23,15 @@ public class PayOrderNotifyRespDTO {
21 */ 23 */
22 private String orderExtensionNo; 24 private String orderExtensionNo;
23 /** 25 /**
24 - * 支付渠道 26 + * 支付渠道编号
25 */ 27 */
26 private String channelOrderNo; 28 private String channelOrderNo;
27 /** 29 /**
28 - * 支付渠道 30 + * 支付渠道用户编号
  31 + */
  32 + private String channelUserId;
  33 + /**
  34 + * 支付成功时间
29 */ 35 */
30 private Date successTime; 36 private Date successTime;
31 37
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java
@@ -122,7 +122,6 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; { @@ -122,7 +122,6 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
122 return client.createOrderV3(TradeTypeEnum.JSAPI, request); 122 return client.createOrderV3(TradeTypeEnum.JSAPI, request);
123 } 123 }
124 124
125 -  
126 private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) { 125 private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
127 String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid"); 126 String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
128 if (StrUtil.isEmpty(openid)) { 127 if (StrUtil.isEmpty(openid)) {
@@ -136,8 +135,10 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; { @@ -136,8 +135,10 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
136 WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data); 135 WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data);
137 Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS"); 136 Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
138 // 转换结果 137 // 转换结果
139 - return new PayOrderNotifyRespDTO(notifyResult.getOutTradeNo(), notifyResult.getTransactionId(),  
140 - DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"), data); 138 + return PayOrderNotifyRespDTO.builder().orderExtensionNo(notifyResult.getOutTradeNo())
  139 + .channelOrderNo(notifyResult.getTransactionId()).channelUserId(notifyResult.getOpenid())
  140 + .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
  141 + .data(data).build();
141 } 142 }
142 143
143 } 144 }
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
@@ -6,7 +6,7 @@ import cn.hutool.extra.servlet.ServletUtil; @@ -6,7 +6,7 @@ import cn.hutool.extra.servlet.ServletUtil;
6 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; 6 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
7 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 7 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8 import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; 8 import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService;
9 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO; 9 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
10 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; 10 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
11 import cn.iocoder.yudao.framework.web.config.WebProperties; 11 import cn.iocoder.yudao.framework.web.config.WebProperties;
12 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; 12 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
@@ -68,7 +68,7 @@ public class ApiAccessLogFilter extends OncePerRequestFilter { @@ -68,7 +68,7 @@ public class ApiAccessLogFilter extends OncePerRequestFilter {
68 68
69 private void createApiAccessLog(HttpServletRequest request, Date beginTime, 69 private void createApiAccessLog(HttpServletRequest request, Date beginTime,
70 Map<String, String> queryString, String requestBody, Exception ex) { 70 Map<String, String> queryString, String requestBody, Exception ex) {
71 - ApiAccessLogCreateDTO accessLog = new ApiAccessLogCreateDTO(); 71 + ApiAccessLogCreateReqDTO accessLog = new ApiAccessLogCreateReqDTO();
72 try { 72 try {
73 this.buildApiAccessLogDTO(accessLog, request, beginTime, queryString, requestBody, ex); 73 this.buildApiAccessLogDTO(accessLog, request, beginTime, queryString, requestBody, ex);
74 apiAccessLogFrameworkService.createApiAccessLogAsync(accessLog); 74 apiAccessLogFrameworkService.createApiAccessLogAsync(accessLog);
@@ -77,7 +77,7 @@ public class ApiAccessLogFilter extends OncePerRequestFilter { @@ -77,7 +77,7 @@ public class ApiAccessLogFilter extends OncePerRequestFilter {
77 } 77 }
78 } 78 }
79 79
80 - private void buildApiAccessLogDTO(ApiAccessLogCreateDTO accessLog, HttpServletRequest request, Date beginTime, 80 + private void buildApiAccessLogDTO(ApiAccessLogCreateReqDTO accessLog, HttpServletRequest request, Date beginTime,
81 Map<String, String> queryString, String requestBody, Exception ex) { 81 Map<String, String> queryString, String requestBody, Exception ex) {
82 // 处理用户信息 82 // 处理用户信息
83 accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request)); 83 accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request));
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkService.java
1 package cn.iocoder.yudao.framework.apilog.core.service; 1 package cn.iocoder.yudao.framework.apilog.core.service;
2 2
3 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO; 3 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
4 4
5 import javax.validation.Valid; 5 import javax.validation.Valid;
6 -import java.util.concurrent.Future;  
7 6
8 /** 7 /**
9 * API 访问日志 Framework Service 接口 8 * API 访问日志 Framework Service 接口
@@ -17,6 +16,6 @@ public interface ApiAccessLogFrameworkService { @@ -17,6 +16,6 @@ public interface ApiAccessLogFrameworkService {
17 * 16 *
18 * @param createDTO 创建信息 17 * @param createDTO 创建信息
19 */ 18 */
20 - void createApiAccessLogAsync(@Valid ApiAccessLogCreateDTO createDTO); 19 + void createApiAccessLogAsync(@Valid ApiAccessLogCreateReqDTO createDTO);
21 20
22 } 21 }
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkService.java
1 package cn.iocoder.yudao.framework.apilog.core.service; 1 package cn.iocoder.yudao.framework.apilog.core.service;
2 2
3 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO; 3 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
4 4
5 import javax.validation.Valid; 5 import javax.validation.Valid;
6 -import java.util.concurrent.Future;  
7 6
8 /** 7 /**
9 * API 错误日志 Framework Service 接口 8 * API 错误日志 Framework Service 接口
@@ -17,6 +16,6 @@ public interface ApiErrorLogFrameworkService { @@ -17,6 +16,6 @@ public interface ApiErrorLogFrameworkService {
17 * 16 *
18 * @param createDTO 创建信息 17 * @param createDTO 创建信息
19 */ 18 */
20 - void createApiErrorLogAsync(@Valid ApiErrorLogCreateDTO createDTO); 19 + void createApiErrorLogAsync(@Valid ApiErrorLogCreateReqDTO createDTO);
21 20
22 } 21 }
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiAccessLogCreateDTO.java renamed to yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiAccessLogCreateReqDTO.java
@@ -11,7 +11,7 @@ import java.util.Date; @@ -11,7 +11,7 @@ import java.util.Date;
11 * @author 芋道源码 11 * @author 芋道源码
12 */ 12 */
13 @Data 13 @Data
14 -public class ApiAccessLogCreateDTO { 14 +public class ApiAccessLogCreateReqDTO {
15 15
16 /** 16 /**
17 * 链路追踪编号 17 * 链路追踪编号
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiErrorLogCreateDTO.java renamed to yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiErrorLogCreateReqDTO.java
@@ -13,7 +13,7 @@ import java.util.Date; @@ -13,7 +13,7 @@ import java.util.Date;
13 */ 13 */
14 @Data 14 @Data
15 @Accessors(chain = true) 15 @Accessors(chain = true)
16 -public class ApiErrorLogCreateDTO { 16 +public class ApiErrorLogCreateReqDTO {
17 17
18 /** 18 /**
19 * 链路编号 19 * 链路编号
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
@@ -6,7 +6,7 @@ import cn.hutool.extra.servlet.ServletUtil; @@ -6,7 +6,7 @@ import cn.hutool.extra.servlet.ServletUtil;
6 import cn.iocoder.yudao.framework.common.exception.ServiceException; 6 import cn.iocoder.yudao.framework.common.exception.ServiceException;
7 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 7 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8 import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; 8 import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
9 -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO; 9 +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
10 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; 10 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
11 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; 11 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
12 import cn.iocoder.yudao.framework.common.util.json.JsonUtils; 12 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
@@ -15,7 +15,6 @@ import io.github.resilience4j.ratelimiter.RequestNotPermitted; @@ -15,7 +15,6 @@ import io.github.resilience4j.ratelimiter.RequestNotPermitted;
15 import lombok.AllArgsConstructor; 15 import lombok.AllArgsConstructor;
16 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
17 import org.apache.commons.lang3.exception.ExceptionUtils; 17 import org.apache.commons.lang3.exception.ExceptionUtils;
18 -import org.springframework.beans.factory.annotation.Value;  
19 import org.springframework.security.access.AccessDeniedException; 18 import org.springframework.security.access.AccessDeniedException;
20 import org.springframework.util.Assert; 19 import org.springframework.util.Assert;
21 import org.springframework.validation.BindException; 20 import org.springframework.validation.BindException;
@@ -28,7 +27,6 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -28,7 +27,6 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
28 import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; 27 import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
29 import org.springframework.web.servlet.NoHandlerFoundException; 28 import org.springframework.web.servlet.NoHandlerFoundException;
30 29
31 -import javax.annotation.Resource;  
32 import javax.servlet.http.HttpServletRequest; 30 import javax.servlet.http.HttpServletRequest;
33 import javax.validation.ConstraintViolation; 31 import javax.validation.ConstraintViolation;
34 import javax.validation.ConstraintViolationException; 32 import javax.validation.ConstraintViolationException;
@@ -231,7 +229,7 @@ public class GlobalExceptionHandler { @@ -231,7 +229,7 @@ public class GlobalExceptionHandler {
231 229
232 private void createExceptionLog(HttpServletRequest req, Throwable e) { 230 private void createExceptionLog(HttpServletRequest req, Throwable e) {
233 // 插入错误日志 231 // 插入错误日志
234 - ApiErrorLogCreateDTO errorLog = new ApiErrorLogCreateDTO(); 232 + ApiErrorLogCreateReqDTO errorLog = new ApiErrorLogCreateReqDTO();
235 try { 233 try {
236 // 初始化 errorLog 234 // 初始化 errorLog
237 initExceptionLog(errorLog, req, e); 235 initExceptionLog(errorLog, req, e);
@@ -242,7 +240,7 @@ public class GlobalExceptionHandler { @@ -242,7 +240,7 @@ public class GlobalExceptionHandler {
242 } 240 }
243 } 241 }
244 242
245 - private void initExceptionLog(ApiErrorLogCreateDTO errorLog, HttpServletRequest request, Throwable e) { 243 + private void initExceptionLog(ApiErrorLogCreateReqDTO errorLog, HttpServletRequest request, Throwable e) {
246 // 处理用户信息 244 // 处理用户信息
247 errorLog.setUserId(WebFrameworkUtils.getLoginUserId(request)); 245 errorLog.setUserId(WebFrameworkUtils.getLoginUserId(request));
248 errorLog.setUserType(WebFrameworkUtils.getLoginUserType(request)); 246 errorLog.setUserType(WebFrameworkUtils.getLoginUserType(request));
yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreServic @@ -6,6 +6,7 @@ import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreServic
6 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; 6 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO;
7 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitRespDTO; 7 import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitRespDTO;
8 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 8 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  9 +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
9 import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitReqVO; 10 import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitReqVO;
10 import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitRespVO; 11 import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitRespVO;
11 import io.swagger.annotations.Api; 12 import io.swagger.annotations.Api;
@@ -52,8 +53,8 @@ public class PayOrderController { @@ -52,8 +53,8 @@ public class PayOrderController {
52 @PostMapping("/notify/wx-pub/{channelId}") 53 @PostMapping("/notify/wx-pub/{channelId}")
53 @ApiOperation("通知微信公众号的结果") 54 @ApiOperation("通知微信公众号的结果")
54 public String notifyWxPayOrder(@PathVariable("channelId") Long channelId, 55 public String notifyWxPayOrder(@PathVariable("channelId") Long channelId,
55 - @RequestBody String xmlData) {  
56 - System.out.println(xmlData); 56 + @RequestBody String xmlData) throws Exception {
  57 + payOrderCoreService.notifyPayOrder(channelId, PayChannelEnum.WX_PUB.getCode(), xmlData);
57 return "success"; 58 return "success";
58 } 59 }
59 60