From ced838f29fdbb94d836eacc1294da6797b150684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E6=99=9A=E6=89=93=E8=80=81=E8=99=8E?= Date: Tue, 25 Jun 2024 04:42:14 +0000 Subject: [PATCH 01/27] =?UTF-8?q?fix(bpm):=20=E5=8F=91=E8=B5=B7=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=AF=E8=83=BD=E6=B2=A1=E6=9C=89=E9=83=A8=E9=97=A8?= =?UTF-8?q?=20=E5=8F=91=E8=B5=B7=E7=94=A8=E6=88=B7=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=83=A8=E9=97=A8=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=83=A8=E9=97=A8=E4=BF=A1=E6=81=AF=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 今晚打老虎 --- .../bpm/controller/admin/task/BpmProcessInstanceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java index 819ce366f..9b1b9cf24 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java @@ -135,7 +135,7 @@ public class BpmProcessInstanceController { processDefinitionService.getProcessDefinitionBpmnModel(processInstance.getProcessDefinitionId())); AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())).getCheckedData(); DeptRespDTO dept = null; - if (startUser != null) { + if (startUser != null && startUser.getDeptId() != null) { dept = deptApi.getDept(startUser.getDeptId()).getCheckedData(); } return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstance(processInstance, From bb2a10ba4a667883af078ca9e2ddbe4689b8b7f4 Mon Sep 17 00:00:00 2001 From: OnPeaceOfMind Date: Tue, 16 Jul 2024 06:12:01 +0000 Subject: [PATCH 02/27] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91AI?= =?UTF-8?q?=E6=A8=A1=E5=9D=97redis=E9=85=8D=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: OnPeaceOfMind --- .../src/main/resources/application-local.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml index dbfdf0cfc..dfc7f41db 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml @@ -75,8 +75,8 @@ spring: password: 123456 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - redis: - data: + data: + redis: host: 127.0.0.1 # 地址 port: 6379 # 端口 database: 0 # 数据库索引 From 40800bd728de42d73ca666bb4e5ea726b0a94a9a Mon Sep 17 00:00:00 2001 From: OnPeaceOfMind Date: Tue, 16 Jul 2024 06:14:38 +0000 Subject: [PATCH 03/27] =?UTF-8?q?=E3=80=90=E4=BE=9D=E8=B5=96=E3=80=91sprin?= =?UTF-8?q?g=20boot=20from=203.2.2=20to=203.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: OnPeaceOfMind --- yudao-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 947d3da08..f2a813688 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -17,7 +17,7 @@ 2.1.0-snapshot 1.6.0 - 3.2.2 + 3.3.1 2023.0.3 2023.0.1.2 From 398171a40222fee9459e60b86849a688210e4851 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 19 Jul 2024 19:27:33 +0800 Subject: [PATCH 04/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91CRM=EF=BC=9A=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AF=BB=E5=8F=96=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/api/logger/OperateLogApi.java | 10 +++++----- .../module/system/api/logger/OperateLogApiImpl.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApi.java index 276a2136b..08a9d340c 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApi.java @@ -6,15 +6,15 @@ import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO; import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogPageReqDTO; import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogRespDTO; import cn.iocoder.yudao.module.system.enums.ApiConstants; -import feign.QueryMap; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.openfeign.SpringQueryMap; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import jakarta.validation.Valid; - @FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = @Tag(name = "RPC 服务 - 操作日志") public interface OperateLogApi { @@ -25,8 +25,8 @@ public interface OperateLogApi { @Operation(summary = "创建操作日志") CommonResult createOperateLog(@Valid @RequestBody OperateLogCreateReqDTO createReqDTO); - @PostMapping(PREFIX + "/page") + @GetMapping(PREFIX + "/page") @Operation(summary = "获取指定模块的指定数据的操作日志分页") - CommonResult> getOperateLogPage(@QueryMap OperateLogPageReqDTO pageReqVO); + CommonResult> getOperateLogPage(@SpringQueryMap OperateLogPageReqDTO pageReqDTO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApiImpl.java index 5c388d5e3..fa0680edf 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApiImpl.java @@ -28,8 +28,8 @@ public class OperateLogApiImpl implements OperateLogApi { } @Override - public CommonResult> getOperateLogPage(OperateLogPageReqDTO pageReqVO) { - PageResult operateLogPage = operateLogService.getOperateLogPage(pageReqVO); + public CommonResult> getOperateLogPage(OperateLogPageReqDTO pageReqDTO) { + PageResult operateLogPage = operateLogService.getOperateLogPage(pageReqDTO); return success(BeanUtils.toBean(operateLogPage, OperateLogRespDTO.class)); } From 24eaa68269c58ec4bf6608552504416f1d870027 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 19 Jul 2024 22:54:25 +0800 Subject: [PATCH 05/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97=E3=80=81?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiAccessLogFrameworkServiceImpl.java | 9 ++++- .../ApiErrorLogFrameworkServiceImpl.java | 9 ++++- .../core/handler/GlobalExceptionHandler.java | 34 +++++++++++-------- .../logger/ApiAccessLogServiceImpl.java | 9 ++++- .../logger/ApiErrorLogServiceImpl.java | 11 ++++-- 5 files changed, 53 insertions(+), 19 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java index 8f8e34306..934f8141c 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import cn.iocoder.yudao.module.infra.api.logger.ApiAccessLogApi; import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; /** @@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.Async; * @author 芋道源码 */ @RequiredArgsConstructor +@Slf4j public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkService { private final ApiAccessLogApi apiAccessLogApi; @@ -20,7 +22,12 @@ public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkSe @Override @Async public void createApiAccessLog(ApiAccessLogCreateReqDTO reqDTO) { - apiAccessLogApi.createApiAccessLog(reqDTO); + try { + apiAccessLogApi.createApiAccessLog(reqDTO); + } catch (Throwable ex) { + // 由于 @Async 异步调用,这里打印下日志,更容易跟进 + log.error("[createApiAccessLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); + } } } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java index 32e4f8043..e4e19fb32 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import cn.iocoder.yudao.module.infra.api.logger.ApiErrorLogApi; import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; /** @@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.Async; * @author 芋道源码 */ @RequiredArgsConstructor +@Slf4j public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkService { private final ApiErrorLogApi apiErrorLogApi; @@ -20,7 +22,12 @@ public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkServ @Override @Async public void createApiErrorLog(ApiErrorLogCreateReqDTO reqDTO) { - apiErrorLogApi.createApiErrorLog(reqDTO); + try { + apiErrorLogApi.createApiErrorLog(reqDTO); + } catch (Throwable ex) { + // 由于 @Async 异步调用,这里打印下日志,更容易跟进 + log.error("[createApiErrorLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); + } } } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 845a84c6a..ea6460580 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -288,45 +288,51 @@ public class GlobalExceptionHandler { } // 1. 数据报表 if (message.contains("report_")) { - log.error("[报表模块 yudao-module-report - 表结构未导入][参考 https://doc.iocoder.cn/report/ 开启]"); + log.error("[报表模块 yudao-module-report - 表结构未导入][参考 https://cloud.iocoder.cn/report/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[报表模块 yudao-module-report - 表结构未导入][参考 https://doc.iocoder.cn/report/ 开启]"); + "[报表模块 yudao-module-report - 表结构未导入][参考 https://cloud.iocoder.cn/report/ 开启]"); } // 2. 工作流 if (message.contains("bpm_")) { - log.error("[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://doc.iocoder.cn/bpm/ 开启]"); + log.error("[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://cloud.iocoder.cn/bpm/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://doc.iocoder.cn/bpm/ 开启]"); + "[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://cloud.iocoder.cn/bpm/ 开启]"); } // 3. 微信公众号 if (message.contains("mp_")) { - log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]"); + log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 https://cloud.iocoder.cn/mp/build/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[微信公众号 yudao-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]"); + "[微信公众号 yudao-module-mp - 表结构未导入][参考 https://cloud.iocoder.cn/mp/build/ 开启]"); } // 4. 商城系统 if (StrUtil.containsAny(message, "product_", "promotion_", "trade_")) { - log.error("[商城系统 yudao-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]"); + log.error("[商城系统 yudao-module-mall - 已禁用][参考 https://cloud.iocoder.cn/mall/build/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[商城系统 yudao-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]"); + "[商城系统 yudao-module-mall - 已禁用][参考 https://cloud.iocoder.cn/mall/build/ 开启]"); } // 5. ERP 系统 if (message.contains("erp_")) { - log.error("[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://doc.iocoder.cn/erp/build/ 开启]"); + log.error("[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://cloud.iocoder.cn/erp/build/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://doc.iocoder.cn/erp/build/ 开启]"); + "[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://cloud.iocoder.cn/erp/build/ 开启]"); } // 6. CRM 系统 if (message.contains("crm_")) { - log.error("[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://doc.iocoder.cn/crm/build/ 开启]"); + log.error("[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://cloud.iocoder.cn/crm/build/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://doc.iocoder.cn/crm/build/ 开启]"); + "[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://cloud.iocoder.cn/crm/build/ 开启]"); } // 7. 支付平台 if (message.contains("pay_")) { - log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); + log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://cloud.iocoder.cn/pay/build/ 开启]"); return CommonResult.error(NOT_IMPLEMENTED.getCode(), - "[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); + "[支付模块 yudao-module-pay - 表结构未导入][参考 https://cloud.iocoder.cn/pay/build/ 开启]"); + } + // 8. AI 大模型 + if (message.contains("ai_")) { + log.error("[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://cloud.iocoder.cn/ai/build/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://cloud.iocoder.cn/ai/build/ 开启]"); } return null; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java index f6b496381..9483e8f73 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.infra.service.logger; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; @@ -35,7 +37,12 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService { ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class); apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH)); - apiAccessLogMapper.insert(apiAccessLog); + if (TenantContextHolder.getTenantId() != null) { + apiAccessLogMapper.insert(apiAccessLog); + } else { + // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败! + TenantUtils.executeIgnore(() -> apiAccessLogMapper.insert(apiAccessLog)); + } } @Override diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java index 5137dc3d3..747b220b5 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.infra.service.logger; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; @@ -25,9 +27,9 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_L * * @author 芋道源码 */ -@Slf4j @Service @Validated +@Slf4j public class ApiErrorLogServiceImpl implements ApiErrorLogService { @Resource @@ -38,7 +40,12 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); - apiErrorLogMapper.insert(apiErrorLog); + if (TenantContextHolder.getTenantId() != null) { + apiErrorLogMapper.insert(apiErrorLog); + } else { + // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败! + TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog)); + } } @Override From f6ff5086be8c2049fcbbd7dc30c1bfc9985a2a86 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 19 Jul 2024 23:14:54 +0800 Subject: [PATCH 06/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E5=A4=84=E7=90=86?= =?UTF-8?q?=20HttpRequestMethodNotSupportedException=20=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/core/handler/GlobalExceptionHandler.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index ea6460580..021858f42 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.servlet.NoHandlerFoundException; +import org.springframework.web.servlet.resource.NoResourceFoundException; import java.time.LocalDateTime; import java.util.Map; @@ -87,6 +88,9 @@ public class GlobalExceptionHandler { if (ex instanceof NoHandlerFoundException) { return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex); } + if (ex instanceof NoResourceFoundException) { + return noResourceFoundExceptionHandler(request, (NoResourceFoundException) ex); + } if (ex instanceof HttpRequestMethodNotSupportedException) { return httpRequestMethodNotSupportedExceptionHandler((HttpRequestMethodNotSupportedException) ex); } @@ -176,6 +180,15 @@ public class GlobalExceptionHandler { return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); } + /** + * 处理 SpringMVC 请求地址不存在 + */ + @ExceptionHandler(NoResourceFoundException.class) + private CommonResult noResourceFoundExceptionHandler(HttpServletRequest req, NoResourceFoundException ex) { + log.warn("[noResourceFoundExceptionHandler]", ex); + return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getResourcePath())); + } + /** * 处理 SpringMVC 请求方法不正确 * From 825be64d6dd699ebd082dd2ef2444690c5f29bbf Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 19 Jul 2024 23:37:00 +0800 Subject: [PATCH 07/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E7=AE=80=E5=8C=96?= =?UTF-8?q?=20GlobalExceptionHandler=20=E5=AF=B9=20ServiceException=20?= =?UTF-8?q?=E7=9A=84=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/web/core/handler/GlobalExceptionHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 021858f42..6935f7bee 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -219,9 +219,11 @@ public class GlobalExceptionHandler { */ @ExceptionHandler(value = ServiceException.class) public CommonResult serviceExceptionHandler(ServiceException ex) { + // 不包含的时候,才进行打印,避免 ex 堆栈过多 if (!IGNORE_ERROR_MESSAGES.contains(ex.getMessage())) { - // 不包含的时候,才进行打印,避免 ex 堆栈过多 - log.info("[serviceExceptionHandler]", ex); + // 即使打印,也只打印第一层 StackTraceElement,并且使用 warn 在控制台输出,更容易看到 + StackTraceElement[] stackTrace = ex.getStackTrace(); + log.warn("[serviceExceptionHandler]\n\t{}", stackTrace[0]); } return CommonResult.error(ex.getCode(), ex.getMessage()); } From e18069d45f64878129ce28df5d0f34e479cbf22c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 13:55:28 +0800 Subject: [PATCH 08/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E5=9C=A8=20RPC=20=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=97=B6=EF=BC=8C=E4=BC=A0=E9=80=92=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E7=9A=84=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 7 ++++ ...daoDataPermissionRpcAutoConfiguration.java | 34 +++++++++++++++++ .../rpc/DataPermissionRequestInterceptor.java | 27 +++++++++++++ .../core/rpc/DataPermissionRpcWebFilter.java | 38 +++++++++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + 5 files changed, 107 insertions(+) create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionRpcAutoConfiguration.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRequestInterceptor.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRpcWebFilter.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml index c80191e55..159615512 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml @@ -34,6 +34,13 @@ yudao-spring-boot-starter-mybatis + + + cn.iocoder.cloud + yudao-spring-boot-starter-rpc + true + + cn.iocoder.cloud diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionRpcAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionRpcAutoConfiguration.java new file mode 100644 index 000000000..fcd43271d --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionRpcAutoConfiguration.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.framework.datapermission.config; + +import cn.iocoder.yudao.framework.datapermission.core.rpc.DataPermissionRequestInterceptor; +import cn.iocoder.yudao.framework.datapermission.core.rpc.DataPermissionRpcWebFilter; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; + +import static cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum.TENANT_CONTEXT_FILTER; + +/** + * 数据权限针对 RPC 的自动配置类 + * + * @author 芋道源码 + */ +@AutoConfiguration +@ConditionalOnClass(name = "feign.RequestInterceptor") +public class YudaoDataPermissionRpcAutoConfiguration { + + @Bean + public DataPermissionRequestInterceptor dataPermissionRequestInterceptor() { + return new DataPermissionRequestInterceptor(); + } + + @Bean + public FilterRegistrationBean dataPermissionRpcFilter() { + FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); + registrationBean.setFilter(new DataPermissionRpcWebFilter()); + registrationBean.setOrder(TENANT_CONTEXT_FILTER - 1); // 顺序没有绝对的要求,在租户 Filter 前面稳妥点 + return registrationBean; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRequestInterceptor.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRequestInterceptor.java new file mode 100644 index 000000000..3fa23c0c0 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRequestInterceptor.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.framework.datapermission.core.rpc; + +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder; +import feign.RequestInterceptor; +import feign.RequestTemplate; + +/** + * DataPermission 的 RequestInterceptor 实现类:Feign 请求时,将 {@link DataPermission} 设置到 header 中,继续透传给被调用的服务 + * + * 注意:由于 {@link DataPermission} 不支持序列化和反序列化,所以暂时只能传递它的 enable 属性 + * + * @author 芋道源码 + */ +public class DataPermissionRequestInterceptor implements RequestInterceptor { + + public static final String ENABLE_HEADER_NAME = "data-permission-enable"; + + @Override + public void apply(RequestTemplate requestTemplate) { + DataPermission dataPermission = DataPermissionContextHolder.get(); + if (dataPermission != null && Boolean.FALSE.equals(dataPermission.enable())) { + requestTemplate.header(ENABLE_HEADER_NAME, "false"); + } + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRpcWebFilter.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRpcWebFilter.java new file mode 100644 index 000000000..b537509fe --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rpc/DataPermissionRpcWebFilter.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.framework.datapermission.core.rpc; + +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder; +import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.web.filter.OncePerRequestFilter; + +import java.io.IOException; +import java.util.Objects; + +/** + * 针对 {@link DataPermissionRequestInterceptor} 的 RPC 调用,设置 {@link DataPermissionContextHolder} 的上下文 + * + * @author 芋道源码 + */ +public class DataPermissionRpcWebFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { + String enable = request.getHeader(DataPermissionRequestInterceptor.ENABLE_HEADER_NAME); + if (Objects.equals(enable, Boolean.FALSE.toString())) { + DataPermissionUtils.executeIgnore(() -> { + try { + chain.doFilter(request, response); + } catch (IOException | ServletException e) { + throw new RuntimeException(e); + } + }); + } else { + chain.doFilter(request, response); + } + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index bd0e97a86..cb87159e1 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,2 +1,3 @@ cn.iocoder.yudao.framework.datapermission.config.YudaoDataPermissionAutoConfiguration cn.iocoder.yudao.framework.datapermission.config.YudaoDeptDataPermissionAutoConfiguration +cn.iocoder.yudao.framework.datapermission.config.YudaoDataPermissionRpcAutoConfiguration From a034b3d2181063b9fb2edd074d8643f4c8e2ff6d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 16:12:55 +0800 Subject: [PATCH 09/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=20application.yaml=20=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E5=86=97=E4=BD=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 7 ++++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 10 +--------- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 5 ----- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 6 +++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 10 +++++++--- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 5 ----- .../src/main/resources/application.yaml | 10 +++++++--- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 6 ------ .../src/main/resources/application.yaml | 10 +++++++--- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 6 ------ .../src/main/resources/application.yaml | 10 +++++++--- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 10 +++++++--- .../src/main/resources/application-dev.yaml | 9 +-------- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 9 +-------- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 5 ++++- .../src/main/resources/application-dev.yaml | 5 ----- .../src/main/resources/application-local.yaml | 8 +------- .../src/main/resources/application.yaml | 5 ++++- .../system/service/social/SocialClientServiceImpl.java | 6 +++++- .../src/main/resources/application-dev.yaml | 7 ------- .../src/main/resources/application-local.yaml | 6 ------ .../src/main/resources/application.yaml | 9 ++++----- 44 files changed, 94 insertions(+), 201 deletions(-) diff --git a/yudao-gateway/src/main/resources/application-local.yaml b/yudao-gateway/src/main/resources/application-local.yaml index 570439c11..a7132bd6f 100644 --- a/yudao-gateway/src/main/resources/application-local.yaml +++ b/yudao-gateway/src/main/resources/application-local.yaml @@ -11,4 +11,9 @@ spring: group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP config: # 【注册中心】配置项 namespace: dev # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP \ No newline at end of file + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + +# 日志文件配置 +logging: + level: + org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示 diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-dev.yaml b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-dev.yaml index e0a4550e4..8c57cf28c 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-dev.yaml @@ -127,9 +127,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 demo: true # 开启演示模式 diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml index dbfdf0cfc..c8b2d76b3 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application-local.yaml @@ -132,11 +132,5 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application.yaml b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application.yaml index 3ded28dae..9bbf3f179 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application.yaml +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/application.yaml @@ -156,11 +156,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-dev.yaml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-dev.yaml index b0139920b..3c0bc8c7d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-dev.yaml @@ -110,9 +110,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 demo: true # 开启演示模式 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-local.yaml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-local.yaml index d6854d1b4..ec21edc0b 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-local.yaml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application-local.yaml @@ -131,15 +131,7 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - captcha: - enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试 security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml index 9f09cc7d0..310413e1a 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml @@ -122,11 +122,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} captcha: timeout: 5m width: 160 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-dev.yaml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-dev.yaml index 5bff92a6b..13aae1d26 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-dev.yaml @@ -106,11 +106,6 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false demo: false # 关闭演示模式 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml index 62f7aa169..137eb9e84 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml @@ -132,11 +132,6 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false demo: false # 关闭演示模式 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application.yaml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application.yaml index 497aadd47..5dd0c03b4 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application.yaml +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application.yaml @@ -109,11 +109,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-dev.yaml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-dev.yaml index 5bff92a6b..13aae1d26 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-dev.yaml @@ -106,11 +106,6 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false demo: false # 关闭演示模式 diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml index 3f410d2be..f9d51e096 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml @@ -132,11 +132,5 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application.yaml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application.yaml index 4b701cbc5..5a5da0070 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application.yaml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application.yaml @@ -109,11 +109,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml index e0a4550e4..8c57cf28c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml @@ -127,9 +127,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 demo: true # 开启演示模式 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml index 5b7317f3c..386c91176 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml @@ -155,11 +155,5 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml index f38ade646..e62c4974c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml @@ -135,6 +135,11 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 + - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 websocket: enable: true # websocket的开关 path: /infra/ws # 路径 @@ -152,7 +157,6 @@ yudao: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} codegen: base-package: cn.iocoder.yudao db-schemas: ${spring.datasource.dynamic.datasource.master.name} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-dev.yaml b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-dev.yaml index e151905f9..1045cb8a2 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-dev.yaml @@ -112,9 +112,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-local.yaml b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-local.yaml index 916204cf0..65d384ffb 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application-local.yaml @@ -131,13 +131,7 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: mock-enable: true - xss: - enable: false access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application.yaml b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application.yaml index a173eed66..d44431cb1 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/resources/application.yaml +++ b/yudao-module-mall/yudao-module-product-biz/src/main/resources/application.yaml @@ -108,13 +108,17 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.module.product + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-dev.yaml b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-dev.yaml index e151905f9..1045cb8a2 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-dev.yaml @@ -112,9 +112,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-local.yaml b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-local.yaml index 11ff0ded7..af0a5c70d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application-local.yaml @@ -131,13 +131,8 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: mock-enable: true - xss: - enable: false access-log: # 访问日志的配置项 enable: false demo: false # 关闭演示模式 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application.yaml b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application.yaml index a4a528fd5..a6a6836a0 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application.yaml +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/resources/application.yaml @@ -108,13 +108,17 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.module.promotion + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-dev.yaml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-dev.yaml index e151905f9..1045cb8a2 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-dev.yaml @@ -112,9 +112,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-local.yaml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-local.yaml index f6a6b84ca..80fea4651 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application-local.yaml @@ -131,13 +131,7 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: mock-enable: true - xss: - enable: false access-log: # 访问日志的配置项 enable: false - demo: false # 关闭演示模式 diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application.yaml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application.yaml index 3560658bf..89ec4a277 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application.yaml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/application.yaml @@ -108,13 +108,17 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.module.statistics + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml index 870e3666f..9e9d191ea 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-dev.yaml @@ -112,10 +112,5 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml index 1581d6743..5093be380 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application-local.yaml @@ -131,14 +131,8 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: mock-enable: true - xss: - enable: false access-log: # 访问日志的配置项 enable: false - demo: false # 关闭演示模式 tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml index 3dd1062af..f3ae12920 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/resources/application.yaml @@ -108,13 +108,17 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.module.trade + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-member/yudao-module-member-biz/src/main/resources/application-dev.yaml b/yudao-module-member/yudao-module-member-biz/src/main/resources/application-dev.yaml index e151905f9..1045cb8a2 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-member/yudao-module-member-biz/src/main/resources/application-dev.yaml @@ -112,9 +112,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 demo: true # 开启演示模式 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/resources/application-local.yaml b/yudao-module-member/yudao-module-member-biz/src/main/resources/application-local.yaml index c0fb60610..d81841aeb 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/resources/application-local.yaml +++ b/yudao-module-member/yudao-module-member-biz/src/main/resources/application-local.yaml @@ -131,13 +131,7 @@ logging: yudao: env: # 多环境的配置项 tag: ${HOSTNAME} - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: mock-enable: true - xss: - enable: false access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/resources/application.yaml b/yudao-module-member/yudao-module-member-biz/src/main/resources/application.yaml index d44c6c445..bb0903335 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/resources/application.yaml +++ b/yudao-module-member/yudao-module-member-biz/src/main/resources/application.yaml @@ -108,13 +108,17 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.module.member + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-dev.yaml b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-dev.yaml index 5bff92a6b..cf54e9602 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-dev.yaml @@ -106,11 +106,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + demo: true # 关闭演示模式 diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-local.yaml b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-local.yaml index 30c1247cb..76c402384 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-local.yaml +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application-local.yaml @@ -127,11 +127,5 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application.yaml b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application.yaml index 84f8326d8..d7c645ff7 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application.yaml +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/application.yaml @@ -112,6 +112,10 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 security: permit-all_urls: - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 @@ -119,7 +123,6 @@ yudao: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-dev.yaml b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-dev.yaml index 3456ed3e1..b483fd7e8 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-dev.yaml @@ -106,14 +106,7 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - access-log: # 访问日志的配置项 - enable: false pay: order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址 refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址 - demo: false # 关闭演示模式 + demo: true # 关闭演示模式 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml index 370a39cdd..05e42abd2 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml @@ -133,14 +133,8 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false pay: order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址 - refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址 - demo: false # 关闭演示模式 + refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址 \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application.yaml b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application.yaml index 072879794..000ebbeaf 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application.yaml +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application.yaml @@ -109,11 +109,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true ignore-urls: diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/application-dev.yaml b/yudao-module-report/yudao-module-report-biz/src/main/resources/application-dev.yaml index e90d23560..047cdc600 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/application-dev.yaml @@ -106,9 +106,4 @@ spring: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 demo: true # 开启演示模式 diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/application-local.yaml b/yudao-module-report/yudao-module-report-biz/src/main/resources/application-local.yaml index b4ec468c5..8c71938b0 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/resources/application-local.yaml +++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/application-local.yaml @@ -128,11 +128,5 @@ yudao: tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/application.yaml b/yudao-module-report/yudao-module-report-biz/src/main/resources/application.yaml index a8d9d9757..d3dc241bf 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/resources/application.yaml +++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/application.yaml @@ -102,11 +102,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} tenant: # 多租户相关配置项 enable: true diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java index 76ef7e5f7..37b1f0bc4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java @@ -64,8 +64,12 @@ public class SocialClientServiceImpl implements SocialClientService { /** * 小程序版本 + * + * 1. release:正式版 + * 2. trial:体验版 + * 3. developer:开发版 */ - @Value("${yudao.wxa-code.env-version}") + @Value("${yudao.wxa-code.env-version:release}") public String envVersion; @Resource diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml index f31ada4ea..df8f155fe 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml @@ -154,14 +154,7 @@ wx: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 demo: true # 开启演示模式 - wxa-code: - env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop" justauth: enabled: true diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml index 10d5fcd53..c682d9852 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml @@ -177,14 +177,8 @@ yudao: enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试 security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false - demo: false # 关闭演示模式 wxa-code: env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop" diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml index 53eec36bb..04753d148 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml @@ -154,15 +154,14 @@ yudao: web: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - base-package: ${yudao.info.base-package} - captcha: - enable: true # 验证码的开关,默认为 true; - wxa-code: - env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"。默认为 release tenant: # 多租户相关配置项 enable: true ignore-urls: From 7fbb96b0f0d18cd1f5f6674566b7adcf30b2761b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 16:14:15 +0800 Subject: [PATCH 10/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=20application.yaml=20=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E5=86=97=E4=BD=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao-module-bpm-biz/src/main/resources/application.yaml | 4 ---- .../src/test/resources/application-unit-test.yaml | 5 ----- 2 files changed, 9 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml index 310413e1a..34b5bbeb5 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml @@ -130,10 +130,6 @@ yudao: title: 管理后台 description: 提供管理员管理的所有功能 version: ${yudao.info.version} - captcha: - timeout: 5m - width: 160 - height: 60 tenant: # 多租户相关配置项 enable: true diff --git a/yudao-module-system/yudao-module-system-biz/src/test/resources/application-unit-test.yaml b/yudao-module-system/yudao-module-system-biz/src/test/resources/application-unit-test.yaml index 432c1e395..93023bdfb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/resources/application-unit-test.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/test/resources/application-unit-test.yaml @@ -51,8 +51,3 @@ mybatis-plus: yudao: info: base-package: cn.iocoder.yudao.module - captcha: - timeout: 5m - width: 160 - height: 60 - enable: true From b728e66282e0585c1e39d67bff516d99ec14b26e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 17:57:31 +0800 Subject: [PATCH 11/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=91INFRA=EF=BC=9A=E5=A2=9E=E5=8A=A0=20ConfigApi?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/infra/api/config/ConfigApi.java | 21 ++++++++++++++++ .../infra/api/config/ConfigApiImpl.java | 25 +++++++++++++++++++ .../system/enums/ErrorCodeConstants.java | 7 +----- .../rpc/config/RpcConfiguration.java | 3 ++- .../service/user/AdminUserServiceImpl.java | 17 ++++++++++--- .../user/AdminUserServiceImplTest.java | 12 +++++++++ 6 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApi.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApiImpl.java diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApi.java new file mode 100644 index 000000000..53803d4d1 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApi.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.infra.api.config; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.infra.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 参数配置") +public interface ConfigApi { + + String PREFIX = ApiConstants.PREFIX + "/config"; + + @GetMapping(PREFIX + "/get-value-by-key") + @Operation(summary = "根据参数键查询参数值") + CommonResult getConfigValueByKey(@RequestParam("key") String key); + +} diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApiImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApiImpl.java new file mode 100644 index 000000000..5ab67c2c2 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApiImpl.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.module.infra.api.config; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; +import cn.iocoder.yudao.module.infra.service.config.ConfigService; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated +public class ConfigApiImpl implements ConfigApi { + + @Resource + private ConfigService configService; + + @Override + public CommonResult getConfigValueByKey(String key) { + ConfigDO config = configService.getConfigByKey(key); + return success(config != null ? config.getValue() : null); + } + +} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 412ac413e..585308dd6 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -14,7 +14,6 @@ public interface ErrorCodeConstants { ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "登录失败,账号被禁用"); ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "验证码不正确,原因:{}"); ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "未绑定账号,需要进行绑定"); - ErrorCode AUTH_TOKEN_EXPIRED = new ErrorCode(1_002_000_006, "Token 已经过期"); ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_007, "手机号不存在"); // ========== 菜单模块 1-002-001-000 ========== @@ -42,6 +41,7 @@ public interface ErrorCodeConstants { ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "用户密码校验失败"); ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用"); ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "创建用户失败,原因:超过租户最大租户配额({})!"); + ErrorCode USER_IMPORT_INIT_PASSWORD = new ErrorCode(1_002_003_009, "初始密码不能为空"); // ========== 部门模块 1-002-004-000 ========== ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门"); @@ -49,7 +49,6 @@ public interface ErrorCodeConstants { ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "当前部门不存在"); ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "存在子部门,无法删除"); ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "不能设置自己为父部门"); - ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "部门中存在员工,无法删除"); ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1_002_004_006, "部门({})不处于开启状态,不允许选择"); ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门"); @@ -96,11 +95,8 @@ public interface ErrorCodeConstants { ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "验证码不存在"); ErrorCode SMS_CODE_EXPIRED = new ErrorCode(1_002_014_001, "验证码已过期"); ErrorCode SMS_CODE_USED = new ErrorCode(1_002_014_002, "验证码已使用"); - ErrorCode SMS_CODE_NOT_CORRECT = new ErrorCode(1_002_014_003, "验证码不正确"); ErrorCode SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY = new ErrorCode(1_002_014_004, "超过每日短信发送数量"); ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_005, "短信发送过于频繁"); - ErrorCode SMS_CODE_IS_EXISTS = new ErrorCode(1_002_014_006, "手机号已被使用"); - ErrorCode SMS_CODE_IS_UNUSED = new ErrorCode(1_002_014_007, "验证码未被使用"); // ========== 租户信息 1-002-015-000 ========== ErrorCode TENANT_NOT_EXISTS = new ErrorCode(1_002_015_000, "租户不存在"); @@ -138,7 +134,6 @@ public interface ErrorCodeConstants { ErrorCode OAUTH2_GRANT_CLIENT_ID_MISMATCH = new ErrorCode(1_002_021_000, "client_id 不匹配"); ErrorCode OAUTH2_GRANT_REDIRECT_URI_MISMATCH = new ErrorCode(1_002_021_001, "redirect_uri 不匹配"); ErrorCode OAUTH2_GRANT_STATE_MISMATCH = new ErrorCode(1_002_021_002, "state 不匹配"); - ErrorCode OAUTH2_GRANT_CODE_NOT_EXISTS = new ErrorCode(1_002_021_003, "code 不存在"); // ========== OAuth2 授权 1-002-022-000 ========= ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1_002_022_000, "code 不存在"); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/rpc/config/RpcConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/rpc/config/RpcConfiguration.java index 57ba6740a..c29757003 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/rpc/config/RpcConfiguration.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/rpc/config/RpcConfiguration.java @@ -1,11 +1,12 @@ package cn.iocoder.yudao.module.system.framework.rpc.config; +import cn.iocoder.yudao.module.infra.api.config.ConfigApi; import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; @Configuration(proxyBeanMethods = false) -@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class}) +@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class}) public class RpcConfiguration { } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index efae327f8..7f905c3c0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils; +import cn.iocoder.yudao.module.infra.api.config.ConfigApi; import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; @@ -32,7 +33,6 @@ import com.mzt.logapi.service.impl.DiffParseFunction; import com.mzt.logapi.starter.annotation.LogRecord; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -57,8 +57,7 @@ import static cn.iocoder.yudao.module.system.enums.LogRecordConstants.*; @Slf4j public class AdminUserServiceImpl implements AdminUserService { - @Value("${sys.user.init-password:yudaoyuanma}") - private String userInitPassword; + static final String USER_INIT_PASSWORD_KEY = "system.user.init-password"; @Resource private AdminUserMapper userMapper; @@ -80,6 +79,8 @@ public class AdminUserServiceImpl implements AdminUserService { @Resource private FileApi fileApi; + @Resource + private ConfigApi configApi; @Override @Transactional(rollbackFor = Exception.class) @@ -428,9 +429,17 @@ public class AdminUserServiceImpl implements AdminUserService { @Override @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 public UserImportRespVO importUserList(List importUsers, boolean isUpdateSupport) { + // 1.1 参数校验 if (CollUtil.isEmpty(importUsers)) { throw exception(USER_IMPORT_LIST_IS_EMPTY); } + // 1.2 初始化密码不能为空 + String initPassword = configApi.getConfigValueByKey(USER_INIT_PASSWORD_KEY).getCheckedData(); + if (StrUtil.isEmpty(initPassword)) { + throw exception(USER_IMPORT_INIT_PASSWORD); + } + + // 2. 遍历,逐个创建 or 更新 UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()) .updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build(); importUsers.forEach(importUser -> { @@ -446,7 +455,7 @@ public class AdminUserServiceImpl implements AdminUserService { AdminUserDO existUser = userMapper.selectByUsername(importUser.getUsername()); if (existUser == null) { userMapper.insert(BeanUtils.toBean(importUser, AdminUserDO.class) - .setPassword(encodePassword(userInitPassword)).setPostIds(new HashSet<>())); // 设置默认密码及空岗位编号数组 + .setPassword(encodePassword(initPassword)).setPostIds(new HashSet<>())); // 设置默认密码及空岗位编号数组 respVO.getCreateUsernames().add(importUser.getUsername()); return; } diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java index 13b945f98..900e1fd0a 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.infra.api.config.ConfigApi; import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; @@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.tenant.TenantService; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.boot.test.mock.mockito.MockBean; @@ -41,6 +43,7 @@ import java.util.function.Consumer; import static cn.hutool.core.util.RandomUtil.randomBytes; import static cn.hutool.core.util.RandomUtil.randomEle; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; @@ -49,6 +52,7 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.system.service.user.AdminUserServiceImpl.USER_INIT_PASSWORD_KEY; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; import static org.assertj.core.util.Lists.newArrayList; @@ -79,6 +83,14 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { private TenantService tenantService; @MockBean private FileApi fileApi; + @MockBean + private ConfigApi configApi; + + @BeforeEach + public void before() { + // mock 初始化密码 + when(configApi.getConfigValueByKey(USER_INIT_PASSWORD_KEY)).thenReturn(success("yudaoyuanma")); + } @Test public void testCreatUser_success() { From b0c2f75a3fbd9c3ec6159aff55e3777f68529853 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 18:42:26 +0800 Subject: [PATCH 12/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9ALoginUser=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E5=88=A4=E6=96=AD=20token=20=E8=BF=87?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../util/json}/databind/NumberSerializer.java | 2 +- .../TimestampLocalDateTimeDeserializer.java | 2 +- .../TimestampLocalDateTimeSerializer.java | 2 +- .../framework/security/core/LoginUser.java | 5 ++ .../filter/TokenAuthenticationFilter.java | 3 +- .../config/YudaoJacksonAutoConfiguration.java | 6 +-- .../gateway/filter/security/LoginUser.java | 5 ++ .../security/TokenAuthenticationFilter.java | 7 ++- .../jackson/JacksonAutoConfiguration.java | 51 +++++++++++++++++++ .../vo/recrod/CombinationRecordReqPageVO.java | 4 +- .../dto/OAuth2AccessTokenCheckRespDTO.java | 4 ++ .../system/api/oauth2/OAuth2TokenApiImpl.java | 1 - 12 files changed, 80 insertions(+), 12 deletions(-) rename yudao-framework/{yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core => yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json}/databind/NumberSerializer.java (95%) rename yudao-framework/{yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core => yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json}/databind/TimestampLocalDateTimeDeserializer.java (93%) rename yudao-framework/{yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core => yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json}/databind/TimestampLocalDateTimeSerializer.java (92%) create mode 100644 yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/jackson/JacksonAutoConfiguration.java diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/NumberSerializer.java similarity index 95% rename from yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java rename to yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/NumberSerializer.java index f6ddd3f27..35fc9f72c 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/NumberSerializer.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.jackson.core.databind; +package cn.iocoder.yudao.framework.common.util.json.databind; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeDeserializer.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java similarity index 93% rename from yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeDeserializer.java rename to yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java index 71a480fbf..5bf5d6c63 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeDeserializer.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.jackson.core.databind; +package cn.iocoder.yudao.framework.common.util.json.databind; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeSerializer.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java similarity index 92% rename from yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeSerializer.java rename to yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java index e72c47bb8..ef767a558 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/TimestampLocalDateTimeSerializer.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.jackson.core.databind; +package cn.iocoder.yudao.framework.common.util.json.databind; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java index 68d1c5611..e23c3a7a2 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; +import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,6 +43,10 @@ public class LoginUser { * 授权范围 */ private List scopes; + /** + * 过期时间 + */ + private LocalDateTime expiresTime; // ========== 上下文 ========== /** diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java index dcc4a325f..88ce4e178 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java @@ -96,7 +96,8 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { // 构建登录用户 return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType()) .setInfo(accessToken.getUserInfo()) // 额外的用户信息 - .setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes()); + .setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes()) + .setExpiresTime(accessToken.getExpiresTime()); } catch (ServiceException serviceException) { // 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可 return null; diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java index 4f94f16ec..c62f0a030 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java @@ -2,9 +2,9 @@ package cn.iocoder.yudao.framework.jackson.config; import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; -import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer; -import cn.iocoder.yudao.framework.jackson.core.databind.TimestampLocalDateTimeDeserializer; -import cn.iocoder.yudao.framework.jackson.core.databind.TimestampLocalDateTimeSerializer; +import cn.iocoder.yudao.framework.common.util.json.databind.NumberSerializer; +import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeDeserializer; +import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeSerializer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/LoginUser.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/LoginUser.java index b5fa89f4b..faca6817b 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/LoginUser.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/LoginUser.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.gateway.filter.security; import lombok.Data; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -35,5 +36,9 @@ public class LoginUser { * 授权范围 */ private List scopes; + /** + * 过期时间 + */ + private LocalDateTime expiresTime; } diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java index 7eac85eae..656300768 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.gateway.filter.security; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.gateway.util.SecurityFrameworkUtils; import cn.iocoder.yudao.gateway.util.WebFrameworkUtils; @@ -94,7 +95,8 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered { // 重要说明:defaultIfEmpty 作用,保证 Mono.empty() 情况,可以继续执行 `flatMap 的 chain.filter(exchange)` 逻辑,避免返回给前端空的 Response!! return getLoginUser(exchange, token).defaultIfEmpty(LOGIN_USER_EMPTY).flatMap(user -> { // 1. 无用户,直接 filter 继续请求 - if (user == LOGIN_USER_EMPTY) { + if (user == LOGIN_USER_EMPTY || // 下面 expiresTime 的判断,为了解决 token 实际已经过期的情况 + user.getExpiresTime() == null || LocalDateTimeUtils.afterNow(user.getExpiresTime())) { return chain.filter(exchange); } @@ -153,7 +155,8 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered { OAuth2AccessTokenCheckRespDTO tokenInfo = result.getData(); return new LoginUser().setId(tokenInfo.getUserId()).setUserType(tokenInfo.getUserType()) .setInfo(tokenInfo.getUserInfo()) // 额外的用户信息 - .setTenantId(tokenInfo.getTenantId()).setScopes(tokenInfo.getScopes()); + .setTenantId(tokenInfo.getTenantId()).setScopes(tokenInfo.getScopes()) + .setExpiresTime(tokenInfo.getExpiresTime()); } @Override diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/jackson/JacksonAutoConfiguration.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/jackson/JacksonAutoConfiguration.java new file mode 100644 index 000000000..d9fcb9de2 --- /dev/null +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/jackson/JacksonAutoConfiguration.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.gateway.jackson; + +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; +import cn.iocoder.yudao.framework.common.util.json.databind.NumberSerializer; +import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeDeserializer; +import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; + +@Configuration +@Slf4j +public class JacksonAutoConfiguration { + + @Bean + public JsonUtils jsonUtils(List objectMappers) { + // 1.1 创建 SimpleModule 对象 + SimpleModule simpleModule = new SimpleModule(); + simpleModule + // 新增 Long 类型序列化规则,数值超过 2^53-1,在 JS 会出现精度丢失问题,因此 Long 自动序列化为字符串类型 + .addSerializer(Long.class, NumberSerializer.INSTANCE) + .addSerializer(Long.TYPE, NumberSerializer.INSTANCE) + .addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE) + .addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE) + .addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE) + .addDeserializer(LocalTime.class, LocalTimeDeserializer.INSTANCE) + // 新增 LocalDateTime 序列化、反序列化规则,使用 Long 时间戳 + .addSerializer(LocalDateTime.class, TimestampLocalDateTimeSerializer.INSTANCE) + .addDeserializer(LocalDateTime.class, TimestampLocalDateTimeDeserializer.INSTANCE); + // 1.2 注册到 objectMapper + objectMappers.forEach(objectMapper -> objectMapper.registerModule(simpleModule)); + + // 2. 设置 objectMapper 到 JsonUtils + JsonUtils.init(CollUtil.getFirst(objectMappers)); + log.info("[init][初始化 JsonUtils 成功]"); + return new JsonUtils(); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java index a66795d64..26d1c0caa 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; +import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -20,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ public class CombinationRecordReqPageVO extends PageParam { @Schema(description = "活动状态", example = "1") - @InEnum(BargainRecordStatusEnum.class) + @InEnum(CombinationRecordStatusEnum.class) private Integer status; @Schema(description = "团长编号", example = "1024") diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/dto/OAuth2AccessTokenCheckRespDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/dto/OAuth2AccessTokenCheckRespDTO.java index 4ea1fecec..87b8cc0f9 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/dto/OAuth2AccessTokenCheckRespDTO.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/dto/OAuth2AccessTokenCheckRespDTO.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -26,4 +27,7 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable { @Schema(description = "授权范围的数组", example = "user_info") private List scopes; + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime expiresTime; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/OAuth2TokenApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/OAuth2TokenApiImpl.java index 5f1b19701..2a32ec781 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/OAuth2TokenApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/OAuth2TokenApiImpl.java @@ -23,7 +23,6 @@ public class OAuth2TokenApiImpl implements OAuth2TokenApi { private OAuth2TokenService oauth2TokenService; @Override - @Operation(description = "创建访问令牌") public CommonResult createAccessToken(OAuth2AccessTokenCreateReqDTO reqDTO) { OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken( reqDTO.getUserId(), reqDTO.getUserType(), reqDTO.getClientId(), reqDTO.getScopes()); From c7d5c68b3bff2b677185632b29deaa6294c09305 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 18:59:07 +0800 Subject: [PATCH 13/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9ASelectSheetWriteHa?= =?UTF-8?q?ndler=20=E5=9C=A8=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=20SelectS?= =?UTF-8?q?heetWriteHandler=20=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=20Excel=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E4=B8=8D=E8=A7=A3=E6=9E=90=E4=B8=8B=E6=8B=89=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/core/handler/SelectSheetWriteHandler.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java index 22337f066..ef1eb65bc 100644 --- a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.framework.excel.core.handler; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; -import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; @@ -55,12 +54,6 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { private final Map> selectMap = new HashMap<>(); public SelectSheetWriteHandler(Class head) { - // 加载下拉数据获取接口 - Map beansMap = SpringUtil.getBeanFactory().getBeansOfType(ExcelColumnSelectFunction.class); - if (MapUtil.isEmpty(beansMap)) { - return; - } - // 解析下拉数据 int colIndex = 0; for (Field field : head.getDeclaredFields()) { From a9fe595823ae5b2641ea55feafb8ef62040e4e65 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jul 2024 22:36:30 +0800 Subject: [PATCH 14/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9ALoginUser=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E5=88=A4=E6=96=AD=20token=20=E8=BF=87?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/filter/security/TokenAuthenticationFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java index 656300768..e02a4bb62 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/security/TokenAuthenticationFilter.java @@ -96,7 +96,7 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered { return getLoginUser(exchange, token).defaultIfEmpty(LOGIN_USER_EMPTY).flatMap(user -> { // 1. 无用户,直接 filter 继续请求 if (user == LOGIN_USER_EMPTY || // 下面 expiresTime 的判断,为了解决 token 实际已经过期的情况 - user.getExpiresTime() == null || LocalDateTimeUtils.afterNow(user.getExpiresTime())) { + user.getExpiresTime() == null || LocalDateTimeUtils.beforeNow(user.getExpiresTime())) { return chain.filter(exchange); } From 2ba141a5c45a6a76f8141f2629c0c992d9777f33 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 21 Jul 2024 10:04:50 +0800 Subject: [PATCH 15/27] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E3=80=91BOOT?= =?UTF-8?q?=20=E5=92=8C=20CLOUD=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/definition/BpmProcessDefinitionController.java | 5 ++--- .../module/bpm/convert/task/BpmProcessInstanceConvert.java | 3 ++- .../mapper/statistics/ErpPurchaseStatisticsMapper.xml | 2 ++ .../resources/mapper/statistics/ErpSaleStatisticsMapper.xml | 2 ++ .../module/promotion/service/coupon/CouponServiceImpl.java | 2 +- .../trade/controller/admin/order/TradeOrderController.http | 5 +++++ .../trade/service/order/TradeOrderQueryServiceImpl.java | 3 +-- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java index 149737ca0..52ccd6274 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java @@ -77,7 +77,6 @@ public class BpmProcessDefinitionController { @GetMapping ("/list") @Operation(summary = "获得流程定义列表") @Parameter(name = "suspensionState", description = "挂起状态", required = true, example = "1") // 参见 Flowable SuspensionState 枚举 - @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')") public CommonResult> getProcessDefinitionList( @RequestParam("suspensionState") Integer suspensionState) { List list = processDefinitionService.getProcessDefinitionListBySuspensionState(suspensionState); @@ -96,7 +95,6 @@ public class BpmProcessDefinitionController { @Operation(summary = "获得流程定义") @Parameter(name = "id", description = "流程编号", required = true, example = "1024") @Parameter(name = "key", description = "流程定义标识", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')") public CommonResult getProcessDefinition( @RequestParam(value = "id", required = false) String id, @RequestParam(value = "key", required = false) String key) { @@ -105,10 +103,11 @@ public class BpmProcessDefinitionController { if (processDefinition == null) { return success(null); } + BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(processDefinition.getId()); BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(processDefinition.getId()); List userTaskList = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectUserTaskList(bpmnModel); return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinition( - processDefinition, null, null, null, null, bpmnModel, userTaskList)); + processDefinition, null, processDefinitionInfo, null, null, bpmnModel, userTaskList)); } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java index 0d4a63244..6eb617993 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java @@ -47,7 +47,8 @@ public interface BpmProcessInstanceConvert { BpmProcessInstanceRespVO respVO = vpPageResult.getList().get(i); respVO.setStatus(FlowableUtils.getProcessInstanceStatus(pageResult.getList().get(i))); MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(), - processDefinition -> respVO.setCategory(processDefinition.getCategory())); + processDefinition -> respVO.setCategory(processDefinition.getCategory()) + .setProcessDefinition(BeanUtils.toBean(processDefinition, BpmProcessDefinitionRespVO.class))); MapUtils.findAndThen(categoryMap, respVO.getCategory(), category -> respVO.setCategoryName(category.getName())); respVO.setTasks(BeanUtils.toBean(taskMap.get(respVO.getId()), BpmProcessInstanceRespVO.Task.class)); // user diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpPurchaseStatisticsMapper.xml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpPurchaseStatisticsMapper.xml index e2b25992a..699286b5d 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpPurchaseStatisticsMapper.xml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpPurchaseStatisticsMapper.xml @@ -10,6 +10,7 @@ AND in_time < #{endTime} + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()} AND deleted = 0) - (SELECT IFNULL(SUM(total_price), 0) FROM erp_purchase_return @@ -17,6 +18,7 @@ AND return_time < #{endTime} + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()} AND deleted = 0) diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpSaleStatisticsMapper.xml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpSaleStatisticsMapper.xml index 8e74606c9..324cbd432 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpSaleStatisticsMapper.xml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/mapper/statistics/ErpSaleStatisticsMapper.xml @@ -10,6 +10,7 @@ AND out_time < #{endTime} + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()} AND deleted = 0) - (SELECT IFNULL(SUM(total_price), 0) FROM erp_sale_return @@ -17,6 +18,7 @@ AND return_time < #{endTime} + AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()} AND deleted = 0) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java index ef466172e..3c6fb25c4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java @@ -215,7 +215,7 @@ public class CouponServiceImpl implements CouponService { int count = 0; for (CouponDO coupon : list) { try { - boolean success = getSelf().expireCoupon(coupon); + boolean success = expireCoupon(coupon); if (success) { count++; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.http b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.http index 0bf8812b2..7877faade 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.http +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.http @@ -7,3 +7,8 @@ tenant-id: {{adminTenentId}} GET {{baseUrl}}/trade/order/get-detail?id=21 Authorization: Bearer {{token}} tenant-id: {{adminTenentId}} + +### 获得交易订单的物流轨迹 => 成功 +GET {{baseUrl}}/trade/order/get-express-track-list?id=21 +Authorization: Bearer {{token}} +tenant-id: {{adminTenentId}} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java index fe857b783..aed545879 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java @@ -215,14 +215,13 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { * @return 物流轨迹 */ @Cacheable(cacheNames = RedisKeyConstants.EXPRESS_TRACK, key = "#code + '-' + #logisticsNo + '-' + #receiverMobile", - condition = "#result != null") + condition = "#result != null && #result.length() > 0") public List getExpressTrackList(String code, String logisticsNo, String receiverMobile) { return expressClientFactory.getDefaultExpressClient().getExpressTrackList( new ExpressTrackQueryReqDTO().setExpressCode(code).setLogisticsNo(logisticsNo) .setPhone(receiverMobile)); } - // =================== Order Item =================== @Override From 468d4cc6f621c454e59092e994cb55c4613ff8e5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 21 Jul 2024 11:52:07 +0800 Subject: [PATCH 16/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E3=80=91PAY=EF=BC=9A=E7=A7=BB=E9=99=A4=E5=AF=B9=20mem?= =?UTF-8?q?ber=20=E7=9A=84=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mysql/pay/PayWalletStatisticsMapper.java | 2 +- .../pay/PayWalletStatisticsServiceImpl.java | 7 +- .../api/notify/dto/PayOrderNotifyReqDTO.java | 20 +- .../api/notify/dto/PayRefundNotifyReqDTO.java | 20 +- .../notify/dto/PayTransferNotifyReqDTO.java | 26 ++ .../api/order/dto/PayOrderCreateReqDTO.java | 44 ++- .../pay/api/order/dto/PayOrderRespDTO.java | 37 +- .../api/refund/dto/PayRefundCreateReqDTO.java | 38 +- .../pay/api/refund/dto/PayRefundRespDTO.java | 34 +- .../transfer/dto/PayTransferCreateReqDTO.java | 64 +++- .../module/pay/enums/ErrorCodeConstants.java | 22 +- .../pay/enums/notify/PayNotifyTypeEnum.java | 1 + .../enums/transfer/PayTransferStatusEnum.java | 10 +- .../enums/transfer/PayTransferTypeEnum.java | 7 +- yudao-module-pay/yudao-module-pay-biz/pom.xml | 5 - .../admin/app/PayAppController.java | 14 +- .../controller/admin/app/vo/PayAppBaseVO.java | 6 +- .../admin/app/vo/PayAppCreateReqVO.java | 5 +- .../controller/admin/app/vo/PayAppRespVO.java | 5 +- .../admin/app/vo/PayAppUpdateReqVO.java | 7 +- .../admin/app/vo/PayAppUpdateStatusReqVO.java | 3 +- .../admin/channel/PayChannelController.java | 4 +- .../admin/channel/vo/PayChannelBaseVO.java | 5 +- .../channel/vo/PayChannelCreateReqVO.java | 5 +- .../admin/channel/vo/PayChannelRespVO.java | 5 +- .../channel/vo/PayChannelUpdateReqVO.java | 8 +- .../admin/demo/PayDemoOrderController.java | 9 +- .../admin/demo/PayDemoTransferController.java | 36 +- .../{ => order}/PayDemoOrderCreateReqVO.java | 5 +- .../vo/{ => order}/PayDemoOrderRespVO.java | 4 +- .../transfer/PayDemoTransferCreateReqVO.java | 49 ++- .../vo/transfer/PayDemoTransferRespVO.java | 47 +++ .../admin/notify/PayNotifyController.java | 10 +- .../admin/notify/vo/PayNotifyTaskRespVO.java | 5 +- .../admin/order/PayOrderController.java | 2 +- .../admin/order/vo/PayOrderBaseVO.java | 3 +- .../admin/order/vo/PayOrderSubmitReqVO.java | 4 +- .../admin/transfer/PayTransferController.java | 41 +- .../transfer/vo/PayTransferCreateReqVO.java | 95 +++++ ...spVO.java => PayTransferCreateRespVO.java} | 7 +- .../vo/PayTransferPageItemRespVO.java | 62 +++ .../transfer/vo/PayTransferPageReqVO.java | 48 +++ .../admin/transfer/vo/PayTransferRespVO.java | 79 ++++ .../transfer/vo/PayTransferSubmitReqVO.java | 25 -- .../admin/wallet/PayWalletController.java | 35 +- .../wallet/PayWalletRechargeController.java | 7 +- .../PayWalletRechargePackageController.java | 11 +- .../PayWalletTransactionController.java | 5 +- .../WalletRechargePackageBaseVO.java | 3 +- .../WalletRechargePackageUpdateReqVO.java | 3 +- .../wallet/vo/wallet/PayWalletBaseVO.java | 3 +- .../wallet/vo/wallet/PayWalletPageReqVO.java | 12 +- .../wallet/vo/wallet/PayWalletRespVO.java | 5 - .../wallet/vo/wallet/PayWalletUserReqVO.java | 3 +- .../app/channel/AppPayChannelController.java | 2 +- .../app/order/AppPayOrderController.java | 3 +- .../app/order/vo/AppPayOrderSubmitRespVO.java | 4 - .../app/wallet/AppPayWalletController.java | 3 +- .../AppPayWalletRechargeController.java | 38 +- ...AppPayWalletRechargePackageController.java | 19 +- .../AppPayWalletTransactionController.java | 36 +- .../AppPayWalletRechargeCreateReqVO.java | 7 +- .../recharge/AppPayWalletRechargeRespVO.java | 42 +++ .../AppPayWalletTransactionPageReqVO.java | 8 + .../AppPayWalletTransactionSummaryRespVO.java | 16 + .../wallet/vo/wallet/AppPayWalletRespVO.java | 6 +- .../module/pay/convert/app/PayAppConvert.java | 1 - .../pay/convert/demo/PayDemoOrderConvert.java | 4 +- .../convert/demo/PayDemoTransferConvert.java | 21 ++ .../convert/transfer/PayTransferConvert.java | 14 +- .../pay/convert/wallet/PayWalletConvert.java | 17 +- .../wallet/PayWalletRechargeConvert.java | 24 ++ ...a => PayWalletRechargePackageConvert.java} | 4 +- .../wallet/PayWalletTransactionConvert.java | 3 - .../pay/dal/dataobject/app/PayAppDO.java | 5 + .../dataobject/demo/PayDemoTransferDO.java | 36 +- .../dal/dataobject/notify/PayNotifyLogDO.java | 2 +- .../dataobject/notify/PayNotifyTaskDO.java | 4 + .../dataobject/order/PayOrderExtensionDO.java | 2 +- .../dataobject/transfer/PayTransferDO.java | 92 ++++- .../transfer/PayTransferExtensionDO.java | 68 ---- .../pay/dal/mysql/app/PayAppMapper.java | 1 - .../dal/mysql/demo/PayDemoTransferMapper.java | 9 +- .../dal/mysql/notify/PayNotifyLogMapper.java | 2 +- .../transfer/PayTransferExtensionMapper.java | 26 -- .../dal/mysql/transfer/PayTransferMapper.java | 29 ++ .../pay/dal/mysql/wallet/PayWalletMapper.java | 8 +- .../mysql/wallet/PayWalletRechargeMapper.java | 9 + .../PayWalletRechargePackageMapper.java | 9 +- .../wallet/PayWalletTransactionMapper.java | 30 +- .../pay/dal/redis/no/PayNoRedisDAO.java | 5 +- .../redis/notify/PayNotifyLockRedisDAO.java | 2 +- .../framework/pay/core/WalletPayClient.java | 6 + .../rpc/config/RpcConfiguration.java | 3 - .../pay/job/transfer/PayTransferSyncJob.java | 30 ++ .../module/pay/service/app/PayAppService.java | 2 +- .../pay/service/app/PayAppServiceImpl.java | 2 +- .../service/channel/PayChannelService.java | 2 +- .../channel/PayChannelServiceImpl.java | 6 +- .../pay/service/demo/PayDemoOrderService.java | 3 +- .../service/demo/PayDemoOrderServiceImpl.java | 6 +- .../service/demo/PayDemoTransferService.java | 24 +- .../demo/PayDemoTransferServiceImpl.java | 106 +++--- .../service/notify/PayNotifyServiceImpl.java | 18 +- .../pay/service/order/PayOrderService.java | 11 +- .../service/order/PayOrderServiceImpl.java | 22 +- .../service/refund/PayRefundServiceImpl.java | 2 +- .../service/transfer/PayTransferService.java | 35 +- .../transfer/PayTransferServiceImpl.java | 356 ++++++++++-------- .../PayWalletRechargePackageService.java | 11 +- .../PayWalletRechargePackageServiceImpl.java | 14 +- .../wallet/PayWalletRechargeService.java | 14 + .../wallet/PayWalletRechargeServiceImpl.java | 16 +- .../pay/service/wallet/PayWalletService.java | 3 +- .../service/wallet/PayWalletServiceImpl.java | 12 +- .../wallet/PayWalletTransactionService.java | 15 +- .../PayWalletTransactionServiceImpl.java | 21 +- .../bo/WalletTransactionCreateReqBO.java | 3 +- .../yudao/module/pay/util/MoneyUtils.java | 39 -- .../yudao/module/pay/util/PaySeqUtils.java | 54 --- .../dataobject/merchant/PayChannelDOTest.java | 29 -- .../PayChannelMapperIntegrationTest.java | 80 ---- .../order/PayOrderServiceIntegrationTest.java | 51 --- .../module/pay/service/package-info.java | 1 - .../test/BaseDbAndRedisIntegrationTest.java | 38 -- .../pay/test/BaseDbIntegrationTest.java | 30 -- .../pay/test/BaseRedisIntegrationTest.java | 23 -- .../application-integration-test.yaml | 83 ---- .../pay/service/app/PayAppServiceTest.java | 4 +- .../channel/PayChannelServiceTest.java | 4 +- .../service/notify/PayNotifyServiceTest.java | 4 +- .../service/order/PayOrderServiceTest.java | 4 +- .../service/refund/PayRefundServiceTest.java | 2 +- .../framework/pay/core/client/PayClient.java | 9 + .../pay/core/client/PayClientConfig.java | 1 - .../dto/order/PayOrderUnifiedReqDTO.java | 6 +- .../dto/refund/PayRefundUnifiedReqDTO.java | 7 +- .../dto/transfer/PayTransferRespDTO.java | 21 +- .../transfer/PayTransferUnifiedReqDTO.java | 33 +- .../core/client/impl/AbstractPayClient.java | 41 +- .../core/client/impl/NonePayClientConfig.java | 3 +- .../client/impl/PayClientFactoryImpl.java | 1 + .../impl/alipay/AbstractAlipayPayClient.java | 128 ++++--- .../impl/alipay/AlipayPayClientConfig.java | 3 +- .../impl/alipay/AlipayWapPayClient.java | 1 + .../core/client/impl/mock/MockPayClient.java | 6 + .../client/impl/mock/MockPayClientConfig.java | 28 -- .../impl/weixin/AbstractWxPayClient.java | 8 + .../client/impl/weixin/WxPayClientConfig.java | 4 +- .../client/impl/weixin/WxWapPayClient.java | 62 +++ .../core/enums/channel/PayChannelEnum.java | 4 + .../transfer/PayTransferStatusRespEnum.java | 6 +- .../enums/transfer/PayTransferTypeEnum.java | 7 +- .../client/impl/PayClientFactoryImplTest.java | 133 ------- 154 files changed, 1910 insertions(+), 1424 deletions(-) create mode 100644 yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayTransferNotifyReqDTO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/{ => order}/PayDemoOrderCreateReqVO.java (81%) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/{ => order}/PayDemoOrderRespVO.java (95%) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferRespVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateReqVO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/{PayTransferSubmitRespVO.java => PayTransferCreateRespVO.java} (57%) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageItemRespVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageReqVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferRespVO.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitReqVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeRespVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionSummaryRespVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoTransferConvert.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/{WalletRechargePackageConvert.java => PayWalletRechargePackageConvert.java} (87%) delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferExtensionDO.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferExtensionMapper.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/transfer/PayTransferSyncJob.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/MoneyUtils.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceIntegrationTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/package-info.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisIntegrationTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbIntegrationTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseRedisIntegrationTest.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml delete mode 100644 yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/mock/MockPayClientConfig.java create mode 100644 yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxWapPayClient.java delete mode 100644 yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test-integration/java/cn/iocoder/yudao/framework/core/client/impl/PayClientFactoryImplTest.java diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java index b9b38fbbe..f2399f8aa 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java @@ -33,6 +33,6 @@ public interface PayWalletStatisticsMapper extends BaseMapperX { @Param("endTime") LocalDateTime endTime, @Param("payStatus") Boolean payStatus); - Integer selectRechargePriceSummary(@Param("payStatus") Integer payStatus); + Integer selectRechargePriceSummary(@Param("payStatus") Boolean payStatus); } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java index 4774a0658..78f12daef 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java @@ -1,15 +1,14 @@ package cn.iocoder.yudao.module.statistics.service.pay; -import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; -import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; +import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.statistics.dal.mysql.pay.PayWalletStatisticsMapper; import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.time.LocalDateTime; /** @@ -46,7 +45,7 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic @Override public Integer getRechargePriceSummary() { - return payWalletStatisticsMapper.selectRechargePriceSummary(PayOrderStatusEnum.SUCCESS.getStatus()); + return payWalletStatisticsMapper.selectRechargePriceSummary(Boolean.TRUE); } } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayOrderNotifyReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayOrderNotifyReqDTO.java index 3e660dbb5..430515367 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayOrderNotifyReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayOrderNotifyReqDTO.java @@ -1,26 +1,32 @@ package cn.iocoder.yudao.module.pay.api.notify.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - -@Schema(description = "RPC 服务 - 支付单的通知 Request DTO") +/** + * 支付单的通知 Request DTO + * + * @author 芋道源码 + */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class PayOrderNotifyReqDTO { - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") + /** + * 商户订单编号 + */ @NotEmpty(message = "商户订单号不能为空") private String merchantOrderId; - @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "P202") + /** + * 支付订单编号 + */ @NotNull(message = "支付订单编号不能为空") private Long payOrderId; diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayRefundNotifyReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayRefundNotifyReqDTO.java index 58218e531..34ea87db0 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayRefundNotifyReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayRefundNotifyReqDTO.java @@ -1,26 +1,32 @@ package cn.iocoder.yudao.module.pay.api.notify.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - -@Schema(description = "RPC 服务 - 退款单的通知 Request DTO") +/** + * 退款单的通知 Request DTO + * + * @author 芋道源码 + */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class PayRefundNotifyReqDTO { - @Schema(description = "商户退款单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MR101") + /** + * 商户退款单编号 + */ @NotEmpty(message = "商户退款单编号不能为空") private String merchantOrderId; - @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "R303") + /** + * 支付退款编号 + */ @NotNull(message = "支付退款编号不能为空") private Long payRefundId; diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayTransferNotifyReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayTransferNotifyReqDTO.java new file mode 100644 index 000000000..c0bff267a --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/notify/dto/PayTransferNotifyReqDTO.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.pay.api.notify.dto; + +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * 转账单的通知 Request DTO + * + * @author jason + */ +@Data +public class PayTransferNotifyReqDTO { + + /** + * 商户转账单号 + */ + @NotEmpty(message = "商户转账单号不能为空") + private String merchantTransferId; + + /** + * 转账订单编号 + */ + @NotNull(message = "转账订单编号不能为空") + private Long payTransferId; +} diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java index 70733464d..ad3770f16 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java @@ -1,52 +1,64 @@ package cn.iocoder.yudao.module.pay.api.order.dto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import org.hibernate.validator.constraints.Length; - import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + import java.io.Serializable; import java.time.LocalDateTime; -@Schema(description = "RPC 服务 - 支付单创建 Request DTO") +/** + * 支付单创建 Request DTO + */ @Data public class PayOrderCreateReqDTO implements Serializable { public static final int SUBJECT_MAX_LENGTH = 32; - @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + /** + * 应用编号 + */ @NotNull(message = "应用编号不能为空") private Long appId; - - @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") + /** + * 用户 IP + */ @NotEmpty(message = "用户 IP 不能为空") private String userIp; // ========== 商户相关字段 ========== - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 + /** + * 商户订单编号 + */ @NotEmpty(message = "商户订单编号不能为空") private String merchantOrderId; - - @Schema(description = "商品标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是标题") + /** + * 商品标题 + */ @NotEmpty(message = "商品标题不能为空") - @Length(max = 32, message = "商品标题不能超过 32") + @Length(max = SUBJECT_MAX_LENGTH, message = "商品标题不能超过 32") private String subject; - - @Schema(description = "商品描述", example = "我是描述") + /** + * 商品描述 + */ @Length(max = 128, message = "商品描述信息长度不能超过128") private String body; // ========== 订单相关字段 ========== - @Schema(description = "支付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") + /** + * 支付金额,单位:分 + */ @NotNull(message = "支付金额不能为空") @DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零") private Integer price; - @Schema(description = "支付过期时间", requiredMode = Schema.RequiredMode.REQUIRED) + /** + * 支付过期时间 + */ @NotNull(message = "支付过期时间不能为空") private LocalDateTime expireTime; diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderRespDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderRespDTO.java index 7bf9e6167..583d6d54d 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderRespDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderRespDTO.java @@ -1,29 +1,44 @@ package cn.iocoder.yudao.module.pay.api.order.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import lombok.Data; -@Schema(description = "RPC 服务 - 支付单信息 Response DTO") +/** + * 支付单信息 Response DTO + * + * @author 芋道源码 + */ @Data public class PayOrderRespDTO { - @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + /** + * 订单编号,数据库自增 + */ private Long id; - - @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_pub") // PayChannelEnum 枚举 + /** + * 渠道编码 + * + * 枚举 PayChannelEnum + */ private String channelCode; // ========== 商户相关字段 ========== - - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 + /** + * 商户订单编号 + * 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 + */ private String merchantOrderId; // ========== 订单相关字段 ========== - - @Schema(description = "支付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") + /** + * 支付金额,单位:分 + */ private Integer price; - - @Schema(description = "支付状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") // PayOrderStatusEnum 枚举 + /** + * 支付状态 + * + * 枚举 {@link PayOrderStatusEnum} + */ private Integer status; // ========== 渠道相关字段 ========== diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundCreateReqDTO.java index 90f8e4fc3..4be5ca13b 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundCreateReqDTO.java @@ -1,43 +1,55 @@ package cn.iocoder.yudao.module.pay.api.refund.dto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import org.hibernate.validator.constraints.Length; - import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.Length; -@Schema(description = "RPC 服务 - 退款单创建 Request DTO") +/** + * 退款单创建 Request DTO + * + * @author 芋道源码 + */ @Data public class PayRefundCreateReqDTO { - @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + /** + * 应用编号 + */ @NotNull(message = "应用编号不能为空") private Long appId; - - @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") + /** + * 用户 IP + */ @NotEmpty(message = "用户 IP 不能为空") private String userIp; // ========== 商户相关字段 ========== - - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 + /** + * 商户订单编号 + */ @NotEmpty(message = "商户订单编号不能为空") private String merchantOrderId; - @Schema(description = "商户退款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MR101") + /** + * 商户退款编号 + */ @NotEmpty(message = "商户退款编号不能为空") private String merchantRefundId; - @Schema(description = "退款描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是退款描述") + /** + * 退款描述 + */ @NotEmpty(message = "退款描述不能为空") @Length(max = 128, message = "退款描述长度不能超过 128") private String reason; // ========== 订单相关字段 ========== - @Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "60") + /** + * 退款金额,单位:分 + */ @NotNull(message = "退款金额不能为空") @Min(value = 1, message = "退款金额必须大于零") private Integer price; diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundRespDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundRespDTO.java index a562f581e..bcc2b7ffa 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundRespDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundRespDTO.java @@ -1,31 +1,43 @@ package cn.iocoder.yudao.module.pay.api.refund.dto; -import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; import lombok.Data; import java.time.LocalDateTime; -@Schema(description = "RPC 服务 - 退款单信息 Response DTO") +/** + * 退款单信息 Response DTO + * + * @author 芋道源码 + */ @Data public class PayRefundRespDTO { - @Schema(description = "退款单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + /** + * 退款单编号 + */ private Long id; // ========== 退款相关字段 ========== - - @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") // PayRefundStatusEnum 枚举 + /** + * 退款状态 + * + * 枚举 {@link PayRefundStatusEnum} + */ private Integer status; - - @Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") + /** + * 退款金额,单位:分 + */ private Integer refundPrice; // ========== 商户相关字段 ========== - - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 + /** + * 商户订单编号 + */ private String merchantOrderId; - - @Schema(description = "退款成功时间", requiredMode = Schema.RequiredMode.REQUIRED) + /** + * 退款成功时间 + */ private LocalDateTime successTime; } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/dto/PayTransferCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/dto/PayTransferCreateReqDTO.java index 19f399e83..d7e75270e 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/dto/PayTransferCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/dto/PayTransferCreateReqDTO.java @@ -2,42 +2,76 @@ package cn.iocoder.yudao.module.pay.api.transfer.dto; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; + import java.util.Map; -@Schema(description = "RPC 服务 - 转账单创建 Request DTO") +/** + * 转账单创建 Request DTO + * + * @author jason + */ @Data public class PayTransferCreateReqDTO { - @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + /** + * 应用编号 + */ @NotNull(message = "应用编号不能为空") private Long appId; - @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotEmpty(message = "转账渠道不能为空") + private String channelCode; + + /** + * 转账渠道的额外参数 + */ + private Map channelExtras; + + @NotEmpty(message = "用户 IP 不能为空") + private String userIp; + + /** + * 类型 + */ @NotNull(message = "转账类型不能为空") @InEnum(PayTransferTypeEnum.class) private Integer type; - @Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 - @NotEmpty(message = "商户订单编号不能为空") - private String merchantOrderId; - @Schema(description = "转账金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") + /** + * 商户转账单编号 + */ + @NotEmpty(message = "商户转账单编号能为空") + private String merchantTransferId; + + /** + * 转账金额,单位:分 + */ @Min(value = 1, message = "转账金额必须大于零") @NotNull(message = "转账金额不能为空") private Integer price; - @Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是标题") + /** + * 转账标题 + */ @NotEmpty(message = "转账标题不能为空") - private String title; + private String subject; - @Schema(description = "收款方信息", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "收款方信息不能为空") - private Map payeeInfo; + /** + * 收款人姓名 + */ + @NotBlank(message = "收款人姓名不能为空", groups = {PayTransferTypeEnum.Alipay.class}) + private String userName; + @NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class}) + private String alipayLogonId; + + // ========== 微信转账相关字段 ========== + @NotBlank(message = "微信 openId 不能为空", groups = {PayTransferTypeEnum.WxPay.class}) + private String openid; } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java index 476d7417b..8b7a38ecf 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java @@ -59,22 +59,18 @@ public interface ErrorCodeConstants { ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_008_008, "钱包退款更新失败,钱包退款单编号不匹配"); ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1_007_008_009, "钱包退款更新失败,退款订单不存在"); ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_008_010, "钱包退款更新失败,退款单金额不匹配"); - ErrorCode WALLET_RECHARGE_PACKAGE_AND_PRICE_IS_EMPTY = new ErrorCode(1_007_008_011, "充值金额和充钱套餐不能同时为空"); - ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_012, "钱包充值套餐不存在"); - ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_013, "钱包充值套餐已禁用"); - ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_014, "钱包充值套餐名称已存在"); + ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_011, "钱包充值套餐不存在"); + ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_012, "钱包充值套餐已禁用"); + ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_013, "钱包充值套餐名称已存在"); // ========== 转账模块 1-007-009-000 ========== ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}"); - ErrorCode PAY_TRANSFER_ALIPAY_LOGIN_ID_IS_EMPTY = new ErrorCode(1_007_009_001, "支付宝登录 ID 不能为空"); - ErrorCode PAY_TRANSFER_ALIPAY_ACCOUNT_NAME_IS_EMPTY = new ErrorCode(1_007_009_002, "支付宝账号名称不能为空"); - ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_003, "转账交易单不存在"); - ErrorCode PAY_TRANSFER_STATUS_IS_SUCCESS = new ErrorCode(1_007_009_004, "转账单已成功转账"); + ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_001, "转账单不存在"); + ErrorCode PAY_SAME_MERCHANT_TRANSFER_TYPE_NOT_MATCH = new ErrorCode(1_007_009_002, "两次相同转账请求的类型不匹配"); + ErrorCode PAY_SAME_MERCHANT_TRANSFER_PRICE_NOT_MATCH = new ErrorCode(1_007_009_003, "两次相同转账请求的金额不匹配"); + ErrorCode PAY_MERCHANT_TRANSFER_EXISTS = new ErrorCode(1_007_009_004, "该笔业务的转账已经发起,请查询转账订单相关状态"); ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_005, "转账单不处于待转账"); ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_006, "转账单不处于待转账或转账中"); - ErrorCode PAY_TRANSFER_EXTENSION_NOT_FOUND = new ErrorCode(1_007_009_007, "转账交易拓展单不存在"); - ErrorCode PAY_TRANSFER_TYPE_AND_CHANNEL_NOT_MATCH = new ErrorCode(1_007_009_008, "转账类型和转账渠道不匹配"); - ErrorCode PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_009, "转账拓展单不处于待转账或转账中"); // ========== 示例订单 1-007-900-000 ========== ErrorCode DEMO_ORDER_NOT_FOUND = new ErrorCode(1_007_900_000, "示例订单不存在"); @@ -89,4 +85,8 @@ public interface ErrorCodeConstants { ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_900_009, "发起退款失败,退款单编号不匹配"); ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_900_010, "发起退款失败,退款单金额不匹配"); + // ========== 示例转账订单 1-007-901-001 ========== + ErrorCode DEMO_TRANSFER_NOT_FOUND = new ErrorCode(1_007_901_001, "示例转账单不存在"); + ErrorCode DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_002, "转账失败,转账单编号不匹配"); + ErrorCode DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "转账失败,转账单金额不匹配"); } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java index 8c259d93c..873e015c6 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java @@ -14,6 +14,7 @@ public enum PayNotifyTypeEnum { ORDER(1, "支付单"), REFUND(2, "退款单"), + TRANSFER(3, "转账单") ; /** diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferStatusEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferStatusEnum.java index f3eff1495..6f2f27c75 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferStatusEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferStatusEnum.java @@ -12,7 +12,7 @@ import java.util.Objects; @AllArgsConstructor public enum PayTransferStatusEnum { - WAITING(0, "待转账"), + WAITING(0, "等待转账"), /** * TODO 转账到银行卡. 会有T+0 T+1 到账的请情况。 还未实现 */ @@ -20,7 +20,7 @@ public enum PayTransferStatusEnum { SUCCESS(20, "转账成功"), /** - * 转账关闭 (失败,或者其它情况) + * 转账关闭 (失败,或者其它情况) // TODO 改成 转账失败状态 */ CLOSED(30, "转账关闭"); @@ -40,16 +40,20 @@ public enum PayTransferStatusEnum { public static boolean isClosed(Integer status) { return Objects.equals(status, CLOSED.getStatus()); } + public static boolean isWaiting(Integer status) { return Objects.equals(status, WAITING.getStatus()); } + public static boolean isInProgress(Integer status) { + return Objects.equals(status, IN_PROGRESS.getStatus()); + } /** * 是否处于待转账或者转账中的状态 * @param status 状态 */ public static boolean isPendingStatus(Integer status) { - return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.status); + return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.getStatus()); } } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferTypeEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferTypeEnum.java index b86b37384..c88151589 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferTypeEnum.java @@ -21,8 +21,11 @@ public enum PayTransferTypeEnum implements IntArrayValuable { BANK_CARD(3, "银行卡"), WALLET_BALANCE(4, "钱包余额"); - public static final String ALIPAY_LOGON_ID = "ALIPAY_LOGON_ID"; - public static final String ALIPAY_ACCOUNT_NAME = "ALIPAY_ACCOUNT_NAME"; + public interface WxPay { + } + + public interface Alipay { + } private final Integer type; private final String name; diff --git a/yudao-module-pay/yudao-module-pay-biz/pom.xml b/yudao-module-pay/yudao-module-pay-biz/pom.xml index fc8a4d036..ed8531ac5 100644 --- a/yudao-module-pay/yudao-module-pay-biz/pom.xml +++ b/yudao-module-pay/yudao-module-pay-biz/pom.xml @@ -30,11 +30,6 @@ yudao-module-pay-api ${revision} - - cn.iocoder.cloud - yudao-module-member-api - ${revision} - diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/PayAppController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/PayAppController.java index bdf861395..a3e6d2824 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/PayAppController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/PayAppController.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.controller.admin.app; import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.*; @@ -12,14 +13,14 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; -import java.util.*; +import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; @@ -87,9 +88,10 @@ public class PayAppController { return success(PageResult.empty()); } - // 得到所有的应用编号,查出所有的渠道 - Collection appIds = convertList(pageResult.getList(), PayAppDO::getId); - List channels = channelService.getChannelListByAppIds(appIds); + // 得到所有的应用编号,查出所有的渠道,并移除未启用的渠道 + List channels = channelService.getChannelListByAppIds( + convertList(pageResult.getList(), PayAppDO::getId)); + channels.removeIf(channel -> !CommonStatusEnum.ENABLE.getStatus().equals(channel.getStatus())); // 拼接后返回 return success(PayAppConvert.INSTANCE.convertPage(pageResult, channels)); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java index a95242a9f..0702dba24 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java @@ -1,12 +1,12 @@ package cn.iocoder.yudao.module.pay.controller.admin.app.vo; + import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import jakarta.validation.constraints.NotNull; +import lombok.Data; import org.hibernate.validator.constraints.URL; -import jakarta.validation.constraints.*; - /** * 支付应用信息 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppCreateReqVO.java index 03cab7d3e..f1a5dddaf 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppCreateReqVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.pay.controller.admin.app.vo; + import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; @Schema(description = "管理后台 - 支付应用信息创建 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppRespVO.java index 9471a2f01..9b0657a7b 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppRespVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.pay.controller.admin.app.vo; + import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import java.time.LocalDateTime; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateReqVO.java index 68c559914..be10dca90 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateReqVO.java @@ -1,7 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.app.vo; + import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import jakarta.validation.constraints.*; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; @Schema(description = "管理后台 - 支付应用信息更新 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateStatusReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateStatusReqVO.java index 585a18fc7..b6e55d1e0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateStatusReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateStatusReqVO.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.module.pay.controller.admin.app.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.NotNull; +import lombok.Data; @Schema(description = "管理后台 - 应用更新状态 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/PayChannelController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/PayChannelController.java index b7b0aeded..b51cff9da 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/PayChannelController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/PayChannelController.java @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; import java.util.List; import java.util.Set; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelBaseVO.java index df99a3c73..5a8b28c18 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelBaseVO.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; + import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import jakarta.validation.constraints.*; +import jakarta.validation.constraints.NotNull; +import lombok.Data; /** * 支付渠道 Base VO,提供给添加、修改、详细的子 VO 使用 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelCreateReqVO.java index ccb0497ad..b9e555339 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelCreateReqVO.java @@ -1,13 +1,12 @@ package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; - @Schema(description = "管理后台 - 支付渠道 创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelRespVO.java index dafd29ec9..4d3fc5596 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelRespVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; + import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import java.time.LocalDateTime; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelUpdateReqVO.java index 999852847..656aa8917 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelUpdateReqVO.java @@ -1,7 +1,11 @@ package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; + import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import jakarta.validation.constraints.*; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; @Schema(description = "管理后台 - 支付渠道 更新 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoOrderController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoOrderController.java index 04e8bd8a5..b14ab6b6d 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoOrderController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoOrderController.java @@ -5,20 +5,19 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderRespVO; import cn.iocoder.yudao.module.pay.convert.demo.PayDemoOrderConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.service.demo.PayDemoOrderService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - import jakarta.annotation.Resource; import jakarta.annotation.security.PermitAll; import jakarta.validation.Valid; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoTransferController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoTransferController.java index d5ea08ce6..848bcaea5 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoTransferController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoTransferController.java @@ -1,21 +1,23 @@ package cn.iocoder.yudao.module.pay.controller.admin.demo; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferRespVO; +import cn.iocoder.yudao.module.pay.convert.demo.PayDemoTransferConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; import cn.iocoder.yudao.module.pay.service.demo.PayDemoTransferService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - import jakarta.annotation.Resource; +import jakarta.annotation.security.PermitAll; import jakarta.validation.Valid; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @Tag(name = "管理后台 - 示例转账单") @RestController @@ -27,7 +29,23 @@ public class PayDemoTransferController { @PostMapping("/create") @Operation(summary = "创建示例转账订单") - public CommonResult createDemoOrder(@Valid @RequestBody PayDemoTransferCreateReqVO createReqVO) { - return success(demoTransferService.createDemoTransfer(getLoginUserId(), createReqVO)); + public CommonResult createDemoTransfer(@Valid @RequestBody PayDemoTransferCreateReqVO createReqVO) { + return success(demoTransferService.createDemoTransfer(createReqVO)); + } + + @GetMapping("/page") + @Operation(summary = "获得示例转账订单分页") + public CommonResult> getDemoTransferPage(@Valid PageParam pageVO) { + PageResult pageResult = demoTransferService.getDemoTransferPage(pageVO); + return success(PayDemoTransferConvert.INSTANCE.convertPage(pageResult)); + } + + @PostMapping("/update-status") + @Operation(summary = "更新示例转账订单的转账状态") // 由 pay-module 转账服务,进行回调 + @PermitAll // 无需登录,安全由 PayDemoTransferService 内部校验实现 + public CommonResult updateDemoTransferStatus(@RequestBody PayTransferNotifyReqDTO notifyReqDTO) { + demoTransferService.updateDemoTransferStatus(Long.valueOf(notifyReqDTO.getMerchantTransferId()), + notifyReqDTO.getPayTransferId()); + return success(true); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderCreateReqVO.java similarity index 81% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderCreateReqVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderCreateReqVO.java index b2bdf89ec..0cface8f6 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderCreateReqVO.java @@ -1,9 +1,8 @@ -package cn.iocoder.yudao.module.pay.controller.admin.demo.vo; +package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order; -import lombok.*; import io.swagger.v3.oas.annotations.media.Schema; - import jakarta.validation.constraints.NotNull; +import lombok.Data; @Schema(description = "管理后台 - 示例订单创建 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderRespVO.java similarity index 95% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderRespVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderRespVO.java index 3404844dc..81c8653e1 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/PayDemoOrderRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/order/PayDemoOrderRespVO.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.module.pay.controller.admin.demo.vo; +package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.Data; import java.time.LocalDateTime; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferCreateReqVO.java index a12927f0c..48309c40c 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferCreateReqVO.java @@ -1,14 +1,17 @@ package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer; +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Validator; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; -import java.util.Map; +import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.Alipay; +import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.WxPay; /** * @author jason @@ -22,13 +25,43 @@ public class PayDemoTransferCreateReqVO { @InEnum(PayTransferTypeEnum.class) private Integer type; + @Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @NotNull(message = "转账金额不能为空") @Min(value = 1, message = "转账金额必须大于零") private Integer price; - // TODO @jason:感觉这个动态字段,晚点改;可能要讨论下怎么搞好; - @Schema(description = "收款方信息", requiredMode = Schema.RequiredMode.REQUIRED, example = "{'ALIPAY_LOGON_ID':'xxxx'}") - @NotEmpty(message = "收款方信息不能为空") - private Map payeeInfo; + @Schema(description = "收款人姓名", example = "test1") + @NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class}) + private String userName; + + // ========== 支付宝转账相关字段 ========== + @Schema(description = "支付宝登录号,支持邮箱和手机号格式", example = "test1@@sandbox.com") + @NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class}) + private String alipayLogonId; + + // ========== 微信转账相关字段 ========== + @Schema(description = "微信 openId", example = "oLefc4g5Gxx") + @NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class}) + private String openid; + + + // ========== 转账到银行卡和钱包相关字段 待补充 ========== + + public void validate(Validator validator) { + PayTransferTypeEnum transferType = PayTransferTypeEnum.typeOf(type); + switch (transferType) { + case ALIPAY_BALANCE: { + ValidationUtils.validate(validator, this, Alipay.class); + break; + } + case WX_BALANCE: { + ValidationUtils.validate(validator, this, WxPay.class); + break; + } + default: { + throw new UnsupportedOperationException("待实现"); + } + } + } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferRespVO.java new file mode 100644 index 000000000..3fdab57c3 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/vo/transfer/PayDemoTransferRespVO.java @@ -0,0 +1,47 @@ +package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 示例业务转账订单 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class PayDemoTransferRespVO { + + @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long appId; + + @Schema(description = "转账金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "22338") + private Integer price; + + @Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer type; + + @Schema(description = "收款人姓名", example = "test") + private String userName; + + @Schema(description = "支付宝登录号", example = "32167") + private String alipayLogonId; + + @Schema(description = "微信 openId", example = "31139") + private String openid; + + @Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer transferStatus; + + @Schema(description = "转账订单编号", example = "23695") + private Long payTransferId; + + @Schema(description = "转账支付成功渠道") + private String payChannelCode; + + @Schema(description = "转账支付时间") + private LocalDateTime transferTime; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java index 287346d06..700232a19 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java @@ -21,14 +21,14 @@ import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.annotation.security.PermitAll; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import jakarta.annotation.security.PermitAll; -import jakarta.validation.Valid; import java.util.List; import java.util.Map; @@ -79,8 +79,8 @@ public class PayNotifyController { @Operation(summary = "支付渠道的统一【退款】回调") @PermitAll public String notifyRefund(@PathVariable("channelId") Long channelId, - @RequestParam(required = false) Map params, - @RequestBody(required = false) String body) { + @RequestParam(required = false) Map params, + @RequestBody(required = false) String body) { log.info("[notifyRefund][channelId({}) 回调数据({}/{})]", channelId, params, body); // 1. 校验支付渠道是否存在 PayClient payClient = channelService.getPayClient(channelId); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/vo/PayNotifyTaskRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/vo/PayNotifyTaskRespVO.java index d7f7fe6fb..ce33672d2 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/vo/PayNotifyTaskRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/vo/PayNotifyTaskRespVO.java @@ -1,7 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.notify.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + import java.time.LocalDateTime; @Schema(description = "管理后台 - 回调通知 Response VO") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java index bb0b472cf..a5322c9eb 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java @@ -109,7 +109,7 @@ public class PayOrderController { @PreAuthorize("@ss.hasPermission('pay:order:export')") @ApiAccessLog(operateType = EXPORT) public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { List list = orderService.getOrderList(exportReqVO); if (CollectionUtil.isEmpty(list)) { ExcelUtils.write(response, "支付订单.xls", "数据", diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java index 8cb5b80fe..599463f85 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.order.vo; + import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import jakarta.validation.constraints.NotNull; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderSubmitReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderSubmitReqVO.java index 3fc7fc90f..8bfa69468 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderSubmitReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderSubmitReqVO.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.hibernate.validator.constraints.URL; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; import java.util.Map; @Schema(description = "管理后台 - 支付订单提交 Request VO") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/PayTransferController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/PayTransferController.java index fb9b32ce4..7ba6cb1f8 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/PayTransferController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/PayTransferController.java @@ -1,19 +1,18 @@ package cn.iocoder.yudao.module.pay.controller.admin.transfer; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitRespVO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.*; +import cn.iocoder.yudao.module.pay.convert.transfer.PayTransferConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - import jakarta.annotation.Resource; import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; @@ -27,12 +26,26 @@ public class PayTransferController { @Resource private PayTransferService payTransferService; - @PostMapping("/submit") - @Operation(summary = "提交转账订单") - // TODO @jason:权限的设置, 管理后台页面加的时候加一下 - public CommonResult submitPayTransfer(@Valid @RequestBody PayTransferSubmitReqVO reqVO) { - PayTransferSubmitRespVO respVO = payTransferService.submitTransfer(reqVO, getClientIP()); - return success(respVO); + @PostMapping("/create") + @Operation(summary = "创建转账单,发起转账") + @PreAuthorize("@ss.hasPermission('pay:transfer:create')") + public CommonResult createPayTransfer(@Valid @RequestBody PayTransferCreateReqVO reqVO) { + PayTransferDO payTransfer = payTransferService.createTransfer(reqVO, getClientIP()); + return success(new PayTransferCreateRespVO().setId(payTransfer.getId()).setStatus(payTransfer.getStatus())); } + @GetMapping("/get") + @Operation(summary = "获得转账订单") + @PreAuthorize("@ss.hasPermission('pay:transfer:query')") + public CommonResult getTransfer(@RequestParam("id") Long id) { + return success(PayTransferConvert.INSTANCE.convert(payTransferService.getTransfer(id))); + } + + @GetMapping("/page") + @Operation(summary = "获得转账订单分页") + @PreAuthorize("@ss.hasPermission('pay:transfer:query')") + public CommonResult> getTransferPage(@Valid PayTransferPageReqVO pageVO) { + PageResult pageResult = payTransferService.getTransferPage(pageVO); + return success(PayTransferConvert.INSTANCE.convertPage(pageResult)); + } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateReqVO.java new file mode 100644 index 000000000..423f425db --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateReqVO.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; + +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; +import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import lombok.Data; + +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.*; + +@Schema(description = "管理后台 - 发起转账 Request VO") +@Data +public class PayTransferCreateReqVO { + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "应用编号不能为空") + private Long appId; + + @Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "商户转账单编号不能为空") + private String merchantTransferId; + + @Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "转账类型不能为空") + @InEnum(PayTransferTypeEnum.class) + private Integer type; + + @Schema(description = "转账渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_pc") + @NotEmpty(message = "转账渠道不能为空") + private String channelCode; + + @Min(value = 1, message = "转账金额必须大于零") + @NotNull(message = "转账金额不能为空") + private Integer price; + + @Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "示例转账") + @NotEmpty(message = "转账标题不能为空") + private String subject; + + @Schema(description = "收款人姓名", example = "test1") + @NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class}) + private String userName; + + @Schema(description = "支付宝登录号", example = "test1@sandbox.com") + @NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class}) + private String alipayLogonId; + + @Schema(description = "微信 openId", example = "oLefc4g5Gxx") + @NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class}) + private String openid; + + @Schema(description = "转账渠道的额外参数") + private Map channelExtras; + + public void validate(Validator validator) { + PayTransferTypeEnum transferType = typeOf(type); + switch (transferType) { + case ALIPAY_BALANCE: { + ValidationUtils.validate(validator, this, Alipay.class); + break; + } + case WX_BALANCE: { + ValidationUtils.validate(validator, this, WxPay.class); + break; + } + default: { + throw new UnsupportedOperationException("待实现"); + } + } + } + + @AssertTrue(message = "转账类型和转账渠道不匹配") + public boolean isValidChannelCode() { + PayTransferTypeEnum transferType = typeOf(type); + switch (transferType) { + case ALIPAY_BALANCE: { + return PayChannelEnum.isAlipay(channelCode); + } + case WX_BALANCE: + case BANK_CARD: + case WALLET_BALANCE: { + throw exception(NOT_IMPLEMENTED); + } + } + return Boolean.FALSE; + } + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateRespVO.java similarity index 57% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitRespVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateRespVO.java index fef296f09..9cb44bf60 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferCreateRespVO.java @@ -3,9 +3,12 @@ package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -@Schema(description = "管理后台 - 转账单提交 Response VO") +@Schema(description = "管理后台 - 发起转账 Response VO") @Data -public class PayTransferSubmitRespVO { +public class PayTransferCreateRespVO { + + @Schema(description = "转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; @Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") // 参见 PayTransferStatusEnum 枚举 private Integer status; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageItemRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageItemRespVO.java new file mode 100644 index 000000000..944014209 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageItemRespVO.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author jason + */ +@Schema(description = "管理后台 - 转账单分页项 Response VO") +@Data +public class PayTransferPageItemRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931") + private Long id; + + @Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String no; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831") + private Long appId; + + @Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833") + private Long channelId; + + @Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) + private String channelCode; + + @Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481") + private String merchantTransferId; + + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer type; + + @Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer status; + + @Schema(description = "转账成功时间") + private LocalDateTime successTime; + + @Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964") + private Integer price; + + @Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED) + private String subject; + + @Schema(description = "收款人姓名", example = "王五") + private String userName; + + @Schema(description = "支付宝登录号", example = "29245") + private String alipayLogonId; + + @Schema(description = "微信 openId", example = "26589") + private String openid; + + @Schema(description = "渠道转账单号") + private String channelTransferNo; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageReqVO.java new file mode 100644 index 000000000..5b50fb417 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferPageReqVO.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 转账单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayTransferPageReqVO extends PageParam { + + @Schema(description = "转账单号") + private String no; + + @Schema(description = "应用编号", example = "12831") + private Long appId; + + @Schema(description = "渠道编码", example = "wx_app") + private String channelCode; + + @Schema(description = "商户转账单编号", example = "17481") + private String merchantTransferId; + + @Schema(description = "类型", example = "2") + private Integer type; + + @Schema(description = "转账状态", example = "2") + private Integer status; + + @Schema(description = "收款人姓名", example = "王五") + private String userName; + + @Schema(description = "渠道转账单号") + private String channelTransferNo; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferRespVO.java new file mode 100644 index 000000000..3f55ecc4c --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferRespVO.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Map; + +@Schema(description = "管理后台 - 转账单 Response VO") +@Data +public class PayTransferRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931") + private Long id; + + @Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String no; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831") + private Long appId; + + @Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833") + private Long channelId; + + @Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) + private String channelCode; + + @Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481") + private String merchantTransferId; + + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer type; + + @Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer status; + + @Schema(description = "转账成功时间") + private LocalDateTime successTime; + + @Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964") + private Integer price; + + @Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED) + private String subject; + + @Schema(description = "收款人姓名", example = "王五") + private String userName; + + @Schema(description = "支付宝登录号", example = "29245") + private String alipayLogonId; + + @Schema(description = "微信 openId", example = "26589") + private String openid; + + @Schema(description = "异步通知商户地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + private String notifyUrl; + + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED) + private String userIp; + + @Schema(description = "渠道的额外参数") + private Map channelExtras; + + @Schema(description = "渠道转账单号") + private String channelTransferNo; + + @Schema(description = "调用渠道的错误码") + private String channelErrorCode; + + @Schema(description = "调用渠道的错误提示") + private String channelErrorMsg; + + @Schema(description = "渠道的同步/异步通知的内容") + private String channelNotifyData; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitReqVO.java deleted file mode 100644 index 1f9b2671f..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferSubmitReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; -import java.util.Map; - -@Schema(description = "管理后台 - 转账单提交 Request VO") -@Data -public class PayTransferSubmitReqVO { - - @Schema(description = "转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "转账单编号不能为空") - private Long id; - - @Schema(description = "转账渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_transfer") - @NotEmpty(message = "转账渠道不能为空") - private String channelCode; - - @Schema(description = "转账渠道的额外参数") - private Map channelExtras; - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java index c43abf153..15e381538 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java @@ -1,11 +1,7 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.member.api.user.MemberUserApi; -import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO; @@ -14,6 +10,8 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -21,14 +19,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; -import java.util.List; -import java.util.Map; - import static cn.iocoder.yudao.framework.common.enums.UserTypeEnum.MEMBER; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; @Tag(name = "管理后台 - 用户钱包") @RestController @@ -39,38 +31,21 @@ public class PayWalletController { @Resource private PayWalletService payWalletService; - @Resource - private MemberUserApi memberUserApi; @GetMapping("/get") @PreAuthorize("@ss.hasPermission('pay:wallet:query')") @Operation(summary = "获得用户钱包明细") public CommonResult getWallet(PayWalletUserReqVO reqVO) { PayWalletDO wallet = payWalletService.getOrCreateWallet(reqVO.getUserId(), MEMBER.getValue()); - // TODO jason:如果为空,返回给前端只要 null 就可以了 - MemberUserRespDTO memberUser = memberUserApi.getUser(reqVO.getUserId()).getCheckedData(); - String nickname = memberUser == null ? "" : memberUser.getNickname(); - String avatar = memberUser == null ? "" : memberUser.getAvatar(); - return success(PayWalletConvert.INSTANCE.convert02(nickname, avatar, wallet)); + return success(PayWalletConvert.INSTANCE.convert02(wallet)); } @GetMapping("/page") @Operation(summary = "获得会员钱包分页") @PreAuthorize("@ss.hasPermission('pay:wallet:query')") public CommonResult> getWalletPage(@Valid PayWalletPageReqVO pageVO) { - if (StrUtil.isNotEmpty(pageVO.getNickname())) { - List users = memberUserApi.getUserListByNickname(pageVO.getNickname()).getCheckedData(); - pageVO.setUserIds(convertSet(users, MemberUserRespDTO::getId)); - } - // TODO @jason:管理员也可以先查询下。。 - // 暂时支持查询 userType 会员类型。管理员类型还不知道使用场景 - PageResult pageResult = payWalletService.getWalletPage(MEMBER.getValue(),pageVO); - if (CollectionUtil.isEmpty(pageResult.getList())) { - return success(new PageResult<>(pageResult.getTotal())); - } - List users = memberUserApi.getUserList(convertList(pageResult.getList(), PayWalletDO::getUserId)).getCheckedData(); - Map userMap = convertMap(users, MemberUserRespDTO::getId); - return success(PayWalletConvert.INSTANCE.convertPage(pageResult, userMap)); + PageResult pageResult = payWalletService.getWalletPage(pageVO); + return success(PayWalletConvert.INSTANCE.convertPage(pageResult)); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargeController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargeController.java index bfa7917a0..bce0d9e07 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargeController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargeController.java @@ -7,13 +7,12 @@ import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - import jakarta.annotation.Resource; import jakarta.annotation.security.PermitAll; import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargePackageController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargePackageController.java index d7aa25e2f..27930f77f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargePackageController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargePackageController.java @@ -6,19 +6,18 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; -import cn.iocoder.yudao.module.pay.convert.wallet.WalletRechargePackageConvert; +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; - import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -61,7 +60,7 @@ public class PayWalletRechargePackageController { @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") public CommonResult getWalletRechargePackage(@RequestParam("id") Long id) { PayWalletRechargePackageDO walletRechargePackage = walletRechargePackageService.getWalletRechargePackage(id); - return success(WalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage)); + return success(PayWalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage)); } @GetMapping("/page") @@ -69,7 +68,7 @@ public class PayWalletRechargePackageController { @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") public CommonResult> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) { PageResult pageResult = walletRechargePackageService.getWalletRechargePackagePage(pageVO); - return success(WalletRechargePackageConvert.INSTANCE.convertPage(pageResult)); + return success(PayWalletRechargePackageConvert.INSTANCE.convertPage(pageResult)); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java index 4b9aee6da..01c181d20 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java @@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -16,9 +18,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; - import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 钱包余额明细") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageBaseVO.java index ea6f0c465..685bc66f7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageBaseVO.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.NotNull; +import lombok.Data; /** * 充值套餐 Base VO,提供给添加、修改、详细的子 VO 使用 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageUpdateReqVO.java index 77b230fb7..ec304b4b3 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/rechargepackage/WalletRechargePackageUpdateReqVO.java @@ -1,12 +1,11 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import jakarta.validation.constraints.NotNull; - @Schema(description = "管理后台 - 充值套餐更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java index 2e319dee0..8aa8f0ed9 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.NotNull; +import lombok.Data; /** * 用户钱包 Base VO,提供给添加、修改、详细的子 VO 使用 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java index d74bd44b1..a31698216 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -8,7 +10,6 @@ import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; -import java.util.Collection; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -18,11 +19,12 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class PayWalletPageReqVO extends PageParam { - @Schema(description = "用户昵称", example = "李四") - private String nickname; + @Schema(description = "用户编号", example = "1024") + private Long userId; - @Schema(description = "用户编号", example = "[1,2]") - private Collection userIds; + @Schema(description = "用户类型", example = "1") + @InEnum(value = UserTypeEnum.class) + private Integer userType; @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java index a9eedbdfd..01b35fb3f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java @@ -19,9 +19,4 @@ public class PayWalletRespVO extends PayWalletBaseVO { @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; - @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王**") - private String nickname; - @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xxx.jpg") - private String avatar; - } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java index e6d4986e9..c12e19754 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.NotNull; +import lombok.Data; @Schema(description = "管理后台 - 用户钱包明细 Request VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java index 9340515e1..9e9f79875 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java @@ -6,13 +6,13 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; import java.util.List; import java.util.Set; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java index da3cf7294..68d5ef2cd 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java @@ -13,12 +13,11 @@ import com.google.common.collect.Maps; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; - import java.util.Map; import java.util.Objects; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java index 106535efd..12438bfd6 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java @@ -2,11 +2,7 @@ package cn.iocoder.yudao.module.pay.controller.app.order.vo; import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; @Schema(description = "用户 APP - 支付订单提交 Response VO") @Data diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java index 24e4fb441..cb079b547 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java @@ -9,14 +9,13 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; - import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargeController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargeController.java index 21e5ef34c..e9b467bb5 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargeController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargeController.java @@ -1,24 +1,30 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - import jakarta.annotation.Resource; import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType; @@ -32,14 +38,30 @@ public class AppPayWalletRechargeController { @Resource private PayWalletRechargeService walletRechargeService; + @Resource + private PayOrderService payOrderService; @PostMapping("/create") @Operation(summary = "创建钱包充值记录(发起充值)") public CommonResult createWalletRecharge( - @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { + @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { PayWalletRechargeDO walletRecharge = walletRechargeService.createWalletRecharge( getLoginUserId(), getLoginUserType(), getClientIP(), reqVO); return success(PayWalletRechargeConvert.INSTANCE.convert(walletRecharge)); } + @GetMapping("/page") + @Operation(summary = "获得钱包充值记录分页") + public CommonResult> getWalletRechargePage(@Valid PageParam pageReqVO) { + PageResult pageResult = walletRechargeService.getWalletRechargePackagePage( + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO, true); + if (CollUtil.isEmpty(pageResult.getList())) { + return success(PageResult.empty(pageResult.getTotal())); + } + // 拼接数据 + List payOrderList = payOrderService.getOrderList( + convertList(pageResult.getList(), PayWalletRechargeDO::getPayOrderId)); + return success(PayWalletRechargeConvert.INSTANCE.convertPage(pageResult, payOrderList)); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargePackageController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargePackageController.java index 9b2aac188..bab3f8698 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargePackageController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargePackageController.java @@ -1,16 +1,21 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletPackageRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -22,14 +27,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Slf4j public class AppPayWalletRechargePackageController { + @Resource + private PayWalletRechargePackageService walletRechargePackageService; + @GetMapping("/list") @Operation(summary = "获得钱包充值套餐列表") public CommonResult> getWalletRechargePackageList() { - // 只查询开启;需要按照 payPrice 排序; - List list = new ArrayList<>(); - list.add(new AppPayWalletPackageRespVO().setId(1L).setName("土豆").setPayPrice(10).setBonusPrice(2)); - list.add(new AppPayWalletPackageRespVO().setId(2L).setName("番茄").setPayPrice(20).setBonusPrice(5)); - return success(list); + List list = walletRechargePackageService.getWalletRechargePackageList( + CommonStatusEnum.ENABLE.getStatus()); + list.sort(Comparator.comparingInt(PayWalletRechargePackageDO::getPayPrice)); + return success(BeanUtils.toBean(list, AppPayWalletPackageRespVO.class)); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java index 89b04dbf8..51af66eb4 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java @@ -3,24 +3,29 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; -import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @Tag(name = "用户 APP - 钱包余额明细") @@ -37,16 +42,19 @@ public class AppPayWalletTransactionController { @Operation(summary = "获得钱包流水分页") public CommonResult> getWalletTransactionPage( @Valid AppPayWalletTransactionPageReqVO pageReqVO) { - if (true) { - PageResult result = new PageResult<>(10L); - result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L) - .setTitle("测试").setCreateTime(LocalDateTime.now())); - result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L) - .setTitle("测试2").setCreateTime(LocalDateTime.now())); - return success(result); - } - PageResult result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), - UserTypeEnum.MEMBER.getValue(), pageReqVO); - return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); + PageResult pageResult = payWalletTransactionService.getWalletTransactionPage( + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO); + return success(BeanUtils.toBean(pageResult, AppPayWalletTransactionRespVO.class)); } + + @GetMapping("/get-summary") + @Operation(summary = "获得钱包流水统计") + @Parameter(name = "times", description = "时间段", required = true) + public CommonResult getWalletTransactionSummary( + @RequestParam("createTime") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] createTime) { + AppPayWalletTransactionSummaryRespVO summary = payWalletTransactionService.getWalletTransactionSummary( + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), createTime); + return success(summary); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java index 287c7c6ac..8f7a2ab14 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.Min; +import lombok.Data; + import java.util.Objects; @Schema(description = "用户 APP - 创建钱包充值 Request VO") @@ -19,7 +19,8 @@ public class AppPayWalletRechargeCreateReqVO { private Long packageId; @AssertTrue(message = "充值金额和充钱套餐不能同时为空") - public boolean validatePayPriceAndPackageId() { + public boolean isValidPayPriceAndPackageId() { return Objects.nonNull(payPrice) || Objects.nonNull(packageId); } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeRespVO.java new file mode 100644 index 000000000..ee55b4080 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeRespVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "用户 APP - 钱包充值记录 Resp VO") +@Data +public class AppPayWalletRechargeRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "用户实际到账余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Integer totalPrice; + + @Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") + private Integer payPrice; + + @Schema(description = "钱包赠送金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") + private Integer bonusPrice; + + @Schema(description = "支付成功的支付渠道", requiredMode = Schema.RequiredMode.REQUIRED) + private String payChannelCode; + + @Schema(description = "支付渠道名", example = "微信小程序支付") + private String payChannelName; + + @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED) + private Long payOrderId; + + @Schema(description = "支付成功的外部订单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String payOrderChannelOrderNo; // 从 PayOrderDO 的 channelOrderNo 字段 + + @Schema(description = "订单支付时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime payTime; + + @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + private Integer refundStatus; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java index 942ab5b6d..d5daad036 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java @@ -1,8 +1,12 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; @Schema(description = "用户 APP - 钱包流水分页 Request VO") @Data @@ -20,4 +24,8 @@ public class AppPayWalletTransactionPageReqVO extends PageParam { @Schema(description = "类型", example = "1") private Integer type; + @Schema(description = "创建时间") + @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionSummaryRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionSummaryRespVO.java new file mode 100644 index 000000000..b1cc58742 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionSummaryRespVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "用户 APP - 钱包流水统计 Request VO") +@Data +public class AppPayWalletTransactionSummaryRespVO { + + @Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + private Integer totalExpense; + + @Schema(description = "累计收入,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") + private Integer totalIncome; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java index f0c78e405..7e42fc52f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java @@ -7,13 +7,13 @@ import lombok.Data; @Data public class AppPayWalletRespVO { - @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") private Integer balance; - @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + @Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") private Integer totalExpense; - @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") + @Schema(description = "累计充值,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") private Integer totalRecharge; } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java index 4853d07f7..98da0206e 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java @@ -14,7 +14,6 @@ import org.mapstruct.factory.Mappers; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.function.Consumer; /** * 支付应用信息 Convert diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoOrderConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoOrderConvert.java index 313e5d266..8fca99791 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoOrderConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoOrderConvert.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.pay.convert.demo; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoTransferConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoTransferConvert.java new file mode 100644 index 000000000..0df9c9d5c --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/demo/PayDemoTransferConvert.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.pay.convert.demo; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * @author jason + */ +@Mapper +public interface PayDemoTransferConvert { + + PayDemoTransferConvert INSTANCE = Mappers.getMapper(PayDemoTransferConvert.class); + + PayDemoTransferDO convert(PayDemoTransferCreateReqVO bean); + + PageResult convertPage(PageResult pageResult); +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/transfer/PayTransferConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/transfer/PayTransferConvert.java index 440f0103b..4e79548d0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/transfer/PayTransferConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/transfer/PayTransferConvert.java @@ -1,10 +1,14 @@ package cn.iocoder.yudao.module.pay.convert.transfer; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageItemRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import org.mapstruct.Mapper; -import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @Mapper @@ -12,9 +16,15 @@ public interface PayTransferConvert { PayTransferConvert INSTANCE = Mappers.getMapper(PayTransferConvert.class); - @Mapping(source = "title", target = "subject") // TODO @jason:是不是都改成 subject 完事呀? PayTransferDO convert(PayTransferCreateReqDTO dto); + PayTransferUnifiedReqDTO convert2(PayTransferDO dto); + + PayTransferCreateReqDTO convert(PayTransferCreateReqVO vo); + PayTransferCreateReqDTO convert(PayDemoTransferCreateReqVO vo); + PayTransferRespVO convert(PayTransferDO bean); + + PageResult convertPage(PageResult pageResult); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java index e162b88bc..3617f23a0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java @@ -1,16 +1,12 @@ package cn.iocoder.yudao.module.pay.convert.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; -import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; -import java.util.Map; - @Mapper public interface PayWalletConvert { @@ -18,19 +14,8 @@ public interface PayWalletConvert { AppPayWalletRespVO convert(PayWalletDO bean); - PayWalletRespVO convert02(String nickname,String avatar, PayWalletDO bean); + PayWalletRespVO convert02(PayWalletDO bean); PageResult convertPage(PageResult page); - default PageResult convertPage(PageResult page, Map userMap){ - PageResult pageResult = convertPage(page); - pageResult.getList().forEach( wallet -> MapUtils.findAndThen(userMap, wallet.getUserId(), - user -> { - // TODO @jason:可以链式调用哈; - wallet.setNickname(user.getNickname()); - wallet.setAvatar(user.getAvatar()); - })); - return pageResult; - } - } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java index eda8bcf95..e9867fe46 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java @@ -1,11 +1,22 @@ package cn.iocoder.yudao.module.pay.convert.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; +import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; +import java.util.List; +import java.util.Map; + @Mapper public interface PayWalletRechargeConvert { @@ -16,4 +27,17 @@ public interface PayWalletRechargeConvert { AppPayWalletRechargeCreateRespVO convert(PayWalletRechargeDO bean); + default PageResult convertPage(PageResult pageResult, + List payOrderList) { + PageResult voPageResult = BeanUtils.toBean(pageResult, AppPayWalletRechargeRespVO.class); + Map payOrderMap = CollectionUtils.convertMap(payOrderList, PayOrderDO::getId); + voPageResult.getList().forEach(recharge -> { + recharge.setPayChannelName(DictFrameworkUtils.getDictDataLabel( + DictTypeConstants.CHANNEL_CODE, recharge.getPayChannelCode())); + MapUtils.findAndThen(payOrderMap, recharge.getPayOrderId(), + order -> recharge.setPayOrderChannelOrderNo(order.getChannelOrderNo())); + }); + return voPageResult; + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/WalletRechargePackageConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargePackageConvert.java similarity index 87% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/WalletRechargePackageConvert.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargePackageConvert.java index 8784adda7..25459eb05 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/WalletRechargePackageConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargePackageConvert.java @@ -11,9 +11,9 @@ import org.mapstruct.factory.Mappers; import java.util.List; @Mapper -public interface WalletRechargePackageConvert { +public interface PayWalletRechargePackageConvert { - WalletRechargePackageConvert INSTANCE = Mappers.getMapper(WalletRechargePackageConvert.class); + PayWalletRechargePackageConvert INSTANCE = Mappers.getMapper(PayWalletRechargePackageConvert.class); PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java index f956f8d56..0448603f8 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.pay.convert.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO; -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; import org.mapstruct.Mapper; @@ -13,8 +12,6 @@ public interface PayWalletTransactionConvert { PayWalletTransactionConvert INSTANCE = Mappers.getMapper(PayWalletTransactionConvert.class); - PageResult convertPage(PageResult page); - PageResult convertPage2(PageResult page); PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/app/PayAppDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/app/PayAppDO.java index 977eff93a..8f3490fc7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/app/PayAppDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/app/PayAppDO.java @@ -54,4 +54,9 @@ public class PayAppDO extends BaseDO { */ private String refundNotifyUrl; + /** + * 转账结果的回调地址 + */ + private String transferNotifyUrl; + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/demo/PayDemoTransferDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/demo/PayDemoTransferDO.java index b036c30a2..f465d0be6 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/demo/PayDemoTransferDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/demo/PayDemoTransferDO.java @@ -1,16 +1,16 @@ package cn.iocoder.yudao.module.pay.dal.dataobject.demo; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.Data; import java.time.LocalDateTime; -import java.util.Map; +// TODO 芋艿:需要详细 review /** * 示例转账订单 * @@ -28,9 +28,18 @@ public class PayDemoTransferDO extends BaseDO { private Long id; /** - * 用户编号 + * 应用编号 + * + * 关联 {@link PayAppDO#getId()} */ - private Long userId; + private Long appId; + + /** + * 转账类型 + *

+ * 枚举 {@link PayTransferTypeEnum} + */ + private Integer type; /** * 转账金额,单位:分 @@ -38,16 +47,19 @@ public class PayDemoTransferDO extends BaseDO { private Integer price; /** - * 转账类型 + * 收款人姓名 */ - private Integer type; + private String userName; - // TODO @jason:要不字段还是弄成正确的平铺开? /** - * 收款人信息,不同类型和渠道不同 + * 支付宝登录号 */ - @TableField(typeHandler = JacksonTypeHandler.class) - private Map payeeInfo; + private String alipayLogonId; + + /** + * 微信 openId + */ + private String openid; /** * 转账状态 @@ -55,7 +67,7 @@ public class PayDemoTransferDO extends BaseDO { private Integer transferStatus; /** - * 转账订单编号 + * 转账单编号 */ private Long payTransferId; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java index a482605d5..a2c158bcd 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.pay.dal.dataobject.notify; -import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java index 181a32802..7bfabad3f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java @@ -66,6 +66,10 @@ public class PayNotifyTaskDO extends TenantBaseDO { * 商户订单编号 */ private String merchantOrderId; + /** + * 商户转账单编号 + */ + private String merchantTransferId; /** * 通知状态 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java index 9466243e1..c173e8e32 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java @@ -1,9 +1,9 @@ package cn.iocoder.yudao.module.pay.dal.dataobject.order; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java index 507157a7a..8f3563ffb 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java @@ -16,6 +16,7 @@ import lombok.Data; import java.time.LocalDateTime; import java.util.Map; +// TODO 芋艿:需要详细 review /** * 转账单 DO * @@ -31,24 +32,44 @@ public class PayTransferDO extends BaseDO { */ @TableId private Long id; + + /** + * 转账单号 + * + */ + private String no; + /** * 应用编号 * * 关联 {@link PayAppDO#getId()} */ private Long appId; + /** * 转账渠道编号 * * 关联 {@link PayChannelDO#getId()} */ private Long channelId; + /** * 转账渠道编码 * * 枚举 {@link PayChannelEnum} */ private String channelCode; + + // ========== 商户相关字段 ========== + /** + * 商户转账单编号 + * + * 例如说,内部系统 A 的订单号,需要保证每个 PayAppDO 唯一 + */ + private String merchantTransferId; + + // ========== 转账相关字段 ========== + /** * 类型 * @@ -56,51 +77,82 @@ public class PayTransferDO extends BaseDO { */ private Integer type; - // ========== 商户相关字段 ========== - - /** - * 商户订单编号 - * - * 例如说,内部系统 A 的订单号,需要保证每个 PayAppDO 唯一 - */ - private String merchantOrderId; - /** * 转账标题 */ private String subject; - // ========== 转账相关字段 ========== /** * 转账金额,单位:分 */ private Integer price; + + /** + * 收款人姓名 + */ + private String userName; + /** * 转账状态 * * 枚举 {@link PayTransferStatusRespEnum} */ private Integer status; + /** * 订单转账成功时间 */ private LocalDateTime successTime; + + // ========== 支付宝转账相关字段 ========== /** - * 转账成功的转账拓展单编号 - * - * 关联 {@link PayTransferExtensionDO#getId()} + * 支付宝登录号 */ - private Long extensionId; + private String alipayLogonId; + + + // ========== 微信转账相关字段 ========== /** - * 转账成功的转账拓展单号 - * - * 关联 {@link PayTransferExtensionDO#getNo()} + * 微信 openId */ - private String no; + private String openid; + + // ========== 其它字段 ========== + /** - * 收款人信息,不同类型和渠道不同 + * 异步通知地址 + */ + private String notifyUrl; + + /** + * 用户 IP + */ + private String userIp; + + /** + * 渠道的额外参数 */ @TableField(typeHandler = JacksonTypeHandler.class) - private Map payeeInfo; + private Map channelExtras; + + /** + * 渠道转账单号 + */ + private String channelTransferNo; + + /** + * 调用渠道的错误码 + */ + private String channelErrorCode; + /** + * 调用渠道的错误提示 + */ + private String channelErrorMsg; + + /** + * 渠道的同步/异步通知的内容 + * + */ + private String channelNotifyData; } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferExtensionDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferExtensionDO.java deleted file mode 100644 index c3d4253e8..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferExtensionDO.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.dataobject.transfer; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.Data; - -import java.util.Map; - -// TODO @jason:转账是不是类似 refund,不用拓展单呀?支付做拓展单的原因,是因为它存在不确定性,可以切换多种;转账和退款,都是明确方式的; -// @芋艿 转账是不是也存在多种方式。 例如转账到银行卡。 可以使用微信,也可以使用支付宝。 支付宝账号余额不够,可以切换到微信; -// TODO @jason:发起了,就不允许调整了,类似退款哈; -/** - * 转账拓展单 DO - * - * @author jason - */ -@TableName(value ="pay_transfer_extension",autoResultMap = true) -@KeySequence("pay_transfer_extension_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -public class PayTransferExtensionDO extends BaseDO { - - /** - * 编号 - */ - @TableId - private Long id; - - /** - * 转账单号 - */ - private String no; - - /** - * 转账单编号 - */ - private Long transferId; - - /** - * 转账渠道编号 - */ - private Long channelId; - - /** - * 转账渠道编码 - */ - private String channelCode; - - /** - * 支付渠道的额外参数 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private Map channelExtras; - - /** - * 转账状态 - */ - private Integer status; - - /** - * 支付渠道异步通知的内容 - */ - private String channelNotifyData; - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/app/PayAppMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/app/PayAppMapper.java index c31dba551..ccec907c6 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/app/PayAppMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/app/PayAppMapper.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.pay.dal.mysql.app; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/demo/PayDemoTransferMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/demo/PayDemoTransferMapper.java index a2a600660..77c7ba047 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/demo/PayDemoTransferMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/demo/PayDemoTransferMapper.java @@ -1,10 +1,17 @@ package cn.iocoder.yudao.module.pay.dal.mysql.demo; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; import org.apache.ibatis.annotations.Mapper; @Mapper public interface PayDemoTransferMapper extends BaseMapperX { -} + default PageResult selectPage(PageParam pageParam){ + return selectPage(pageParam, new LambdaQueryWrapperX() + .orderByDesc(PayDemoTransferDO::getId)); + } +} \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogMapper.java index 8b586dff2..5e9222692 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogMapper.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.notify; -import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferExtensionMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferExtensionMapper.java deleted file mode 100644 index 8e808f24d..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferExtensionMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.mysql.transfer; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferExtensionDO; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface PayTransferExtensionMapper extends BaseMapperX { - - default PayTransferExtensionDO selectByNo(String no){ - return selectOne(PayTransferExtensionDO::getNo, no); - } - - default int updateByIdAndStatus(Long id, List whereStatuses, PayTransferExtensionDO updateObj) { - return update(updateObj, new LambdaQueryWrapper() - .eq(PayTransferExtensionDO::getId, id).in(PayTransferExtensionDO::getStatus, whereStatuses)); - } - -} - - - - diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferMapper.java index 3bd25d4b5..af4f6debf 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/transfer/PayTransferMapper.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.pay.dal.mysql.transfer; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; @@ -15,6 +18,32 @@ public interface PayTransferMapper extends BaseMapperX { .eq(PayTransferDO::getId, id).in(PayTransferDO::getStatus, status)); } + default PayTransferDO selectByAppIdAndMerchantTransferId(Long appId, String merchantTransferId){ + return selectOne(PayTransferDO::getAppId, appId, + PayTransferDO::getMerchantTransferId, merchantTransferId); + } + + default PayTransferDO selectByNo(String no){ + return selectOne(PayTransferDO::getNo, no); + } + + default PageResult selectPage(PayTransferPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PayTransferDO::getNo, reqVO.getNo()) + .eqIfPresent(PayTransferDO::getAppId, reqVO.getAppId()) + .eqIfPresent(PayTransferDO::getChannelCode, reqVO.getChannelCode()) + .eqIfPresent(PayTransferDO::getMerchantTransferId, reqVO.getMerchantTransferId()) + .eqIfPresent(PayTransferDO::getType, reqVO.getType()) + .eqIfPresent(PayTransferDO::getStatus, reqVO.getStatus()) + .likeIfPresent(PayTransferDO::getUserName, reqVO.getUserName()) + .eqIfPresent(PayTransferDO::getChannelTransferNo, reqVO.getChannelTransferNo()) + .betweenIfPresent(PayTransferDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PayTransferDO::getId)); + } + + default List selectListByStatus(Integer status){ + return selectList(PayTransferDO::getStatus, status); + } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java index ce672255a..4bbaff8b5 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java @@ -17,10 +17,10 @@ public interface PayWalletMapper extends BaseMapperX { PayWalletDO::getUserType, userType); } - default PageResult selectPage(Integer userType, PayWalletPageReqVO reqVO) { + default PageResult selectPage(PayWalletPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .inIfPresent(PayWalletDO::getUserId, reqVO.getUserIds()) - .eqIfPresent(PayWalletDO::getUserType, userType) + .eqIfPresent(PayWalletDO::getUserId, reqVO.getUserId()) + .eqIfPresent(PayWalletDO::getUserType, reqVO.getUserType()) .betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(PayWalletDO::getId)); } @@ -31,7 +31,7 @@ public interface PayWalletMapper extends BaseMapperX { * @param id 钱包 id * @param price 消费金额 */ - default int updateWhenConsumptionRefund(Long id, Integer price){ + default int updateWhenConsumptionRefund(Long id, Integer price) { LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper() .setSql(" balance = balance + " + price + ", total_expense = total_expense - " + price) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java index 4cb77f020..d6de1f803 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; @@ -18,4 +20,11 @@ public interface PayWalletRechargeMapper extends BaseMapperX selectPage(PageParam pageReqVO, Long walletId, Boolean payStatus) { + return selectPage(pageReqVO, new LambdaQueryWrapperX() + .eq(PayWalletRechargeDO::getWalletId, walletId) + .eq(PayWalletRechargeDO::getPayStatus, payStatus) + .orderByDesc(PayWalletRechargeDO::getId)); + } + } \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargePackageMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargePackageMapper.java index b68b4c893..821908c89 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargePackageMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargePackageMapper.java @@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface PayWalletRechargePackageMapper extends BaseMapperX { @@ -19,9 +21,12 @@ public interface PayWalletRechargePackageMapper extends BaseMapperX selectListByStatus(Integer status) { + return selectList(PayWalletRechargePackageDO::getStatus, status); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java index 41d7dbeb4..87d80ceb5 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java @@ -1,32 +1,54 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import org.apache.ibatis.annotations.Mapper; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; import java.util.Objects; +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE; +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME; + @Mapper public interface PayWalletTransactionMapper extends BaseMapperX { default PageResult selectPage(Long walletId, Integer type, - PageParam pageParam) { + PageParam pageParam, LocalDateTime[] createTime) { LambdaQueryWrapperX query = new LambdaQueryWrapperX() .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId); - if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { + if (Objects.equals(type, TYPE_INCOME)) { query.gt(PayWalletTransactionDO::getPrice, 0); - } else if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { + } else if (Objects.equals(type, TYPE_EXPENSE)) { query.lt(PayWalletTransactionDO::getPrice, 0); } + query.betweenIfPresent(PayWalletTransactionDO::getCreateTime, createTime); query.orderByDesc(PayWalletTransactionDO::getId); return selectPage(pageParam, query); } + default Integer selectPriceSum(Long walletId, Integer type, LocalDateTime[] createTime) { + // SQL sum 查询 + List> result = selectMaps(new QueryWrapperX() + .select("SUM(price) AS priceSum") + .gt(Objects.equals(type, TYPE_INCOME), "price", 0) // 收入 + .lt(Objects.equals(type, TYPE_EXPENSE), "price", 0) // 支出 + .eq("wallet_id", walletId) + .between("create_time", createTime[0], createTime[1])); + // 获得 sum 结果 + Map first = CollUtil.getFirst(result); + return MapUtil.getInt(first, "priceSum", 0); + } + default PayWalletTransactionDO selectByNo(String no) { return selectOne(PayWalletTransactionDO::getNo, no); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/no/PayNoRedisDAO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/no/PayNoRedisDAO.java index 1482ddf63..2e07ff98c 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/no/PayNoRedisDAO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/no/PayNoRedisDAO.java @@ -1,11 +1,12 @@ package cn.iocoder.yudao.module.pay.dal.redis.no; -import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants; +import jakarta.annotation.Resource; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Repository; -import jakarta.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java index b5916f62d..4b185878e 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.pay.dal.redis.notify; +import jakarta.annotation.Resource; import org.redisson.api.RLock; import org.redisson.api.RedissonClient; import org.springframework.stereotype.Repository; -import jakarta.annotation.Resource; import java.util.concurrent.TimeUnit; import static cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants.PAY_NOTIFY_LOCK; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/WalletPayClient.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/WalletPayClient.java index 212551f4d..c7be35f1a 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/WalletPayClient.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/WalletPayClient.java @@ -14,6 +14,7 @@ import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; +import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; @@ -181,4 +182,9 @@ public class WalletPayClient extends AbstractPayClient { throw new UnsupportedOperationException("待实现"); } + @Override + protected PayTransferRespDTO doGetTransfer(String outTradeNo, PayTransferTypeEnum type) { + throw new UnsupportedOperationException("待实现"); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/rpc/config/RpcConfiguration.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/rpc/config/RpcConfiguration.java index 92317f04b..ce59fac18 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/rpc/config/RpcConfiguration.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/rpc/config/RpcConfiguration.java @@ -1,10 +1,7 @@ package cn.iocoder.yudao.module.pay.framework.rpc.config; -import cn.iocoder.yudao.module.member.api.user.MemberUserApi; -import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; @Configuration(proxyBeanMethods = false) -@EnableFeignClients(clients = MemberUserApi.class) public class RpcConfiguration { } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/transfer/PayTransferSyncJob.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/transfer/PayTransferSyncJob.java new file mode 100644 index 000000000..23ff13699 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/transfer/PayTransferSyncJob.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.pay.job.transfer; + +import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; +import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService; +import com.xxl.job.core.handler.annotation.XxlJob; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 转账订单的同步 Job + * + * 由于转账订单的转账结果,有些渠道是异步通知进行同步的,考虑到异步通知可能会失败(小概率),所以需要定时进行同步。 + * + * @author jason + */ +@Component +@Slf4j +public class PayTransferSyncJob { + + @Resource + private PayTransferService transferService; + + @XxlJob("payTransferSyncJob") + @TenantJob // 多租户 + public void execute(String param) { + int count = transferService.syncTransfer(); + log.info("[execute][同步转账订单 ({}) 个]", count); + } +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppService.java index c7a54bdaf..6d613d28d 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppService.java @@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; - import jakarta.validation.Valid; + import java.util.Collection; import java.util.List; import java.util.Map; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceImpl.java index 786b70c9f..3be747184 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceImpl.java @@ -11,11 +11,11 @@ import cn.iocoder.yudao.module.pay.dal.mysql.app.PayAppMapper; import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; +import jakarta.annotation.Resource; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.util.Collection; import java.util.List; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelService.java index dcd075db9..ac505ed33 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelService.java @@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; - import jakarta.validation.Valid; + import java.util.Collection; import java.util.List; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java index 522b2b0ae..6dde7d9a7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java @@ -16,14 +16,14 @@ import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; +import jakarta.validation.Validator; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.PostConstruct; -import jakarta.annotation.Resource; -import jakarta.validation.Validator; import java.time.Duration; import java.util.Collection; import java.util.List; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java index 20586e67a..e95ae995b 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.pay.service.demo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; - import jakarta.validation.Valid; /** diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java index a9f0886f8..3fce3fdf2 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java @@ -9,16 +9,16 @@ import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO; -import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.dal.mysql.demo.PayDemoOrderMapper; import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; import java.util.HashMap; @@ -232,7 +232,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService { throw exception(DEMO_ORDER_NOT_FOUND); } // 1.2 校验退款订单匹配 - if (Objects.equals(order.getPayOrderId(), payRefundId)) { + if (Objects.equals(order.getPayRefundId(), payRefundId)) { log.error("[validateDemoOrderCanRefunded][order({}) 退款单不匹配({}),请进行处理!order 数据是:{}]", id, payRefundId, toJsonString(order)); throw exception(DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferService.java index b05e423cd..155cc42a3 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferService.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.pay.service.demo; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; - +import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; import jakarta.validation.Valid; /** @@ -12,11 +14,25 @@ import jakarta.validation.Valid; public interface PayDemoTransferService { /** - * 创建转账单 + * 创建转账业务示例订单 * - * @param userId 用户编号 * @param createReqVO 创建信息 * @return 编号 */ - Long createDemoTransfer(Long userId, @Valid PayDemoTransferCreateReqVO createReqVO); + Long createDemoTransfer(@Valid PayDemoTransferCreateReqVO createReqVO); + + /** + * 获得转账业务示例订单分页 + * + * @param pageVO 分页查询参数 + */ + PageResult getDemoTransferPage(PageParam pageVO); + + /** + * 更新转账业务示例订单的转账状态 + * + * @param id 编号 + * @param payTransferId 转账单编号 + */ + void updateDemoTransferStatus(Long id, Long payTransferId); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferServiceImpl.java index 0d8828005..bda59c5ea 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoTransferServiceImpl.java @@ -1,25 +1,25 @@ package cn.iocoder.yudao.module.pay.service.demo; -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; +import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; -import cn.iocoder.yudao.module.pay.convert.transfer.PayTransferConvert; +import cn.iocoder.yudao.module.pay.convert.demo.PayDemoTransferConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import cn.iocoder.yudao.module.pay.dal.mysql.demo.PayDemoTransferMapper; +import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum; import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.annotation.Validated; - import jakarta.annotation.Resource; import jakarta.validation.Valid; -import java.util.Map; +import jakarta.validation.Validator; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum.*; -import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.PAY_TRANSFER_ALIPAY_ACCOUNT_NAME_IS_EMPTY; -import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.PAY_TRANSFER_ALIPAY_LOGIN_ID_IS_EMPTY; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum.WAITING; /** @@ -40,50 +40,60 @@ public class PayDemoTransferServiceImpl implements PayDemoTransferService { @Resource private PayDemoTransferMapper demoTransferMapper; @Resource - private PayTransferService transferService; + private PayTransferService payTransferService; + @Resource + private Validator validator; @Override - @Transactional(rollbackFor = Exception.class) - public Long createDemoTransfer(Long userId, @Valid PayDemoTransferCreateReqVO vo) { - // 1 校验收款账号 - validatePayeeInfo(vo.getType(), vo.getPayeeInfo()); - + public Long createDemoTransfer(@Valid PayDemoTransferCreateReqVO vo) { + // 1 校验参数 + vo.validate(validator); // 2 保存示例转账业务表 - PayDemoTransferDO demoTransfer = new PayDemoTransferDO().setUserId(userId).setType(vo.getType()) - .setPrice(vo.getPrice()).setPayeeInfo(vo.getPayeeInfo()) - .setTransferStatus(WAITING.getStatus()); + PayDemoTransferDO demoTransfer = PayDemoTransferConvert.INSTANCE.convert(vo) + .setAppId(TRANSFER_APP_ID).setTransferStatus(WAITING.getStatus()); demoTransferMapper.insert(demoTransfer); - - // 3.1 创建转账单 - Long transferId = transferService.createTransfer(PayTransferConvert.INSTANCE.convert(vo) - .setAppId(TRANSFER_APP_ID).setTitle("示例转账") - .setMerchantOrderId(String.valueOf(demoTransfer.getId()))); - // 3.2 更新转账单编号 - demoTransferMapper.updateById(new PayDemoTransferDO().setId(demoTransfer.getId()) - .setPayTransferId(transferId)); return demoTransfer.getId(); } - // TODO @jason:可以参考 AppBrokerageWithdrawCreateReqVO 搞下字段哈,进行校验 - // @jason payeeinfo 字段确定改一下 - private void validatePayeeInfo(Integer transferType, Map payeeInfo) { - PayTransferTypeEnum transferTypeEnum = typeOf(transferType); - switch (transferTypeEnum) { - case ALIPAY_BALANCE: { - if (StrUtil.isEmpty(MapUtil.getStr(payeeInfo, ALIPAY_LOGON_ID))) { - throw exception(PAY_TRANSFER_ALIPAY_LOGIN_ID_IS_EMPTY); - } - if (StrUtil.isEmpty(MapUtil.getStr(payeeInfo, ALIPAY_ACCOUNT_NAME))) { - throw exception(PAY_TRANSFER_ALIPAY_ACCOUNT_NAME_IS_EMPTY); - } - break; - } - case WX_BALANCE: - case BANK_CARD: - case WALLET_BALANCE: { - throw new UnsupportedOperationException("待实现"); - } + @Override + public PageResult getDemoTransferPage(PageParam pageVO) { + return demoTransferMapper.selectPage(pageVO); + } + + @Override + public void updateDemoTransferStatus(Long id, Long payTransferId) { + PayTransferDO payTransfer = validateDemoTransferStatusCanUpdate(id, payTransferId); + // 更新示例订单状态 + if (payTransfer != null) { + demoTransferMapper.updateById(new PayDemoTransferDO().setId(id) + .setPayTransferId(payTransferId) + .setPayChannelCode(payTransfer.getChannelCode()) + .setTransferStatus(payTransfer.getStatus()) + .setTransferTime(payTransfer.getSuccessTime())); } } + private PayTransferDO validateDemoTransferStatusCanUpdate(Long id, Long payTransferId) { + PayDemoTransferDO demoTransfer = demoTransferMapper.selectById(id); + if (demoTransfer == null) { + throw exception(DEMO_TRANSFER_NOT_FOUND); + } + if (PayTransferStatusEnum.isSuccess(demoTransfer.getTransferStatus()) + || PayTransferStatusEnum.isClosed(demoTransfer.getTransferStatus())) { + // 无需更新返回 null + return null; + } + PayTransferDO transfer = payTransferService.getTransfer(payTransferId); + if (transfer == null) { + throw exception(PAY_TRANSFER_NOT_FOUND); + } + if (!Objects.equals(demoTransfer.getPrice(), transfer.getPrice())) { + throw exception(DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH); + } + if (ObjectUtil.notEqual(transfer.getMerchantTransferId(), id.toString())) { + throw exception(DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR); + } + // TODO 校验账号 + return transfer; + } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java index 7952a0f0e..782993a3e 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java @@ -13,11 +13,13 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; +import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO; import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyLogMapper; import cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyTaskMapper; import cn.iocoder.yudao.module.pay.dal.redis.notify.PayNotifyLockRedisDAO; @@ -25,7 +27,10 @@ import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; +import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService; import com.google.common.annotations.VisibleForTesting; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -34,8 +39,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronizationManager; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; import java.time.Duration; import java.time.LocalDateTime; import java.util.HashMap; @@ -73,6 +76,9 @@ public class PayNotifyServiceImpl implements PayNotifyService { @Resource @Lazy // 循环依赖,避免报错 private PayRefundService refundService; + @Resource + @Lazy // 循环依赖,避免报错 + private PayTransferService transferService; @Resource private PayNotifyTaskMapper notifyTaskMapper; @@ -100,6 +106,10 @@ public class PayNotifyServiceImpl implements PayNotifyService { PayRefundDO refundDO = refundService.getRefund(task.getDataId()); task.setAppId(refundDO.getAppId()) .setMerchantOrderId(refundDO.getMerchantOrderId()).setNotifyUrl(refundDO.getNotifyUrl()); + } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.TRANSFER.getType())) { + PayTransferDO transfer = transferService.getTransfer(task.getDataId()); + task.setAppId(transfer.getAppId()).setMerchantTransferId(transfer.getMerchantTransferId()) + .setNotifyUrl(transfer.getNotifyUrl()); } // 执行插入 @@ -214,6 +224,9 @@ public class PayNotifyServiceImpl implements PayNotifyService { } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.REFUND.getType())) { request = PayRefundNotifyReqDTO.builder().merchantOrderId(task.getMerchantOrderId()) .payRefundId(task.getDataId()).build(); + } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.TRANSFER.getType())) { + request = new PayTransferNotifyReqDTO().setMerchantTransferId(task.getMerchantTransferId()) + .setPayTransferId(task.getDataId()); } else { throw new RuntimeException("未知的通知任务类型:" + JsonUtils.toJsonString(task)); } @@ -252,6 +265,7 @@ public class PayNotifyServiceImpl implements PayNotifyService { notifyTaskMapper.updateById(updateTask); return updateTask.getStatus(); } + // 情况二:调用失败、调用异常 // 2.1 超过最大回调次数 if (updateTask.getNotifyTimes() >= PayNotifyTaskDO.NOTIFY_FREQUENCY.length) { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java index 9532de2d2..8ca043a33 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java @@ -9,10 +9,11 @@ import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitReqVO import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; - import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; + import java.time.LocalDateTime; +import java.util.Collection; import java.util.List; /** @@ -39,6 +40,14 @@ public interface PayOrderService { */ PayOrderDO getOrder(Long appId, String merchantOrderId); + /** + * 获得支付订单列表 + * + * @param ids 编号数组 + * @return 支付订单列表 + */ + List getOrderList(Collection ids); + /** * 获得指定应用的订单数量 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java index 4a2550c77..36fe9bccf 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java @@ -32,13 +32,15 @@ import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; import com.google.common.annotations.VisibleForTesting; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Objects; @@ -83,6 +85,14 @@ public class PayOrderServiceImpl implements PayOrderService { return orderMapper.selectByAppIdAndMerchantOrderId(appId, merchantOrderId); } + @Override + public List getOrderList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return orderMapper.selectBatchIds(ids); + } + @Override public Long getOrderCountByAppId(Long appId) { return orderMapper.selectCountByAppId(appId); @@ -438,7 +448,7 @@ public class PayOrderServiceImpl implements PayOrderService { @Override public int syncOrder(LocalDateTime minCreateTime) { - // 1. 查询指定创建时间内的待支付订单 + // 1. 查询指定创建时间前的待支付订单 List orderExtensions = orderExtensionMapper.selectListByStatusAndCreateTimeGe( PayOrderStatusEnum.WAITING.getStatus(), minCreateTime); if (CollUtil.isEmpty(orderExtensions)) { @@ -467,6 +477,14 @@ public class PayOrderServiceImpl implements PayOrderService { return false; } PayOrderRespDTO respDTO = payClient.getOrder(orderExtension.getNo()); + // 如果查询到订单不存在,PayClient 返回的状态为关闭。但此时不能关闭订单。存在以下一种场景: + // 拉起渠道支付后,短时间内用户未及时完成支付,但是该订单同步定时任务恰巧自动触发了,主动查询结果为订单不存在。 + // 当用户支付成功之后,该订单状态在渠道的回调中无法从已关闭改为已支付,造成重大影响。 + // 考虑此定时任务是异常场景的兜底操作,因此这里不做变更,优先以回调为准。 + // 让订单自动随着支付渠道那边一起等到过期,确保渠道先过期关闭支付入口,而后通过订单过期定时任务关闭自己的订单。 + if (PayOrderStatusRespEnum.isClosed(respDTO.getStatus())) { + return false; + } // 1.2 回调支付结果 notifyOrder(orderExtension.getChannelId(), respDTO); diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java index 360d00abf..d6087a99a 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java @@ -26,12 +26,12 @@ import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java index 70510733e..37c921b1b 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.pay.service.transfer; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitRespVO; - +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import jakarta.validation.Valid; /** @@ -14,22 +15,42 @@ import jakarta.validation.Valid; public interface PayTransferService { /** - * 提交转账单 + * 创建转账单,并发起转账 * - * 此时,会发起支付渠道的调用 + * 此时,会发起转账渠道的调用 * * @param reqVO 请求 * @param userIp 用户 ip * @return 渠道的返回结果 */ - PayTransferSubmitRespVO submitTransfer(@Valid PayTransferSubmitReqVO reqVO, String userIp); + PayTransferDO createTransfer(@Valid PayTransferCreateReqVO reqVO, String userIp); /** - * 创建转账单 + * 创建转账单,并发起转账 * * @param reqDTO 创建请求 * @return 转账单编号 */ Long createTransfer(@Valid PayTransferCreateReqDTO reqDTO); + /** + * 获取转账单 + * @param id 转账单编号 + */ + PayTransferDO getTransfer(Long id); + + /** + * 获得转账单分页 + * + * @param pageReqVO 分页查询 + * @return 转账单分页 + */ + PageResult getTransferPage(PayTransferPageReqVO pageReqVO); + + /** + * 同步渠道转账单状态 + * + * @return 同步到状态的转账数量,包括转账成功、转账失败、转账中的 + */ + int syncTransfer(); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferServiceImpl.java index 3b6839094..25465b5e0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferServiceImpl.java @@ -1,40 +1,44 @@ package cn.iocoder.yudao.module.pay.service.transfer; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.extra.spring.SpringUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferStatusRespEnum; import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitRespVO; -import cn.iocoder.yudao.module.pay.convert.transfer.PayTransferConvert; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; -import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferExtensionDO; -import cn.iocoder.yudao.module.pay.dal.mysql.transfer.PayTransferExtensionMapper; import cn.iocoder.yudao.module.pay.dal.mysql.transfer.PayTransferMapper; import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum; import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; +import jakarta.annotation.Resource; +import jakarta.validation.Validator; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; -import java.util.Objects; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.pay.convert.transfer.PayTransferConvert.INSTANCE; import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum.*; // TODO @jason:等彻底实现完,单测写写; + /** * 转账 Service 实现类 * @@ -48,63 +52,88 @@ public class PayTransferServiceImpl implements PayTransferService { @Resource private PayTransferMapper transferMapper; - @Resource - private PayTransferExtensionMapper transferExtensionMapper; - @Resource private PayAppService appService; @Resource private PayChannelService channelService; - + @Resource + private PayNotifyService notifyService; @Resource private PayNoRedisDAO noRedisDAO; + @Resource + private Validator validator; @Override - public PayTransferSubmitRespVO submitTransfer(PayTransferSubmitReqVO reqVO, String userIp) { - // 1.1 校验转账单是否可以提交 - PayTransferDO transfer = validateTransferCanSubmit(reqVO.getId()); - // 1.2 校验转账类型和渠道是否匹配 - validateChannelCodeAndTypeMatch(reqVO.getChannelCode(), transfer.getType()); - // 1.3 校验支付渠道是否有效 - PayChannelDO channel = validateChannelCanSubmit(transfer.getAppId(), reqVO.getChannelCode()); - PayClient client = channelService.getPayClient(channel.getId()); + public PayTransferDO createTransfer(PayTransferCreateReqVO reqVO, String userIp) { + // 1. 校验参数 + reqVO.validate(validator); - // 2. 新增转账拓展单 - String no = noRedisDAO.generate(TRANSFER_NO_PREFIX); - PayTransferExtensionDO transferExtension = new PayTransferExtensionDO().setNo(no) - .setTransferId(transfer.getId()).setChannelId(channel.getId()) - .setChannelCode(channel.getCode()).setStatus(WAITING.getStatus()); - transferExtensionMapper.insert(transferExtension); + // 2. 创建转账单,发起转账 + PayTransferCreateReqDTO req = INSTANCE.convert(reqVO).setUserIp(userIp); + Long transferId = createTransfer(req); - // 3. 调用三方渠道发起转账 - PayTransferUnifiedReqDTO transferUnifiedReq = new PayTransferUnifiedReqDTO() - .setOutTransferNo(transferExtension.getNo()).setPrice(transfer.getPrice()) - .setType(transfer.getType()).setTitle(transfer.getSubject()) - .setPayeeInfo(transfer.getPayeeInfo()).setUserIp(userIp) - .setChannelExtras(reqVO.getChannelExtras()); - PayTransferRespDTO unifiedTransferResp = client.unifiedTransfer(transferUnifiedReq); - - // 4. 通知转账结果 - getSelf().notifyTransfer(channel, unifiedTransferResp); - // 如有渠道错误码,则抛出业务异常,提示用户 - if (StrUtil.isNotEmpty(unifiedTransferResp.getChannelErrorCode())) { - throw exception(PAY_TRANSFER_SUBMIT_CHANNEL_ERROR, unifiedTransferResp.getChannelErrorCode(), - unifiedTransferResp.getChannelErrorMsg()); - } - return new PayTransferSubmitRespVO().setStatus(unifiedTransferResp.getStatus()); + // 3. 返回转账单 + return getTransfer(transferId); } @Override public Long createTransfer(PayTransferCreateReqDTO reqDTO) { - // 校验 App - appService.validPayApp(reqDTO.getAppId()); - // 创建转账单 - PayTransferDO transfer = PayTransferConvert.INSTANCE.convert(reqDTO) - .setStatus(WAITING.getStatus()); - transferMapper.insert(transfer); + // 1.1 校验 App + PayAppDO payApp = appService.validPayApp(reqDTO.getAppId()); + // 1.2 校验支付渠道是否有效 + PayChannelDO channel = channelService.validPayChannel(reqDTO.getAppId(), reqDTO.getChannelCode()); + PayClient client = channelService.getPayClient(channel.getId()); + if (client == null) { + log.error("[createTransfer][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); + throw exception(CHANNEL_NOT_FOUND); + } + // 1.3 校验转账单已经发起过转账。 + PayTransferDO transfer = validateTransferCanCreate(reqDTO); + + if (transfer == null) { + // 2.不存在创建转账单. 否则允许使用相同的 no 再次发起转账 + String no = noRedisDAO.generate(TRANSFER_NO_PREFIX); + transfer = INSTANCE.convert(reqDTO) + .setChannelId(channel.getId()) + .setNo(no).setStatus(WAITING.getStatus()) + .setNotifyUrl(payApp.getTransferNotifyUrl()); + transferMapper.insert(transfer); + } + try { + // 3. 调用三方渠道发起转账 + PayTransferUnifiedReqDTO transferUnifiedReq = INSTANCE.convert2(transfer) + .setOutTransferNo(transfer.getNo()); + PayTransferRespDTO unifiedTransferResp = client.unifiedTransfer(transferUnifiedReq); + // 4. 通知转账结果 + getSelf().notifyTransfer(channel, unifiedTransferResp); + } catch (Throwable e) { + // 注意这里仅打印异常,不进行抛出。 + // 原因是:虽然调用支付渠道进行转账发生异常(网络请求超时),实际转账成功。这个结果,后续转账轮询可以拿到。 + // 或者使用相同 no 再次发起转账请求 + log.error("[createTransfer][转账 id({}) requestDTO({}) 发生异常]", transfer.getId(), reqDTO, e); + } + return transfer.getId(); } + private PayTransferDO validateTransferCanCreate(PayTransferCreateReqDTO dto) { + PayTransferDO transfer = transferMapper.selectByAppIdAndMerchantTransferId(dto.getAppId(), dto.getMerchantTransferId()); + if (transfer != null) { + // 已经存在,并且状态不为等待状态。说明已经调用渠道转账并返回结果. + if (!PayTransferStatusEnum.isWaiting(transfer.getStatus())) { + throw exception(PAY_MERCHANT_TRANSFER_EXISTS); + } + if (ObjectUtil.notEqual(dto.getPrice(), transfer.getPrice())) { + throw exception(PAY_SAME_MERCHANT_TRANSFER_PRICE_NOT_MATCH); + } + if (ObjectUtil.notEqual(dto.getType(), transfer.getType())) { + throw exception(PAY_SAME_MERCHANT_TRANSFER_TYPE_NOT_MATCH); + } + } + // 如果状态为等待状态。不知道渠道转账是否发起成功。 允许使用相同的 no 再次发起转账,渠道会保证幂等 + return transfer; + } + @Transactional(rollbackFor = Exception.class) // 注意,如果是方法内调用该方法,需要通过 getSelf().notifyTransfer(channel, notify) 调用,否则事务不生效 public void notifyTransfer(PayChannelDO channel, PayTransferRespDTO notify) { @@ -116,32 +145,48 @@ public class PayTransferServiceImpl implements PayTransferService { if (PayTransferStatusRespEnum.isClosed(notify.getStatus())) { notifyTransferClosed(channel, notify); } - // WAITING 状态无需处理 - // TODO IN_PROGRESS 待处理 - } - - private void notifyTransferSuccess(PayChannelDO channel, PayTransferRespDTO notify) { - // 1. 更新 PayTransferExtensionDO 转账成功 - PayTransferExtensionDO transferExtension = updateTransferExtensionSuccess(notify); - - // 2. 更新 PayTransferDO 转账成功 - Boolean transferred = updateTransferSuccess(channel,transferExtension, notify); - if (transferred) { - return; + // 转账处理中的回调 + if (PayTransferStatusRespEnum.isInProgress(notify.getStatus())) { + notifyTransferInProgress(channel, notify); } - // 3. TODO 插入转账通知记录 + // WAITING 状态无需处理 } - private Boolean updateTransferSuccess(PayChannelDO channel, PayTransferExtensionDO transferExtension, - PayTransferRespDTO notify) { + private void notifyTransferInProgress(PayChannelDO channel, PayTransferRespDTO notify) { // 1.校验 - PayTransferDO transfer = transferMapper.selectById(transferExtension.getTransferId()); + PayTransferDO transfer = transferMapper.selectByNo(notify.getOutTransferNo()); if (transfer == null) { throw exception(PAY_TRANSFER_NOT_FOUND); } - if (isSuccess(transfer.getStatus()) && Objects.equals(transfer.getExtensionId(), transferExtension.getId())) { - log.info("[updateTransferSuccess][transfer({}) 已经是已转账,无需更新]", transfer.getId()); - return true; + if (isInProgress(transfer.getStatus())) { // 如果已经是转账中,直接返回,不用重复更新 + return; + } + if (!isWaiting(transfer.getStatus())) { + throw exception(PAY_TRANSFER_STATUS_IS_NOT_WAITING); + } + // 2.更新 + int updateCounts = transferMapper.updateByIdAndStatus(transfer.getId(), + CollUtil.newArrayList(WAITING.getStatus()), + new PayTransferDO().setStatus(IN_PROGRESS.getStatus())); + if (updateCounts == 0) { + throw exception(PAY_TRANSFER_STATUS_IS_NOT_WAITING); + } + log.info("[notifyTransferInProgress][transfer({}) 更新为转账进行中状态]", transfer.getId()); + + // 3. 插入转账通知记录 + notifyService.createPayNotifyTask(PayNotifyTypeEnum.TRANSFER.getType(), + transfer.getId()); + } + + + private void notifyTransferSuccess(PayChannelDO channel, PayTransferRespDTO notify) { + // 1.校验 + PayTransferDO transfer = transferMapper.selectByNo(notify.getOutTransferNo()); + if (transfer == null) { + throw exception(PAY_TRANSFER_NOT_FOUND); + } + if (isSuccess(transfer.getStatus())) { // 如果已成功,直接返回,不用重复更新 + return; } if (!isPendingStatus(transfer.getStatus())) { throw exception(PAY_TRANSFER_STATUS_IS_NOT_PENDING); @@ -150,114 +195,99 @@ public class PayTransferServiceImpl implements PayTransferService { int updateCounts = transferMapper.updateByIdAndStatus(transfer.getId(), CollUtil.newArrayList(WAITING.getStatus(), IN_PROGRESS.getStatus()), new PayTransferDO().setStatus(SUCCESS.getStatus()).setSuccessTime(notify.getSuccessTime()) + .setChannelTransferNo(notify.getChannelTransferNo()) .setChannelId(channel.getId()).setChannelCode(channel.getCode()) - .setExtensionId(transferExtension.getId()).setNo(transferExtension.getNo())); + .setChannelNotifyData(JsonUtils.toJsonString(notify))); if (updateCounts == 0) { throw exception(PAY_TRANSFER_STATUS_IS_NOT_PENDING); } log.info("[updateTransferSuccess][transfer({}) 更新为已转账]", transfer.getId()); - return false; - } - private PayTransferExtensionDO updateTransferExtensionSuccess(PayTransferRespDTO notify) { - // 1 校验 - PayTransferExtensionDO transferExtension = transferExtensionMapper.selectByNo(notify.getOutTransferNo()); - if (transferExtension == null) { - throw exception(PAY_TRANSFER_EXTENSION_NOT_FOUND); - } - if (isSuccess(transferExtension.getStatus())) { // 如果已成功,直接返回,不用重复更新 - log.info("[updateTransferExtensionSuccess][transferExtension({}) 已经是成功状态,无需更新]", transferExtension.getId()); - return transferExtension; - } - if (!isPendingStatus(transferExtension.getStatus())) { - throw exception(PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING); - } - // 2. 更新 PayTransferExtensionDO - int updateCount = transferExtensionMapper.updateByIdAndStatus(transferExtension.getId(), - CollUtil.newArrayList(WAITING.getStatus(), IN_PROGRESS.getStatus()), - new PayTransferExtensionDO().setStatus(SUCCESS.getStatus()) - .setChannelNotifyData(JsonUtils.toJsonString(notify))); - if (updateCount == 0) { - throw exception(PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING); - } - log.info("[updateTransferExtensionSuccess][transferExtension({}) 更新为已转账]", transferExtension.getId()); - return transferExtension; + // 3. 插入转账通知记录 + notifyService.createPayNotifyTask(PayNotifyTypeEnum.TRANSFER.getType(), + transfer.getId()); } private void notifyTransferClosed(PayChannelDO channel, PayTransferRespDTO notify) { - // 更新 PayTransferExtensionDO 转账关闭 - updateTransferExtensionClosed(notify); - } - - private void updateTransferExtensionClosed(PayTransferRespDTO notify) { - // 1 校验 - PayTransferExtensionDO transferExtension = transferExtensionMapper.selectByNo(notify.getOutTransferNo()); - if (transferExtension == null) { - throw exception(PAY_TRANSFER_EXTENSION_NOT_FOUND); - } - if (isClosed(transferExtension.getStatus())) { // 如果已是关闭状态,直接返回,不用重复更新 - log.info("[updateTransferExtensionSuccess][transferExtension({}) 已经是关闭状态,无需更新]", transferExtension.getId()); - return; - } - if (!isPendingStatus(transferExtension.getStatus())) { - throw exception(PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING); - } - // 2. 更新 PayTransferExtensionDO - int updateCount = transferExtensionMapper.updateByIdAndStatus(transferExtension.getId(), - CollUtil.newArrayList(WAITING.getStatus(), IN_PROGRESS.getStatus()), - new PayTransferExtensionDO().setStatus(CLOSED.getStatus()) - .setChannelNotifyData(JsonUtils.toJsonString(notify))); - if (updateCount == 0) { - throw exception(PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING); - } - log.info("[updateTransferExtensionSuccess][transferExtension({}) 更新为关闭状态]", transferExtension.getId()); - } - - private void validateChannelCodeAndTypeMatch(String channelCode, Integer type) { - PayTransferTypeEnum transferType = PayTransferTypeEnum.typeOf(type); - PayChannelEnum payChannel = PayChannelEnum.getByCode(channelCode); - switch (transferType) { - case ALIPAY_BALANCE: { - // TODO @jason:可以抽到 PayChannelEnum 里,isAlipay? 类似这种哈 - if (!payChannel.getCode().startsWith("alipay")) { - throw exception(PAY_TRANSFER_TYPE_AND_CHANNEL_NOT_MATCH); - } - break; - } - case WX_BALANCE: - case BANK_CARD: - case WALLET_BALANCE: { - throw new UnsupportedOperationException("待实现"); - } - } - } - - private PayChannelDO validateChannelCanSubmit(Long appId, String channelCode) { - // 校验 App - appService.validPayApp(appId); - // 校验支付渠道是否有效 - PayChannelDO channel = channelService.validPayChannel(appId, channelCode); - PayClient client = channelService.getPayClient(channel.getId()); - if (client == null) { - log.error("[validateChannelCanSubmit][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); - throw exception(CHANNEL_NOT_FOUND); - } - return channel; - } - - private PayTransferDO validateTransferCanSubmit(Long id) { - PayTransferDO transfer = transferMapper.selectById(id); - if (transfer == null) { // 是否存在 + // 1.校验 + PayTransferDO transfer = transferMapper.selectByNo(notify.getOutTransferNo()); + if (transfer == null) { throw exception(PAY_TRANSFER_NOT_FOUND); } - if (PayTransferStatusEnum.isSuccess(transfer.getStatus())) { - throw exception(PAY_TRANSFER_STATUS_IS_SUCCESS); + if (isClosed(transfer.getStatus())) { // 如果已是关闭状态,直接返回,不用重复更新 + log.info("[updateTransferClosed][transfer({}) 已经是关闭状态,无需更新]", transfer.getId()); + return; } - if (!PayTransferStatusEnum.isWaiting(transfer.getStatus())) { - throw exception(PAY_TRANSFER_STATUS_IS_NOT_WAITING); + if (!isPendingStatus(transfer.getStatus())) { + throw exception(PAY_TRANSFER_STATUS_IS_NOT_PENDING); } - // TODO 查询拓展单是否未已转账和转账中 - return transfer; + + // 2.更新 + int updateCount = transferMapper.updateByIdAndStatus(transfer.getId(), + CollUtil.newArrayList(WAITING.getStatus(), IN_PROGRESS.getStatus()), + new PayTransferDO().setStatus(CLOSED.getStatus()).setChannelId(channel.getId()) + .setChannelCode(channel.getCode()).setChannelTransferNo(notify.getChannelTransferNo()) + .setChannelErrorCode(notify.getChannelErrorCode()).setChannelErrorMsg(notify.getChannelErrorMsg()) + .setChannelNotifyData(JsonUtils.toJsonString(notify))); + if (updateCount == 0) { + throw exception(PAY_TRANSFER_STATUS_IS_NOT_PENDING); + } + log.info("[updateTransferClosed][transfer({}) 更新为关闭状态]", transfer.getId()); + + // 3. 插入转账通知记录 + notifyService.createPayNotifyTask(PayNotifyTypeEnum.TRANSFER.getType(), + transfer.getId()); + + } + + @Override + public PayTransferDO getTransfer(Long id) { + return transferMapper.selectById(id); + } + + @Override + public PageResult getTransferPage(PayTransferPageReqVO pageReqVO) { + return transferMapper.selectPage(pageReqVO); + } + + @Override + public int syncTransfer() { + List list = transferMapper.selectListByStatus(WAITING.getStatus()); + if (CollUtil.isEmpty(list)) { + return 0; + } + int count = 0; + for (PayTransferDO transfer : list) { + count += syncTransfer(transfer) ? 1 : 0; + } + return count; + } + + private boolean syncTransfer(PayTransferDO transfer) { + try { + // 1. 查询转账订单信息 + PayClient payClient = channelService.getPayClient(transfer.getChannelId()); + if (payClient == null) { + log.error("[syncTransfer][渠道编号({}) 找不到对应的支付客户端]", transfer.getChannelId()); + return false; + } + PayTransferRespDTO resp = payClient.getTransfer(transfer.getNo(), + PayTransferTypeEnum.typeOf(transfer.getType())); + + // 2. 回调转账结果 + notifyTransfer(transfer.getChannelId(), resp); + return true; + } catch (Throwable ex) { + log.error("[syncTransfer][transfer({}) 同步转账单状态异常]", transfer.getId(), ex); + return false; + } + } + + private void notifyTransfer(Long channelId, PayTransferRespDTO notify) { + // 校验渠道是否有效 + PayChannelDO channel = channelService.validPayChannel(channelId); + // 通知转账结果给对应的业务 + TenantUtils.execute(channel.getTenantId(), () -> getSelf().notifyTransfer(channel, notify)); } /** diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java index 1fda4286c..c2f2e6957 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java @@ -5,9 +5,10 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; - import jakarta.validation.Valid; +import java.util.List; + /** * 钱包充值套餐 Service 接口 * @@ -58,4 +59,12 @@ public interface PayWalletRechargePackageService { */ PageResult getWalletRechargePackagePage(WalletRechargePackagePageReqVO pageReqVO); + /** + * 获得充值套餐列表 + * + * @param status 状态 + * @return 充值套餐列表 + */ + List getWalletRechargePackageList(Integer status); + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java index 5ddebc557..3dc080186 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java @@ -6,12 +6,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; -import cn.iocoder.yudao.module.pay.convert.wallet.WalletRechargePackageConvert; +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargePackageMapper; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; -import jakarta.annotation.Resource; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; @@ -50,7 +51,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac validateRechargePackageNameUnique(null, createReqVO.getName()); // 插入 - PayWalletRechargePackageDO walletRechargePackage = WalletRechargePackageConvert.INSTANCE.convert(createReqVO); + PayWalletRechargePackageDO walletRechargePackage = PayWalletRechargePackageConvert.INSTANCE.convert(createReqVO); walletRechargePackageMapper.insert(walletRechargePackage); // 返回 return walletRechargePackage.getId(); @@ -64,7 +65,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac validateRechargePackageNameUnique(updateReqVO.getId(), updateReqVO.getName()); // 更新 - PayWalletRechargePackageDO updateObj = WalletRechargePackageConvert.INSTANCE.convert(updateReqVO); + PayWalletRechargePackageDO updateObj = PayWalletRechargePackageConvert.INSTANCE.convert(updateReqVO); walletRechargePackageMapper.updateById(updateObj); } @@ -103,4 +104,9 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac return walletRechargePackageMapper.selectPage(pageReqVO); } + @Override + public List getWalletRechargePackageList(Integer status) { + return walletRechargePackageMapper.selectListByStatus(status); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java index 752ce89af..1d2813d1e 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; @@ -22,6 +24,18 @@ public interface PayWalletRechargeService { PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp, AppPayWalletRechargeCreateReqVO createReqVO); + /** + * 获得钱包充值记录分页 + * + * @param userId 用户编号 + * @param userType 用户类型 + * @param pageReqVO 分页请求 + * @param payStatus 是否支付 + * @return 钱包充值记录分页 + */ + PageResult getWalletRechargePackagePage(Long userId, Integer userType, + PageParam pageReqVO, Boolean payStatus); + /** * 更新钱包充值成功 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java index a09fba350..fd4b19e56 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.hutool.core.lang.Assert; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; @@ -16,11 +18,11 @@ import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; import java.util.Objects; @@ -64,11 +66,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { @Transactional(rollbackFor = Exception.class) public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp, AppPayWalletRechargeCreateReqVO reqVO) { - - if (Objects.isNull(reqVO.getPayPrice()) && Objects.isNull(reqVO.getPackageId())) { - // TODO @jason @AssertTrue 貌似没有效果。需要查下原因 - throw exception(WALLET_RECHARGE_PACKAGE_AND_PRICE_IS_EMPTY); - } // 1.1 计算充值金额 int payPrice; int bonusPrice = 0; @@ -97,6 +94,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { return recharge; } + @Override + public PageResult getWalletRechargePackagePage(Long userId, Integer userType, + PageParam pageReqVO, Boolean payStatus) { + PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); + return walletRechargeMapper.selectPage(pageReqVO, wallet.getId(), payStatus); + } + @Override @Transactional(rollbackFor = Exception.class) public void updateWalletRechargerPaid(Long id, Long payOrderId) { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java index d9abe958d..358d149da 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java @@ -30,14 +30,13 @@ public interface PayWalletService { */ PayWalletDO getWallet(Long walletId); - /** * 获得会员钱包分页 * * @param pageReqVO 分页查询 * @return 会员钱包分页 */ - PageResult getWalletPage(Integer userType, PayWalletPageReqVO pageReqVO); + PageResult getWalletPage(PayWalletPageReqVO pageReqVO); /** * 钱包订单支付 diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java index 036d73d04..acbbebaee 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java @@ -12,12 +12,12 @@ import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -36,13 +36,15 @@ public class PayWalletServiceImpl implements PayWalletService { @Resource private PayWalletMapper walletMapper; + @Resource + @Lazy // 延迟加载,避免循环依赖 private PayWalletTransactionService walletTransactionService; @Resource - @Lazy + @Lazy // 延迟加载,避免循环依赖 private PayOrderService orderService; @Resource - @Lazy + @Lazy // 延迟加载,避免循环依赖 private PayRefundService refundService; @Override @@ -63,8 +65,8 @@ public class PayWalletServiceImpl implements PayWalletService { } @Override - public PageResult getWalletPage(Integer userType,PayWalletPageReqVO pageReqVO) { - return walletMapper.selectPage(userType, pageReqVO); + public PageResult getWalletPage(PayWalletPageReqVO pageReqVO) { + return walletMapper.selectPage(pageReqVO); } @Override diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java index 551a18261..df509193b 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java @@ -3,12 +3,14 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; - import jakarta.validation.Valid; +import java.time.LocalDateTime; + /** * 钱包余额流水 Service 接口 * @@ -57,4 +59,15 @@ public interface PayWalletTransactionService { */ PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type); + /** + * 获得钱包流水统计 + * + * @param userId 用户编号 + * @param userType 用户类型 + * @param createTime 时间段 + * @return 钱包流水统计 + */ + AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, + LocalDateTime[] createTime); + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java index 34e1c7956..b8ecb4d36 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; @@ -10,11 +11,15 @@ import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper; import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE; +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME; /** * 钱包流水 Service 实现类 @@ -42,12 +47,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ public PageResult getWalletTransactionPage(Long userId, Integer userType, AppPayWalletTransactionPageReqVO pageVO) { PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); - return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO); + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO, pageVO.getCreateTime()); } @Override public PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) { - return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO); + return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO, null); } @Override @@ -68,4 +73,14 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ return payWalletTransactionMapper.selectByBiz(bizId, type.getType()); } + @Override + public AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, LocalDateTime[] createTime) { + PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); + AppPayWalletTransactionSummaryRespVO summary = new AppPayWalletTransactionSummaryRespVO() + .setTotalExpense(1).setTotalIncome(100); + return new AppPayWalletTransactionSummaryRespVO() + .setTotalExpense(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_EXPENSE, createTime)) + .setTotalIncome(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_INCOME, createTime)); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java index cde57f112..15f351a15 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java @@ -2,10 +2,9 @@ package cn.iocoder.yudao.module.pay.service.wallet.bo; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; -import lombok.Data; - import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; /** * 创建钱包流水 BO diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/MoneyUtils.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/MoneyUtils.java deleted file mode 100644 index 15865f60a..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/MoneyUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.module.pay.util; - -import cn.hutool.core.util.NumberUtil; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -/** - * 金额工具类 - * - * @author 芋道源码 - */ -public class MoneyUtils { - - /** - * 计算百分比金额,四舍五入 - * - * @param price 金额 - * @param rate 百分比,例如说 56.77% 则传入 56.77 - * @return 百分比金额 - */ - public static Integer calculateRatePrice(Integer price, Double rate) { - return calculateRatePrice(price, rate, 0, RoundingMode.HALF_UP).intValue(); - } - - /** - * 计算百分比金额 - * - * @param price 金额 - * @param rate 百分比,例如说 56.77% 则传入 56.77 - * @param scale 保留小数位数 - * @param roundingMode 舍入模式 - */ - public static BigDecimal calculateRatePrice(Number price, Number rate, int scale, RoundingMode roundingMode) { - return NumberUtil.toBigDecimal(price).multiply(NumberUtil.toBigDecimal(rate)) // 乘以 - .divide(BigDecimal.valueOf(100), scale, roundingMode); // 除以 100 - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java deleted file mode 100644 index 3882a2fd3..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.yudao.module.pay.util; - -import cn.hutool.core.date.DatePattern; -import cn.hutool.core.date.DateUtil; - -import java.time.LocalDateTime; -import java.util.concurrent.atomic.AtomicLong; - -/** - * 支付相关编号的生产 - */ -// TODO @jason:需要改造,基于 db; -public class PaySeqUtils { - - private static final AtomicLong REFUND_REQ_NO_SEQ = new AtomicLong(0L); - - private static final AtomicLong MER_REFUND_NO_SEQ = new AtomicLong(0L); - - private static final AtomicLong MER_ORDER_NO_SEQ = new AtomicLong(0L); - - // TODO 芋艿:需要看看 - /** - * 生成商户退款单号,用于测试,应该由商户系统生成 - * @return 商户退款单 - */ - public static String genMerchantRefundNo() { - return String.format("%s%s%04d", "MR", - DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), - (int) MER_REFUND_NO_SEQ.getAndIncrement() % 10000); - } - - // TODO 芋艿:需要看看 - - /** - * 生成退款请求号 - * @return 退款请求号 - */ - public static String genRefundReqNo() { - return String.format("%s%s%04d", "RR", - DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), - (int) REFUND_REQ_NO_SEQ.getAndIncrement() % 10000); - } - - /** - * 生成商户订单编号号 用于测试,应该由商户系统生成 - * @return 商户订单编号 - */ - public static String genMerchantOrderNo() { - return String.format("%s%s%04d", "MO", - DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), - (int) MER_ORDER_NO_SEQ.getAndIncrement() % 10000); - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java deleted file mode 100644 index 73b4f6f82..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; - -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; -import org.junit.jupiter.api.Test; - -public class PayChannelDOTest { - - @Test - public void testSerialization() { - PayChannelDO payChannelDO = new PayChannelDO(); - // 创建配置 - WXPayClientConfig config = new WXPayClientConfig(); - config.setAppId("wx041349c6f39b268b"); - config.setMchId("1545083881"); - config.setApiVersion(WXPayClientConfig.API_VERSION_V2); - config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p"); - payChannelDO.setConfig(config); - - // 序列化 - String text = JsonUtils.toJsonString(payChannelDO); - System.out.println(text); - - // 反序列化 - payChannelDO = JsonUtils.parseObject(text, PayChannelDO.class); - System.out.println(payChannelDO.getConfig().getClass()); - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java deleted file mode 100644 index bed3d1471..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.mysql.merchant; - -import cn.hutool.core.io.IoUtil; -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; -import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; -import org.junit.jupiter.api.Test; - -import jakarta.annotation.Resource; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.List; - -@Resource -public class PayChannelMapperIntegrationTest extends BaseDbIntegrationTest { - - @Resource - private PayChannelMapper payChannelMapper; - - /** - * 插入 {@link PayChannelEnum#WX_PUB} 初始配置 - */ - @Test - public void testInsertWxPub() throws FileNotFoundException { - PayChannelDO payChannelDO = new PayChannelDO(); - payChannelDO.setCode(PayChannelEnum.WX_PUB.getCode()); - payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - payChannelDO.setFeeRate(1D); - payChannelDO.setAppId(6L); - // 配置 - WXPayClientConfig config = new WXPayClientConfig(); - config.setAppId("wx041349c6f39b268b"); - config.setMchId("1545083881"); - config.setApiVersion(WXPayClientConfig.API_VERSION_V2); - config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p"); - config.setPrivateKeyContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_key.pem"))); - config.setPrivateCertContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem"))); - config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase"); - payChannelDO.setConfig(config); - // 执行插入 - payChannelMapper.insert(payChannelDO); - } - - // TODO @ouyang:Zfb 改成 AlipayQr - /** - * 插入 {@link PayChannelEnum#ALIPAY_QR} 初始配置 - */ - @Test - public void testInsertZfb() { - PayChannelDO payChannelDO = new PayChannelDO(); - payChannelDO.setCode(PayChannelEnum.ALIPAY_QR.getCode()); - payChannelDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - payChannelDO.setFeeRate(1D); - payChannelDO.setAppId(6L); - // 配置 - AlipayPayClientConfig config = new AlipayPayClientConfig(); - config.setAppId("2021000118634035"); - config.setServerUrl(AlipayPayClientConfig.SERVER_URL_SANDBOX); - config.setSignType(AlipayPayClientConfig.SIGN_TYPE_DEFAULT); - config.setPrivateKey("MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCHsEV1cDupwJv890x84qbppUtRIfhaKSwSVN0thCcsDCaAsGR5MZslDkO8NCT9V4r2SVXjyY7eJUZlZd1M0C8T01Tg4UOx5LUbic0O3A1uJMy6V1n9IyYwbAW3AEZhBd5bSbPgrqvmv3NeWSTQT6Anxnllf+2iDH6zyA2fPl7cYyQtbZoDJQFGqr4F+cGh2R6akzRKNoBkAeMYwoY6es2lX8sJxCVPWUmxNUoL3tScwlSpd7Bxw0q9c/X01jMwuQ0+Va358zgFiGERTE6yD01eu40OBDXOYO3z++y+TAYHlQQ2toMO63trepo88X3xV3R44/1DH+k2pAm2IF5ixiLrAgMBAAECggEAPx3SoXcseaD7rmcGcE0p4SMfbsUDdkUSmBBbtfF0GzwnqNLkWa+mgE0rWt9SmXngTQH97vByAYmLPl1s3G82ht1V7Sk7yQMe74lhFllr8eEyTjeVx3dTK1EEM4TwN+936DTXdFsr4TELJEcJJdD0KaxcCcfBLRDs2wnitEFZ9N+GoZybVmY8w0e0MI7PLObUZ2l0X4RurQnfG9ZxjXjC7PkeMVv7cGGylpNFi3BbvkRhdhLPDC2E6wqnr9e7zk+hiENivAezXrtxtwKovzCtnWJ1r0IO14Rh47H509Ic0wFnj+o5YyUL4LdmpL7yaaH6fM7zcSLFjNZPHvZCKPwYcQKBgQDQFho98QvnL8ex4v6cry4VitGpjSXm1qP3vmMQk4rTsn8iPWtcxPjqGEqOQJjdi4Mi0VZKQOLFwlH0kl95wNrD/isJ4O1yeYfX7YAXApzHqYNINzM79HemO3Yx1qLMW3okRFJ9pPRzbQ9qkTpsaegsmyX316zOBhzGRYjKbutTYwKBgQCm7phr9XdFW5Vh+XR90mVs483nrLmMiDKg7YKxSLJ8amiDjzPejCn7i95Hah08P+2MIZLIPbh2VLacczR6ltRRzN5bg5etFuqSgfkuHyxpoDmpjbe08+Q2h8JBYqcC5Nhv1AKU4iOUhVLHo/FBAQliMcGc/J3eiYTFC7EsNx382QKBgClb20doe7cttgFTXswBvaUmfFm45kmla924B7SpvrQpDD/f+VDtDZRp05fGmxuduSjYdtA3aVtpLiTwWu22OUUvZZqHDGruYOO4Hvdz23mL5b4ayqImCwoNU4bAZIc9v18p/UNf3/55NNE3oGcf/bev9rH2OjCQ4nM+Ktwhg8CFAoGACSgvbkShzUkv0ZcIf9ppu+ZnJh1AdGgINvGwaJ8vQ0nm/8h8NOoFZ4oNoGc+wU5Ubops7dUM6FjPR5e+OjdJ4E7Xp7d5O4J1TaIZlCEbo5OpdhaTDDcQvrkFu+Z4eN0qzj+YAKjDAOOrXc4tbr5q0FsgXscwtcNfaBuzFVTUrUkCgYEAwzPnMNhWG3zOWLUs2QFA2GP4Y+J8cpUYfj6pbKKzeLwyG9qBwF1NJpN8m+q9q7V9P2LY+9Lp9e1mGsGeqt5HMEA3P6vIpcqLJLqE/4PBLLRzfccTcmqb1m71+erxTRhHBRkGS+I7dZEb3olQfnS1Y1tpMBxiwYwR3LW4oXuJwj8="); - config.setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnq90KnF4dTnlzzmxpujbI05OYqi5WxAS6cL0gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBNlrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB"); - // 创建客户端 - payChannelDO.setConfig(config); - // 执行插入 - payChannelMapper.insert(payChannelDO); - } - - /** - * 查询所有支付配置,看看是否都是 ok 的 - */ - @Test - public void testSelectList() { - List payChannels = payChannelMapper.selectList(); - System.out.println(payChannels.size()); - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceIntegrationTest.java deleted file mode 100644 index 60d8f9ba6..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceIntegrationTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.iocoder.yudao.module.pay.service.order; - -import cn.iocoder.yudao.module.pay.service.channel.PayAppServiceImpl; -import cn.iocoder.yudao.module.pay.service.channel.PayChannelServiceImpl; -import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderCreateReqDTO; -import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; -import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; -import cn.iocoder.yudao.framework.common.util.date.DateUtils; -import cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration; -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import jakarta.annotation.Resource; -import java.time.Duration; - -@Import({PayOrderServiceImpl.class, PayAppServiceImpl.class, - PayChannelServiceImpl.class, YudaoPayAutoConfiguration.class}) -public class PayOrderServiceIntegrationTest extends BaseDbIntegrationTest { - - @Resource - private PayOrderService payOrderService; - - @Test - public void testCreatePayOrder() { - // 构造请求 - PayOrderCreateReqDTO reqDTO = new PayOrderCreateReqDTO(); - reqDTO.setAppId(6L); - reqDTO.setUserIp("127.0.0.1"); - reqDTO.setMerchantOrderId(String.valueOf(System.currentTimeMillis())); - reqDTO.setSubject("标题"); - reqDTO.setBody("内容"); - reqDTO.setPrice(100); - reqDTO.setExpireTime(DateUtils.addTime(Duration.ofDays(1))); - // 发起请求 - payOrderService.createPayOrder(reqDTO); - } - - @Test - public void testSubmitPayOrder() { - // 构造请求 - PayOrderSubmitReqDTO reqDTO = new PayOrderSubmitReqDTO(); - reqDTO.setId(10L); - reqDTO.setAppId(6L); - reqDTO.setChannelCode(PayChannelEnum.WX_PUB.getCode()); - reqDTO.setUserIp("127.0.0.1"); - // 发起请求 - payOrderService.submitPayOrder(reqDTO); - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/package-info.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/package-info.java deleted file mode 100644 index 2cad91eba..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/service/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.module.pay.service; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisIntegrationTest.java deleted file mode 100644 index 2ee19ebf9..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisIntegrationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.yudao.module.pay.test; - -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; -import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; -import org.redisson.spring.starter.RedissonAutoConfiguration; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbAndRedisIntegrationTest.Application.class) -@ActiveProfiles("integration-test") // 设置使用 application-integration-test 配置文件 -public class BaseDbAndRedisIntegrationTest { - - @Import({ - // DB 配置类 - DynamicDataSourceAutoConfiguration.class, // Dynamic Datasource 配置类 - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 - // MyBatis 配置类 - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 - - // Redis 配置类 - RedisAutoConfiguration.class, // Spring Redis 自动配置类 - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 - RedissonAutoConfiguration.class, // Redisson 自动高配置类 - }) - public static class Application { - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbIntegrationTest.java deleted file mode 100644 index 380efa3f4..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseDbIntegrationTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.pay.test; - -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; -import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbIntegrationTest.Application.class) -@ActiveProfiles("integration-test") // 设置使用 application-integration-test 配置文件 -public class BaseDbIntegrationTest { - - @Import({ - // DB 配置类 - DynamicDataSourceAutoConfiguration.class, // Dynamic Datasource 配置类 - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 - // MyBatis 配置类 - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 - }) - public static class Application { - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseRedisIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseRedisIntegrationTest.java deleted file mode 100644 index d01353d72..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/test/BaseRedisIntegrationTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.module.pay.test; - -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; -import org.redisson.spring.starter.RedissonAutoConfiguration; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseRedisIntegrationTest.Application.class) -@ActiveProfiles("integration-test") // 设置使用 application-integration-test 配置文件 -public class BaseRedisIntegrationTest { - - @Import({ - // Redis 配置类 - RedisAutoConfiguration.class, // Spring Redis 自动配置类 - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 - RedissonAutoConfiguration.class, // Redisson 自动高配置类 - }) - public static class Application { - } - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml b/yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml deleted file mode 100644 index 15fa79bd5..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml +++ /dev/null @@ -1,83 +0,0 @@ -spring: - main: - lazy-initialization: true # 开启懒加载,加快速度 - banner-mode: off # 单元测试,禁用 Banner - ---- #################### 数据库相关配置 #################### - -spring: - # 数据源配置项 - autoconfigure: - exclude: - datasource: - druid: # Druid 【监控】相关的全局配置 - web-stat-filter: - enabled: true - dynamic: # 多数据源配置 - druid: # Druid 【连接池】相关的全局配置 - initial-size: 5 # 初始连接数 - min-idle: 10 # 最小连接池数量 - max-active: 20 # 最大连接池数量 - max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 - time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 - min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 - max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 - validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 - test-while-idle: true - test-on-borrow: false - test-on-return: false - primary: master - datasource: - master: - name: ruoyi-vue-pro - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: 123456 - slave: # 模拟从库,可根据自己需要修改 - name: ruoyi-vue-pro - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: 123456 - - # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 - data: - redis: - host: 127.0.0.1 # 地址 - port: 6379 # 端口 - database: 0 # 数据库索引 - -mybatis: - lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志 - global-config: - db-config: - id-type: AUTO # 自增 ID - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: ${yudao.info.base-package}.dal.dataobject - ---- #################### 定时任务相关配置 #################### - ---- #################### 配置中心相关配置 #################### - ---- #################### 服务保障相关配置 #################### - -# Lock4j 配置项(单元测试,禁用 Lock4j) - ---- #################### 监控相关配置 #################### - ---- #################### 芋道相关配置 #################### - -yudao: - info: - version: 1.0.0 - base-package: cn.iocoder.yudao.module.pay - pay: - pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify - refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java index 25a7f54a5..cd5f12bb7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java @@ -11,11 +11,12 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import cn.iocoder.yudao.module.pay.dal.mysql.app.PayAppMapper; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import jakarta.annotation.Resource; import java.util.Map; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; @@ -35,6 +36,7 @@ import static org.mockito.Mockito.when; * * @author aquan */ +@Disabled // TODO 芋艿:后续 fix 补充的单测 @Import(PayAppServiceImpl.class) public class PayAppServiceTest extends BaseDbUnitTest { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java index 64ad3c482..45dcb4df2 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java @@ -13,12 +13,12 @@ import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateR import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; import com.alibaba.fastjson.JSON; +import jakarta.annotation.Resource; +import jakarta.validation.Validator; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import jakarta.annotation.Resource; -import jakarta.validation.Validator; import java.util.Collections; import java.util.List; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java index 345aee2ad..a3315f7a1 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java @@ -18,6 +18,8 @@ import cn.iocoder.yudao.module.pay.framework.job.config.PayJobConfiguration; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundServiceImpl; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; import org.redisson.api.RLock; @@ -25,7 +27,6 @@ import org.redisson.api.RedissonClient; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import jakarta.annotation.Resource; import java.time.Duration; import java.util.List; @@ -46,6 +47,7 @@ import static org.mockito.Mockito.*; * * @author 芋艿 */ +@Disabled // TODO 芋艿:后续 fix 补充的单测 @Import({PayJobConfiguration.class, PayNotifyServiceImpl.class, PayNotifyLockRedisDAO.class}) public class PayNotifyServiceTest extends BaseDbUnitTest { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java index 5dfe018a8..394e45d7f 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java @@ -26,13 +26,13 @@ import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties; import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; +import jakarta.annotation.Resource; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import jakarta.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; import java.util.List; @@ -945,7 +945,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { int count = orderService.syncOrder(minCreateTime); // 断言 assertEquals(count, 0); - verify(payOrderServiceImpl).notifyOrder(same(channel), same(respDTO)); + verify(payOrderServiceImpl, never()).notifyOrder(same(channel), same(respDTO)); } } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java index 7429d6c58..4b98daf8f 100755 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java @@ -25,13 +25,13 @@ import cn.iocoder.yudao.module.pay.service.app.PayAppService; import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import jakarta.annotation.Resource; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import jakarta.annotation.Resource; import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java index 18ae017d1..86e3566b2 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import java.util.Map; @@ -86,4 +87,12 @@ public interface PayClient { */ PayTransferRespDTO unifiedTransfer(PayTransferUnifiedReqDTO reqDTO); + /** + * 获得转账订单信息 + * + * @param outTradeNo 外部订单号 + * @param type 转账类型 + * @return 转账信息 + */ + PayTransferRespDTO getTransfer(String outTradeNo, PayTransferTypeEnum type); } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java index beb3b4165..52b75c89c 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.framework.pay.core.client; import com.fasterxml.jackson.annotation.JsonTypeInfo; - import jakarta.validation.Validator; /** diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java index 15be7a757..da8469496 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java @@ -1,13 +1,13 @@ package cn.iocoder.yudao.framework.pay.core.client.dto.order; import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.URL; -import jakarta.validation.constraints.DecimalMin; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; import java.time.LocalDateTime; import java.util.Map; diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java index 3101633b8..06efe895f 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.framework.pay.core.client.dto.refund; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -7,10 +10,6 @@ import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.URL; -import jakarta.validation.constraints.DecimalMin; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - /** * 统一 退款 Request DTO * diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java index 400abb510..0f9b48240 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java @@ -29,7 +29,7 @@ public class PayTransferRespDTO { /** * 支付渠道编号 */ - private String channelOrderNo; + private String channelTransferNo; /** * 支付成功时间 @@ -53,11 +53,24 @@ public class PayTransferRespDTO { /** * 创建【WAITING】状态的转账返回 */ - public static PayTransferRespDTO waitingOf(String channelOrderNo, + public static PayTransferRespDTO waitingOf(String channelTransferNo, String outTransferNo, Object rawData) { PayTransferRespDTO respDTO = new PayTransferRespDTO(); respDTO.status = PayTransferStatusRespEnum.WAITING.getStatus(); - respDTO.channelOrderNo = channelOrderNo; + respDTO.channelTransferNo = channelTransferNo; + respDTO.outTransferNo = outTransferNo; + respDTO.rawData = rawData; + return respDTO; + } + + /** + * 创建【IN_PROGRESS】状态的转账返回 + */ + public static PayTransferRespDTO dealingOf(String channelTransferNo, + String outTransferNo, Object rawData) { + PayTransferRespDTO respDTO = new PayTransferRespDTO(); + respDTO.status = PayTransferStatusRespEnum.IN_PROGRESS.getStatus(); + respDTO.channelTransferNo = channelTransferNo; respDTO.outTransferNo = outTransferNo; respDTO.rawData = rawData; return respDTO; @@ -85,7 +98,7 @@ public class PayTransferRespDTO { String outTransferNo, Object rawData) { PayTransferRespDTO respDTO = new PayTransferRespDTO(); respDTO.status = PayTransferStatusRespEnum.SUCCESS.getStatus(); - respDTO.channelOrderNo = channelTransferNo; + respDTO.channelTransferNo = channelTransferNo; respDTO.successTime = successTime; // 相对通用的字段 respDTO.outTransferNo = outTransferNo; diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java index b41f957ca..b945912dc 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java @@ -2,14 +2,18 @@ package cn.iocoder.yudao.framework.pay.core.client.dto.transfer; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.hibernate.validator.constraints.Length; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; import java.util.Map; +import static cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum.Alipay; +import static cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum.WxPay; + /** * 统一转账 Request DTO * @@ -48,19 +52,28 @@ public class PayTransferUnifiedReqDTO { */ @NotEmpty(message = "转账标题不能为空") @Length(max = 128, message = "转账标题不能超过 128") - private String title; + private String subject; /** - * 收款方信息。 - * - * 转账类型 {@link #type} 不同,收款方信息不同 + * 收款人姓名 */ - @NotEmpty(message = "收款方信息 不能为空") - private Map payeeInfo; + @NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class}) + private String userName; + + /** + * 支付宝登录号 + */ + @NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class}) + private String alipayLogonId; + + /** + * 微信 openId + */ + @NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class}) + private String openid; /** * 支付渠道的额外参数 */ private Map channelExtras; - } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java index 49114fb5b..82d68b58f 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java @@ -11,10 +11,13 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReq import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; +import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import lombok.extern.slf4j.Slf4j; import java.util.Map; +import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; /** @@ -185,11 +188,11 @@ public abstract class AbstractPayClient implemen @Override public final PayTransferRespDTO unifiedTransfer(PayTransferUnifiedReqDTO reqDTO) { - ValidationUtils.validate(reqDTO); + validatePayTransferReqDTO(reqDTO); PayTransferRespDTO resp; - try{ + try { resp = doUnifiedTransfer(reqDTO); - }catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可 + } catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可 throw ex; } catch (Throwable ex) { // 系统异常,则包装成 PayException 异常抛出 @@ -199,10 +202,42 @@ public abstract class AbstractPayClient implemen } return resp; } + private void validatePayTransferReqDTO(PayTransferUnifiedReqDTO reqDTO) { + PayTransferTypeEnum transferType = PayTransferTypeEnum.typeOf(reqDTO.getType()); + switch (transferType) { + case ALIPAY_BALANCE: { + ValidationUtils.validate(reqDTO, PayTransferTypeEnum.Alipay.class); + break; + } + case WX_BALANCE: { + ValidationUtils.validate(reqDTO, PayTransferTypeEnum.WxPay.class); + break; + } + default: { + throw exception(NOT_IMPLEMENTED); + } + } + } + + @Override + public final PayTransferRespDTO getTransfer(String outTradeNo, PayTransferTypeEnum type) { + try { + return doGetTransfer(outTradeNo, type); + } catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可 + throw ex; + } catch (Throwable ex) { + log.error("[getTransfer][客户端({}) outTradeNo({}) type({}) 查询转账单异常]", + getId(), outTradeNo, type, ex); + throw buildPayException(ex); + } + } protected abstract PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) throws Throwable; + protected abstract PayTransferRespDTO doGetTransfer(String outTradeNo, PayTransferTypeEnum type) + throws Throwable; + // ========== 各种工具方法 ========== private PayException buildPayException(Throwable ex) { diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java index 80581f304..4f35cae90 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl; import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; -import lombok.Data; - import jakarta.validation.Validator; +import lombok.Data; /** * 无需任何配置 PayClientConfig 实现类 diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java index 0b39587ab..815f8d4a6 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java @@ -44,6 +44,7 @@ public class PayClientFactoryImpl implements PayClientFactory { clientClass.put(WX_APP, WxAppPayClient.class); clientClass.put(WX_BAR, WxBarPayClient.class); clientClass.put(WX_NATIVE, WxNativePayClient.class); + clientClass.put(WX_WAP, WxWapPayClient.class); // 支付包支付客户端 clientClass.put(ALIPAY_WAP, AlipayWapPayClient.class); clientClass.put(ALIPAY_QR, AlipayQrPayClient.class); diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java index cb8a0df6e..4dcf23675 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java @@ -23,14 +23,8 @@ import com.alipay.api.AlipayResponse; import com.alipay.api.DefaultAlipayClient; import com.alipay.api.domain.*; import com.alipay.api.internal.util.AlipaySignature; -import com.alipay.api.request.AlipayFundTransUniTransferRequest; -import com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest; -import com.alipay.api.request.AlipayTradeQueryRequest; -import com.alipay.api.request.AlipayTradeRefundRequest; -import com.alipay.api.response.AlipayFundTransUniTransferResponse; -import com.alipay.api.response.AlipayTradeFastpayRefundQueryResponse; -import com.alipay.api.response.AlipayTradeQueryResponse; -import com.alipay.api.response.AlipayTradeRefundResponse; +import com.alipay.api.request.*; +import com.alipay.api.response.*; import lombok.Getter; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -43,7 +37,8 @@ import java.util.Objects; import java.util.function.Supplier; import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER; -import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; +import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; @@ -125,7 +120,7 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient { + Assert.notNull(status, () -> { throw new IllegalArgumentException(StrUtil.format("body({}) 的 trade_status 不正确", response.getBody())); }); return PayOrderRespDTO.of(status, response.getTradeNo(), response.getBuyerUserId(), LocalDateTimeUtil.of(response.getSendPayDate()), @@ -227,64 +222,107 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient { throw new UnsupportedOperationException("待实现"); } + @Override + protected PayTransferRespDTO doGetTransfer(String outTradeNo, PayTransferTypeEnum type) { + throw new UnsupportedOperationException("待实现"); + } + } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/mock/MockPayClientConfig.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/mock/MockPayClientConfig.java deleted file mode 100644 index e6e402be7..000000000 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/mock/MockPayClientConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.framework.pay.core.client.impl.mock; - -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; -import lombok.Data; - -import jakarta.validation.Validator; - -/** - * 模拟支付的 PayClientConfig 实现类 - * - * @author jason - */ -@Data -public class MockPayClientConfig implements PayClientConfig { - - /** - * 配置名称 - * - * 如果不加任何属性,JsonUtils.parseObject2 解析会报错,所以暂时加个名称 - */ - private String name; - - @Override - public void validate(Validator validator) { - // 模拟支付配置无需校验 - } - -} diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java index bd361e9c0..a8c50cf1c 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java @@ -16,6 +16,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDT import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; +import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Result; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; @@ -70,6 +71,7 @@ public abstract class AbstractWxPayClient extends AbstractPayClientH5下单API + * + * @author YYQ + */ +@Slf4j +public class WxWapPayClient extends AbstractWxPayClient { + + public WxWapPayClient(Long channelId, WxPayClientConfig config) { + super(channelId, PayChannelEnum.WX_WAP.getCode(), config); + } + + protected WxWapPayClient(Long channelId, String channelCode, WxPayClientConfig config) { + super(channelId, channelCode, config); + } + + @Override + protected void doInit() { + super.doInit(WxPayConstants.TradeType.MWEB); + } + + @Override + protected PayOrderRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderRequest request = buildPayUnifiedOrderRequestV2(reqDTO); + // 执行请求 + WxPayMwebOrderResult response = client.createOrder(request); + + // 转换结果 + return PayOrderRespDTO.waitingOf(PayOrderDisplayModeEnum.URL.getMode(), response.getMwebUrl(), + reqDTO.getOutTradeNo(), response); + } + + @Override + protected PayOrderRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderV3Request request = buildPayUnifiedOrderRequestV3(reqDTO); + // 执行请求 + String response = client.createOrderV3(TradeTypeEnum.H5, request); + + // 转换结果 + return PayOrderRespDTO.waitingOf(PayOrderDisplayModeEnum.URL.getMode(), response, + reqDTO.getOutTradeNo(), response); + } + +} diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java index e049ad33e..24f51bbb0 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java @@ -21,6 +21,7 @@ public enum PayChannelEnum { WX_LITE("wx_lite", "微信小程序支付", WxPayClientConfig.class), WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class), WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class), + WX_WAP("wx_wap", "微信 Wap 网站支付", WxPayClientConfig.class), // H5 网页 WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class), ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), @@ -62,4 +63,7 @@ public enum PayChannelEnum { return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); } + public static boolean isAlipay(String channelCode) { + return channelCode != null && channelCode.startsWith("alipay"); + } } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferStatusRespEnum.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferStatusRespEnum.java index 145a470cc..35ea344da 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferStatusRespEnum.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferStatusRespEnum.java @@ -14,7 +14,7 @@ import java.util.Objects; @AllArgsConstructor public enum PayTransferStatusRespEnum { - WAITING(0, "转账中"), + WAITING(0, "等待转账"), /** * TODO 转账到银行卡. 会有T+0 T+1 到账的请情况。 还未实现 @@ -38,4 +38,8 @@ public enum PayTransferStatusRespEnum { public static boolean isClosed(Integer status) { return Objects.equals(status, CLOSED.getStatus()); } + + public static boolean isInProgress(Integer status) { + return Objects.equals(status, IN_PROGRESS.getStatus()); + } } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferTypeEnum.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferTypeEnum.java index 2de6fd21f..a7580f013 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferTypeEnum.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferTypeEnum.java @@ -21,8 +21,11 @@ public enum PayTransferTypeEnum implements IntArrayValuable { BANK_CARD(3, "银行卡"), WALLET_BALANCE(4, "钱包余额"); - public static final String ALIPAY_LOGON_ID = "ALIPAY_LOGON_ID"; - public static final String ALIPAY_ACCOUNT_NAME = "ALIPAY_ACCOUNT_NAME"; + public interface WxPay { + } + + public interface Alipay { + } private final Integer type; private final String name; diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test-integration/java/cn/iocoder/yudao/framework/core/client/impl/PayClientFactoryImplTest.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test-integration/java/cn/iocoder/yudao/framework/core/client/impl/PayClientFactoryImplTest.java deleted file mode 100644 index 582840e4e..000000000 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test-integration/java/cn/iocoder/yudao/framework/core/client/impl/PayClientFactoryImplTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package cn.iocoder.yudao.framework.core.client.impl; - -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; -import cn.iocoder.yudao.framework.pay.core.client.PayClient; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; -import cn.iocoder.yudao.framework.pay.core.client.impl.PayClientFactoryImpl; -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient; -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; -import com.alipay.api.response.AlipayTradePrecreateResponse; -import org.junit.jupiter.api.Test; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; - -/** - * {@link PayClientFactoryImpl} 的集成测试 - * - * @author 芋道源码 - */ -public class PayClientFactoryImplTest { - - private final PayClientFactoryImpl payClientFactory = new PayClientFactoryImpl(); - - /** - * {@link WXPubPayClient} 的 V2 版本 - */ - @Test - public void testCreatePayClient_WX_PUB_V2() { - // 创建配置 - WXPayClientConfig config = new WXPayClientConfig(); - config.setAppId("wx041349c6f39b268b"); - config.setMchId("1545083881"); - config.setApiVersion(WXPayClientConfig.API_VERSION_V2); - config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p"); - // 创建客户端 - Long channelId = RandomUtil.randomLong(); - payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config); - PayClient client = payClientFactory.getPayClient(channelId); - // 发起支付 - PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); - CommonResult result = client.unifiedOrder(reqDTO); - System.out.println(result); - } - - /** - * {@link WXPubPayClient} 的 V3 版本 - */ - @Test - public void testCreatePayClient_WX_PUB_V3() throws FileNotFoundException { - // 创建配置 - WXPayClientConfig config = new WXPayClientConfig(); - config.setAppId("wx041349c6f39b268b"); - config.setMchId("1545083881"); - config.setApiVersion(WXPayClientConfig.API_VERSION_V3); - config.setPrivateKeyContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_key.pem"))); - config.setPrivateCertContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem"))); - config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase"); - // 创建客户端 - Long channelId = RandomUtil.randomLong(); - payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.WX_PUB.getCode(), config); - PayClient client = payClientFactory.getPayClient(channelId); - // 发起支付 - PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); - CommonResult result = client.unifiedOrder(reqDTO); - System.out.println(result); - } - - /** - * {@link AlipayQrPayClient} - */ - @Test - @SuppressWarnings("unchecked") - public void testCreatePayClient_ALIPAY_QR() { - // 创建配置 - AlipayPayClientConfig config = new AlipayPayClientConfig(); - config.setAppId("2021000118634035"); - config.setServerUrl(AlipayPayClientConfig.SERVER_URL_SANDBOX); - config.setSignType(AlipayPayClientConfig.SIGN_TYPE_DEFAULT); - config.setPrivateKey("MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCHsEV1cDupwJv890x84qbppUtRIfhaKSwSVN0thCcsDCaAsGR5MZslDkO8NCT9V4r2SVXjyY7eJUZlZd1M0C8T01Tg4UOx5LUbic0O3A1uJMy6V1n9IyYwbAW3AEZhBd5bSbPgrqvmv3NeWSTQT6Anxnllf+2iDH6zyA2fPl7cYyQtbZoDJQFGqr4F+cGh2R6akzRKNoBkAeMYwoY6es2lX8sJxCVPWUmxNUoL3tScwlSpd7Bxw0q9c/X01jMwuQ0+Va358zgFiGERTE6yD01eu40OBDXOYO3z++y+TAYHlQQ2toMO63trepo88X3xV3R44/1DH+k2pAm2IF5ixiLrAgMBAAECggEAPx3SoXcseaD7rmcGcE0p4SMfbsUDdkUSmBBbtfF0GzwnqNLkWa+mgE0rWt9SmXngTQH97vByAYmLPl1s3G82ht1V7Sk7yQMe74lhFllr8eEyTjeVx3dTK1EEM4TwN+936DTXdFsr4TELJEcJJdD0KaxcCcfBLRDs2wnitEFZ9N+GoZybVmY8w0e0MI7PLObUZ2l0X4RurQnfG9ZxjXjC7PkeMVv7cGGylpNFi3BbvkRhdhLPDC2E6wqnr9e7zk+hiENivAezXrtxtwKovzCtnWJ1r0IO14Rh47H509Ic0wFnj+o5YyUL4LdmpL7yaaH6fM7zcSLFjNZPHvZCKPwYcQKBgQDQFho98QvnL8ex4v6cry4VitGpjSXm1qP3vmMQk4rTsn8iPWtcxPjqGEqOQJjdi4Mi0VZKQOLFwlH0kl95wNrD/isJ4O1yeYfX7YAXApzHqYNINzM79HemO3Yx1qLMW3okRFJ9pPRzbQ9qkTpsaegsmyX316zOBhzGRYjKbutTYwKBgQCm7phr9XdFW5Vh+XR90mVs483nrLmMiDKg7YKxSLJ8amiDjzPejCn7i95Hah08P+2MIZLIPbh2VLacczR6ltRRzN5bg5etFuqSgfkuHyxpoDmpjbe08+Q2h8JBYqcC5Nhv1AKU4iOUhVLHo/FBAQliMcGc/J3eiYTFC7EsNx382QKBgClb20doe7cttgFTXswBvaUmfFm45kmla924B7SpvrQpDD/f+VDtDZRp05fGmxuduSjYdtA3aVtpLiTwWu22OUUvZZqHDGruYOO4Hvdz23mL5b4ayqImCwoNU4bAZIc9v18p/UNf3/55NNE3oGcf/bev9rH2OjCQ4nM+Ktwhg8CFAoGACSgvbkShzUkv0ZcIf9ppu+ZnJh1AdGgINvGwaJ8vQ0nm/8h8NOoFZ4oNoGc+wU5Ubops7dUM6FjPR5e+OjdJ4E7Xp7d5O4J1TaIZlCEbo5OpdhaTDDcQvrkFu+Z4eN0qzj+YAKjDAOOrXc4tbr5q0FsgXscwtcNfaBuzFVTUrUkCgYEAwzPnMNhWG3zOWLUs2QFA2GP4Y+J8cpUYfj6pbKKzeLwyG9qBwF1NJpN8m+q9q7V9P2LY+9Lp9e1mGsGeqt5HMEA3P6vIpcqLJLqE/4PBLLRzfccTcmqb1m71+erxTRhHBRkGS+I7dZEb3olQfnS1Y1tpMBxiwYwR3LW4oXuJwj8="); - config.setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnq90KnF4dTnlzzmxpujbI05OYqi5WxAS6cL0gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBNlrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB"); - // 创建客户端 - Long channelId = RandomUtil.randomLong(); - payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config); - PayClient client = payClientFactory.getPayClient(channelId); - // 发起支付 - PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); - reqDTO.setNotifyUrl("http://niubi.natapp1.cc/api/pay/order/notify/alipay-qr/1"); // TODO @tina: 这里改成你的 natapp 回调地址 - CommonResult result = (CommonResult) client.unifiedOrder(reqDTO); - System.out.println(JsonUtils.toJsonString(result)); - System.out.println(result.getData().getQrCode()); - } - - /** - * {@link AlipayWapPayClient} - */ - @Test - public void testCreatePayClient_ALIPAY_WAP() { - // 创建配置 - AlipayPayClientConfig config = new AlipayPayClientConfig(); - config.setAppId("2021000118634035"); - config.setServerUrl(AlipayPayClientConfig.SERVER_URL_SANDBOX); - config.setSignType(AlipayPayClientConfig.SIGN_TYPE_DEFAULT); - config.setPrivateKey("MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCHsEV1cDupwJv890x84qbppUtRIfhaKSwSVN0thCcsDCaAsGR5MZslDkO8NCT9V4r2SVXjyY7eJUZlZd1M0C8T01Tg4UOx5LUbic0O3A1uJMy6V1n9IyYwbAW3AEZhBd5bSbPgrqvmv3NeWSTQT6Anxnllf+2iDH6zyA2fPl7cYyQtbZoDJQFGqr4F+cGh2R6akzRKNoBkAeMYwoY6es2lX8sJxCVPWUmxNUoL3tScwlSpd7Bxw0q9c/X01jMwuQ0+Va358zgFiGERTE6yD01eu40OBDXOYO3z++y+TAYHlQQ2toMO63trepo88X3xV3R44/1DH+k2pAm2IF5ixiLrAgMBAAECggEAPx3SoXcseaD7rmcGcE0p4SMfbsUDdkUSmBBbtfF0GzwnqNLkWa+mgE0rWt9SmXngTQH97vByAYmLPl1s3G82ht1V7Sk7yQMe74lhFllr8eEyTjeVx3dTK1EEM4TwN+936DTXdFsr4TELJEcJJdD0KaxcCcfBLRDs2wnitEFZ9N+GoZybVmY8w0e0MI7PLObUZ2l0X4RurQnfG9ZxjXjC7PkeMVv7cGGylpNFi3BbvkRhdhLPDC2E6wqnr9e7zk+hiENivAezXrtxtwKovzCtnWJ1r0IO14Rh47H509Ic0wFnj+o5YyUL4LdmpL7yaaH6fM7zcSLFjNZPHvZCKPwYcQKBgQDQFho98QvnL8ex4v6cry4VitGpjSXm1qP3vmMQk4rTsn8iPWtcxPjqGEqOQJjdi4Mi0VZKQOLFwlH0kl95wNrD/isJ4O1yeYfX7YAXApzHqYNINzM79HemO3Yx1qLMW3okRFJ9pPRzbQ9qkTpsaegsmyX316zOBhzGRYjKbutTYwKBgQCm7phr9XdFW5Vh+XR90mVs483nrLmMiDKg7YKxSLJ8amiDjzPejCn7i95Hah08P+2MIZLIPbh2VLacczR6ltRRzN5bg5etFuqSgfkuHyxpoDmpjbe08+Q2h8JBYqcC5Nhv1AKU4iOUhVLHo/FBAQliMcGc/J3eiYTFC7EsNx382QKBgClb20doe7cttgFTXswBvaUmfFm45kmla924B7SpvrQpDD/f+VDtDZRp05fGmxuduSjYdtA3aVtpLiTwWu22OUUvZZqHDGruYOO4Hvdz23mL5b4ayqImCwoNU4bAZIc9v18p/UNf3/55NNE3oGcf/bev9rH2OjCQ4nM+Ktwhg8CFAoGACSgvbkShzUkv0ZcIf9ppu+ZnJh1AdGgINvGwaJ8vQ0nm/8h8NOoFZ4oNoGc+wU5Ubops7dUM6FjPR5e+OjdJ4E7Xp7d5O4J1TaIZlCEbo5OpdhaTDDcQvrkFu+Z4eN0qzj+YAKjDAOOrXc4tbr5q0FsgXscwtcNfaBuzFVTUrUkCgYEAwzPnMNhWG3zOWLUs2QFA2GP4Y+J8cpUYfj6pbKKzeLwyG9qBwF1NJpN8m+q9q7V9P2LY+9Lp9e1mGsGeqt5HMEA3P6vIpcqLJLqE/4PBLLRzfccTcmqb1m71+erxTRhHBRkGS+I7dZEb3olQfnS1Y1tpMBxiwYwR3LW4oXuJwj8="); - config.setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnq90KnF4dTnlzzmxpujbI05OYqi5WxAS6cL0gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBNlrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB"); - // 创建客户端 - Long channelId = RandomUtil.randomLong(); - payClientFactory.createOrUpdatePayClient(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config); - PayClient client = payClientFactory.getPayClient(channelId); - // 发起支付 - PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO(); - CommonResult result = client.unifiedOrder(reqDTO); - System.out.println(JsonUtils.toJsonString(result)); - } - - private static PayOrderUnifiedReqDTO buildPayOrderUnifiedReqDTO() { - PayOrderUnifiedReqDTO reqDTO = new PayOrderUnifiedReqDTO(); - reqDTO.setAmount(123L); - reqDTO.setSubject("IPhone 13"); - reqDTO.setBody("biubiubiu"); - reqDTO.setMerchantOrderId(String.valueOf(System.currentTimeMillis())); - reqDTO.setUserIp("127.0.0.1"); - reqDTO.setNotifyUrl("http://127.0.0.1:8080"); - return reqDTO; - } - -} From ec62043a657a7f7b9d0b1d660ef35edd6e6d46ad Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 21 Jul 2024 18:03:31 +0800 Subject: [PATCH 17/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9ABaseMapperX=20?= =?UTF-8?q?=E7=9A=84=E5=88=86=E9=A1=B5=20pageSize=20=E4=B8=8D=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=88=A4=E6=96=AD=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/mybatis/core/mapper/BaseMapperX.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java index 8dca318de..3f1cb3e2b 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java @@ -56,7 +56,7 @@ public interface BaseMapperX extends MPJBaseMapper { default PageResult selectJoinPage(PageParam pageParam, Class clazz, MPJLambdaWrapper lambdaWrapper) { // 特殊:不分页,直接查询全部 - if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageNo())) { + if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) { List list = selectJoinList(clazz, lambdaWrapper); return new PageResult<>(list, (long) list.size()); } From a981ad6e1ca94be04aa827e8115f69ec84cf275e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 22 Jul 2024 22:32:00 +0800 Subject: [PATCH 18/27] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E3=80=91BOOT?= =?UTF-8?q?=20=E5=92=8C=20CLOUD=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seckill/SeckillActivityController.java | 2 +- .../seckill/SeckillConfigController.java | 2 +- .../seckill/AppSeckillActivityController.java | 3 +- .../seckill/AppSeckillConfigController.java | 2 +- .../CombinationActivityConvert.java | 3 +- .../SeckillActivityConvert.java | 12 +++---- .../SeckillConfigConvert.java | 2 +- .../seckill/SeckillActivityServiceImpl.java | 2 +- .../seckill/SeckillConfigServiceImpl.java | 2 +- .../brokerage/BrokerageRecordMapper.java | 7 ++-- .../brokerage/BrokerageRecordService.java | 3 +- .../brokerage/BrokerageRecordServiceImpl.java | 36 ++++++++++--------- .../brokerage/BrokerageUserService.java | 11 ------ .../brokerage/BrokerageUserServiceImpl.java | 5 --- .../handler/TradeBrokerageOrderHandler.java | 6 +--- 15 files changed, 39 insertions(+), 59 deletions(-) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/{seckillactivity => }/SeckillActivityConvert.java (93%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/{seckillconfig => }/SeckillConfigConvert.java (95%) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillActivityController.java index 0b40f915b..2cc22fddc 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillActivityController.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.*; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillProductDO; import cn.iocoder.yudao.module.promotion.service.seckill.SeckillActivityService; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java index 093003bac..6d3932574 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.*; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillConfigConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.service.seckill.SeckillConfigService; import io.swagger.v3.oas.annotations.Operation; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java index 8a6b020d0..a7a27bab8 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java @@ -12,7 +12,7 @@ import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppS import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityNowRespVO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityPageReqVO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityRespVO; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillProductDO; @@ -38,7 +38,6 @@ import java.time.LocalTime; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildCache; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.findFirst; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java index 6da59751f..6b6489fd4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.app.seckill; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config.AppSeckillConfigRespVO; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillConfigConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.service.seckill.SeckillConfigService; import io.swagger.v3.oas.annotations.Operation; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java index 965459b77..8acdac6ee 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java @@ -68,10 +68,11 @@ public interface CombinationActivityConvert { List spuList) { PageResult pageResult = convertPage(page); Map spuMap = convertMap(spuList, ProductSpuRespDTO::getId); + Map> productMap = convertMultiMap(productList, CombinationProductDO::getActivityId); pageResult.getList().forEach(item -> { MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()) .setMarketPrice(spu.getMarketPrice())); - item.setProducts(convertList2(productList)); + item.setProducts(convertList2(productMap.get(item.getId()))); // 设置统计字段 item.setGroupCount(groupCountMap.getOrDefault(item.getId(), 0)) .setGroupSuccessCount(groupSuccessCountMap.getOrDefault(item.getId(), 0)) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillActivityConvert.java similarity index 93% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillActivityConvert.java index 4f53cf3dc..10259cb69 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillActivityConvert.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity; +package cn.iocoder.yudao.module.promotion.convert.seckill; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.Sec import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityDetailRespVO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityNowRespVO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityRespVO; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillProductDO; @@ -56,10 +55,11 @@ public interface SeckillActivityConvert { PageResult pageResult = convertPage(page); // 拼接商品 Map spuMap = CollectionUtils.convertMap(spuList, ProductSpuRespDTO::getId); - pageResult.getList().forEach(item -> { - item.setProducts(convertList2(seckillProducts)); - MapUtils.findAndThen(spuMap, item.getSpuId(), - spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); + Map> productMap = convertMultiMap(seckillProducts, SeckillProductDO::getActivityId); + pageResult.getList().forEach(activity -> { + activity.setProducts(convertList2(productMap.get(activity.getId()))); + MapUtils.findAndThen(spuMap, activity.getSpuId(), + spu -> activity.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); }); return pageResult; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillConfigConvert.java similarity index 95% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillConfigConvert.java index f8dd77440..4d4e4a454 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillConfigConvert.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig; +package cn.iocoder.yudao.module.promotion.convert.seckill; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java index 99cc44472..227e17bee 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java @@ -17,7 +17,7 @@ import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.Se import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductBaseVO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityPageReqVO; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillProductDO; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigServiceImpl.java index c9d5c8930..e2e54896e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigServiceImpl.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigPageReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert; +import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillConfigConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillconfig.SeckillConfigMapper; import jakarta.annotation.Resource; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java index 388f927ad..7034f9ea5 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java @@ -50,10 +50,9 @@ public interface BrokerageRecordMapper extends BaseMapperX { .eq(BrokerageRecordDO::getStatus, status)); } - default BrokerageRecordDO selectByBizTypeAndBizIdAndUserId(Integer bizType, String bizId, Long userId) { - return selectOne(BrokerageRecordDO::getBizType, bizType, - BrokerageRecordDO::getBizId, bizId, - BrokerageRecordDO::getUserId, userId); + default List selectListByBizTypeAndBizId(Integer bizType, String bizId) { + return selectList(BrokerageRecordDO::getBizType, bizType, + BrokerageRecordDO::getBizId, bizId); } default List selectCountAndSumPriceByUserIdInAndBizTypeAndStatus(Collection userIds, diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordService.java index b5b5a27d5..5869889f2 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordService.java @@ -78,11 +78,10 @@ public interface BrokerageRecordService { /** * 取消佣金:将佣金记录,状态修改为已失效 * - * @param userId 会员编号 * @param bizType 业务类型 * @param bizId 业务编号 */ - void cancelBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, String bizId); + void cancelBrokerage(BrokerageRecordBizTypeEnum bizType, String bizId); /** * 解冻佣金:将待结算的佣金记录,状态修改为已结算 diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java index 53de4d2d6..660727083 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java @@ -107,27 +107,29 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService { @Override @Transactional(rollbackFor = Exception.class) - public void cancelBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, String bizId) { - BrokerageRecordDO record = brokerageRecordMapper.selectByBizTypeAndBizIdAndUserId(bizType.getType(), bizId, userId); - if (record == null) { - log.error("[cancelBrokerage][userId({})][bizId({}) 更新为已失效失败:记录不存在]", userId, bizId); + public void cancelBrokerage(BrokerageRecordBizTypeEnum bizType, String bizId) { + List records = brokerageRecordMapper.selectListByBizTypeAndBizId(bizType.getType(), bizId); + if (CollUtil.isEmpty(records)) { + log.error("[cancelBrokerage][bizId({}) bizType({}) 更新为已失效失败:记录不存在]", bizId, bizType); return; } - // 1. 更新佣金记录为已失效 - BrokerageRecordDO updateObj = new BrokerageRecordDO().setStatus(BrokerageRecordStatusEnum.CANCEL.getStatus()); - int updateRows = brokerageRecordMapper.updateByIdAndStatus(record.getId(), record.getStatus(), updateObj); - if (updateRows == 0) { - log.error("[cancelBrokerage][record({}) 更新为已失效失败]", record.getId()); - return; - } + records.forEach(record -> { + // 1. 更新佣金记录为已失效 + BrokerageRecordDO updateObj = new BrokerageRecordDO().setStatus(BrokerageRecordStatusEnum.CANCEL.getStatus()); + int updateRows = brokerageRecordMapper.updateByIdAndStatus(record.getId(), record.getStatus(), updateObj); + if (updateRows == 0) { + log.error("[cancelBrokerage][record({}) 更新为已失效失败]", record.getId()); + return; + } - // 2. 更新用户的佣金 - if (BrokerageRecordStatusEnum.WAIT_SETTLEMENT.getStatus().equals(record.getStatus())) { - brokerageUserService.updateUserFrozenPrice(userId, -record.getPrice()); - } else if (BrokerageRecordStatusEnum.SETTLEMENT.getStatus().equals(record.getStatus())) { - brokerageUserService.updateUserPrice(userId, -record.getPrice()); - } + // 2. 更新用户的佣金 + if (BrokerageRecordStatusEnum.WAIT_SETTLEMENT.getStatus().equals(record.getStatus())) { + brokerageUserService.updateUserFrozenPrice(record.getUserId(), -record.getPrice()); + } else if (BrokerageRecordStatusEnum.SETTLEMENT.getStatus().equals(record.getStatus())) { + brokerageUserService.updateUserPrice(record.getUserId(), -record.getPrice()); + } + }); } /** diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java index 7b6e4b110..c6ec0922e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java @@ -9,9 +9,6 @@ import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokera import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; import jakarta.validation.constraints.NotNull; -import java.util.Collection; -import java.util.List; - /** * 分销用户 Service 接口 * @@ -27,14 +24,6 @@ public interface BrokerageUserService { */ BrokerageUserDO getBrokerageUser(Long id); - /** - * 获得分销用户列表 - * - * @param ids 编号 - * @return 分销用户列表 - */ - List getBrokerageUserList(Collection ids); - /** * 获得分销用户分页 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java index 412c59213..073a8d6cc 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java @@ -60,11 +60,6 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { return brokerageUserMapper.selectById(id); } - @Override - public List getBrokerageUserList(Collection ids) { - return brokerageUserMapper.selectBatchIds(ids); - } - @Override public PageResult getBrokerageUserPage(BrokerageUserPageReqVO pageReqVO) { List childIds = getChildUserIdsByLevel(pageReqVO.getBindUserId(), pageReqVO.getLevel()); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBrokerageOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBrokerageOrderHandler.java index 03064508b..08810897f 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBrokerageOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBrokerageOrderHandler.java @@ -83,7 +83,7 @@ public class TradeBrokerageOrderHandler implements TradeOrderHandler { if (order.getBrokerageUserId() == null) { return; } - cancelBrokerage(order.getBrokerageUserId(), orderItem.getId()); + brokerageRecordService.cancelBrokerage(BrokerageRecordBizTypeEnum.ORDER, String.valueOf(orderItem.getId())); } /** @@ -111,8 +111,4 @@ public class TradeBrokerageOrderHandler implements TradeOrderHandler { brokerageRecordService.addBrokerage(userId, BrokerageRecordBizTypeEnum.ORDER, addList); } - protected void cancelBrokerage(Long userId, Long orderItemId) { - brokerageRecordService.cancelBrokerage(userId, BrokerageRecordBizTypeEnum.ORDER, String.valueOf(orderItemId)); - } - } From 74f66735c6527eea183791105383858398a7176b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 23 Jul 2024 22:40:42 +0800 Subject: [PATCH 19/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9AuserId=20=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8C=E7=9B=B4=E6=8E=A5=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=B8=8D=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SecurityFrameworkServiceImpl.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/service/SecurityFrameworkServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/service/SecurityFrameworkServiceImpl.java index 2e4dc15f5..ffa64a0b6 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/service/SecurityFrameworkServiceImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/service/SecurityFrameworkServiceImpl.java @@ -1,13 +1,7 @@ package cn.iocoder.yudao.framework.security.core.service; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.ListUtil; -import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.HashUtil; -import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.util.cache.CacheUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; @@ -20,7 +14,6 @@ import java.time.Duration; import java.util.Arrays; import java.util.List; -import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildCache; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @@ -70,7 +63,11 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService { @Override @SneakyThrows public boolean hasAnyPermissions(String... permissions) { - return hasAnyPermissionsCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(permissions))); + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return hasAnyPermissionsCache.get(new KeyValue<>(userId, Arrays.asList(permissions))); } @Override @@ -81,7 +78,11 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService { @Override @SneakyThrows public boolean hasAnyRoles(String... roles) { - return hasAnyRolesCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(roles))); + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles))); } @Override From 1c95e12aeadf5f473994d50b2b6d9631656809ee Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 23 Jul 2024 23:26:09 +0800 Subject: [PATCH 20/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E5=A4=9A=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E7=BC=93=E5=AD=98=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E7=9A=84=20Spring=20Cache=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/tenant/config/TenantProperties.java | 7 +++++++ .../tenant/config/YudaoTenantAutoConfiguration.java | 5 +++-- .../tenant/core/redis/TenantRedisCacheManager.java | 12 ++++++++++-- .../src/main/resources/application.yaml | 7 +++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/TenantProperties.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/TenantProperties.java index 7cb813ca9..b0c0217f0 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/TenantProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/TenantProperties.java @@ -39,4 +39,11 @@ public class TenantProperties { */ private Set ignoreTables = Collections.emptySet(); + /** + * 需要忽略多租户的 Spring Cache 缓存 + * + * 即默认所有缓存都开启多租户的功能,所以记得添加对应的 tenant_id 字段哟 + */ + private Set ignoreCaches = Collections.emptySet(); + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index e2cbbeb95..cd3b3659e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -133,12 +133,13 @@ public class YudaoTenantAutoConfiguration { @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate redisTemplate, RedisCacheConfiguration redisCacheConfiguration, - YudaoCacheProperties yudaoCacheProperties) { + YudaoCacheProperties yudaoCacheProperties, + TenantProperties tenantProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 - return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); + return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration, tenantProperties.getIgnoreCaches()); } } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java index 240b9209f..68a2a3e91 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.tenant.core.redis; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.redis.core.TimeoutRedisCacheManager; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import lombok.extern.slf4j.Slf4j; @@ -8,6 +9,8 @@ import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; +import java.util.Set; + /** * 多租户的 {@link RedisCacheManager} 实现类 * @@ -18,16 +21,21 @@ import org.springframework.data.redis.cache.RedisCacheWriter; @Slf4j public class TenantRedisCacheManager extends TimeoutRedisCacheManager { + private final Set ignoreCaches; + public TenantRedisCacheManager(RedisCacheWriter cacheWriter, - RedisCacheConfiguration defaultCacheConfiguration) { + RedisCacheConfiguration defaultCacheConfiguration, + Set ignoreCaches) { super(cacheWriter, defaultCacheConfiguration); + this.ignoreCaches = ignoreCaches; } @Override public Cache getCache(String name) { // 如果开启多租户,则 name 拼接租户后缀 if (!TenantContextHolder.isIgnore() - && TenantContextHolder.getTenantId() != null) { + && TenantContextHolder.getTenantId() != null + && !CollUtil.contains(ignoreCaches, name)) { name = name + ":" + TenantContextHolder.getTenantId(); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml index 04753d148..533c34162 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml @@ -190,6 +190,13 @@ yudao: - system_mail_template - system_mail_log - system_notify_template + ignore-caches: + - permission_menu_ids + - oauth_client + - notify_template + - mail_account + - mail_template + - sms_template sms-code: # 短信验证码相关的配置项 expire-times: 10m send-frequency: 1m From c0df6eab4e9d8c86496535baf77fb7d960e8dae1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 24 Jul 2024 19:05:11 +0800 Subject: [PATCH 21/27] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E3=80=91BOOT?= =?UTF-8?q?=20=E5=92=8C=20CLOUD=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/quartz.sql | 451 ++++++++---------- .../interceptor/ApiAccessLogInterceptor.java | 36 ++ .../task/BpmProcessInstanceStatusEnum.java | 2 +- .../config/SecurityConfiguration.java | 2 +- .../app/spu/AppProductSpuController.java | 2 +- .../dal/mysql/sku/ProductSkuMapper.java | 13 +- .../dal/mysql/spu/ProductSpuMapper.java | 14 +- .../brokerage/BrokerageUserServiceImpl.java | 1 + .../service/JmReportTokenServiceImpl.java | 9 +- 9 files changed, 254 insertions(+), 276 deletions(-) diff --git a/sql/mysql/quartz.sql b/sql/mysql/quartz.sql index b4cfcc07c..21ae3918c 100644 --- a/sql/mysql/quartz.sql +++ b/sql/mysql/quartz.sql @@ -1,363 +1,284 @@ /* - 注意:仅仅需要 Quartz 定时任务的场景,可选!!! + Navicat Premium Data Transfer - Date: 30/04/2024 09:54:18 + Source Server : 127.0.0.1 MySQL + Source Server Type : MySQL + Source Server Version : 80200 (8.2.0) + Source Host : 127.0.0.1:3306 + Source Schema : ruoyi-vue-pro + + Target Server Type : MySQL + Target Server Version : 80200 (8.2.0) + File Encoding : 65001 + + Date: 24/07/2024 08:52:41 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for qrtz_blob_triggers +-- Table structure for QRTZ_BLOB_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_blob_triggers`; -CREATE TABLE `qrtz_blob_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `blob_data` blob NULL, - PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, - INDEX `sched_name` (`sched_name` ASC, `trigger_name` ASC, `trigger_group` ASC) USING BTREE, - CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_BLOB_TRIGGERS`; +CREATE TABLE `QRTZ_BLOB_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `BLOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `SCHED_NAME`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_blob_triggers +-- Records of QRTZ_BLOB_TRIGGERS -- ---------------------------- --- @format:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- -- Table structure for QRTZ_CALENDARS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_calendars`; -CREATE TABLE `qrtz_calendars` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `calendar_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `calendar` blob NOT NULL, - PRIMARY KEY (`sched_name`, `calendar_name`) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_CALENDARS`; +CREATE TABLE `QRTZ_CALENDARS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_calendars +-- Records of QRTZ_CALENDARS -- ---------------------------- --- @format:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_cron_triggers +-- Table structure for QRTZ_CRON_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_cron_triggers`; -CREATE TABLE `qrtz_cron_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_expression` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `time_zone_id` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, - CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_CRON_TRIGGERS`; +CREATE TABLE `QRTZ_CRON_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_cron_triggers +-- Records of QRTZ_CRON_TRIGGERS -- ---------------------------- --- @format:off BEGIN; -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', '* * * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); -INSERT INTO `qrtz_cron_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `cron_expression`, `time_zone_id`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'payNotifyJob', 'DEFAULT', '* * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_fired_triggers +-- Table structure for QRTZ_FIRED_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_fired_triggers`; -CREATE TABLE `qrtz_fired_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `entry_id` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `instance_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `fired_time` bigint NOT NULL, - `sched_time` bigint NOT NULL, - `priority` int NOT NULL, - `state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `job_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `is_nonconcurrent` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `requests_recovery` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - PRIMARY KEY (`sched_name`, `entry_id`) USING BTREE, - INDEX `idx_qrtz_ft_trig_inst_name` (`sched_name` ASC, `instance_name` ASC) USING BTREE, - INDEX `idx_qrtz_ft_inst_job_req_rcvry` (`sched_name` ASC, `instance_name` ASC, `requests_recovery` ASC) USING BTREE, - INDEX `idx_qrtz_ft_j_g` (`sched_name` ASC, `job_name` ASC, `job_group` ASC) USING BTREE, - INDEX `idx_qrtz_ft_jg` (`sched_name` ASC, `job_group` ASC) USING BTREE, - INDEX `idx_qrtz_ft_t_g` (`sched_name` ASC, `trigger_name` ASC, `trigger_group` ASC) USING BTREE, - INDEX `idx_qrtz_ft_tg` (`sched_name` ASC, `trigger_group` ASC) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_FIRED_TRIGGERS`; +CREATE TABLE `QRTZ_FIRED_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `ENTRY_ID` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `FIRED_TIME` bigint NOT NULL, + `SCHED_TIME` bigint NOT NULL, + `PRIORITY` int NOT NULL, + `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE, + INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_fired_triggers +-- Records of QRTZ_FIRED_TRIGGERS -- ---------------------------- --- @format:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_job_details +-- Table structure for QRTZ_JOB_DETAILS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_job_details`; -CREATE TABLE `qrtz_job_details` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `job_class_name` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `is_durable` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `is_nonconcurrent` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `is_update_data` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `requests_recovery` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_data` blob NULL, - PRIMARY KEY (`sched_name`, `job_name`, `job_group`) USING BTREE, - INDEX `idx_qrtz_j_req_recovery` (`sched_name` ASC, `requests_recovery` ASC) USING BTREE, - INDEX `idx_qrtz_j_grp` (`sched_name` ASC, `job_group` ASC) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_JOB_DETAILS`; +CREATE TABLE `QRTZ_JOB_DETAILS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_DURABLE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE, + INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_job_details +-- Records of QRTZ_JOB_DETAILS -- ---------------------------- --- @format:off BEGIN; -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000197400104A4F425F48414E444C45525F4E414D457400116163636573734C6F67436C65616E4A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000187400104A4F425F48414E444C45525F4E414D4574001A62726F6B65726167655265636F7264556E667265657A654A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001A7400104A4F425F48414E444C45525F4E414D457400106572726F724C6F67436C65616E4A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001B7400104A4F425F48414E444C45525F4E414D4574000E6A6F624C6F67436C65616E4A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000057400104A4F425F48414E444C45525F4E414D4574000C7061794E6F746966794A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000127400104A4F425F48414E444C45525F4E414D457400117061794F726465724578706972654A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000117400104A4F425F48414E444C45525F4E414D4574000F7061794F7264657253796E634A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000137400104A4F425F48414E444C45525F4E414D45740010706179526566756E6453796E634A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000157400104A4F425F48414E444C45525F4E414D4574001774726164654F726465724175746F43616E63656C4A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000177400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F436F6D6D656E744A6F627800); -INSERT INTO `qrtz_job_details` (`sched_name`, `job_name`, `job_group`, `description`, `job_class_name`, `is_durable`, `is_nonconcurrent`, `is_update_data`, `requests_recovery`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000167400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F526563656976654A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000197400104A4F425F48414E444C45525F4E414D457400116163636573734C6F67436C65616E4A6F627800), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000187400104A4F425F48414E444C45525F4E414D4574001A62726F6B65726167655265636F7264556E667265657A654A6F627800), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001A7400104A4F425F48414E444C45525F4E414D457400106572726F724C6F67436C65616E4A6F627800), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001B7400104A4F425F48414E444C45525F4E414D4574000E6A6F624C6F67436C65616E4A6F627800), ('schedulerName', 'payNotifyJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000057400104A4F425F48414E444C45525F4E414D4574000C7061794E6F746966794A6F627800), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000127400104A4F425F48414E444C45525F4E414D457400117061794F726465724578706972654A6F627800), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000117400104A4F425F48414E444C45525F4E414D4574000F7061794F7264657253796E634A6F627800), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000137400104A4F425F48414E444C45525F4E414D45740010706179526566756E6453796E634A6F627800), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000157400104A4F425F48414E444C45525F4E414D4574001774726164654F726465724175746F43616E63656C4A6F627800), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000177400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F436F6D6D656E744A6F627800), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000167400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F526563656976654A6F627800); COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_locks +-- Table structure for QRTZ_LOCKS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_locks`; -CREATE TABLE `qrtz_locks` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `lock_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`sched_name`, `lock_name`) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_LOCKS`; +CREATE TABLE `QRTZ_LOCKS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_locks +-- Records of QRTZ_LOCKS -- ---------------------------- --- @format:off BEGIN; -INSERT INTO `qrtz_locks` (`sched_name`, `lock_name`) VALUES ('schedulerName', 'STATE_ACCESS'); -INSERT INTO `qrtz_locks` (`sched_name`, `lock_name`) VALUES ('schedulerName', 'TRIGGER_ACCESS'); +INSERT INTO `QRTZ_LOCKS` (`SCHED_NAME`, `LOCK_NAME`) VALUES ('schedulerName', 'STATE_ACCESS'), ('schedulerName', 'TRIGGER_ACCESS'); COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_paused_trigger_grps +-- Table structure for QRTZ_PAUSED_TRIGGER_GRPS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; -CREATE TABLE `qrtz_paused_trigger_grps` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`sched_name`, `trigger_group`) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_PAUSED_TRIGGER_GRPS`; +CREATE TABLE `QRTZ_PAUSED_TRIGGER_GRPS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_paused_trigger_grps +-- Records of QRTZ_PAUSED_TRIGGER_GRPS -- ---------------------------- --- @format:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- -- Table structure for QRTZ_SCHEDULER_STATE -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_scheduler_state`; -CREATE TABLE `qrtz_scheduler_state` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `instance_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `last_checkin_time` bigint NOT NULL, - `checkin_interval` bigint NOT NULL, - PRIMARY KEY (`sched_name`, `instance_name`) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_SCHEDULER_STATE`; +CREATE TABLE `QRTZ_SCHEDULER_STATE` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LAST_CHECKIN_TIME` bigint NOT NULL, + `CHECKIN_INTERVAL` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_scheduler_state +-- Records of QRTZ_SCHEDULER_STATE -- ---------------------------- --- @format:off BEGIN; -INSERT INTO `qrtz_scheduler_state` (`sched_name`, `instance_name`, `last_checkin_time`, `checkin_interval`) VALUES ('schedulerName', 'MacBook-Pro.local1713489703551', 1713742509534, 15000); +INSERT INTO `QRTZ_SCHEDULER_STATE` (`SCHED_NAME`, `INSTANCE_NAME`, `LAST_CHECKIN_TIME`, `CHECKIN_INTERVAL`) VALUES ('schedulerName', 'MacBook-Pro.local1713489703551', 1713742509534, 15000); COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_simple_triggers +-- Table structure for QRTZ_SIMPLE_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_simple_triggers`; -CREATE TABLE `qrtz_simple_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `repeat_count` bigint NOT NULL, - `repeat_interval` bigint NOT NULL, - `times_triggered` bigint NOT NULL, - PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, - CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_SIMPLE_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPLE_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REPEAT_COUNT` bigint NOT NULL, + `REPEAT_INTERVAL` bigint NOT NULL, + `TIMES_TRIGGERED` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- -- Records of QRTZ_SIMPLE_TRIGGERS -- ---------------------------- --- @format:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_simprop_triggers +-- Table structure for QRTZ_SIMPROP_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_simprop_triggers`; -CREATE TABLE `qrtz_simprop_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `str_prop_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `str_prop_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `str_prop_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `int_prop_1` int NULL DEFAULT NULL, - `int_prop_2` int NULL DEFAULT NULL, - `long_prop_1` bigint NULL DEFAULT NULL, - `long_prop_2` bigint NULL DEFAULT NULL, - `dec_prop_1` decimal(13, 4) NULL DEFAULT NULL, - `dec_prop_2` decimal(13, 4) NULL DEFAULT NULL, - `bool_prop_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `bool_prop_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, - CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_SIMPROP_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPROP_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `INT_PROP_1` int NULL DEFAULT NULL, + `INT_PROP_2` int NULL DEFAULT NULL, + `LONG_PROP_1` bigint NULL DEFAULT NULL, + `LONG_PROP_2` bigint NULL DEFAULT NULL, + `DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL, + `DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL, + `BOOL_PROP_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `BOOL_PROP_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_simprop_triggers +-- Records of QRTZ_SIMPROP_TRIGGERS -- ---------------------------- --- @formatter:off BEGIN; COMMIT; --- @formatter:on -- ---------------------------- --- Table structure for qrtz_triggers +-- Table structure for QRTZ_TRIGGERS -- ---------------------------- -DROP TABLE IF EXISTS `qrtz_triggers`; -CREATE TABLE `qrtz_triggers` -( - `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `job_group` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `next_fire_time` bigint NULL DEFAULT NULL, - `prev_fire_time` bigint NULL DEFAULT NULL, - `priority` int NULL DEFAULT NULL, - `trigger_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `trigger_type` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `start_time` bigint NOT NULL, - `end_time` bigint NULL DEFAULT NULL, - `calendar_name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, - `misfire_instr` smallint NULL DEFAULT NULL, - `job_data` blob NULL, - PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, - INDEX `idx_qrtz_t_j` (`sched_name` ASC, `job_name` ASC, `job_group` ASC) USING BTREE, - INDEX `idx_qrtz_t_jg` (`sched_name` ASC, `job_group` ASC) USING BTREE, - INDEX `idx_qrtz_t_c` (`sched_name` ASC, `calendar_name` ASC) USING BTREE, - INDEX `idx_qrtz_t_g` (`sched_name` ASC, `trigger_group` ASC) USING BTREE, - INDEX `idx_qrtz_t_state` (`sched_name` ASC, `trigger_state` ASC) USING BTREE, - INDEX `idx_qrtz_t_n_state` (`sched_name` ASC, `trigger_name` ASC, `trigger_group` ASC, `trigger_state` - ASC) USING BTREE, - INDEX `idx_qrtz_t_n_g_state` (`sched_name` ASC, `trigger_group` ASC, `trigger_state` ASC) USING BTREE, - INDEX `idx_qrtz_t_next_fire_time` (`sched_name` ASC, `next_fire_time` ASC) USING BTREE, - INDEX `idx_qrtz_t_nft_st` (`sched_name` ASC, `trigger_state` ASC, `next_fire_time` ASC) USING BTREE, - INDEX `idx_qrtz_t_nft_misfire` (`sched_name` ASC, `misfire_instr` ASC, `next_fire_time` ASC) USING BTREE, - INDEX `idx_qrtz_t_nft_st_misfire` (`sched_name` ASC, `misfire_instr` ASC, `next_fire_time` ASC, `trigger_state` - ASC) USING BTREE, - INDEX `idx_qrtz_t_nft_st_misfire_grp` (`sched_name` ASC, `misfire_instr` ASC, `next_fire_time` ASC, `trigger_group` - ASC, `trigger_state` ASC) USING BTREE, - CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `QRTZ_TRIGGERS`; +CREATE TABLE `QRTZ_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `NEXT_FIRE_TIME` bigint NULL DEFAULT NULL, + `PREV_FIRE_TIME` bigint NULL DEFAULT NULL, + `PRIORITY` int NULL DEFAULT NULL, + `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `START_TIME` bigint NOT NULL, + `END_TIME` bigint NULL DEFAULT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `MISFIRE_INSTR` smallint NULL DEFAULT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_J`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_C`(`SCHED_NAME` ASC, `CALENDAR_NAME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_G`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; -- ---------------------------- --- Records of qrtz_triggers +-- Records of QRTZ_TRIGGERS -- ---------------------------- --- @format:off BEGIN; -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', 'accessLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696301981000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 1695909720000, -1, 5, 'PAUSED', 'CRON', 1695909706000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', 'errorLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302043000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', 'jobLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302092000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', 'payNotifyJob', 'DEFAULT', NULL, 1688907102000, 1688907101000, 5, 'PAUSED', 'CRON', 1635294882000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', 'payOrderExpireJob', 'DEFAULT', NULL, 1690011600000, -1, 5, 'PAUSED', 'CRON', 1690011553000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', 'payOrderSyncJob', 'DEFAULT', NULL, 1690011600000, 1690011540000, 5, 'PAUSED', 'CRON', 1690007785000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', 'payRefundSyncJob', 'DEFAULT', NULL, 1690117560000, 1690117500000, 5, 'PAUSED', 'CRON', 1690117424000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 1695727440000, 1695727380000, 5, 'PAUSED', 'CRON', 1695656605000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 1695783840000, 1695783780000, 5, 'PAUSED', 'CRON', 1695742709000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); -INSERT INTO `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`, `job_name`, `job_group`, `description`, `next_fire_time`, `prev_fire_time`, `priority`, `trigger_state`, `trigger_type`, `start_time`, `end_time`, `calendar_name`, `misfire_instr`, `job_data`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 1695742740000, 1695742680000, 5, 'PAUSED', 'CRON', 1695727433000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', 'accessLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696301981000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 1695909720000, -1, 5, 'PAUSED', 'CRON', 1695909706000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', 'errorLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302043000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', 'jobLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302092000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'payNotifyJob', 'DEFAULT', 'payNotifyJob', 'DEFAULT', NULL, 1688907102000, 1688907101000, 5, 'PAUSED', 'CRON', 1635294882000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', 'payOrderExpireJob', 'DEFAULT', NULL, 1690011600000, -1, 5, 'PAUSED', 'CRON', 1690011553000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', 'payOrderSyncJob', 'DEFAULT', NULL, 1690011600000, 1690011540000, 5, 'PAUSED', 'CRON', 1690007785000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', 'payRefundSyncJob', 'DEFAULT', NULL, 1690117560000, 1690117500000, 5, 'PAUSED', 'CRON', 1690117424000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 1695727440000, 1695727380000, 5, 'PAUSED', 'CRON', 1695656605000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 1695783840000, 1695783780000, 5, 'PAUSED', 'CRON', 1695742709000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 1695742740000, 1695742680000, 5, 'PAUSED', 'CRON', 1695727433000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); COMMIT; --- @formatter:on -SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java index 04296ec57..7d6b45646 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.framework.apilog.core.interceptor; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.resource.ResourceUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.common.util.spring.SpringUtils; @@ -11,7 +13,11 @@ import org.springframework.util.StopWatch; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; +import java.lang.reflect.Method; +import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.stream.IntStream; /** * API 访问日志 Interceptor @@ -49,6 +55,8 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor { StopWatch stopWatch = new StopWatch(); stopWatch.start(); request.setAttribute(ATTRIBUTE_STOP_WATCH, stopWatch); + // 打印 Controller 路径 + printHandlerMethodPosition(handlerMethod); } return true; } @@ -64,4 +72,32 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor { } } + /** + * 打印 Controller 方法路径 + */ + private void printHandlerMethodPosition(HandlerMethod handlerMethod) { + if (handlerMethod == null) { + return; + } + Method method = handlerMethod.getMethod(); + Class clazz = method.getDeclaringClass(); + try { + // 获取 method 的 lineNumber + List clazzContents = FileUtil.readUtf8Lines( + ResourceUtil.getResource(null, clazz).getPath().replace("/target/classes/", "/src/main/java/") + + clazz.getSimpleName() + ".java"); + Optional lineNumber = IntStream.range(0, clazzContents.size()) + .filter(i -> clazzContents.get(i).contains(" " + method.getName() + "(")) // 简单匹配,不考虑方法重名 + .mapToObj(i -> i + 1) // 行号从 1 开始 + .findFirst(); + if (!lineNumber.isPresent()) { + return; + } + // 打印结果 + System.out.printf("\tController 方法路径:%s(%s.java:%d)\n", clazz.getName(), clazz.getSimpleName(), lineNumber.get()); + } catch (Exception ignore) { + // 忽略异常。原因:仅仅打印,非重要逻辑 + } + } + } diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java index 82a4119b5..720d4f13e 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java @@ -33,7 +33,7 @@ public enum BpmProcessInstanceStatusEnum implements IntArrayValuable { @Override public int[] array() { - return new int[0]; + return ARRAYS; } } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java index f6533609c..4f6bcb48f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java @@ -12,7 +12,7 @@ import org.springframework.security.config.annotation.web.configurers.AuthorizeH * Infra 模块的 Security 配置 */ @Configuration(proxyBeanMethods = false, value = "infraSecurityConfiguration") -public class SecurityConfiguration { +public class SecurityConfiguration { @Value("${spring.boot.admin.context-path:''}") private String adminSeverContextPath; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java index 28af46557..e4dec07f7 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java @@ -112,7 +112,7 @@ public class AppProductSpuController { productBrowseHistoryService.createBrowseHistory(getLoginUserId(), id); // 拼接返回 - spu.setBrowseCount(spu.getBrowseCount() + spu.getVirtualSalesCount()); + spu.setSalesCount(spu.getSalesCount() + spu.getVirtualSalesCount()); AppProductSpuDetailRespVO spuVO = BeanUtils.toBean(spu, AppProductSpuDetailRespVO.class) .setSkus(BeanUtils.toBean(skus, AppProductSpuDetailRespVO.Sku.class)); // 处理 vip 价格 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java index 82bfc87fa..09b47daa8 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java @@ -26,7 +26,7 @@ public interface ProductSkuMapper extends BaseMapperX { } /** - * 更新 SKU 库存(增加) + * 更新 SKU 库存(增加)、销量(减少) * * @param id 编号 * @param incrCount 增加库存(正数) @@ -34,13 +34,14 @@ public interface ProductSkuMapper extends BaseMapperX { default void updateStockIncr(Long id, Integer incrCount) { Assert.isTrue(incrCount > 0); LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper() - .setSql(" stock = stock + " + incrCount) + .setSql(" stock = stock + " + incrCount + + ", sales_count = sales_count - " + incrCount) .eq(ProductSkuDO::getId, id); update(null, lambdaUpdateWrapper); } /** - * 更新 SKU 库存(减少) + * 更新 SKU 库存(减少)、销量(增加) * * @param id 编号 * @param incrCount 减少库存(负数) @@ -48,10 +49,12 @@ public interface ProductSkuMapper extends BaseMapperX { */ default int updateStockDecr(Long id, Integer incrCount) { Assert.isTrue(incrCount < 0); + incrCount = - incrCount; // 取正 LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - .setSql(" stock = stock + " + incrCount) // 负数,所以使用 + 号 + .setSql(" stock = stock - " + incrCount + + ", sales_count = sales_count + " + incrCount) .eq(ProductSkuDO::getId, id) - .ge(ProductSkuDO::getStock, -incrCount); // cas 逻辑 + .ge(ProductSkuDO::getStock, incrCount); return update(null, updateWrapper); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java index cf8ae6483..a5926d18c 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java @@ -85,9 +85,19 @@ public interface ProductSpuMapper extends BaseMapperX { * @param incrCount 增加的库存数量 */ default void updateStock(Long id, Integer incrCount) { + // 拼接 SQL + if (incrCount == 0) { + return; + } + String sql; + if (incrCount > 0) { + sql = " stock = stock + " + incrCount + ", sales_count = sales_count - " + incrCount; + } else { + sql = " stock = stock - " + Math.abs(incrCount) + ", sales_count = sales_count + " + Math.abs(incrCount); + } + // 执行更新 LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - // 负数,所以使用 + 号 - .setSql(" stock = stock +" + incrCount) + .setSql(sql) .eq(ProductSpuDO::getId, id); update(null, updateWrapper); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java index 073a8d6cc..422c97d67 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java @@ -125,6 +125,7 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { @Override public BrokerageUserDO getOrCreateBrokerageUser(Long id) { + // TODO @芋艿:这块优化下;统一到注册时处理; BrokerageUserDO brokerageUser = brokerageUserMapper.selectById(id); // 特殊:人人分销的情况下,如果分销人为空则创建分销人 if (brokerageUser == null && ObjUtil.equal(BrokerageEnabledConditionEnum.ALL.getCondition(), diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java index bdc3d9016..a9a1b748e 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java +++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java @@ -13,11 +13,11 @@ import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi; import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; +import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; import org.springframework.http.HttpHeaders; -import jakarta.servlet.http.HttpServletRequest; import java.util.Objects; /** @@ -133,6 +133,13 @@ public class JmReportTokenServiceImpl implements JmReportTokenServiceI { @Override public String[] getRoles(String token) { + // 设置租户上下文。原因是:/jmreport/** 纯前端地址,不会走 buildLoginUserByToken 逻辑 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + if (loginUser == null) { + return null; + } + TenantContextHolder.setTenantId(loginUser.getTenantId()); + // 参见文档 https://help.jeecg.com/jimureport/prodSafe.html 文档 // 适配:如果是本系统的管理员,则转换成 jimu 报表的管理员 Long userId = SecurityFrameworkUtils.getLoginUserId(); From f717c0f9c632f82195a2d3eb6a678290c51c8144 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 24 Jul 2024 23:03:59 +0800 Subject: [PATCH 22/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91PAY=EF=BC=9A=E7=A7=BB=E9=99=A4=20PayClient=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=EF=BC=8C=E5=87=8F=E5=B0=91=E5=A4=8D=E6=9D=82?= =?UTF-8?q?=E6=80=A7=EF=BC=8C=E6=80=A7=E8=83=BD=E8=B6=B3=E5=A4=9F=EF=BC=88?= =?UTF-8?q?=E9=9D=9E=E9=AB=98=E9=A2=91=E8=AF=BB=E5=8F=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/handler/GlobalExceptionHandler.java | 15 ++++++- .../module/pay/job/order/PayOrderSyncJob.java | 4 +- .../channel/PayChannelServiceImpl.java | 42 +------------------ .../pay/core/client/PayClientFactory.java | 5 ++- .../client/impl/PayClientFactoryImpl.java | 5 ++- .../client/impl/weixin/WxNativePayClient.java | 3 +- 6 files changed, 25 insertions(+), 49 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 6935f7bee..6658d0b27 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -2,10 +2,12 @@ package cn.iocoder.yudao.framework.web.core.handler; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.JakartaServletUtil; import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.collection.SetUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; @@ -222,8 +224,17 @@ public class GlobalExceptionHandler { // 不包含的时候,才进行打印,避免 ex 堆栈过多 if (!IGNORE_ERROR_MESSAGES.contains(ex.getMessage())) { // 即使打印,也只打印第一层 StackTraceElement,并且使用 warn 在控制台输出,更容易看到 - StackTraceElement[] stackTrace = ex.getStackTrace(); - log.warn("[serviceExceptionHandler]\n\t{}", stackTrace[0]); + try { + StackTraceElement[] stackTraces = ex.getStackTrace(); + for (StackTraceElement stackTrace : stackTraces) { + if (ObjUtil.notEqual(stackTrace.getClassName(), ServiceExceptionUtil.class.getName())) { + log.warn("[serviceExceptionHandler]\n\t{}", stackTrace); + break; + } + } + } catch (Exception ignored) { + // 忽略日志,避免影响主流程 + } } return CommonResult.error(ex.getCode(), ex.getMessage()); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/order/PayOrderSyncJob.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/order/PayOrderSyncJob.java index b39032322..bd247d082 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/order/PayOrderSyncJob.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/job/order/PayOrderSyncJob.java @@ -22,9 +22,9 @@ import java.time.LocalDateTime; public class PayOrderSyncJob { /** - * 同步创建时间在 N 分钟之前的订单 + * 同步创建时间在 N 分钟之内的订单 * - * 为什么同步 10 分钟之前的订单? + * 为什么同步 10 分钟之内的订单? * 因为一个订单发起支付,到支付成功,大多数在 10 分钟内,需要保证轮询到。 * 如果设置为 30、60 或者更大时间范围,会导致轮询的订单太多,影响性能。当然,你也可以根据自己的业务情况来处理。 */ diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java index 6dde7d9a7..ba2bef7b8 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java @@ -14,22 +14,17 @@ import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; import jakarta.annotation.PostConstruct; import jakarta.annotation.Resource; import jakarta.validation.Validator; -import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import java.time.Duration; import java.util.Collection; import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; /** @@ -42,25 +37,6 @@ import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; @Validated public class PayChannelServiceImpl implements PayChannelService { - /** - * {@link PayClient} 缓存,通过它异步清空 smsClientFactory - */ - @Getter - private final LoadingCache clientCache = buildAsyncReloadingCache(Duration.ofSeconds(10L), - new CacheLoader() { - - @Override - public PayClient load(Long id) { - // 查询,然后尝试清空 - PayChannelDO channel = payChannelMapper.selectById(id); - if (channel != null) { - payClientFactory.createOrUpdatePayClient(channel.getId(), channel.getCode(), channel.getConfig()); - } - return payClientFactory.getPayClient(id); - } - - }); - @Resource private PayClientFactory payClientFactory; @@ -102,9 +78,6 @@ public class PayChannelServiceImpl implements PayChannelService { PayChannelDO channel = PayChannelConvert.INSTANCE.convert(updateReqVO) .setConfig(parseConfig(dbChannel.getCode(), updateReqVO.getConfig())); payChannelMapper.updateById(channel); - - // 清空缓存 - clearCache(channel.getId()); } /** @@ -135,18 +108,6 @@ public class PayChannelServiceImpl implements PayChannelService { // 删除 payChannelMapper.deleteById(id); - - // 清空缓存 - clearCache(id); - } - - /** - * 删除缓存 - * - * @param id 渠道编号 - */ - private void clearCache(Long id) { - clientCache.invalidate(id); } private PayChannelDO validateChannelExists(Long id) { @@ -202,7 +163,8 @@ public class PayChannelServiceImpl implements PayChannelService { @Override public PayClient getPayClient(Long id) { - return clientCache.getUnchecked(id); + PayChannelDO channel = validPayChannel(id); + return payClientFactory.createOrUpdatePayClient(id, channel.getCode(), channel.getConfig()); } } diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java index 53f1a8c06..934b20bd8 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java @@ -23,9 +23,10 @@ public interface PayClientFactory { * @param channelId 渠道编号 * @param channelCode 渠道编码 * @param config 支付配置 + * @return 支付客户端 */ - void createOrUpdatePayClient(Long channelId, String channelCode, - Config config); + PayClient createOrUpdatePayClient(Long channelId, String channelCode, + Config config); /** * 注册支付客户端 Class,用于模块中实现的 PayClient diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java index 815f8d4a6..1a50215cb 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java @@ -71,8 +71,8 @@ public class PayClientFactoryImpl implements PayClientFactory { @Override @SuppressWarnings("unchecked") - public void createOrUpdatePayClient(Long channelId, String channelCode, - Config config) { + public PayClient createOrUpdatePayClient(Long channelId, String channelCode, + Config config) { AbstractPayClient client = (AbstractPayClient) clients.get(channelId); if (client == null) { client = this.createPayClient(channelId, channelCode, config); @@ -81,6 +81,7 @@ public class PayClientFactoryImpl implements PayClientFactory { } else { client.refresh(config); } + return client; } @SuppressWarnings("unchecked") diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java index 5a073501d..7961ad510 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java @@ -34,7 +34,8 @@ public class WxNativePayClient extends AbstractWxPayClient { @Override protected PayOrderRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { // 构建 WxPayUnifiedOrderRequest 对象 - WxPayUnifiedOrderRequest request = buildPayUnifiedOrderRequestV2(reqDTO); + WxPayUnifiedOrderRequest request = buildPayUnifiedOrderRequestV2(reqDTO) + .setProductId(reqDTO.getOutTradeNo()); // V2 必须传递 productId,无需在微信配置。该参数在 V3 简化,无需传递! // 执行请求 WxPayNativeOrderResult response = client.createOrder(request); From 41f56969e12b3a1b5aa80b0b509720853f18c272 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 24 Jul 2024 23:06:11 +0800 Subject: [PATCH 23/27] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91PAY=EF=BC=9A=E7=A7=BB=E9=99=A4=20PayClient=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=EF=BC=8C=E5=87=8F=E5=B0=91=E5=A4=8D=E6=9D=82?= =?UTF-8?q?=E6=80=A7=EF=BC=8C=E6=80=A7=E8=83=BD=E8=B6=B3=E5=A4=9F=EF=BC=88?= =?UTF-8?q?=E9=9D=9E=E9=AB=98=E9=A2=91=E8=AF=BB=E5=8F=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/channel/PayChannelServiceTest.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java index 45dcb4df2..229e71795 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java @@ -13,12 +13,12 @@ import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateR import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; import com.alibaba.fastjson.JSON; -import jakarta.annotation.Resource; -import jakarta.validation.Validator; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import jakarta.annotation.Resource; +import jakarta.validation.Validator; import java.util.Collections; import java.util.List; @@ -60,8 +60,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = channelMapper.selectById(channelId); assertPojoEquals(reqVO, channel, "config"); assertPojoEquals(config, channel.getConfig()); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(channelId)); } @Test @@ -102,8 +100,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = channelMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, channel, "config"); assertPojoEquals(config, channel.getConfig()); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(channel.getId())); } @Test @@ -134,8 +130,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { channelService.deleteChannel(id); // 校验数据不存在了 assertNull(channelMapper.selectById(id)); - // 校验缓存 - assertNull(channelService.getClientCache().getIfPresent(id)); } @Test @@ -306,20 +300,20 @@ public class PayChannelServiceTest extends BaseDbUnitTest { PayChannelDO channel = randomPojo(PayChannelDO.class, o -> { o.setCode(PayChannelEnum.ALIPAY_APP.getCode()); o.setConfig(randomAlipayPayClientConfig()); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); }); channelMapper.insert(channel); // mock 参数 Long id = channel.getId(); // mock 方法 PayClient mockClient = mock(PayClient.class); - when(payClientFactory.getPayClient(eq(id))).thenReturn(mockClient); + when(payClientFactory.createOrUpdatePayClient(eq(id), eq(channel.getCode()), eq(channel.getConfig()))) + .thenReturn(mockClient); // 调用 PayClient client = channelService.getPayClient(id); // 断言 assertSame(client, mockClient); - verify(payClientFactory).createOrUpdatePayClient(eq(id), eq(channel.getCode()), - eq(channel.getConfig())); } public WxPayClientConfig randomWxPayClientConfig() { From 5fc4b5a64bf7d2919e6fde6136c7bf03eda05254 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 26 Jul 2024 09:23:32 +0800 Subject: [PATCH 24/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91PAY=EF=BC=9A=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E4=BD=BF=E7=94=A8=20certSerialNo=20=E6=9B=BF=E4=BB=A3?= =?UTF-8?q?=20privateCertContent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rule/dept/DeptDataPermissionRule.java | 2 +- .../impl/weixin/AbstractWxPayClient.java | 26 ++++++++----------- .../client/impl/weixin/WxPayClientConfig.java | 24 ++++++----------- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRule.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRule.java index af1a5a6fb..9774c59af 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRule.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRule.java @@ -157,7 +157,7 @@ public class DeptDataPermissionRule implements DataPermissionRule { // 拼接条件 return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName), // Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号 - new Parenthesis(new ExpressionList<>(CollectionUtils.convertList(deptIds, LongValue::new)))); + new Parenthesis(new ExpressionList(CollectionUtils.convertList(deptIds, LongValue::new)))); } private Expression buildUserExpression(String tableName, Alias tableAlias, Boolean self, Long userId) { diff --git a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java index a8c50cf1c..9ad4b260f 100644 --- a/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java +++ b/yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java @@ -36,6 +36,7 @@ import java.util.Objects; import static cn.hutool.core.date.DatePattern.*; import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V2; +import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V3; /** * 微信支付抽象类,实现微信统一的接口、以及部分实现(退款) @@ -59,19 +60,14 @@ public abstract class AbstractWxPayClient extends AbstractPayClient Date: Sat, 27 Jul 2024 14:02:36 +0800 Subject: [PATCH 25/27] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=EF=BC=9A?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=89=80=E6=9C=89=20xxl-job=20=E8=B5=B0=2090?= =?UTF-8?q?90=EF=BC=8C=E4=BF=9D=E6=8C=81=E5=92=8C=E3=80=8A=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E3=80=8B=E6=96=87=E6=A1=A3=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 2 +- .../src/main/resources/application-local.yaml | 2 +- .../src/main/resources/application-local.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml index 137eb9e84..f02f6aa5d 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/application-local.yaml @@ -89,7 +89,7 @@ xxl: job: enabled: false # 是否开启调度中心,默认为 true 开启 admin: - addresses: http://127.0.0.1:8000/xxl-job-admin # 调度中心部署跟地址 + addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml index f9d51e096..0d22a4a25 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/resources/application-local.yaml @@ -89,7 +89,7 @@ xxl: job: enabled: false # 是否开启调度中心,默认为 true 开启 admin: - addresses: http://127.0.0.1:8000/xxl-job-admin # 调度中心部署跟地址 + addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml index 05e42abd2..bc5cd1249 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/application-local.yaml @@ -89,7 +89,7 @@ xxl: job: enabled: false # 是否开启调度中心,默认为 true 开启 admin: - addresses: http://127.0.0.1:8000/xxl-job-admin # 调度中心部署跟地址 + addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### From c9a64030da1353d6b00b057750d72c5f56a2a86e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 27 Jul 2024 15:41:35 +0800 Subject: [PATCH 26/27] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E3=80=91BOOT?= =?UTF-8?q?=20=E5=92=8C=20CLOUD=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apilog/core/filter/ApiAccessLogFilter.java | 2 +- .../yudao/module/bpm/enums/DictTypeConstants.java | 3 --- .../vo/receivable/CrmReceivableRespVO.java | 13 +++++++------ .../controller/admin/config/ConfigController.java | 2 +- .../framework/file/core/client/s3/S3FileClient.java | 12 ++++++++++++ .../file/core/client/s3/S3FileClientConfig.java | 1 + .../module/infra/service/config/ConfigService.java | 2 +- .../src/main/resources/codegen/sql/h2.vm | 2 +- .../main/resources/codegen/vue/views/index.vue.vm | 4 ++-- .../main/resources/codegen/vue3/views/index.vue.vm | 4 ++-- .../resources/codegen/vue3_vben/views/index.vue.vm | 3 ++- .../trade/convert/order/TradeOrderConvert.java | 2 +- .../dal/mysql/brokerage/BrokerageRecordMapper.java | 4 ++-- 13 files changed, 33 insertions(+), 21 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java index a4c05a366..d0e84e837 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java @@ -181,7 +181,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { // ========== 请求和响应的脱敏逻辑,移除类似 password、token 等敏感字段 ========== private static String sanitizeMap(Map map, String[] sanitizeKeys) { - if (CollUtil.isNotEmpty(map)) { + if (CollUtil.isEmpty(map)) { return null; } if (sanitizeKeys != null) { diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java index 7abb3e1db..c00638694 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java @@ -7,7 +7,4 @@ package cn.iocoder.yudao.module.bpm.enums; */ public interface DictTypeConstants { - String TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型 - String TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本 - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java index 12dcbaa02..6d712e3a5 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; +import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; @@ -27,7 +30,8 @@ public class CrmReceivableRespVO { private Long planId; @Schema(description = "回款方式", example = "2") - @ExcelProperty("回款方式") + @ExcelProperty(value = "回款方式", converter = DictConvert.class) + @DictFormat(DictTypeConstants.CRM_RECEIVABLE_RETURN_TYPE) private Integer returnType; @Schema(description = "回款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "9000") @@ -39,7 +43,6 @@ public class CrmReceivableRespVO { private LocalDateTime returnTime; @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @ExcelProperty("客户编号") private Long customerId; @Schema(description = "客户名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") @ExcelProperty("客户名字") @@ -49,11 +52,9 @@ public class CrmReceivableRespVO { @ExcelProperty("合同编号") private Long contractId; @Schema(description = "合同信息") - @ExcelProperty("合同信息") private CrmContractRespVO contract; @Schema(description = "负责人的用户编号", example = "25682") - @ExcelProperty("负责人的用户编号") private Long ownerUserId; @Schema(description = "负责人名字", example = "25682") @ExcelProperty("负责人名字") @@ -67,7 +68,8 @@ public class CrmReceivableRespVO { private String processInstanceId; @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") - @ExcelProperty("审批状态") + @ExcelProperty(value = "审批状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.CRM_AUDIT_STATUS) private Integer auditStatus; @Schema(description = "工作流编号", example = "备注") @@ -83,7 +85,6 @@ public class CrmReceivableRespVO { private LocalDateTime updateTime; @Schema(description = "创建人", example = "25682") - @ExcelProperty("创建人") private String creator; @Schema(description = "创建人名字", example = "test") @ExcelProperty("创建人名字") diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java index d3af2a954..43e64c02a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java @@ -96,7 +96,7 @@ public class ConfigController { @Operation(summary = "导出参数配置") @PreAuthorize("@ss.hasPermission('infra:config:export')") @ApiAccessLog(operateType = EXPORT) - public void exportConfig(@Valid ConfigPageReqVO exportReqVO, + public void exportConfig(ConfigPageReqVO exportReqVO, HttpServletResponse response) throws IOException { exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List list = configService.getConfigPage(exportReqVO).getList(); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java index 67995caa2..43ff2733b 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java @@ -37,6 +37,7 @@ public class S3FileClient extends AbstractFileClient { .region(buildRegion()) // Region .credentials(config.getAccessKey(), config.getAccessSecret()) // 认证密钥 .build(); + enableVirtualStyleEndpoint(); } /** @@ -86,6 +87,17 @@ public class S3FileClient extends AbstractFileClient { return null; } + /** + * 开启 VirtualStyle 模式 + */ + private void enableVirtualStyleEndpoint() { + if (StrUtil.containsAll(config.getEndpoint(), + S3FileClientConfig.ENDPOINT_TENCENT, // 腾讯云 https://cloud.tencent.com/document/product/436/41284 + S3FileClientConfig.ENDPOINT_VOLCES)) { // 火山云 https://www.volcengine.com/docs/6349/1288493 + client.enableVirtualStyleEndpoint(); + } + } + @Override public String upload(byte[] content, String path, String type) throws Exception { // 执行上传 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClientConfig.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClientConfig.java index 3d9e3c561..d25f3deb2 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClientConfig.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClientConfig.java @@ -19,6 +19,7 @@ public class S3FileClientConfig implements FileClientConfig { public static final String ENDPOINT_QINIU = "qiniucs.com"; public static final String ENDPOINT_ALIYUN = "aliyuncs.com"; public static final String ENDPOINT_TENCENT = "myqcloud.com"; + public static final String ENDPOINT_VOLCES = "volces.com"; // 火山云(字节) /** * 节点地址 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java index 087c4669d..8ff2fb168 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java @@ -58,6 +58,6 @@ public interface ConfigService { * @param reqVO 分页条件 * @return 分页列表 */ - PageResult getConfigPage(@Valid ConfigPageReqVO reqVO); + PageResult getConfigPage(ConfigPageReqVO reqVO); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm index b22389b0b..a073fdba1 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm @@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS "${table.tableName.toLowerCase()}" ( "${column.columnName}" ${dataType} DEFAULT '', #elseif (${column.columnName} == 'deleted') "deleted" bit NOT NULL DEFAULT FALSE, - #elseif (${column.columnName} == 'tenantId') + #elseif (${column.columnName} == 'tenant_id') "tenant_id" bigint NOT NULL DEFAULT 0, #else "${column.columnName.toLowerCase()}" ${dataType}#if (${column.nullable} == false) NOT NULL#end, diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm index 2328007a0..9c1e124dc 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm @@ -306,8 +306,8 @@ export default { await this.#[[$modal]]#.confirm('是否确认导出所有${table.classComment}数据项?'); try { this.exportLoading = true; - const res = await ${simpleClassName}Api.export${simpleClassName}Excel(this.queryParams); - this.#[[$]]#download.excel(res.data, '${table.classComment}.xls'); + const data = await ${simpleClassName}Api.export${simpleClassName}Excel(this.queryParams); + this.#[[$]]#download.excel(data, '${table.classComment}.xls'); } catch { } finally { this.exportLoading = false; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm index 361d379fa..399b58e34 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm @@ -74,7 +74,7 @@ start-placeholder="开始日期" end-placeholder="结束日期" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" - class="!w-240px" + class="!w-220px" /> #end @@ -181,7 +181,7 @@ #end #end #end - +