Commit eefd5341b34057f07b603f5bc2a3d4d6e261d4bc
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into develop-api-remove
# Conflicts: # yudao-module-ai/yudao-module-ai-biz/pom.xml
Showing
150 changed files
with
762 additions
and
1002 deletions
yudao-module-ai/pom.xml
yudao-module-ai/yudao-module-ai-biz/pom.xml
| ... | ... | @@ -17,6 +17,10 @@ |
| 17 | 17 | 国内:通义千问、文心一言、讯飞星火、智谱 GLM、DeepSeek |
| 18 | 18 | 国外:OpenAI、Ollama、Midjourney、StableDiffusion、Suno |
| 19 | 19 | </description> |
| 20 | + <properties> | |
| 21 | + <spring-ai.version>1.0.0-M6</spring-ai.version> | |
| 22 | + <tinyflow.version>1.0.2</tinyflow.version> | |
| 23 | + </properties> | |
| 20 | 24 | |
| 21 | 25 | <dependencies> |
| 22 | 26 | <dependency> |
| ... | ... | @@ -24,14 +28,19 @@ |
| 24 | 28 | <artifactId>yudao-module-ai-api</artifactId> |
| 25 | 29 | <version>${revision}</version> |
| 26 | 30 | </dependency> |
| 27 | - | |
| 28 | - <!-- 业务组件 --> | |
| 29 | 31 | <dependency> |
| 30 | 32 | <groupId>cn.iocoder.boot</groupId> |
| 31 | - <artifactId>yudao-spring-boot-starter-ai</artifactId> | |
| 33 | + <artifactId>yudao-module-system-api</artifactId> | |
| 34 | + <version>${revision}</version> | |
| 35 | + </dependency> | |
| 36 | + <dependency> | |
| 37 | + <groupId>cn.iocoder.boot</groupId> | |
| 38 | + <artifactId>yudao-module-infra-api</artifactId> | |
| 32 | 39 | <version>${revision}</version> |
| 33 | 40 | </dependency> |
| 34 | 41 | |
| 42 | + <!-- 业务组件 --> | |
| 43 | + | |
| 35 | 44 | <dependency> |
| 36 | 45 | <groupId>cn.iocoder.boot</groupId> |
| 37 | 46 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> |
| ... | ... | @@ -66,5 +75,142 @@ |
| 66 | 75 | <groupId>cn.iocoder.boot</groupId> |
| 67 | 76 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 68 | 77 | </dependency> |
| 78 | + | |
| 79 | + <!-- Spring AI Model 模型接入 --> | |
| 80 | + <dependency> | |
| 81 | + <groupId>org.springframework.ai</groupId> | |
| 82 | + <artifactId>spring-ai-openai-spring-boot-starter</artifactId> | |
| 83 | + <version>${spring-ai.version}</version> | |
| 84 | + </dependency> | |
| 85 | + <dependency> | |
| 86 | + <groupId>org.springframework.ai</groupId> | |
| 87 | + <artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId> | |
| 88 | + <version>${spring-ai.version}</version> | |
| 89 | + </dependency> | |
| 90 | + <dependency> | |
| 91 | + <groupId>org.springframework.ai</groupId> | |
| 92 | + <artifactId>spring-ai-ollama-spring-boot-starter</artifactId> | |
| 93 | + <version>${spring-ai.version}</version> | |
| 94 | + </dependency> | |
| 95 | + <dependency> | |
| 96 | + <groupId>org.springframework.ai</groupId> | |
| 97 | + <artifactId>spring-ai-stability-ai-spring-boot-starter</artifactId> | |
| 98 | + <version>${spring-ai.version}</version> | |
| 99 | + </dependency> | |
| 100 | + <dependency> | |
| 101 | + <!-- 通义千问 --> | |
| 102 | + <groupId>com.alibaba.cloud.ai</groupId> | |
| 103 | + <artifactId>spring-ai-alibaba-starter</artifactId> | |
| 104 | + <version>${spring-ai.version}.1</version> | |
| 105 | + </dependency> | |
| 106 | + <dependency> | |
| 107 | + <!-- 文心一言 --> | |
| 108 | + <groupId>org.springframework.ai</groupId> | |
| 109 | + <artifactId>spring-ai-qianfan-spring-boot-starter</artifactId> | |
| 110 | + <version>${spring-ai.version}</version> | |
| 111 | + </dependency> | |
| 112 | + <dependency> | |
| 113 | + <!-- 智谱 GLM --> | |
| 114 | + <groupId>org.springframework.ai</groupId> | |
| 115 | + <artifactId>spring-ai-zhipuai-spring-boot-starter</artifactId> | |
| 116 | + <version>${spring-ai.version}</version> | |
| 117 | + </dependency> | |
| 118 | + <dependency> | |
| 119 | + <groupId>org.springframework.ai</groupId> | |
| 120 | + <artifactId>spring-ai-minimax-spring-boot-starter</artifactId> | |
| 121 | + <version>${spring-ai.version}</version> | |
| 122 | + </dependency> | |
| 123 | + <dependency> | |
| 124 | + <groupId>org.springframework.ai</groupId> | |
| 125 | + <artifactId>spring-ai-moonshot-spring-boot-starter</artifactId> | |
| 126 | + <version>${spring-ai.version}</version> | |
| 127 | + </dependency> | |
| 128 | + | |
| 129 | + <!-- 向量存储:https://db-engines.com/en/ranking/vector+dbms --> | |
| 130 | + <dependency> | |
| 131 | + <!-- Qdrant:https://qdrant.tech/ --> | |
| 132 | + <groupId>org.springframework.ai</groupId> | |
| 133 | + <artifactId>spring-ai-qdrant-store</artifactId> | |
| 134 | + <version>${spring-ai.version}</version> | |
| 135 | + </dependency> | |
| 136 | + | |
| 137 | + <dependency> | |
| 138 | + <!-- Redis:https://redis.io/docs/latest/develop/get-started/vector-database/ --> | |
| 139 | + <groupId>org.springframework.ai</groupId> | |
| 140 | + <artifactId>spring-ai-redis-store</artifactId> | |
| 141 | + <version>${spring-ai.version}</version> | |
| 142 | + </dependency> | |
| 143 | + <dependency> | |
| 144 | + <groupId>cn.iocoder.boot</groupId> | |
| 145 | + <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 146 | + </dependency> | |
| 147 | + | |
| 148 | + <dependency> | |
| 149 | + <!-- Milvus:https://milvus.io/ --> | |
| 150 | + <groupId>org.springframework.ai</groupId> | |
| 151 | + <artifactId>spring-ai-milvus-store</artifactId> | |
| 152 | + <version>${spring-ai.version}</version> | |
| 153 | + <exclusions> | |
| 154 | + <!-- 解决和 logback 的日志冲突 --> | |
| 155 | + <exclusion> | |
| 156 | + <groupId>org.slf4j</groupId> | |
| 157 | + <artifactId>slf4j-reload4j</artifactId> | |
| 158 | + </exclusion> | |
| 159 | + </exclusions> | |
| 160 | + </dependency> | |
| 161 | + | |
| 162 | + <dependency> | |
| 163 | + <!-- Tika:负责内容的解析 --> | |
| 164 | + <groupId>org.springframework.ai</groupId> | |
| 165 | + <artifactId>spring-ai-tika-document-reader</artifactId> | |
| 166 | + <version>${spring-ai.version}</version> | |
| 167 | + <!-- TODO 芋艿:boot 项目里,不引入 cloud 依赖!!!另外,这样也是为了解决启动报错的问题! --> | |
| 168 | + <exclusions> | |
| 169 | + <exclusion> | |
| 170 | + <artifactId>spring-cloud-function-context</artifactId> | |
| 171 | + <groupId>org.springframework.cloud</groupId> | |
| 172 | + </exclusion> | |
| 173 | + <exclusion> | |
| 174 | + <artifactId>spring-cloud-function-core</artifactId> | |
| 175 | + <groupId>org.springframework.cloud</groupId> | |
| 176 | + </exclusion> | |
| 177 | + </exclusions> | |
| 178 | + </dependency> | |
| 179 | + | |
| 180 | + <!-- TinyFlow:AI 工作流 --> | |
| 181 | + <dependency> | |
| 182 | + <groupId>dev.tinyflow</groupId> | |
| 183 | + <artifactId>tinyflow-java-core</artifactId> | |
| 184 | + <version>${tinyflow.version}</version> | |
| 185 | + <exclusions> | |
| 186 | + <exclusion> | |
| 187 | + <groupId>com.jfinal</groupId> | |
| 188 | + <artifactId>enjoy</artifactId> | |
| 189 | + </exclusion> | |
| 190 | + <exclusion> | |
| 191 | + <!-- 解决 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1318/ 问题 --> | |
| 192 | + <groupId>com.agentsflex</groupId> | |
| 193 | + <artifactId>agents-flex-store-elasticsearch</artifactId> | |
| 194 | + </exclusion> | |
| 195 | + <exclusion> | |
| 196 | + <!-- TODO @芋艿:暂时移除 groovy,和 iot 冲突 --> | |
| 197 | + <groupId>org.codehaus.groovy</groupId> | |
| 198 | + <artifactId>groovy-all</artifactId> | |
| 199 | + </exclusion> | |
| 200 | + <!-- 解决和 logback 的日志冲突 --> | |
| 201 | + <exclusion> | |
| 202 | + <groupId>org.slf4j</groupId> | |
| 203 | + <artifactId>slf4j-simple</artifactId> | |
| 204 | + </exclusion> | |
| 205 | + <exclusion> | |
| 206 | + <groupId>org.apache.logging.log4j</groupId> | |
| 207 | + <artifactId>log4j-slf4j-impl</artifactId> | |
| 208 | + </exclusion> | |
| 209 | + <exclusion> | |
| 210 | + <groupId>org.slf4j</groupId> | |
| 211 | + <artifactId>slf4j-reload4j</artifactId> | |
| 212 | + </exclusion> | |
| 213 | + </exclusions> | |
| 214 | + </dependency> | |
| 69 | 215 | </dependencies> |
| 70 | 216 | </project> |
| 71 | 217 | \ No newline at end of file | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.controller.admin.image; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.ObjUtil; |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/vo/AiImageRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.controller.admin.image.vo; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/model/vo/model/AiModelSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.controller.admin.model.vo.model; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiModelTypeEnum; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiModelTypeEnum; | |
| 4 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 7 | 7 | import io.swagger.v3.oas.annotations.media.Schema; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/image/AiImageDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.image; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | 5 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 6 | import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiModelDO; |
| 6 | 7 | import cn.iocoder.yudao.module.ai.enums.image.AiImageStatusEnum; |
| ... | ... | @@ -49,7 +50,7 @@ public class AiImageDO extends BaseDO { |
| 49 | 50 | /** |
| 50 | 51 | * 平台 |
| 51 | 52 | * |
| 52 | - * 枚举 {@link cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum} | |
| 53 | + * 枚举 {@link AiPlatformEnum} | |
| 53 | 54 | */ |
| 54 | 55 | private String platform; |
| 55 | 56 | /** | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/mindmap/AiMindMapDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.mindmap; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 5 | import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiModelDO; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/model/AiApiKeyDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.model; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/model/AiModelDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.model; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiModelTypeEnum; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiModelTypeEnum; | |
| 4 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 7 | 7 | import com.baomidou.mybatisplus.annotation.KeySequence; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/music/AiMusicDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.music; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 5 | import cn.iocoder.yudao.module.ai.enums.music.AiMusicGenerateModeEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.ai.enums.music.AiMusicStatusEnum; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/write/AiWriteDO.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.dal.dataobject.write; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 5 | import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiModelDO; |
| 6 | 6 | import cn.iocoder.yudao.module.ai.enums.DictTypeConstants; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiModelTypeEnum.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/enums/model/AiModelTypeEnum.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/enums/model/AiPlatformEnum.java
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/enums/package-info.java
0 → 100644
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/AiAutoConfiguration.java
| 1 | -package cn.iocoder.yudao.framework.ai.config; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.config; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.hutool.extra.spring.SpringUtil; |
| 5 | -import cn.iocoder.yudao.framework.ai.core.factory.AiModelFactory; | |
| 6 | -import cn.iocoder.yudao.framework.ai.core.factory.AiModelFactoryImpl; | |
| 7 | -import cn.iocoder.yudao.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 8 | -import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 9 | -import cn.iocoder.yudao.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 10 | -import cn.iocoder.yudao.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 11 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 12 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 13 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 14 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 15 | -import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 5 | +import cn.iocoder.yudao.module.ai.framework.ai.core.AiModelFactory; | |
| 6 | +import cn.iocoder.yudao.module.ai.framework.ai.core.AiModelFactoryImpl; | |
| 7 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 8 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 9 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 10 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 11 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 12 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 13 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 14 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 15 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 16 | 16 | import lombok.extern.slf4j.Slf4j; |
| 17 | 17 | import org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusServiceClientProperties; |
| 18 | 18 | import org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusVectorStoreProperties; |
| ... | ... | @@ -26,24 +26,24 @@ import org.springframework.ai.openai.OpenAiChatOptions; |
| 26 | 26 | import org.springframework.ai.openai.api.OpenAiApi; |
| 27 | 27 | import org.springframework.ai.tokenizer.JTokkitTokenCountEstimator; |
| 28 | 28 | import org.springframework.ai.tokenizer.TokenCountEstimator; |
| 29 | -import org.springframework.boot.autoconfigure.AutoConfiguration; | |
| 30 | 29 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| 31 | 30 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 32 | 31 | import org.springframework.context.annotation.Bean; |
| 32 | +import org.springframework.context.annotation.Configuration; | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * 芋道 AI 自动配置 |
| 36 | 36 | * |
| 37 | 37 | * @author fansili |
| 38 | 38 | */ |
| 39 | -@AutoConfiguration | |
| 39 | +@Configuration | |
| 40 | 40 | @EnableConfigurationProperties({ YudaoAiProperties.class, |
| 41 | 41 | QdrantVectorStoreProperties.class, // 解析 Qdrant 配置 |
| 42 | 42 | RedisVectorStoreProperties.class, // 解析 Redis 配置 |
| 43 | 43 | MilvusVectorStoreProperties.class, MilvusServiceClientProperties.class // 解析 Milvus 配置 |
| 44 | 44 | }) |
| 45 | 45 | @Slf4j |
| 46 | -public class YudaoAiAutoConfiguration { | |
| 46 | +public class AiAutoConfiguration { | |
| 47 | 47 | |
| 48 | 48 | @Bean |
| 49 | 49 | public AiModelFactory aiModelFactory() { | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiProperties.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/YudaoAiProperties.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/factory/AiModelFactory.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/AiModelFactory.java
| 1 | -package cn.iocoder.yudao.framework.ai.core.factory; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 5 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 5 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 6 | 6 | import org.springframework.ai.chat.model.ChatModel; |
| 7 | 7 | import org.springframework.ai.embedding.EmbeddingModel; |
| 8 | 8 | import org.springframework.ai.image.ImageModel; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/factory/AiModelFactoryImpl.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/AiModelFactoryImpl.java
| 1 | -package cn.iocoder.yudao.framework.ai.core.factory; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.FileUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| ... | ... | @@ -8,20 +8,20 @@ import cn.hutool.core.util.ArrayUtil; |
| 8 | 8 | import cn.hutool.core.util.RuntimeUtil; |
| 9 | 9 | import cn.hutool.core.util.StrUtil; |
| 10 | 10 | import cn.hutool.extra.spring.SpringUtil; |
| 11 | -import cn.iocoder.yudao.framework.ai.config.YudaoAiAutoConfiguration; | |
| 12 | -import cn.iocoder.yudao.framework.ai.config.YudaoAiProperties; | |
| 13 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 14 | -import cn.iocoder.yudao.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 15 | -import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 16 | -import cn.iocoder.yudao.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 17 | -import cn.iocoder.yudao.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 18 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 19 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 20 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 21 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageApi; | |
| 22 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageModel; | |
| 23 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 24 | -import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 11 | +import cn.iocoder.yudao.module.ai.framework.ai.config.AiAutoConfiguration; | |
| 12 | +import cn.iocoder.yudao.module.ai.framework.ai.config.YudaoAiProperties; | |
| 13 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 14 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 15 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 16 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 17 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 18 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 19 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 20 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 21 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageApi; | |
| 22 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageModel; | |
| 23 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 24 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 25 | 25 | import cn.iocoder.yudao.framework.common.util.spring.SpringUtils; |
| 26 | 26 | import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; |
| 27 | 27 | import com.alibaba.cloud.ai.dashscope.api.DashScopeApi; |
| ... | ... | @@ -361,39 +361,39 @@ public class AiModelFactoryImpl implements AiModelFactory { |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | - * 可参考 {@link YudaoAiAutoConfiguration#deepSeekChatModel(YudaoAiProperties)} | |
| 364 | + * 可参考 {@link AiAutoConfiguration#deepSeekChatModel(YudaoAiProperties)} | |
| 365 | 365 | */ |
| 366 | 366 | private static DeepSeekChatModel buildDeepSeekChatModel(String apiKey) { |
| 367 | 367 | YudaoAiProperties.DeepSeekProperties properties = new YudaoAiProperties.DeepSeekProperties() |
| 368 | 368 | .setApiKey(apiKey); |
| 369 | - return new YudaoAiAutoConfiguration().buildDeepSeekChatModel(properties); | |
| 369 | + return new AiAutoConfiguration().buildDeepSeekChatModel(properties); | |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
| 373 | - * 可参考 {@link YudaoAiAutoConfiguration#douBaoChatClient(YudaoAiProperties)} | |
| 373 | + * 可参考 {@link AiAutoConfiguration#douBaoChatClient(YudaoAiProperties)} | |
| 374 | 374 | */ |
| 375 | 375 | private ChatModel buildDouBaoChatModel(String apiKey) { |
| 376 | 376 | YudaoAiProperties.DouBaoProperties properties = new YudaoAiProperties.DouBaoProperties() |
| 377 | 377 | .setApiKey(apiKey); |
| 378 | - return new YudaoAiAutoConfiguration().buildDouBaoChatClient(properties); | |
| 378 | + return new AiAutoConfiguration().buildDouBaoChatClient(properties); | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | - * 可参考 {@link YudaoAiAutoConfiguration#hunYuanChatClient(YudaoAiProperties)} | |
| 382 | + * 可参考 {@link AiAutoConfiguration#hunYuanChatClient(YudaoAiProperties)} | |
| 383 | 383 | */ |
| 384 | 384 | private ChatModel buildHunYuanChatModel(String apiKey, String url) { |
| 385 | 385 | YudaoAiProperties.HunYuanProperties properties = new YudaoAiProperties.HunYuanProperties() |
| 386 | 386 | .setBaseUrl(url).setApiKey(apiKey); |
| 387 | - return new YudaoAiAutoConfiguration().buildHunYuanChatClient(properties); | |
| 387 | + return new AiAutoConfiguration().buildHunYuanChatClient(properties); | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
| 391 | - * 可参考 {@link YudaoAiAutoConfiguration#siliconFlowChatClient(YudaoAiProperties)} | |
| 391 | + * 可参考 {@link AiAutoConfiguration#siliconFlowChatClient(YudaoAiProperties)} | |
| 392 | 392 | */ |
| 393 | 393 | private ChatModel buildSiliconFlowChatModel(String apiKey) { |
| 394 | 394 | YudaoAiProperties.SiliconFlowProperties properties = new YudaoAiProperties.SiliconFlowProperties() |
| 395 | 395 | .setApiKey(apiKey); |
| 396 | - return new YudaoAiAutoConfiguration().buildSiliconFlowChatClient(properties); | |
| 396 | + return new AiAutoConfiguration().buildSiliconFlowChatClient(properties); | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
| ... | ... | @@ -436,23 +436,23 @@ public class AiModelFactoryImpl implements AiModelFactory { |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
| 439 | - * 可参考 {@link YudaoAiAutoConfiguration#xingHuoChatClient(YudaoAiProperties)} | |
| 439 | + * 可参考 {@link AiAutoConfiguration#xingHuoChatClient(YudaoAiProperties)} | |
| 440 | 440 | */ |
| 441 | 441 | private static XingHuoChatModel buildXingHuoChatModel(String key) { |
| 442 | 442 | List<String> keys = StrUtil.split(key, '|'); |
| 443 | 443 | Assert.equals(keys.size(), 2, "XingHuoChatClient 的密钥需要 (appKey|secretKey) 格式"); |
| 444 | 444 | YudaoAiProperties.XingHuoProperties properties = new YudaoAiProperties.XingHuoProperties() |
| 445 | 445 | .setAppKey(keys.get(0)).setSecretKey(keys.get(1)); |
| 446 | - return new YudaoAiAutoConfiguration().buildXingHuoChatClient(properties); | |
| 446 | + return new AiAutoConfiguration().buildXingHuoChatClient(properties); | |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
| 450 | - * 可参考 {@link YudaoAiAutoConfiguration#baiChuanChatClient(YudaoAiProperties)} | |
| 450 | + * 可参考 {@link AiAutoConfiguration#baiChuanChatClient(YudaoAiProperties)} | |
| 451 | 451 | */ |
| 452 | 452 | private BaiChuanChatModel buildBaiChuanChatModel(String apiKey) { |
| 453 | 453 | YudaoAiProperties.BaiChuanProperties properties = new YudaoAiProperties.BaiChuanProperties() |
| 454 | 454 | .setApiKey(apiKey); |
| 455 | - return new YudaoAiAutoConfiguration().buildBaiChuanChatClient(properties); | |
| 455 | + return new AiAutoConfiguration().buildBaiChuanChatClient(properties); | |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/baichuan/BaiChuanChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/baichuan/BaiChuanChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/deepseek/DeepSeekChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/deepseek/DeepSeekChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/doubao/DouBaoChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/doubao/DouBaoChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/hunyuan/HunYuanChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/hunyuan/HunYuanChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/midjourney/api/MidjourneyApi.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/midjourney/api/MidjourneyApi.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/siliconflow/SiliconFlowApiConstants.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/siliconflow/SiliconFlowApiConstants.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/siliconflow/SiliconFlowChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/siliconflow/SiliconFlowChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/siliconflow/SiliconFlowImageApi.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/siliconflow/SiliconFlowImageApi.java
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | * limitations under the License. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -package cn.iocoder.yudao.framework.ai.core.model.siliconflow; | |
| 17 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow; | |
| 18 | 18 | |
| 19 | 19 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 20 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/siliconflow/SiliconFlowImageModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/siliconflow/SiliconFlowImageModel.java
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | * limitations under the License. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -package cn.iocoder.yudao.framework.ai.core.model.siliconflow; | |
| 17 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow; | |
| 18 | 18 | |
| 19 | 19 | import io.micrometer.observation.ObservationRegistry; |
| 20 | 20 | import lombok.Setter; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/siliconflow/SiliconFlowImageOptions.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/siliconflow/SiliconFlowImageOptions.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/suno/api/SunoApi.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/suno/api/SunoApi.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/wenduoduo/api/WenDuoDuoPptApi.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/wenduoduo/api/WenDuoDuoPptApi.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/xinghuo/XingHuoChatModel.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XunFeiPptApi.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/xinghuo/api/XunFeiPptApi.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/package-info.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/package-info.java
| ... | ... | @@ -10,4 +10,4 @@ |
| 10 | 10 | * 6. midjourney 包:Midjourney API,对接 https://github.com/novicezk/midjourney-proxy 实现 |
| 11 | 11 | * 7. suno 包:Suno API,对接 https://github.com/gcui-art/suno-api 实现 |
| 12 | 12 | */ |
| 13 | -package cn.iocoder.yudao.framework.ai; | |
| 14 | 13 | \ No newline at end of file |
| 14 | +package cn.iocoder.yudao.module.ai.framework.ai; | |
| 15 | 15 | \ No newline at end of file | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatConversationServiceImpl.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | 5 | import cn.hutool.core.util.ObjUtil; |
| 6 | 6 | import cn.hutool.core.util.ObjectUtil; |
| 7 | -import cn.iocoder.yudao.framework.ai.core.enums.AiModelTypeEnum; | |
| 7 | +import cn.iocoder.yudao.module.ai.enums.model.AiModelTypeEnum; | |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 10 | 10 | import cn.iocoder.yudao.module.ai.controller.admin.chat.vo.conversation.AiChatConversationCreateMyReqVO; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatMessageServiceImpl.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.ai.service.chat; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 7 | -import cn.iocoder.yudao.framework.ai.core.util.AiUtils; | |
| 6 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 7 | +import cn.iocoder.yudao.module.ai.util.AiUtils; | |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.service.image; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.*; |
| 6 | 6 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.midjourney.AiMidjourneyActionReqVO; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| ... | ... | @@ -9,9 +9,9 @@ import cn.hutool.core.util.ObjUtil; |
| 9 | 9 | import cn.hutool.core.util.StrUtil; |
| 10 | 10 | import cn.hutool.extra.spring.SpringUtil; |
| 11 | 11 | import cn.hutool.http.HttpUtil; |
| 12 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 13 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 14 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageOptions; | |
| 12 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 13 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 14 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageOptions; | |
| 15 | 15 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 16 | 16 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 17 | 17 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDrawReqVO; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/mindmap/AiMindMapServiceImpl.java
| ... | ... | @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.ai.service.mindmap; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | -import cn.iocoder.yudao.framework.ai.core.enums.AiModelTypeEnum; | |
| 7 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 8 | -import cn.iocoder.yudao.framework.ai.core.util.AiUtils; | |
| 6 | +import cn.iocoder.yudao.module.ai.enums.model.AiModelTypeEnum; | |
| 7 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 8 | +import cn.iocoder.yudao.module.ai.util.AiUtils; | |
| 9 | 9 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiModelService.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.service.model; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.module.ai.controller.admin.model.vo.model.AiModelPageReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.ai.controller.admin.model.vo.model.AiModelSaveReqVO; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiModelServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.service.model; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.factory.AiModelFactory; | |
| 5 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 6 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.AiModelFactory; | |
| 5 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 6 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 7 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/tool/UserProfileQueryToolFunction.java
| 1 | 1 | package cn.iocoder.yudao.module.ai.service.model.tool; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.util.AiUtils; | |
| 3 | +import cn.iocoder.yudao.module.ai.util.AiUtils; | |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | 5 | import cn.iocoder.yudao.framework.security.core.LoginUser; |
| 6 | 6 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/music/AiMusicServiceImpl.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.hutool.core.util.ObjUtil; |
| 6 | 6 | import cn.hutool.core.util.ObjectUtil; |
| 7 | 7 | import cn.hutool.core.util.StrUtil; |
| 8 | 8 | import cn.hutool.http.HttpUtil; |
| 9 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 9 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 10 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiMusicPageReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiMusicUpdateMyReqVO; | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/write/AiWriteServiceImpl.java
| ... | ... | @@ -3,9 +3,10 @@ package cn.iocoder.yudao.module.ai.service.write; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | -import cn.iocoder.yudao.framework.ai.core.enums.AiModelTypeEnum; | |
| 7 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 8 | -import cn.iocoder.yudao.framework.ai.core.util.AiUtils; | |
| 6 | +import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | |
| 7 | +import cn.iocoder.yudao.module.ai.enums.model.AiModelTypeEnum; | |
| 8 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 9 | +import cn.iocoder.yudao.module.ai.util.AiUtils; | |
| 9 | 10 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | 11 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 12 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/util/AiUtils.java renamed to yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
| 1 | -package cn.iocoder.yudao.framework.ai.core.util; | |
| 1 | +package cn.iocoder.yudao.module.ai.util; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.ObjUtil; |
| 4 | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | -import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; | |
| 5 | +import cn.iocoder.yudao.module.ai.enums.model.AiPlatformEnum; | |
| 6 | 6 | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
| 7 | 7 | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 8 | 8 | import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/AzureOpenAIChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/AzureOpenAIChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/BaiChuanChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/BaiChuanChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 5 | 5 | import org.junit.jupiter.api.Disabled; |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | 7 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/CozeChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/CozeChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/DeepSeekChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/DeepSeekChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.deepseek.DeepSeekChatModel; | |
| 4 | 4 | import org.junit.jupiter.api.Disabled; |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/DifyChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/DifyChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/DouBaoChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/DouBaoChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 4 | 4 | import org.junit.jupiter.api.Disabled; |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/FastGPTChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/FastGPTChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/HunYuanChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/HunYuanChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel; | |
| 4 | 4 | import org.junit.jupiter.api.Disabled; |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/LlamaChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/LlamaChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/MiniMaxChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/MiniMaxChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/MoonshotChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/MoonshotChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/OllamaChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/OllamaChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/OpenAIChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/OpenAIChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/SiliconFlowChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/SiliconFlowChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowChatModel; | |
| 5 | 5 | import org.junit.jupiter.api.Disabled; |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | 7 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/TongYiChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/TongYiChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/XingHuoChatModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.chat; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.chat; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.XingHuoChatModel; | |
| 4 | 4 | import org.junit.jupiter.api.Disabled; |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | import org.springframework.ai.chat.messages.Message; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/YiYanChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/YiYanChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/ZhiPuAiChatModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/chat/ZhiPuAiChatModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MidjourneyApiTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/MidjourneyApiTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.image; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.image; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi; | |
| 4 | 4 | import org.junit.jupiter.api.Disabled; |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/OpenAiImageModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/OpenAiImageModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/QianFanImageTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/QianFanImageTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.image; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.image; | |
| 2 | 2 | |
| 3 | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | 4 | import org.junit.jupiter.api.Test; |
| ... | ... | @@ -8,7 +8,7 @@ import org.springframework.ai.qianfan.QianFanImageModel; |
| 8 | 8 | import org.springframework.ai.qianfan.QianFanImageOptions; |
| 9 | 9 | import org.springframework.ai.qianfan.api.QianFanImageApi; |
| 10 | 10 | |
| 11 | -import static cn.iocoder.yudao.framework.ai.image.StabilityAiImageModelTests.viewImage; | |
| 11 | +import static cn.iocoder.yudao.module.ai.framework.ai.core.model.image.StabilityAiImageModelTests.viewImage; | |
| 12 | 12 | |
| 13 | 13 | // TODO @芋艿:百度千帆 API 提供了 V2 版本,目前 Spring AI 不兼容,可关键 <https://github.com/spring-projects/spring-ai/issues/2179> 进展 |
| 14 | 14 | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/SiliconFlowImageModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/SiliconFlowImageModelTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.image; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.image; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageApi; | |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageModel; | |
| 5 | -import cn.iocoder.yudao.framework.ai.core.model.siliconflow.SiliconFlowImageOptions; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageApi; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageModel; | |
| 5 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowImageOptions; | |
| 6 | 6 | import org.junit.jupiter.api.Disabled; |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | 8 | import org.springframework.ai.image.ImagePrompt; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/StabilityAiImageModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/StabilityAiImageModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/TongYiImagesModelTest.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/TongYiImagesModelTest.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/ZhiPuAiImageModelTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/image/ZhiPuAiImageModelTests.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/mcp/DouBaoMcpTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/mcp/DouBaoMcpTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.mcp; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.mcp; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel; | |
| 4 | +import org.junit.jupiter.api.Disabled; | |
| 4 | 5 | import org.junit.jupiter.api.Test; |
| 5 | 6 | import org.springframework.ai.chat.client.ChatClient; |
| 6 | 7 | import org.springframework.ai.openai.OpenAiChatModel; |
| ... | ... | @@ -9,6 +10,7 @@ import org.springframework.ai.openai.api.OpenAiApi; |
| 9 | 10 | import org.springframework.ai.tool.annotation.Tool; |
| 10 | 11 | import org.springframework.ai.tool.method.MethodToolCallbackProvider; |
| 11 | 12 | |
| 13 | +@Disabled | |
| 12 | 14 | public class DouBaoMcpTests { |
| 13 | 15 | |
| 14 | 16 | private final OpenAiChatModel openAiChatModel = OpenAiChatModel.builder() | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/music/SunoApiTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/music/SunoApiTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.music; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.music; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.ListUtil; |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.suno.api.SunoApi; | |
| 5 | 5 | import org.junit.jupiter.api.Disabled; |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | 7 | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/wdd/WenDuoDuoPptApiTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/ppt/wdd/WenDuoDuoPptApiTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.ppt.wdd; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.ppt.wdd; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.wenduoduo.api.WenDuoDuoPptApi; | |
| 3 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.wenduoduo.api.WenDuoDuoPptApi; | |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 5 | 5 | import org.junit.jupiter.api.Disabled; |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| ... | ... | @@ -14,6 +14,7 @@ import java.util.Objects; |
| 14 | 14 | * |
| 15 | 15 | * @author xiaoxin |
| 16 | 16 | */ |
| 17 | +@Disabled | |
| 17 | 18 | public class WenDuoDuoPptApiTests { |
| 18 | 19 | |
| 19 | 20 | private final String token = ""; // API Token | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/xunfei/XunFeiPptApiTests.java renamed to yudao-module-ai/yudao-module-ai-biz/src/test/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/ppt/xunfei/XunFeiPptApiTests.java
| 1 | -package cn.iocoder.yudao.framework.ai.ppt.xunfei; | |
| 1 | +package cn.iocoder.yudao.module.ai.framework.ai.core.model.ppt.xunfei; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.FileUtil; |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XunFeiPptApi; | |
| 4 | +import cn.iocoder.yudao.module.ai.framework.ai.core.model.xinghuo.api.XunFeiPptApi; | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 6 | 6 | import org.junit.jupiter.api.Disabled; |
| 7 | 7 | import org.junit.jupiter.api.Test; | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-module-ai</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-spring-boot-starter-ai</artifactId> | |
| 12 | - <packaging>jar</packaging> | |
| 13 | - | |
| 14 | - <name>${project.artifactId}</name> | |
| 15 | - <description>AI 大模型拓展,接入国内外大模型</description> | |
| 16 | - <properties> | |
| 17 | - <spring-ai.version>1.0.0-M6</spring-ai.version> | |
| 18 | - <tinyflow.version>1.0.2</tinyflow.version> | |
| 19 | - </properties> | |
| 20 | - | |
| 21 | - <dependencies> | |
| 22 | - <dependency> | |
| 23 | - <groupId>cn.iocoder.boot</groupId> | |
| 24 | - <artifactId>yudao-common</artifactId> | |
| 25 | - </dependency> | |
| 26 | - | |
| 27 | - <!-- 业务组件 --> | |
| 28 | - <dependency> | |
| 29 | - <groupId>cn.iocoder.boot</groupId> | |
| 30 | - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 31 | - </dependency> | |
| 32 | - | |
| 33 | - <!-- Web 相关 --> | |
| 34 | - <dependency> | |
| 35 | - <groupId>cn.iocoder.boot</groupId> | |
| 36 | - <artifactId>yudao-spring-boot-starter-security</artifactId> | |
| 37 | - </dependency> | |
| 38 | - | |
| 39 | - <!-- Spring AI Model 模型接入 --> | |
| 40 | - <dependency> | |
| 41 | - <groupId>org.springframework.ai</groupId> | |
| 42 | - <artifactId>spring-ai-openai-spring-boot-starter</artifactId> | |
| 43 | - <version>${spring-ai.version}</version> | |
| 44 | - </dependency> | |
| 45 | - <dependency> | |
| 46 | - <groupId>org.springframework.ai</groupId> | |
| 47 | - <artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId> | |
| 48 | - <version>${spring-ai.version}</version> | |
| 49 | - </dependency> | |
| 50 | - <dependency> | |
| 51 | - <groupId>org.springframework.ai</groupId> | |
| 52 | - <artifactId>spring-ai-ollama-spring-boot-starter</artifactId> | |
| 53 | - <version>${spring-ai.version}</version> | |
| 54 | - </dependency> | |
| 55 | - <dependency> | |
| 56 | - <groupId>org.springframework.ai</groupId> | |
| 57 | - <artifactId>spring-ai-stability-ai-spring-boot-starter</artifactId> | |
| 58 | - <version>${spring-ai.version}</version> | |
| 59 | - </dependency> | |
| 60 | - <dependency> | |
| 61 | - <!-- 通义千问 --> | |
| 62 | - <groupId>com.alibaba.cloud.ai</groupId> | |
| 63 | - <artifactId>spring-ai-alibaba-starter</artifactId> | |
| 64 | - <version>${spring-ai.version}.1</version> | |
| 65 | - </dependency> | |
| 66 | - <dependency> | |
| 67 | - <!-- 文心一言 --> | |
| 68 | - <groupId>org.springframework.ai</groupId> | |
| 69 | - <artifactId>spring-ai-qianfan-spring-boot-starter</artifactId> | |
| 70 | - <version>${spring-ai.version}</version> | |
| 71 | - </dependency> | |
| 72 | - <dependency> | |
| 73 | - <!-- 智谱 GLM --> | |
| 74 | - <groupId>org.springframework.ai</groupId> | |
| 75 | - <artifactId>spring-ai-zhipuai-spring-boot-starter</artifactId> | |
| 76 | - <version>${spring-ai.version}</version> | |
| 77 | - </dependency> | |
| 78 | - <dependency> | |
| 79 | - <groupId>org.springframework.ai</groupId> | |
| 80 | - <artifactId>spring-ai-minimax-spring-boot-starter</artifactId> | |
| 81 | - <version>${spring-ai.version}</version> | |
| 82 | - </dependency> | |
| 83 | - <dependency> | |
| 84 | - <groupId>org.springframework.ai</groupId> | |
| 85 | - <artifactId>spring-ai-moonshot-spring-boot-starter</artifactId> | |
| 86 | - <version>${spring-ai.version}</version> | |
| 87 | - </dependency> | |
| 88 | - | |
| 89 | - <!-- 向量存储:https://db-engines.com/en/ranking/vector+dbms --> | |
| 90 | - <dependency> | |
| 91 | - <!-- Qdrant:https://qdrant.tech/ --> | |
| 92 | - <groupId>org.springframework.ai</groupId> | |
| 93 | - <artifactId>spring-ai-qdrant-store</artifactId> | |
| 94 | - <version>${spring-ai.version}</version> | |
| 95 | - </dependency> | |
| 96 | - | |
| 97 | - <dependency> | |
| 98 | - <!-- Redis:https://redis.io/docs/latest/develop/get-started/vector-database/ --> | |
| 99 | - <groupId>org.springframework.ai</groupId> | |
| 100 | - <artifactId>spring-ai-redis-store</artifactId> | |
| 101 | - <version>${spring-ai.version}</version> | |
| 102 | - </dependency> | |
| 103 | - <dependency> | |
| 104 | - <groupId>cn.iocoder.boot</groupId> | |
| 105 | - <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 106 | - </dependency> | |
| 107 | - | |
| 108 | - <dependency> | |
| 109 | - <!-- Milvus:https://milvus.io/ --> | |
| 110 | - <groupId>org.springframework.ai</groupId> | |
| 111 | - <artifactId>spring-ai-milvus-store</artifactId> | |
| 112 | - <version>${spring-ai.version}</version> | |
| 113 | - <exclusions> | |
| 114 | - <!-- 解决和 logback 的日志冲突 --> | |
| 115 | - <exclusion> | |
| 116 | - <groupId>org.slf4j</groupId> | |
| 117 | - <artifactId>slf4j-reload4j</artifactId> | |
| 118 | - </exclusion> | |
| 119 | - </exclusions> | |
| 120 | - </dependency> | |
| 121 | - | |
| 122 | - <dependency> | |
| 123 | - <!-- Tika:负责内容的解析 --> | |
| 124 | - <groupId>org.springframework.ai</groupId> | |
| 125 | - <artifactId>spring-ai-tika-document-reader</artifactId> | |
| 126 | - <version>${spring-ai.version}</version> | |
| 127 | - <!-- TODO 芋艿:boot 项目里,不引入 cloud 依赖!!!另外,这样也是为了解决启动报错的问题! --> | |
| 128 | - <exclusions> | |
| 129 | - <exclusion> | |
| 130 | - <artifactId>spring-cloud-function-context</artifactId> | |
| 131 | - <groupId>org.springframework.cloud</groupId> | |
| 132 | - </exclusion> | |
| 133 | - <exclusion> | |
| 134 | - <artifactId>spring-cloud-function-core</artifactId> | |
| 135 | - <groupId>org.springframework.cloud</groupId> | |
| 136 | - </exclusion> | |
| 137 | - </exclusions> | |
| 138 | - </dependency> | |
| 139 | - | |
| 140 | - <!-- TinyFlow:AI 工作流 --> | |
| 141 | - <dependency> | |
| 142 | - <groupId>dev.tinyflow</groupId> | |
| 143 | - <artifactId>tinyflow-java-core</artifactId> | |
| 144 | - <version>${tinyflow.version}</version> | |
| 145 | - <exclusions> | |
| 146 | - <exclusion> | |
| 147 | - <groupId>com.jfinal</groupId> | |
| 148 | - <artifactId>enjoy</artifactId> | |
| 149 | - </exclusion> | |
| 150 | - <exclusion> | |
| 151 | - <!-- 解决 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1318/ 问题 --> | |
| 152 | - <groupId>com.agentsflex</groupId> | |
| 153 | - <artifactId>agents-flex-store-elasticsearch</artifactId> | |
| 154 | - </exclusion> | |
| 155 | - <exclusion> | |
| 156 | - <!-- TODO @芋艿:暂时移除 groovy,和 iot 冲突 --> | |
| 157 | - <groupId>org.codehaus.groovy</groupId> | |
| 158 | - <artifactId>groovy-all</artifactId> | |
| 159 | - </exclusion> | |
| 160 | - <!-- 解决和 logback 的日志冲突 --> | |
| 161 | - <exclusion> | |
| 162 | - <groupId>org.slf4j</groupId> | |
| 163 | - <artifactId>slf4j-simple</artifactId> | |
| 164 | - </exclusion> | |
| 165 | - <exclusion> | |
| 166 | - <groupId>org.apache.logging.log4j</groupId> | |
| 167 | - <artifactId>log4j-slf4j-impl</artifactId> | |
| 168 | - </exclusion> | |
| 169 | - <exclusion> | |
| 170 | - <groupId>org.slf4j</groupId> | |
| 171 | - <artifactId>slf4j-reload4j</artifactId> | |
| 172 | - </exclusion> | |
| 173 | - </exclusions> | |
| 174 | - </dependency> | |
| 175 | - | |
| 176 | - <!-- Test 测试相关 --> | |
| 177 | - <dependency> | |
| 178 | - <groupId>org.springframework.boot</groupId> | |
| 179 | - <artifactId>spring-boot-starter-test</artifactId> | |
| 180 | - <scope>test</scope> | |
| 181 | - </dependency> | |
| 182 | - </dependencies> | |
| 183 | - | |
| 184 | -</project> | |
| 185 | 0 | \ No newline at end of file |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted
yudao-module-pay/pom.xml
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/PayChannelEnum.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.enums; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.util.ArrayUtil; | |
| 4 | +import cn.hutool.core.util.StrUtil; | |
| 3 | 5 | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| 4 | 6 | import lombok.AllArgsConstructor; |
| 5 | 7 | import lombok.Getter; |
| ... | ... | @@ -27,6 +29,7 @@ public enum PayChannelEnum implements ArrayValuable<String> { |
| 27 | 29 | ALIPAY_APP("alipay_app", "支付宝App 支付"), |
| 28 | 30 | ALIPAY_QR("alipay_qr", "支付宝扫码支付"), |
| 29 | 31 | ALIPAY_BAR("alipay_bar", "支付宝条码支付"), |
| 32 | + | |
| 30 | 33 | MOCK("mock", "模拟支付"), |
| 31 | 34 | |
| 32 | 35 | WALLET("wallet", "钱包支付"); |
| ... | ... | @@ -49,4 +52,16 @@ public enum PayChannelEnum implements ArrayValuable<String> { |
| 49 | 52 | return ARRAYS; |
| 50 | 53 | } |
| 51 | 54 | |
| 55 | + public static PayChannelEnum getByCode(String code) { | |
| 56 | + return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); | |
| 57 | + } | |
| 58 | + | |
| 59 | + public static boolean isAlipay(String channelCode) { | |
| 60 | + return StrUtil.startWith(channelCode, "alipay_"); | |
| 61 | + } | |
| 62 | + | |
| 63 | + public static boolean isWeixin(String channelCode) { | |
| 64 | + return StrUtil.startWith(channelCode, "wx_"); | |
| 65 | + } | |
| 66 | + | |
| 52 | 67 | } | ... | ... |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderStatusEnum.java
| ... | ... | @@ -51,6 +51,16 @@ public enum PayOrderStatusEnum implements ArrayValuable<Integer> { |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | + * 判断是否已退款 | |
| 55 | + * | |
| 56 | + * @param status 状态 | |
| 57 | + * @return 是否已退款 | |
| 58 | + */ | |
| 59 | + public static boolean isRefund(Integer status) { | |
| 60 | + return Objects.equals(status, REFUND.getStatus()); | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 54 | 64 | * 判断是否支付成功或者已退款 |
| 55 | 65 | * |
| 56 | 66 | * @param status 状态 | ... | ... |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/transfer/PayTransferStatusEnum.java
| ... | ... | @@ -40,7 +40,7 @@ public enum PayTransferStatusEnum { |
| 40 | 40 | return Objects.equals(status, WAITING.getStatus()); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public static boolean isProgressing(Integer status) { | |
| 43 | + public static boolean isProcessing(Integer status) { | |
| 44 | 44 | return Objects.equals(status, PROCESSING.getStatus()); |
| 45 | 45 | } |
| 46 | 46 | |
| ... | ... | @@ -51,7 +51,7 @@ public enum PayTransferStatusEnum { |
| 51 | 51 | * @return 是否 |
| 52 | 52 | */ |
| 53 | 53 | public static boolean isWaitingOrProcessing(Integer status) { |
| 54 | - return isWaiting(status) || isProgressing(status); | |
| 54 | + return isWaiting(status) || isProcessing(status); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** | ... | ... |
yudao-module-pay/yudao-module-pay-biz/pom.xml
| ... | ... | @@ -32,11 +32,6 @@ |
| 32 | 32 | <!-- 业务组件 --> |
| 33 | 33 | <dependency> |
| 34 | 34 | <groupId>cn.iocoder.boot</groupId> |
| 35 | - <artifactId>yudao-spring-boot-starter-biz-pay</artifactId> | |
| 36 | - <version>${revision}</version> | |
| 37 | - </dependency> | |
| 38 | - <dependency> | |
| 39 | - <groupId>cn.iocoder.boot</groupId> | |
| 40 | 35 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> |
| 41 | 36 | </dependency> |
| 42 | 37 | |
| ... | ... | @@ -75,6 +70,24 @@ |
| 75 | 70 | <groupId>cn.iocoder.boot</groupId> |
| 76 | 71 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 77 | 72 | </dependency> |
| 73 | + | |
| 74 | + <!-- 三方云服务相关 --> | |
| 75 | + <dependency> | |
| 76 | + <groupId>com.alipay.sdk</groupId> | |
| 77 | + <artifactId>alipay-sdk-java</artifactId> | |
| 78 | + <version>4.35.79.ALL</version> | |
| 79 | + <exclusions> | |
| 80 | + <exclusion> | |
| 81 | + <groupId>org.bouncycastle</groupId> | |
| 82 | + <artifactId>bcprov-jdk15on</artifactId> | |
| 83 | + </exclusion> | |
| 84 | + </exclusions> | |
| 85 | + </dependency> | |
| 86 | + <dependency> | |
| 87 | + <groupId>com.github.binarywang</groupId> | |
| 88 | + <artifactId>weixin-java-pay</artifactId> | |
| 89 | + </dependency> | |
| 90 | + | |
| 78 | 91 | </dependencies> |
| 79 | 92 | |
| 80 | 93 | </project> | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/PayTransferApiImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.api.transfer; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 5 | 5 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateRespDTO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferRespDTO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java
| ... | ... | @@ -4,10 +4,10 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 11 | 11 | import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; |
| 12 | 12 | import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskDetailRespVO; |
| 13 | 13 | import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskPageReqVO; |
| ... | ... | @@ -156,7 +156,7 @@ public class PayNotifyController { |
| 156 | 156 | } |
| 157 | 157 | // 拼接返回 |
| 158 | 158 | Map<Long, PayAppDO> apps = appService.getAppMap(convertList(pageResult.getList(), PayNotifyTaskDO::getAppId)); |
| 159 | - | |
| 159 | + | |
| 160 | 160 | // 转换对象 |
| 161 | 161 | return success(BeanUtils.toBean(pageResult, PayNotifyTaskRespVO.class, order -> { |
| 162 | 162 | PayAppDO app = apps.get(order.getAppId()); | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java
| ... | ... | @@ -6,15 +6,15 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 10 | 9 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 13 | 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; |
| 14 | 13 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 15 | 14 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 15 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 16 | 16 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 17 | -import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; | |
| 17 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.wallet.WalletPayClient; | |
| 18 | 18 | import cn.iocoder.yudao.module.pay.service.app.PayAppService; |
| 19 | 19 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 20 | 20 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java
| ... | ... | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.pay.controller.app.order; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | 5 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderRespVO; |
| 7 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; |
| 8 | 7 | import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO; |
| ... | ... | @@ -10,8 +9,9 @@ import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitResp |
| 10 | 9 | import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 12 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 13 | 13 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 14 | -import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; | |
| 14 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.wallet.WalletPayClient; | |
| 15 | 15 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 16 | 16 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; |
| 17 | 17 | import com.google.common.collect.Maps; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.pay.convert.order; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | 7 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 8 | 8 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; |
| 9 | 9 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; |
| ... | ... | @@ -67,7 +67,7 @@ public interface PayOrderConvert { |
| 67 | 67 | PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO, String userIp); |
| 68 | 68 | |
| 69 | 69 | @Mapping(source = "order.status", target = "status") |
| 70 | - PayOrderSubmitRespVO convert(PayOrderDO order, cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO respDTO); | |
| 70 | + PayOrderSubmitRespVO convert(PayOrderDO order, cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO respDTO); | |
| 71 | 71 | |
| 72 | 72 | AppPayOrderSubmitRespVO convert3(PayOrderSubmitRespVO bean); |
| 73 | 73 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/channel/PayChannelDO.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.channel; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.util.StrUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 6 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 6 | 8 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 7 | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.NonePayClientConfig; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayAppPayClient; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 8 | 14 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | 15 | import com.baomidou.mybatisplus.annotation.TableField; |
| 10 | 16 | import com.baomidou.mybatisplus.annotation.TableName; |
| 17 | +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; | |
| 11 | 18 | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| 19 | +import com.fasterxml.jackson.core.type.TypeReference; | |
| 12 | 20 | import lombok.*; |
| 13 | 21 | |
| 22 | +import java.lang.reflect.Field; | |
| 23 | + | |
| 14 | 24 | /** |
| 15 | 25 | * 支付渠道 DO |
| 16 | 26 | * 一个应用下,会有多种支付渠道,例如说微信支付、支付宝支付等等 |
| ... | ... | @@ -63,7 +73,46 @@ public class PayChannelDO extends TenantBaseDO { |
| 63 | 73 | /** |
| 64 | 74 | * 支付渠道配置 |
| 65 | 75 | */ |
| 66 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 76 | + @TableField(typeHandler = PayClientConfigTypeHandler.class) | |
| 67 | 77 | private PayClientConfig config; |
| 68 | 78 | |
| 79 | + public static class PayClientConfigTypeHandler extends AbstractJsonTypeHandler<Object> { | |
| 80 | + | |
| 81 | + public PayClientConfigTypeHandler(Class<?> type) { | |
| 82 | + super(type); | |
| 83 | + } | |
| 84 | + | |
| 85 | + public PayClientConfigTypeHandler(Class<?> type, Field field) { | |
| 86 | + super(type, field); | |
| 87 | + } | |
| 88 | + | |
| 89 | + @Override | |
| 90 | + public Object parse(String json) { | |
| 91 | + PayClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference<>() {}); | |
| 92 | + if (config != null) { | |
| 93 | + return config; | |
| 94 | + } | |
| 95 | + | |
| 96 | + // 兼容老版本的包路径 | |
| 97 | + String className = JsonUtils.parseObject(json, "@class", String.class); | |
| 98 | + className = StrUtil.subAfter(className, ".", true); | |
| 99 | + switch (className) { | |
| 100 | + case "AlipayPayClientConfig": | |
| 101 | + return JsonUtils.parseObject2(json, AlipayPayClientConfig.class); | |
| 102 | + case "WxPayClientConfig": | |
| 103 | + return JsonUtils.parseObject2(json, WxPayClientConfig.class); | |
| 104 | + case "NonePayClientConfig": | |
| 105 | + return JsonUtils.parseObject2(json, NonePayClientConfig.class); | |
| 106 | + default: | |
| 107 | + throw new IllegalArgumentException("未知的 PayClientConfig 类型:" + json); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + | |
| 111 | + @Override | |
| 112 | + public String toJson(Object obj) { | |
| 113 | + return JsonUtils.toJsonString(obj); | |
| 114 | + } | |
| 115 | + | |
| 116 | + } | |
| 117 | + | |
| 69 | 118 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.order; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 6 | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 6 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 7 | 7 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 8 | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | 9 | import com.baomidou.mybatisplus.annotation.TableName; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.order; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 3 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 5 | 5 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.refund; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 6 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 8 | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.transfer; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferStatusRespEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 7 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 7 | +import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum; | |
| 8 | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | 9 | import com.baomidou.mybatisplus.annotation.TableField; |
| 10 | 10 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -89,7 +89,7 @@ public class PayTransferDO extends BaseDO { |
| 89 | 89 | /** |
| 90 | 90 | * 转账状态 |
| 91 | 91 | * |
| 92 | - * 枚举 {@link PayTransferStatusRespEnum} | |
| 92 | + * 枚举 {@link PayTransferStatusEnum} | |
| 93 | 93 | */ |
| 94 | 94 | private Integer status; |
| 95 | 95 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/config/PayConfiguration.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.framework.pay.config; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientFactory; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.PayClientFactoryImpl; | |
| 3 | 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 6 | +import org.springframework.context.annotation.Bean; | |
| 4 | 7 | import org.springframework.context.annotation.Configuration; |
| 5 | 8 | |
| 6 | 9 | @Configuration(proxyBeanMethods = false) |
| 7 | 10 | @EnableConfigurationProperties(PayProperties.class) |
| 8 | 11 | public class PayConfiguration { |
| 12 | + | |
| 13 | + @Bean | |
| 14 | + public PayClientFactory payClientFactory() { | |
| 15 | + return new PayClientFactoryImpl(); | |
| 16 | + } | |
| 17 | + | |
| 9 | 18 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/PayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 9 | 9 | |
| 10 | 10 | import java.util.Map; |
| 11 | 11 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/PayClientConfig.java
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientFactory.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/PayClientFactory.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client; | |
| 4 | 2 | |
| 5 | 3 | /** |
| 6 | 4 | * 支付客户端的工厂接口 |
| ... | ... | @@ -27,13 +25,4 @@ public interface PayClientFactory { |
| 27 | 25 | */ |
| 28 | 26 | <Config extends PayClientConfig> PayClient createOrUpdatePayClient(Long channelId, String channelCode, |
| 29 | 27 | Config config); |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 注册支付客户端 Class,用于模块中实现的 PayClient | |
| 33 | - * | |
| 34 | - * @param channel 支付渠道的编码的枚举 | |
| 35 | - * @param payClientClass 支付客户端 class | |
| 36 | - */ | |
| 37 | - void registerPayClientClass(PayChannelEnum channel, Class<?> payClientClass); | |
| 38 | - | |
| 39 | 28 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderRespDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/order/PayOrderRespDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto.order; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.exception.PayClientException; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | |
| 8 | 8 | import java.time.LocalDateTime; |
| ... | ... | @@ -18,7 +18,7 @@ public class PayOrderRespDTO { |
| 18 | 18 | /** |
| 19 | 19 | * 支付状态 |
| 20 | 20 | * |
| 21 | - * 枚举:{@link PayOrderStatusRespEnum} | |
| 21 | + * 枚举:{@link PayOrderStatusEnum} | |
| 22 | 22 | */ |
| 23 | 23 | private Integer status; |
| 24 | 24 | |
| ... | ... | @@ -65,7 +65,7 @@ public class PayOrderRespDTO { |
| 65 | 65 | * 调用渠道的错误码 |
| 66 | 66 | * |
| 67 | 67 | * 注意:这里返回的是业务异常,而是不系统异常。 |
| 68 | - * 如果是系统异常,则会抛出 {@link PayException} | |
| 68 | + * 如果是系统异常,则会抛出 {@link PayClientException} | |
| 69 | 69 | */ |
| 70 | 70 | private String channelErrorCode; |
| 71 | 71 | /** |
| ... | ... | @@ -82,7 +82,7 @@ public class PayOrderRespDTO { |
| 82 | 82 | public static PayOrderRespDTO waitingOf(String displayMode, String displayContent, |
| 83 | 83 | String outTradeNo, Object rawData) { |
| 84 | 84 | PayOrderRespDTO respDTO = new PayOrderRespDTO(); |
| 85 | - respDTO.status = PayOrderStatusRespEnum.WAITING.getStatus(); | |
| 85 | + respDTO.status = PayOrderStatusEnum.WAITING.getStatus(); | |
| 86 | 86 | respDTO.displayMode = displayMode; |
| 87 | 87 | respDTO.displayContent = displayContent; |
| 88 | 88 | // 相对通用的字段 |
| ... | ... | @@ -97,7 +97,7 @@ public class PayOrderRespDTO { |
| 97 | 97 | public static PayOrderRespDTO successOf(String channelOrderNo, String channelUserId, LocalDateTime successTime, |
| 98 | 98 | String outTradeNo, Object rawData) { |
| 99 | 99 | PayOrderRespDTO respDTO = new PayOrderRespDTO(); |
| 100 | - respDTO.status = PayOrderStatusRespEnum.SUCCESS.getStatus(); | |
| 100 | + respDTO.status = PayOrderStatusEnum.SUCCESS.getStatus(); | |
| 101 | 101 | respDTO.channelOrderNo = channelOrderNo; |
| 102 | 102 | respDTO.channelUserId = channelUserId; |
| 103 | 103 | respDTO.successTime = successTime; |
| ... | ... | @@ -129,7 +129,7 @@ public class PayOrderRespDTO { |
| 129 | 129 | public static PayOrderRespDTO closedOf(String channelErrorCode, String channelErrorMsg, |
| 130 | 130 | String outTradeNo, Object rawData) { |
| 131 | 131 | PayOrderRespDTO respDTO = new PayOrderRespDTO(); |
| 132 | - respDTO.status = PayOrderStatusRespEnum.CLOSED.getStatus(); | |
| 132 | + respDTO.status = PayOrderStatusEnum.CLOSED.getStatus(); | |
| 133 | 133 | respDTO.channelErrorCode = channelErrorCode; |
| 134 | 134 | respDTO.channelErrorMsg = channelErrorMsg; |
| 135 | 135 | // 相对通用的字段 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto.order; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.Length; |
| 6 | 6 | import org.hibernate.validator.constraints.URL; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundRespDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/refund/PayRefundRespDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto.refund; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.exception.PayClientException; | |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | 7 | import java.time.LocalDateTime; |
| ... | ... | @@ -17,7 +17,7 @@ public class PayRefundRespDTO { |
| 17 | 17 | /** |
| 18 | 18 | * 退款状态 |
| 19 | 19 | * |
| 20 | - * 枚举 {@link PayRefundStatusRespEnum} | |
| 20 | + * 枚举 {@link PayRefundStatusEnum} | |
| 21 | 21 | */ |
| 22 | 22 | private Integer status; |
| 23 | 23 | |
| ... | ... | @@ -49,7 +49,7 @@ public class PayRefundRespDTO { |
| 49 | 49 | * 调用渠道的错误码 |
| 50 | 50 | * |
| 51 | 51 | * 注意:这里返回的是业务异常,而是不系统异常。 |
| 52 | - * 如果是系统异常,则会抛出 {@link PayException} | |
| 52 | + * 如果是系统异常,则会抛出 {@link PayClientException} | |
| 53 | 53 | */ |
| 54 | 54 | private String channelErrorCode; |
| 55 | 55 | /** |
| ... | ... | @@ -66,7 +66,7 @@ public class PayRefundRespDTO { |
| 66 | 66 | public static PayRefundRespDTO waitingOf(String channelRefundNo, |
| 67 | 67 | String outRefundNo, Object rawData) { |
| 68 | 68 | PayRefundRespDTO respDTO = new PayRefundRespDTO(); |
| 69 | - respDTO.status = PayRefundStatusRespEnum.WAITING.getStatus(); | |
| 69 | + respDTO.status = PayRefundStatusEnum.WAITING.getStatus(); | |
| 70 | 70 | respDTO.channelRefundNo = channelRefundNo; |
| 71 | 71 | // 相对通用的字段 |
| 72 | 72 | respDTO.outRefundNo = outRefundNo; |
| ... | ... | @@ -80,7 +80,7 @@ public class PayRefundRespDTO { |
| 80 | 80 | public static PayRefundRespDTO successOf(String channelRefundNo, LocalDateTime successTime, |
| 81 | 81 | String outRefundNo, Object rawData) { |
| 82 | 82 | PayRefundRespDTO respDTO = new PayRefundRespDTO(); |
| 83 | - respDTO.status = PayRefundStatusRespEnum.SUCCESS.getStatus(); | |
| 83 | + respDTO.status = PayRefundStatusEnum.SUCCESS.getStatus(); | |
| 84 | 84 | respDTO.channelRefundNo = channelRefundNo; |
| 85 | 85 | respDTO.successTime = successTime; |
| 86 | 86 | // 相对通用的字段 |
| ... | ... | @@ -103,7 +103,7 @@ public class PayRefundRespDTO { |
| 103 | 103 | public static PayRefundRespDTO failureOf(String channelErrorCode, String channelErrorMsg, |
| 104 | 104 | String outRefundNo, Object rawData) { |
| 105 | 105 | PayRefundRespDTO respDTO = new PayRefundRespDTO(); |
| 106 | - respDTO.status = PayRefundStatusRespEnum.FAILURE.getStatus(); | |
| 106 | + respDTO.status = PayRefundStatusEnum.FAILURE.getStatus(); | |
| 107 | 107 | respDTO.channelErrorCode = channelErrorCode; |
| 108 | 108 | respDTO.channelErrorMsg = channelErrorMsg; |
| 109 | 109 | // 相对通用的字段 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/transfer/PayTransferRespDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto.transfer; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferStatusRespEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum; | |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | 6 | import java.time.LocalDateTime; |
| ... | ... | @@ -16,7 +16,7 @@ public class PayTransferRespDTO { |
| 16 | 16 | /** |
| 17 | 17 | * 转账状态 |
| 18 | 18 | * |
| 19 | - * 关联 {@link PayTransferStatusRespEnum#getStatus()} | |
| 19 | + * 关联 {@link PayTransferStatusEnum} | |
| 20 | 20 | */ |
| 21 | 21 | private Integer status; |
| 22 | 22 | |
| ... | ... | @@ -63,7 +63,7 @@ public class PayTransferRespDTO { |
| 63 | 63 | public static PayTransferRespDTO waitingOf(String channelTransferNo, |
| 64 | 64 | String outTransferNo, Object rawData) { |
| 65 | 65 | PayTransferRespDTO respDTO = new PayTransferRespDTO(); |
| 66 | - respDTO.status = PayTransferStatusRespEnum.WAITING.getStatus(); | |
| 66 | + respDTO.status = PayTransferStatusEnum.WAITING.getStatus(); | |
| 67 | 67 | respDTO.channelTransferNo = channelTransferNo; |
| 68 | 68 | respDTO.outTransferNo = outTransferNo; |
| 69 | 69 | respDTO.rawData = rawData; |
| ... | ... | @@ -76,7 +76,7 @@ public class PayTransferRespDTO { |
| 76 | 76 | public static PayTransferRespDTO processingOf(String channelTransferNo, |
| 77 | 77 | String outTransferNo, Object rawData) { |
| 78 | 78 | PayTransferRespDTO respDTO = new PayTransferRespDTO(); |
| 79 | - respDTO.status = PayTransferStatusRespEnum.PROCESSING.getStatus(); | |
| 79 | + respDTO.status = PayTransferStatusEnum.PROCESSING.getStatus(); | |
| 80 | 80 | respDTO.channelTransferNo = channelTransferNo; |
| 81 | 81 | respDTO.outTransferNo = outTransferNo; |
| 82 | 82 | respDTO.rawData = rawData; |
| ... | ... | @@ -89,7 +89,7 @@ public class PayTransferRespDTO { |
| 89 | 89 | public static PayTransferRespDTO closedOf(String channelErrorCode, String channelErrorMsg, |
| 90 | 90 | String outTransferNo, Object rawData) { |
| 91 | 91 | PayTransferRespDTO respDTO = new PayTransferRespDTO(); |
| 92 | - respDTO.status = PayTransferStatusRespEnum.CLOSED.getStatus(); | |
| 92 | + respDTO.status = PayTransferStatusEnum.CLOSED.getStatus(); | |
| 93 | 93 | respDTO.channelErrorCode = channelErrorCode; |
| 94 | 94 | respDTO.channelErrorMsg = channelErrorMsg; |
| 95 | 95 | // 相对通用的字段 |
| ... | ... | @@ -104,7 +104,7 @@ public class PayTransferRespDTO { |
| 104 | 104 | public static PayTransferRespDTO successOf(String channelTransferNo, LocalDateTime successTime, |
| 105 | 105 | String outTransferNo, Object rawData) { |
| 106 | 106 | PayTransferRespDTO respDTO = new PayTransferRespDTO(); |
| 107 | - respDTO.status = PayTransferStatusRespEnum.SUCCESS.getStatus(); | |
| 107 | + respDTO.status = PayTransferStatusEnum.SUCCESS.getStatus(); | |
| 108 | 108 | respDTO.channelTransferNo = channelTransferNo; |
| 109 | 109 | respDTO.successTime = successTime; |
| 110 | 110 | // 相对通用的字段 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/exception/PayException.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/exception/PayClientException.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.exception; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.exception; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | import lombok.EqualsAndHashCode; |
| ... | ... | @@ -8,9 +8,9 @@ import lombok.EqualsAndHashCode; |
| 8 | 8 | */ |
| 9 | 9 | @Data |
| 10 | 10 | @EqualsAndHashCode(callSuper = true) |
| 11 | -public class PayException extends RuntimeException { | |
| 11 | +public class PayClientException extends RuntimeException { | |
| 12 | 12 | |
| 13 | - public PayException(Throwable cause) { | |
| 13 | + public PayClientException(Throwable cause) { | |
| 14 | 14 | super(cause); |
| 15 | 15 | } |
| 16 | 16 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/AbstractPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.exception.PayClientException; | |
| 14 | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | 15 | |
| 16 | 16 | import java.util.Map; |
| ... | ... | @@ -241,11 +241,11 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen |
| 241 | 241 | |
| 242 | 242 | // ========== 各种工具方法 ========== |
| 243 | 243 | |
| 244 | - private PayException buildPayException(Throwable ex) { | |
| 245 | - if (ex instanceof PayException) { | |
| 246 | - return (PayException) ex; | |
| 244 | + private PayClientException buildPayException(Throwable ex) { | |
| 245 | + if (ex instanceof PayClientException) { | |
| 246 | + return (PayClientException) ex; | |
| 247 | 247 | } |
| 248 | - throw new PayException(ex); | |
| 248 | + throw new PayClientException(ex); | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/NonePayClientConfig.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 3 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | 6 | import jakarta.validation.Validator; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImpl.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | 4 | import cn.hutool.core.util.ReflectUtil; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.impl.mock.MockPayClient; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.*; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | +import cn.hutool.core.util.TypeUtil; | |
| 6 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientFactory; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.*; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.wallet.WalletPayClient; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.*; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.mock.MockPayClient; | |
| 12 | 14 | import lombok.extern.slf4j.Slf4j; |
| 13 | 15 | |
| 16 | +import java.lang.reflect.Type; | |
| 14 | 17 | import java.util.Map; |
| 15 | 18 | import java.util.concurrent.ConcurrentHashMap; |
| 16 | 19 | import java.util.concurrent.ConcurrentMap; |
| 17 | 20 | |
| 18 | -import static cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum.*; | |
| 21 | +import static cn.iocoder.yudao.module.pay.enums.PayChannelEnum.*; | |
| 19 | 22 | |
| 20 | 23 | /** |
| 21 | 24 | * 支付客户端的工厂实现类 |
| ... | ... | @@ -35,7 +38,7 @@ public class PayClientFactoryImpl implements PayClientFactory { |
| 35 | 38 | /** |
| 36 | 39 | * 支付客户端 Class Map |
| 37 | 40 | */ |
| 38 | - private final Map<PayChannelEnum, Class<?>> clientClass = new ConcurrentHashMap<>(); | |
| 41 | + private final Map<PayChannelEnum, Class<? extends PayClient<?>>> clientClass = new ConcurrentHashMap<>(); | |
| 39 | 42 | |
| 40 | 43 | public PayClientFactoryImpl() { |
| 41 | 44 | // 微信支付客户端 |
| ... | ... | @@ -51,16 +54,13 @@ public class PayClientFactoryImpl implements PayClientFactory { |
| 51 | 54 | clientClass.put(ALIPAY_APP, AlipayAppPayClient.class); |
| 52 | 55 | clientClass.put(ALIPAY_PC, AlipayPcPayClient.class); |
| 53 | 56 | clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class); |
| 57 | + // 钱包支付客户端 | |
| 58 | + clientClass.put(WALLET, WalletPayClient.class); | |
| 54 | 59 | // Mock 支付客户端 |
| 55 | 60 | clientClass.put(MOCK, MockPayClient.class); |
| 56 | 61 | } |
| 57 | 62 | |
| 58 | 63 | @Override |
| 59 | - public void registerPayClientClass(PayChannelEnum channel, Class<?> payClientClass) { | |
| 60 | - clientClass.put(channel, payClientClass); | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Override | |
| 64 | 64 | public PayClient getPayClient(Long channelId) { |
| 65 | 65 | AbstractPayClient<?> client = clients.get(channelId); |
| 66 | 66 | if (client == null) { | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| ... | ... | @@ -8,14 +8,14 @@ import cn.hutool.core.util.StrUtil; |
| 8 | 8 | import cn.hutool.http.HttpUtil; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 14 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 15 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 16 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 17 | -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | |
| 18 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 11 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 14 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 15 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 16 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 17 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 18 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.AbstractPayClient; | |
| 19 | 19 | import com.alipay.api.AlipayApiException; |
| 20 | 20 | import com.alipay.api.AlipayConfig; |
| 21 | 21 | import com.alipay.api.AlipayResponse; |
| ... | ... | @@ -39,8 +39,8 @@ import java.util.Objects; |
| 39 | 39 | import java.util.function.Supplier; |
| 40 | 40 | |
| 41 | 41 | import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER; |
| 42 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 43 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_PUBLIC_KEY; | |
| 42 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 43 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_PUBLIC_KEY; | |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * 支付宝抽象类,实现支付宝统一的接口、以及部分实现(退款) |
| ... | ... | @@ -89,7 +89,7 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa |
| 89 | 89 | Integer status = parseStatus(bodyObj.get("trade_status")); |
| 90 | 90 | // 特殊逻辑: 支付宝没有退款成功的状态,所以,如果有退款金额,我们认为是退款成功 |
| 91 | 91 | if (MapUtil.getDouble(bodyObj, "refund_fee", 0D) > 0) { |
| 92 | - status = PayOrderStatusRespEnum.REFUND.getStatus(); | |
| 92 | + status = PayOrderStatusEnum.REFUND.getStatus(); | |
| 93 | 93 | } |
| 94 | 94 | Assert.notNull(status, (Supplier<Throwable>) () -> { |
| 95 | 95 | throw new IllegalArgumentException(StrUtil.format("body({}) 的 trade_status 不正确", body)); |
| ... | ... | @@ -127,9 +127,9 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | private static Integer parseStatus(String tradeStatus) { |
| 130 | - return Objects.equals("WAIT_BUYER_PAY", tradeStatus) ? PayOrderStatusRespEnum.WAITING.getStatus() | |
| 131 | - : ObjectUtils.equalsAny(tradeStatus, "TRADE_FINISHED", "TRADE_SUCCESS") ? PayOrderStatusRespEnum.SUCCESS.getStatus() | |
| 132 | - : Objects.equals("TRADE_CLOSED", tradeStatus) ? PayOrderStatusRespEnum.CLOSED.getStatus() : null; | |
| 130 | + return Objects.equals("WAIT_BUYER_PAY", tradeStatus) ? PayOrderStatusEnum.WAITING.getStatus() | |
| 131 | + : ObjectUtils.equalsAny(tradeStatus, "TRADE_FINISHED", "TRADE_SUCCESS") ? PayOrderStatusEnum.SUCCESS.getStatus() | |
| 132 | + : Objects.equals("TRADE_CLOSED", tradeStatus) ? PayOrderStatusEnum.CLOSED.getStatus() : null; | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // ============ 退款相关 ========== | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 8 | 7 | import com.alipay.api.AlipayApiException; |
| 9 | 8 | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| 10 | 9 | import com.alipay.api.request.AlipayTradeAppPayRequest; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayBarPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 11 | 10 | import com.alipay.api.AlipayApiException; |
| 12 | 11 | import com.alipay.api.domain.AlipayTradePayModel; |
| 13 | 12 | import com.alipay.api.request.AlipayTradePayRequest; |
| ... | ... | @@ -19,7 +18,7 @@ import java.util.Objects; |
| 19 | 18 | |
| 20 | 19 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| 21 | 20 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; |
| 22 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 21 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 23 | 22 | |
| 24 | 23 | /** |
| 25 | 24 | * 支付宝【条码支付】的 PayClient 实现类 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayClientConfig.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPayClientConfig.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | 7 | import jakarta.validation.Validator; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPcPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 4 | import cn.hutool.http.Method; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 10 | 9 | import com.alipay.api.AlipayApiException; |
| 11 | 10 | import com.alipay.api.domain.AlipayTradePagePayModel; |
| 12 | 11 | import com.alipay.api.request.AlipayTradePagePayRequest; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayQrPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.alipay.api.AlipayApiException; |
| 8 | 8 | import com.alipay.api.domain.AlipayTradePrecreateModel; |
| 9 | 9 | import com.alipay.api.request.AlipayTradePrecreateRequest; |
| ... | ... | @@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j; |
| 12 | 12 | |
| 13 | 13 | import java.util.Objects; |
| 14 | 14 | |
| 15 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 15 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE; | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * 支付宝【扫码支付】的 PayClient 实现类 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.http.Method; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 8 | 8 | import com.alipay.api.AlipayApiException; |
| 9 | 9 | import com.alipay.api.domain.AlipayTradeWapPayModel; |
| 10 | 10 | import com.alipay.api.request.AlipayTradeWapPayRequest; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/mock/MockPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/mock/MockPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.mock; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.mock; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.AbstractPayClient; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.NonePayClientConfig; | |
| 12 | 12 | |
| 13 | 13 | import java.time.LocalDateTime; |
| 14 | 14 | import java.util.Map; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/WalletPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/wallet/WalletPayClient.java
| 1 | -package cn.iocoder.yudao.module.pay.framework.pay.core; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.wallet; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | 5 | import cn.hutool.extra.spring.SpringUtil; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | |
| 14 | -import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; | |
| 15 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 16 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 17 | -import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferStatusRespEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 8 | +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | |
| 9 | +import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 14 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 15 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 16 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.AbstractPayClient; | |
| 17 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.NonePayClientConfig; | |
| 18 | 18 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 19 | 19 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; |
| 20 | 20 | import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; |
| ... | ... | @@ -51,7 +51,7 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> { |
| 51 | 51 | private PayRefundService refundService; |
| 52 | 52 | private PayTransferService transferService; |
| 53 | 53 | |
| 54 | - public WalletPayClient(Long channelId, NonePayClientConfig config) { | |
| 54 | + public WalletPayClient(Long channelId, NonePayClientConfig config) { | |
| 55 | 55 | super(channelId, PayChannelEnum.WALLET.getCode(), config); |
| 56 | 56 | } |
| 57 | 57 | |
| ... | ... | @@ -163,12 +163,12 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> { |
| 163 | 163 | outRefundNo, ""); |
| 164 | 164 | } |
| 165 | 165 | // 退款失败 |
| 166 | - if (PayRefundStatusRespEnum.isFailure(payRefund.getStatus())) { | |
| 166 | + if (PayRefundStatusEnum.isFailure(payRefund.getStatus())) { | |
| 167 | 167 | return PayRefundRespDTO.failureOf(payRefund.getChannelErrorCode(), payRefund.getChannelErrorMsg(), |
| 168 | 168 | outRefundNo, ""); |
| 169 | 169 | } |
| 170 | 170 | // 退款成功 |
| 171 | - if (PayRefundStatusRespEnum.isSuccess(payRefund.getStatus())) { | |
| 171 | + if (PayRefundStatusEnum.isSuccess(payRefund.getStatus())) { | |
| 172 | 172 | PayWalletTransactionDO walletTransaction = walletTransactionService.getWalletTransaction( |
| 173 | 173 | String.valueOf(payRefund.getId()), PayWalletBizTypeEnum.PAYMENT_REFUND); |
| 174 | 174 | Assert.notNull(walletTransaction, "支付退款单 {} 钱包流水不能为空", outRefundNo); |
| ... | ... | @@ -221,12 +221,12 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> { |
| 221 | 221 | PAY_ORDER_EXTENSION_NOT_FOUND.getMsg(), outTradeNo, ""); |
| 222 | 222 | } |
| 223 | 223 | // 关闭状态 |
| 224 | - if (PayTransferStatusRespEnum.isClosed(transfer.getStatus())) { | |
| 224 | + if (PayTransferStatusEnum.isClosed(transfer.getStatus())) { | |
| 225 | 225 | return PayTransferRespDTO.closedOf(transfer.getChannelErrorCode(), |
| 226 | 226 | transfer.getChannelErrorMsg(), outTradeNo, ""); |
| 227 | 227 | } |
| 228 | 228 | // 成功状态 |
| 229 | - if (PayTransferStatusRespEnum.isSuccess(transfer.getStatus())) { | |
| 229 | + if (PayTransferStatusEnum.isSuccess(transfer.getStatus())) { | |
| 230 | 230 | PayWalletTransactionDO walletTransaction = walletTransactionService.getWalletTransaction( |
| 231 | 231 | String.valueOf(transfer.getId()), PayWalletBizTypeEnum.TRANSFER); |
| 232 | 232 | Assert.notNull(walletTransaction, "转账单 {} 钱包流水不能为空", outTradeNo); |
| ... | ... | @@ -234,12 +234,12 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> { |
| 234 | 234 | outTradeNo, walletTransaction); |
| 235 | 235 | } |
| 236 | 236 | // 处理中状态 |
| 237 | - if (PayTransferStatusRespEnum.isProcessing(transfer.getStatus())) { | |
| 237 | + if (PayTransferStatusEnum.isProcessing(transfer.getStatus())) { | |
| 238 | 238 | return PayTransferRespDTO.processingOf(transfer.getChannelTransferNo(), |
| 239 | 239 | outTradeNo, transfer); |
| 240 | 240 | } |
| 241 | 241 | // 等待状态 |
| 242 | - if (transfer.getStatus().equals(PayTransferStatusRespEnum.WAITING.getStatus())) { | |
| 242 | + if (PayTransferStatusEnum.isWaiting(transfer.getStatus())) { | |
| 243 | 243 | return PayTransferRespDTO.waitingOf(transfer.getChannelTransferNo(), |
| 244 | 244 | outTradeNo, transfer); |
| 245 | 245 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.codec.Base64; |
| ... | ... | @@ -9,14 +9,14 @@ import cn.hutool.core.util.StrUtil; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 11 | 11 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 14 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 15 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 16 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 17 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 18 | -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | |
| 19 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 12 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 14 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 15 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 16 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 17 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 18 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 19 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.AbstractPayClient; | |
| 20 | 20 | import com.github.binarywang.wxpay.bean.notify.*; |
| 21 | 21 | import com.github.binarywang.wxpay.bean.request.*; |
| 22 | 22 | import com.github.binarywang.wxpay.bean.result.*; |
| ... | ... | @@ -36,8 +36,8 @@ import java.util.Map; |
| 36 | 36 | import java.util.Objects; |
| 37 | 37 | |
| 38 | 38 | import static cn.hutool.core.date.DatePattern.*; |
| 39 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V2; | |
| 40 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V3; | |
| 39 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V2; | |
| 40 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V3; | |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * 微信支付抽象类,实现微信统一的接口、以及部分实现(退款) |
| ... | ... | @@ -173,7 +173,7 @@ public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientC |
| 173 | 173 | // 2. 构建结果 |
| 174 | 174 | // V2 微信支付的回调,只有 SUCCESS 支付成功、CLOSED 支付失败两种情况,无需像支付宝一样解析的比较复杂 |
| 175 | 175 | Integer status = Objects.equals(response.getResultCode(), "SUCCESS") ? |
| 176 | - PayOrderStatusRespEnum.SUCCESS.getStatus() : PayOrderStatusRespEnum.CLOSED.getStatus(); | |
| 176 | + PayOrderStatusEnum.SUCCESS.getStatus() : PayOrderStatusEnum.CLOSED.getStatus(); | |
| 177 | 177 | return PayOrderRespDTO.of(status, response.getTransactionId(), response.getOpenid(), parseDateV2(response.getTimeEnd()), |
| 178 | 178 | response.getOutTradeNo(), body); |
| 179 | 179 | } |
| ... | ... | @@ -244,15 +244,15 @@ public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientC |
| 244 | 244 | switch (tradeState) { |
| 245 | 245 | case "NOTPAY": |
| 246 | 246 | case "USERPAYING": // 支付中,等待用户输入密码(条码支付独有) |
| 247 | - return PayOrderStatusRespEnum.WAITING.getStatus(); | |
| 247 | + return PayOrderStatusEnum.WAITING.getStatus(); | |
| 248 | 248 | case "SUCCESS": |
| 249 | - return PayOrderStatusRespEnum.SUCCESS.getStatus(); | |
| 249 | + return PayOrderStatusEnum.SUCCESS.getStatus(); | |
| 250 | 250 | case "REFUND": |
| 251 | - return PayOrderStatusRespEnum.REFUND.getStatus(); | |
| 251 | + return PayOrderStatusEnum.REFUND.getStatus(); | |
| 252 | 252 | case "CLOSED": |
| 253 | 253 | case "REVOKED": // 已撤销(刷卡支付独有) |
| 254 | 254 | case "PAYERROR": // 支付失败(其它原因,如银行返回失败) |
| 255 | - return PayOrderStatusRespEnum.CLOSED.getStatus(); | |
| 255 | + return PayOrderStatusEnum.CLOSED.getStatus(); | |
| 256 | 256 | default: |
| 257 | 257 | throw new IllegalArgumentException(StrUtil.format("未知的支付状态({})", tradeState)); |
| 258 | 258 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxAppPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult; |
| 8 | 8 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| 9 | 9 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | 4 | import cn.hutool.core.thread.ThreadUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 11 | 11 | import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest; |
| 12 | 12 | import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult; |
| 13 | 13 | import com.github.binarywang.wxpay.constant.WxPayConstants; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxLitePayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxLitePayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | 4 | import lombok.extern.slf4j.Slf4j; |
| 5 | 5 | |
| 6 | 6 | /** | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult; |
| 8 | 8 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| 9 | 9 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxPayClientConfig.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxPayClientConfig.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 5 | 5 | import jakarta.validation.Validator; |
| 6 | 6 | import jakarta.validation.constraints.NotBlank; |
| 7 | 7 | import lombok.Data; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxPubPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxPubPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 8 | 9 | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| 9 | 10 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| 10 | 11 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; |
| ... | ... | @@ -27,6 +28,11 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString |
| 27 | 28 | @Slf4j |
| 28 | 29 | public class WxPubPayClient extends AbstractWxPayClient { |
| 29 | 30 | |
| 31 | + @SuppressWarnings("unused") // 反射会调用到,所以不能删除 | |
| 32 | + public WxPubPayClient(Long channelId, WxPayClientConfig config) { | |
| 33 | + super(channelId, PayChannelEnum.WX_PUB.getCode(), config); | |
| 34 | + } | |
| 35 | + | |
| 30 | 36 | protected WxPubPayClient(Long channelId, String channelCode, WxPayClientConfig config) { |
| 31 | 37 | super(channelId, channelCode, config); |
| 32 | 38 | } | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxWapPayClient.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxWapPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 3 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult; |
| 8 | 8 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| 9 | 9 | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/order/PayOrderDisplayModeEnum.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/core/enums/PayOrderDisplayModeEnum.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/framework/pay/package-info.java
0 → 100644
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelService.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.service.channel; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 5 | 5 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java
| ... | ... | @@ -4,17 +4,18 @@ import cn.hutool.core.lang.Assert; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 7 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientConfig; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientFactory; | |
| 11 | 11 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; |
| 13 | 13 | import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; |
| 14 | 14 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 15 | 15 | import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; |
| 16 | -import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; | |
| 17 | -import jakarta.annotation.PostConstruct; | |
| 16 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.NonePayClientConfig; | |
| 17 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 18 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 18 | 19 | import jakarta.annotation.Resource; |
| 19 | 20 | import jakarta.validation.Validator; |
| 20 | 21 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -46,14 +47,6 @@ public class PayChannelServiceImpl implements PayChannelService { |
| 46 | 47 | @Resource |
| 47 | 48 | private Validator validator; |
| 48 | 49 | |
| 49 | - /** | |
| 50 | - * 初始化,为了注册钱包 | |
| 51 | - */ | |
| 52 | - @PostConstruct | |
| 53 | - public void init() { | |
| 54 | - payClientFactory.registerPayClientClass(PayChannelEnum.WALLET, WalletPayClient.class); | |
| 55 | - } | |
| 56 | - | |
| 57 | 50 | @Override |
| 58 | 51 | public Long createChannel(PayChannelCreateReqVO reqVO) { |
| 59 | 52 | // 断言是否有重复的 |
| ... | ... | @@ -89,7 +82,9 @@ public class PayChannelServiceImpl implements PayChannelService { |
| 89 | 82 | */ |
| 90 | 83 | private PayClientConfig parseConfig(String code, String configStr) { |
| 91 | 84 | // 解析配置 |
| 92 | - Class<? extends PayClientConfig> payClass = PayChannelEnum.getByCode(code).getConfigClass(); | |
| 85 | + Class<? extends PayClientConfig> payClass = PayChannelEnum.isAlipay(configStr) ? AlipayPayClientConfig.class | |
| 86 | + : PayChannelEnum.isWeixin(configStr) ? WxPayClientConfig.class | |
| 87 | + : NonePayClientConfig.class; | |
| 93 | 88 | if (ObjectUtil.isNull(payClass)) { |
| 94 | 89 | throw exception(CHANNEL_NOT_FOUND); |
| 95 | 90 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.service.order; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | 5 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
| ... | ... | @@ -7,10 +7,9 @@ import cn.hutool.extra.spring.SpringUtil; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 14 | 13 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 15 | 14 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 16 | 15 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| ... | ... | @@ -218,13 +217,13 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 218 | 217 | throw exception(PAY_ORDER_EXTENSION_IS_PAID); |
| 219 | 218 | } |
| 220 | 219 | // 情况二:调用三方接口,查询支付单状态,是不是已支付 |
| 221 | - PayClient payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 220 | + PayClient<?> payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 222 | 221 | if (payClient == null) { |
| 223 | 222 | log.error("[validateOrderCanSubmit][渠道编号({}) 找不到对应的支付客户端]", orderExtension.getChannelId()); |
| 224 | 223 | return; |
| 225 | 224 | } |
| 226 | 225 | PayOrderRespDTO respDTO = payClient.getOrder(orderExtension.getNo()); |
| 227 | - if (respDTO != null && PayOrderStatusRespEnum.isSuccess(respDTO.getStatus())) { | |
| 226 | + if (respDTO != null && PayOrderStatusEnum.isSuccess(respDTO.getStatus())) { | |
| 228 | 227 | log.warn("[validateOrderCanSubmit][order({}) 的 PayOrderRespDTO({}) 已支付,可能是回调延迟]", |
| 229 | 228 | id, toJsonString(respDTO)); |
| 230 | 229 | throw exception(PAY_ORDER_EXTENSION_IS_PAID); |
| ... | ... | @@ -273,12 +272,12 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 273 | 272 | // 注意,如果是方法内调用该方法,需要通过 getSelf().notifyPayOrder(channel, notify) 调用,否则事务不生效 |
| 274 | 273 | public void notifyOrder(PayChannelDO channel, PayOrderRespDTO notify) { |
| 275 | 274 | // 情况一:支付成功的回调 |
| 276 | - if (PayOrderStatusRespEnum.isSuccess(notify.getStatus())) { | |
| 275 | + if (PayOrderStatusEnum.isSuccess(notify.getStatus())) { | |
| 277 | 276 | notifyOrderSuccess(channel, notify); |
| 278 | 277 | return; |
| 279 | 278 | } |
| 280 | 279 | // 情况二:支付失败的回调 |
| 281 | - if (PayOrderStatusRespEnum.isClosed(notify.getStatus())) { | |
| 280 | + if (PayOrderStatusEnum.isClosed(notify.getStatus())) { | |
| 282 | 281 | notifyOrderClosed(channel, notify); |
| 283 | 282 | } |
| 284 | 283 | // 情况三:WAITING:无需处理 |
| ... | ... | @@ -373,6 +372,7 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 373 | 372 | updateOrderExtensionClosed(channel, notify); |
| 374 | 373 | } |
| 375 | 374 | |
| 375 | + @SuppressWarnings("unused") | |
| 376 | 376 | private void updateOrderExtensionClosed(PayChannelDO channel, PayOrderRespDTO notify) { |
| 377 | 377 | // 1. 查询 PayOrderExtensionDO |
| 378 | 378 | PayOrderExtensionDO orderExtension = orderExtensionMapper.selectByNo(notify.getOutTradeNo()); |
| ... | ... | @@ -488,7 +488,7 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 488 | 488 | private boolean syncOrder(PayOrderExtensionDO orderExtension) { |
| 489 | 489 | try { |
| 490 | 490 | // 1.1 查询支付订单信息 |
| 491 | - PayClient payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 491 | + PayClient<?> payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 492 | 492 | if (payClient == null) { |
| 493 | 493 | log.error("[syncOrder][渠道编号({}) 找不到对应的支付客户端]", orderExtension.getChannelId()); |
| 494 | 494 | return false; |
| ... | ... | @@ -499,14 +499,14 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 499 | 499 | // 当用户支付成功之后,该订单状态在渠道的回调中无法从已关闭改为已支付,造成重大影响。 |
| 500 | 500 | // 考虑此定时任务是异常场景的兜底操作,因此这里不做变更,优先以回调为准。 |
| 501 | 501 | // 让订单自动随着支付渠道那边一起等到过期,确保渠道先过期关闭支付入口,而后通过订单过期定时任务关闭自己的订单。 |
| 502 | - if (PayOrderStatusRespEnum.isClosed(respDTO.getStatus())) { | |
| 502 | + if (PayOrderStatusEnum.isClosed(respDTO.getStatus())) { | |
| 503 | 503 | return false; |
| 504 | 504 | } |
| 505 | 505 | // 1.2 回调支付结果 |
| 506 | 506 | notifyOrder(orderExtension.getChannelId(), respDTO); |
| 507 | 507 | |
| 508 | 508 | // 2. 如果是已支付,则返回 true |
| 509 | - return PayOrderStatusRespEnum.isSuccess(respDTO.getStatus()); | |
| 509 | + return PayOrderStatusEnum.isSuccess(respDTO.getStatus()); | |
| 510 | 510 | } catch (Throwable e) { |
| 511 | 511 | log.error("[syncOrder][orderExtension({}) 同步支付状态异常]", orderExtension.getId(), e); |
| 512 | 512 | return false; |
| ... | ... | @@ -551,20 +551,20 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 551 | 551 | return false; |
| 552 | 552 | } |
| 553 | 553 | // 情况二:调用三方接口,查询支付单状态,是不是已支付/已退款 |
| 554 | - PayClient payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 554 | + PayClient<?> payClient = channelService.getPayClient(orderExtension.getChannelId()); | |
| 555 | 555 | if (payClient == null) { |
| 556 | 556 | log.error("[expireOrder][渠道编号({}) 找不到对应的支付客户端]", orderExtension.getChannelId()); |
| 557 | 557 | return false; |
| 558 | 558 | } |
| 559 | 559 | PayOrderRespDTO respDTO = payClient.getOrder(orderExtension.getNo()); |
| 560 | - if (PayOrderStatusRespEnum.isRefund(respDTO.getStatus())) { | |
| 560 | + if (PayOrderStatusEnum.isRefund(respDTO.getStatus())) { | |
| 561 | 561 | // 补充说明:按道理,应该是 WAITING => SUCCESS => REFUND 状态,如果直接 WAITING => REFUND 状态,说明中间丢了过程 |
| 562 | 562 | // 此时,需要人工介入,手工补齐数据,保持 WAITING => SUCCESS => REFUND 的过程 |
| 563 | 563 | log.error("[expireOrder][extension({}) 的 PayOrderRespDTO({}) 已退款,可能是回调延迟]", |
| 564 | 564 | orderExtension.getId(), toJsonString(respDTO)); |
| 565 | 565 | return false; |
| 566 | 566 | } |
| 567 | - if (PayOrderStatusRespEnum.isSuccess(respDTO.getStatus())) { | |
| 567 | + if (PayOrderStatusEnum.isSuccess(respDTO.getStatus())) { | |
| 568 | 568 | notifyOrder(orderExtension.getChannelId(), respDTO); |
| 569 | 569 | return false; |
| 570 | 570 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.service.refund; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 5 | 5 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java
| ... | ... | @@ -3,10 +3,9 @@ package cn.iocoder.yudao.module.pay.service.refund; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.extra.spring.SpringUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 10 | 9 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| ... | ... | @@ -203,12 +202,12 @@ public class PayRefundServiceImpl implements PayRefundService { |
| 203 | 202 | @Transactional(rollbackFor = Exception.class) |
| 204 | 203 | public void notifyRefund(PayChannelDO channel, PayRefundRespDTO notify) { |
| 205 | 204 | // 情况一:退款成功 |
| 206 | - if (PayRefundStatusRespEnum.isSuccess(notify.getStatus())) { | |
| 205 | + if (PayRefundStatusEnum.isSuccess(notify.getStatus())) { | |
| 207 | 206 | notifyRefundSuccess(channel, notify); |
| 208 | 207 | return; |
| 209 | 208 | } |
| 210 | 209 | // 情况二:退款失败 |
| 211 | - if (PayRefundStatusRespEnum.isFailure(notify.getStatus())) { | |
| 210 | + if (PayRefundStatusEnum.isFailure(notify.getStatus())) { | |
| 212 | 211 | notifyRefundFailure(channel, notify); |
| 213 | 212 | } |
| 214 | 213 | } |
| ... | ... | @@ -302,7 +301,7 @@ public class PayRefundServiceImpl implements PayRefundService { |
| 302 | 301 | private boolean syncRefund(PayRefundDO refund) { |
| 303 | 302 | try { |
| 304 | 303 | // 1.1 查询退款订单信息 |
| 305 | - PayClient payClient = channelService.getPayClient(refund.getChannelId()); | |
| 304 | + PayClient<?> payClient = channelService.getPayClient(refund.getChannelId()); | |
| 306 | 305 | if (payClient == null) { |
| 307 | 306 | log.error("[syncRefund][渠道编号({}) 找不到对应的支付客户端]", refund.getChannelId()); |
| 308 | 307 | return false; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.service.transfer; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 5 | 5 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateRespDTO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferServiceImpl.java
| ... | ... | @@ -6,10 +6,9 @@ import cn.hutool.extra.spring.SpringUtil; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferStatusRespEnum; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO; | |
| 13 | 12 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 14 | 13 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; |
| 15 | 14 | import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateRespDTO; |
| ... | ... | @@ -142,15 +141,15 @@ public class PayTransferServiceImpl implements PayTransferService { |
| 142 | 141 | // 注意,如果是方法内调用该方法,需要通过 getSelf().notifyTransfer(channel, notify) 调用,否则事务不生效 |
| 143 | 142 | public void notifyTransfer(PayChannelDO channel, PayTransferRespDTO notify) { |
| 144 | 143 | // 转账成功的回调 |
| 145 | - if (PayTransferStatusRespEnum.isSuccess(notify.getStatus())) { | |
| 144 | + if (PayTransferStatusEnum.isSuccess(notify.getStatus())) { | |
| 146 | 145 | notifyTransferSuccess(channel, notify); |
| 147 | 146 | } |
| 148 | 147 | // 转账关闭的回调 |
| 149 | - if (PayTransferStatusRespEnum.isClosed(notify.getStatus())) { | |
| 148 | + if (PayTransferStatusEnum.isClosed(notify.getStatus())) { | |
| 150 | 149 | notifyTransferClosed(channel, notify); |
| 151 | 150 | } |
| 152 | 151 | // 转账处理中的回调 |
| 153 | - if (PayTransferStatusRespEnum.isProcessing(notify.getStatus())) { | |
| 152 | + if (PayTransferStatusEnum.isProcessing(notify.getStatus())) { | |
| 154 | 153 | notifyTransferProgressing(channel, notify); |
| 155 | 154 | } |
| 156 | 155 | // WAITING 状态无需处理 |
| ... | ... | @@ -162,7 +161,7 @@ public class PayTransferServiceImpl implements PayTransferService { |
| 162 | 161 | if (transfer == null) { |
| 163 | 162 | throw exception(PAY_TRANSFER_NOT_FOUND); |
| 164 | 163 | } |
| 165 | - if (PayTransferStatusEnum.isProgressing(transfer.getStatus())) { // 如果已经是转账中,直接返回,不用重复更新 | |
| 164 | + if (PayTransferStatusEnum.isProcessing(transfer.getStatus())) { // 如果已经是转账中,直接返回,不用重复更新 | |
| 166 | 165 | log.info("[notifyTransferProgressing][transfer({}) 已经是转账中状态,无需更新]", transfer.getId()); |
| 167 | 166 | return; |
| 168 | 167 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
| ... | ... | @@ -6,7 +6,6 @@ import cn.hutool.core.util.ObjectUtil; |
| 6 | 6 | import cn.hutool.extra.spring.SpringUtil; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 10 | 9 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| ... | ... | @@ -224,7 +223,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { |
| 224 | 223 | .setRefundTotalPrice(walletRecharge.getTotalPrice()).setRefundPayPrice(walletRecharge.getPayPrice()) |
| 225 | 224 | .setRefundBonusPrice(walletRecharge.getBonusPrice()); |
| 226 | 225 | // 情况二:退款失败 |
| 227 | - } else if (PayRefundStatusRespEnum.isFailure(payRefund.getStatus())) { | |
| 226 | + } else if (PayRefundStatusEnum.isFailure(payRefund.getStatus())) { | |
| 228 | 227 | // 2.2 解冻余额 |
| 229 | 228 | payWalletService.unfreezePrice(walletRecharge.getWalletId(), walletRecharge.getTotalPrice()); |
| 230 | 229 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.PayClientFactoryImpl; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayQrPayClient; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayWapPayClient; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPubPayClient; | |
| 13 | 14 | import org.junit.jupiter.api.Disabled; |
| 14 | 15 | import org.junit.jupiter.api.Test; |
| 15 | 16 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; | |
| 12 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 13 | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; |
| 9 | +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | |
| 10 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.exception.PayClientException; | |
| 14 | 14 | import com.alipay.api.AlipayApiException; |
| 15 | 15 | import com.alipay.api.DefaultAlipayClient; |
| 16 | 16 | import com.alipay.api.DefaultSigner; |
| ... | ... | @@ -27,8 +27,8 @@ import org.mockito.Mock; |
| 27 | 27 | import jakarta.validation.ConstraintViolationException; |
| 28 | 28 | import java.util.Date; |
| 29 | 29 | |
| 30 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_PUBLIC_KEY; | |
| 31 | 30 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 31 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_PUBLIC_KEY; | |
| 32 | 32 | import static org.junit.jupiter.api.Assertions.*; |
| 33 | 33 | import static org.mockito.ArgumentMatchers.argThat; |
| 34 | 34 | import static org.mockito.Mockito.when; |
| ... | ... | @@ -106,7 +106,7 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest { |
| 106 | 106 | // 调用 |
| 107 | 107 | PayRefundRespDTO resp = client.unifiedRefund(refundReqDTO); |
| 108 | 108 | // 断言 |
| 109 | - assertEquals(PayRefundStatusRespEnum.SUCCESS.getStatus(), resp.getStatus()); | |
| 109 | + assertEquals(PayRefundStatusEnum.SUCCESS.getStatus(), resp.getStatus()); | |
| 110 | 110 | assertEquals(outRefundNo, resp.getOutRefundNo()); |
| 111 | 111 | assertNull(resp.getChannelRefundNo()); |
| 112 | 112 | assertEquals(LocalDateTimeUtil.of(refundTime), resp.getSuccessTime()); |
| ... | ... | @@ -142,7 +142,7 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest { |
| 142 | 142 | // 调用 |
| 143 | 143 | PayRefundRespDTO resp = client.unifiedRefund(refundReqDTO); |
| 144 | 144 | // 断言 |
| 145 | - assertEquals(PayRefundStatusRespEnum.FAILURE.getStatus(), resp.getStatus()); | |
| 145 | + assertEquals(PayRefundStatusEnum.FAILURE.getStatus(), resp.getStatus()); | |
| 146 | 146 | assertEquals(outRefundNo, resp.getOutRefundNo()); |
| 147 | 147 | assertNull(resp.getChannelRefundNo()); |
| 148 | 148 | assertNull(resp.getSuccessTime()); |
| ... | ... | @@ -190,7 +190,7 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest { |
| 190 | 190 | PayRefundUnifiedReqDTO refundReqDTO = randomPojo(PayRefundUnifiedReqDTO.class, o -> o.setNotifyUrl(notifyUrl)); |
| 191 | 191 | |
| 192 | 192 | // 调用,并断言 |
| 193 | - assertThrows(PayException.class, () -> client.unifiedRefund(refundReqDTO)); | |
| 193 | + assertThrows(PayClientException.class, () -> client.unifiedRefund(refundReqDTO)); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | @Test | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 9 | 9 | import com.alipay.api.AlipayApiException; |
| 10 | 10 | import com.alipay.api.domain.AlipayTradePayModel; |
| 11 | 11 | import com.alipay.api.request.AlipayTradePayRequest; |
| ... | ... | @@ -20,8 +20,8 @@ import java.util.Date; |
| 20 | 20 | import java.util.HashMap; |
| 21 | 21 | import java.util.Map; |
| 22 | 22 | |
| 23 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED; | |
| 24 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING; | |
| 23 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED; | |
| 24 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING; | |
| 25 | 25 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 26 | 26 | import static org.junit.jupiter.api.Assertions.*; |
| 27 | 27 | import static org.mockito.ArgumentMatchers.argThat; |
| ... | ... | @@ -110,7 +110,7 @@ public class AlipayBarPayClientTest extends AbstractAlipayClientTest { |
| 110 | 110 | // 下单请求 |
| 111 | 111 | PayOrderRespDTO resp = client.unifiedOrder(reqDTO); |
| 112 | 112 | // 断言 |
| 113 | - assertEquals(PayOrderStatusRespEnum.SUCCESS.getStatus(), resp.getStatus()); | |
| 113 | + assertEquals(PayOrderStatusEnum.SUCCESS.getStatus(), resp.getStatus()); | |
| 114 | 114 | assertEquals(outTradeNo, resp.getOutTradeNo()); |
| 115 | 115 | assertEquals(channelNo, resp.getChannelOrderNo()); |
| 116 | 116 | assertEquals(channelUserId, resp.getChannelUserId()); | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.http.Method; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.alipay.api.AlipayApiException; |
| 8 | 8 | import com.alipay.api.request.AlipayTradePagePayRequest; |
| 9 | 9 | import com.alipay.api.response.AlipayTradePagePayResponse; |
| ... | ... | @@ -13,8 +13,8 @@ import org.junit.jupiter.api.Test; |
| 13 | 13 | import org.mockito.ArgumentMatcher; |
| 14 | 14 | import org.mockito.InjectMocks; |
| 15 | 15 | |
| 16 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED; | |
| 17 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING; | |
| 16 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED; | |
| 17 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING; | |
| 18 | 18 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 19 | 19 | import static org.junit.jupiter.api.Assertions.*; |
| 20 | 20 | import static org.junit.jupiter.api.Assertions.assertNull; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.exception.PayException; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.exception.PayClientException; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 10 | 10 | import com.alipay.api.AlipayApiException; |
| 11 | 11 | import com.alipay.api.request.AlipayTradePrecreateRequest; |
| 12 | 12 | import com.alipay.api.response.AlipayTradePrecreateResponse; |
| ... | ... | @@ -16,9 +16,9 @@ import org.junit.jupiter.api.Test; |
| 16 | 16 | import org.mockito.ArgumentMatcher; |
| 17 | 17 | import org.mockito.InjectMocks; |
| 18 | 18 | |
| 19 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED; | |
| 20 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING; | |
| 21 | 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 20 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED; | |
| 21 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING; | |
| 22 | 22 | import static org.junit.jupiter.api.Assertions.*; |
| 23 | 23 | import static org.mockito.ArgumentMatchers.argThat; |
| 24 | 24 | import static org.mockito.Mockito.when; |
| ... | ... | @@ -123,7 +123,7 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest { |
| 123 | 123 | PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo,price); |
| 124 | 124 | |
| 125 | 125 | // 调用,并断言 |
| 126 | - assertThrows(PayException.class, () -> client.unifiedOrder(reqDTO)); | |
| 126 | + assertThrows(PayClientException.class, () -> client.unifiedOrder(reqDTO)); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | @Test | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.http.Method; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 5 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 7 | 7 | import com.alipay.api.AlipayApiException; |
| 8 | 8 | import com.alipay.api.domain.AlipayTradeWapPayModel; |
| 9 | 9 | import com.alipay.api.request.AlipayTradeWapPayRequest; |
| ... | ... | @@ -14,9 +14,9 @@ import org.junit.jupiter.api.Test; |
| 14 | 14 | import org.mockito.ArgumentMatcher; |
| 15 | 15 | import org.mockito.InjectMocks; |
| 16 | 16 | |
| 17 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED; | |
| 18 | -import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING; | |
| 19 | 17 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 18 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED; | |
| 19 | +import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING; | |
| 20 | 20 | import static org.junit.jupiter.api.Assertions.*; |
| 21 | 21 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 22 | 22 | import static org.mockito.ArgumentMatchers.argThat; | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| ... | ... | @@ -18,7 +18,7 @@ import org.junit.jupiter.api.Test; |
| 18 | 18 | |
| 19 | 19 | import java.time.Duration; |
| 20 | 20 | |
| 21 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV2; | |
| 21 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV2; | |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * {@link WxBarPayClient} 的集成测试,用于快速调试微信条码支付 | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java renamed to yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 1 | +package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| ... | ... | @@ -15,7 +15,8 @@ import org.junit.jupiter.api.Test; |
| 15 | 15 | |
| 16 | 16 | import java.time.Duration; |
| 17 | 17 | |
| 18 | -import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV3; | |
| 18 | +import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV3; | |
| 19 | + | |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * {@link WxNativePayClient} 的集成测试,用于快速调试微信扫码支付 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
| ... | ... | @@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.pay.service.channel; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientFactory; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 9 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 10 | 10 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 11 | 11 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
| ... | ... | @@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.pay.service.order; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.extra.spring.SpringUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | |
| 10 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| ... | ... | @@ -515,7 +514,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 515 | 514 | // 准备参数 |
| 516 | 515 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 517 | 516 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 518 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus())); | |
| 517 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus())); | |
| 519 | 518 | |
| 520 | 519 | // 调用,并断言异常 |
| 521 | 520 | assertServiceException(() -> orderService.notifyOrder(channel, notify), |
| ... | ... | @@ -532,7 +531,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 532 | 531 | // 准备参数 |
| 533 | 532 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 534 | 533 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 535 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus()) | |
| 534 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus()) | |
| 536 | 535 | .setOutTradeNo("P110")); |
| 537 | 536 | |
| 538 | 537 | // 调用,并断言异常 |
| ... | ... | @@ -550,7 +549,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 550 | 549 | // 准备参数 |
| 551 | 550 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 552 | 551 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 553 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus()) | |
| 552 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus()) | |
| 554 | 553 | .setOutTradeNo("P110")); |
| 555 | 554 | |
| 556 | 555 | // 调用,并断言异常 |
| ... | ... | @@ -583,7 +582,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 583 | 582 | // 准备参数 |
| 584 | 583 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 585 | 584 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 586 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus()) | |
| 585 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus()) | |
| 587 | 586 | .setOutTradeNo("P110")); |
| 588 | 587 | |
| 589 | 588 | // 调用,并断言异常 |
| ... | ... | @@ -611,7 +610,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 611 | 610 | // 准备参数 |
| 612 | 611 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 613 | 612 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 614 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus()) | |
| 613 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus()) | |
| 615 | 614 | .setOutTradeNo("P110")); |
| 616 | 615 | |
| 617 | 616 | // 调用,并断言异常 |
| ... | ... | @@ -641,7 +640,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 641 | 640 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L) |
| 642 | 641 | .setFeeRate(10D)); |
| 643 | 642 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 644 | - o -> o.setStatus(PayOrderStatusRespEnum.SUCCESS.getStatus()) | |
| 643 | + o -> o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus()) | |
| 645 | 644 | .setOutTradeNo("P110")); |
| 646 | 645 | |
| 647 | 646 | // 调用,并断言异常 |
| ... | ... | @@ -669,7 +668,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 669 | 668 | // 准备参数 |
| 670 | 669 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 671 | 670 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 672 | - o -> o.setStatus(PayOrderStatusRespEnum.CLOSED.getStatus())); | |
| 671 | + o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus())); | |
| 673 | 672 | |
| 674 | 673 | // 调用,并断言异常 |
| 675 | 674 | assertServiceException(() -> orderService.notifyOrder(channel, notify), |
| ... | ... | @@ -686,7 +685,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 686 | 685 | // 准备参数 |
| 687 | 686 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 688 | 687 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 689 | - o -> o.setStatus(PayOrderStatusRespEnum.CLOSED.getStatus()) | |
| 688 | + o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus()) | |
| 690 | 689 | .setOutTradeNo("P110")); |
| 691 | 690 | |
| 692 | 691 | // 调用,并断言 |
| ... | ... | @@ -705,7 +704,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 705 | 704 | // 准备参数 |
| 706 | 705 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 707 | 706 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 708 | - o -> o.setStatus(PayOrderStatusRespEnum.CLOSED.getStatus()) | |
| 707 | + o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus()) | |
| 709 | 708 | .setOutTradeNo("P110")); |
| 710 | 709 | |
| 711 | 710 | // 调用,并断言 |
| ... | ... | @@ -724,7 +723,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 724 | 723 | // 准备参数 |
| 725 | 724 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 726 | 725 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 727 | - o -> o.setStatus(PayOrderStatusRespEnum.CLOSED.getStatus()) | |
| 726 | + o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus()) | |
| 728 | 727 | .setOutTradeNo("P110")); |
| 729 | 728 | |
| 730 | 729 | // 调用,并断言异常 |
| ... | ... | @@ -742,7 +741,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { |
| 742 | 741 | // 准备参数 |
| 743 | 742 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); |
| 744 | 743 | PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, |
| 745 | - o -> o.setStatus(PayOrderStatusRespEnum.CLOSED.getStatus()) | |
| 744 | + o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus()) | |
| 746 | 745 | .setOutTradeNo("P110")); |
| 747 | 746 | |
| 748 | 747 | // 调用 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
| ... | ... | @@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.pay.service.refund; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.extra.spring.SpringUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClient; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 8 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | |
| 5 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | |
| 6 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | |
| 7 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | |
| 10 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; |
| 11 | 10 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 12 | 11 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| ... | ... | @@ -464,7 +463,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 464 | 463 | // 准备参数 |
| 465 | 464 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 466 | 465 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 467 | - o -> o.setStatus(PayRefundStatusRespEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 466 | + o -> o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 468 | 467 | |
| 469 | 468 | // 调用,并断言异常 |
| 470 | 469 | assertServiceException(() -> refundService.notifyRefund(channel, refundRespDTO), |
| ... | ... | @@ -476,7 +475,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 476 | 475 | // 准备参数 |
| 477 | 476 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 478 | 477 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 479 | - o -> o.setStatus(PayRefundStatusRespEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 478 | + o -> o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 480 | 479 | // mock 数据(refund + 已支付) |
| 481 | 480 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 482 | 481 | .setStatus(PayRefundStatusEnum.SUCCESS.getStatus())); |
| ... | ... | @@ -493,7 +492,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 493 | 492 | // 准备参数 |
| 494 | 493 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 495 | 494 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 496 | - o -> o.setStatus(PayRefundStatusRespEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 495 | + o -> o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 497 | 496 | // mock 数据(refund + 已支付) |
| 498 | 497 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 499 | 498 | .setStatus(PayRefundStatusEnum.FAILURE.getStatus())); |
| ... | ... | @@ -509,7 +508,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 509 | 508 | // 准备参数 |
| 510 | 509 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 511 | 510 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 512 | - o -> o.setStatus(PayRefundStatusRespEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 511 | + o -> o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 513 | 512 | // mock 数据(refund + 已支付) |
| 514 | 513 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 515 | 514 | .setStatus(PayRefundStatusEnum.WAITING.getStatus()) |
| ... | ... | @@ -530,7 +529,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 530 | 529 | // 准备参数 |
| 531 | 530 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 532 | 531 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 533 | - o -> o.setStatus(PayRefundStatusRespEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 532 | + o -> o.setStatus(PayRefundStatusEnum.SUCCESS.getStatus()).setOutRefundNo("R100")); | |
| 534 | 533 | // mock 数据(refund + 已支付) |
| 535 | 534 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 536 | 535 | .setStatus(PayRefundStatusEnum.WAITING.getStatus()) |
| ... | ... | @@ -557,7 +556,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 557 | 556 | // 准备参数 |
| 558 | 557 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 559 | 558 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 560 | - o -> o.setStatus(PayRefundStatusRespEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 559 | + o -> o.setStatus(PayRefundStatusEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 561 | 560 | |
| 562 | 561 | // 调用,并断言异常 |
| 563 | 562 | assertServiceException(() -> refundService.notifyRefund(channel, refundRespDTO), |
| ... | ... | @@ -569,7 +568,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 569 | 568 | // 准备参数 |
| 570 | 569 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 571 | 570 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 572 | - o -> o.setStatus(PayRefundStatusRespEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 571 | + o -> o.setStatus(PayRefundStatusEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 573 | 572 | // mock 数据(refund + 退款失败) |
| 574 | 573 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 575 | 574 | .setStatus(PayRefundStatusEnum.FAILURE.getStatus())); |
| ... | ... | @@ -586,7 +585,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 586 | 585 | // 准备参数 |
| 587 | 586 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 588 | 587 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 589 | - o -> o.setStatus(PayRefundStatusRespEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 588 | + o -> o.setStatus(PayRefundStatusEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 590 | 589 | // mock 数据(refund + 已支付) |
| 591 | 590 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 592 | 591 | .setStatus(PayRefundStatusEnum.SUCCESS.getStatus())); |
| ... | ... | @@ -602,7 +601,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 602 | 601 | // 准备参数 |
| 603 | 602 | PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L).setAppId(1L)); |
| 604 | 603 | PayRefundRespDTO refundRespDTO = randomPojo(PayRefundRespDTO.class, |
| 605 | - o -> o.setStatus(PayRefundStatusRespEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 604 | + o -> o.setStatus(PayRefundStatusEnum.FAILURE.getStatus()).setOutRefundNo("R100")); | |
| 606 | 605 | // mock 数据(refund + 已支付) |
| 607 | 606 | PayRefundDO refund = randomPojo(PayRefundDO.class, o -> o.setAppId(1L).setNo("R100") |
| 608 | 607 | .setStatus(PayRefundStatusEnum.WAITING.getStatus()) |
| ... | ... | @@ -639,17 +638,17 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { |
| 639 | 638 | |
| 640 | 639 | @Test |
| 641 | 640 | public void testSyncRefund_waiting() { |
| 642 | - assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusRespEnum.WAITING.getStatus()), 0); | |
| 641 | + assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusEnum.WAITING.getStatus()), 0); | |
| 643 | 642 | } |
| 644 | 643 | |
| 645 | 644 | @Test |
| 646 | 645 | public void testSyncRefund_success() { |
| 647 | - assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusRespEnum.SUCCESS.getStatus()), 1); | |
| 646 | + assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusEnum.SUCCESS.getStatus()), 1); | |
| 648 | 647 | } |
| 649 | 648 | |
| 650 | 649 | @Test |
| 651 | 650 | public void testSyncRefund_failure() { |
| 652 | - assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusRespEnum.FAILURE.getStatus()), 1); | |
| 651 | + assertEquals(testSyncRefund_waitingOrSuccessOrFailure(PayRefundStatusEnum.FAILURE.getStatus()), 1); | |
| 653 | 652 | } |
| 654 | 653 | |
| 655 | 654 | private int testSyncRefund_waitingOrSuccessOrFailure(Integer status) { | ... | ... |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-module-pay</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - | |
| 12 | - <artifactId>yudao-spring-boot-starter-biz-pay</artifactId> | |
| 13 | - <name>${project.artifactId}</name> | |
| 14 | - <description>支付拓展,接入国内多个支付渠道 | |
| 15 | - 1. 支付宝,基于官方 SDK 接入 | |
| 16 | - 2. 微信支付,基于 weixin-java-pay 接入 | |
| 17 | - </description> | |
| 18 | - | |
| 19 | - <dependencies> | |
| 20 | - <dependency> | |
| 21 | - <groupId>cn.iocoder.boot</groupId> | |
| 22 | - <artifactId>yudao-common</artifactId> | |
| 23 | - </dependency> | |
| 24 | - | |
| 25 | - <!-- Spring 核心 --> | |
| 26 | - <dependency> | |
| 27 | - <groupId>org.springframework.boot</groupId> | |
| 28 | - <artifactId>spring-boot-starter</artifactId> | |
| 29 | - </dependency> | |
| 30 | - | |
| 31 | - <!-- 工具类相关 --> | |
| 32 | - <dependency> | |
| 33 | - <groupId>org.springframework.boot</groupId> | |
| 34 | - <artifactId>spring-boot-starter-validation</artifactId> | |
| 35 | - </dependency> | |
| 36 | - | |
| 37 | - <dependency> | |
| 38 | - <groupId>org.slf4j</groupId> | |
| 39 | - <artifactId>slf4j-api</artifactId> | |
| 40 | - </dependency> | |
| 41 | - | |
| 42 | - <dependency> | |
| 43 | - <groupId>com.fasterxml.jackson.core</groupId> | |
| 44 | - <artifactId>jackson-databind</artifactId> | |
| 45 | - </dependency> | |
| 46 | - <dependency> | |
| 47 | - <groupId>com.fasterxml.jackson.core</groupId> | |
| 48 | - <artifactId>jackson-core</artifactId> | |
| 49 | - </dependency> | |
| 50 | - | |
| 51 | - <!-- 三方云服务相关 --> | |
| 52 | - <dependency> | |
| 53 | - <groupId>com.alipay.sdk</groupId> | |
| 54 | - <artifactId>alipay-sdk-java</artifactId> | |
| 55 | - <version>4.35.79.ALL</version> | |
| 56 | - <exclusions> | |
| 57 | - <exclusion> | |
| 58 | - <groupId>org.bouncycastle</groupId> | |
| 59 | - <artifactId>bcprov-jdk15on</artifactId> | |
| 60 | - </exclusion> | |
| 61 | - </exclusions> | |
| 62 | - </dependency> | |
| 63 | - <dependency> | |
| 64 | - <groupId>com.github.binarywang</groupId> | |
| 65 | - <artifactId>weixin-java-pay</artifactId> | |
| 66 | - </dependency> | |
| 67 | - | |
| 68 | - <!-- Test 测试相关 --> | |
| 69 | - <dependency> | |
| 70 | - <groupId>cn.iocoder.boot</groupId> | |
| 71 | - <artifactId>yudao-spring-boot-starter-test</artifactId> | |
| 72 | - <scope>test</scope> | |
| 73 | - </dependency> | |
| 74 | - | |
| 75 | - </dependencies> | |
| 76 | - | |
| 77 | -</project> |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/YudaoPayAutoConfiguration.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.config; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.impl.PayClientFactoryImpl; | |
| 5 | -import org.springframework.boot.autoconfigure.AutoConfiguration; | |
| 6 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 7 | -import org.springframework.context.annotation.Bean; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 支付配置类 | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@AutoConfiguration | |
| 15 | -public class YudaoPayAutoConfiguration { | |
| 16 | - | |
| 17 | - @Bean | |
| 18 | - public PayClientFactory payClientFactory() { | |
| 19 | - return new PayClientFactoryImpl(); | |
| 20 | - } | |
| 21 | - | |
| 22 | -} |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.core.enums.channel; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.ArrayUtil; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; | |
| 8 | -import lombok.AllArgsConstructor; | |
| 9 | -import lombok.Getter; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 支付渠道的编码的枚举 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Getter | |
| 17 | -@AllArgsConstructor | |
| 18 | -public enum PayChannelEnum { | |
| 19 | - | |
| 20 | - WX_PUB("wx_pub", "微信 JSAPI 支付", WxPayClientConfig.class), // 公众号网页 | |
| 21 | - WX_LITE("wx_lite", "微信小程序支付", WxPayClientConfig.class), | |
| 22 | - WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class), | |
| 23 | - WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class), | |
| 24 | - WX_WAP("wx_wap", "微信 Wap 网站支付", WxPayClientConfig.class), // H5 网页 | |
| 25 | - WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class), | |
| 26 | - | |
| 27 | - ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), | |
| 28 | - ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class), | |
| 29 | - ALIPAY_APP("alipay_app", "支付宝App 支付", AlipayPayClientConfig.class), | |
| 30 | - ALIPAY_QR("alipay_qr", "支付宝扫码支付", AlipayPayClientConfig.class), | |
| 31 | - ALIPAY_BAR("alipay_bar", "支付宝条码支付", AlipayPayClientConfig.class), | |
| 32 | - MOCK("mock", "模拟支付", NonePayClientConfig.class), | |
| 33 | - | |
| 34 | - WALLET("wallet", "钱包支付", NonePayClientConfig.class); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 编码 | |
| 38 | - * | |
| 39 | - * 参考 <a href="https://www.pingxx.com/api/支付渠道属性值.html">支付渠道属性值</a> | |
| 40 | - */ | |
| 41 | - private final String code; | |
| 42 | - /** | |
| 43 | - * 名字 | |
| 44 | - */ | |
| 45 | - private final String name; | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 配置类 | |
| 49 | - */ | |
| 50 | - private final Class<? extends PayClientConfig> configClass; | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 微信支付 | |
| 54 | - */ | |
| 55 | - public static final String WECHAT = "WECHAT"; | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 支付宝支付 | |
| 59 | - */ | |
| 60 | - public static final String ALIPAY = "ALIPAY"; | |
| 61 | - | |
| 62 | - public static PayChannelEnum getByCode(String code) { | |
| 63 | - return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); | |
| 64 | - } | |
| 65 | - | |
| 66 | - public static boolean isAlipay(String channelCode) { | |
| 67 | - return channelCode != null && channelCode.startsWith("alipay"); | |
| 68 | - } | |
| 69 | -} |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/order/PayOrderStatusRespEnum.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.core.enums.order; | |
| 2 | - | |
| 3 | -import lombok.AllArgsConstructor; | |
| 4 | -import lombok.Getter; | |
| 5 | - | |
| 6 | -import java.util.Objects; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 渠道的支付状态枚举 | |
| 10 | - * | |
| 11 | - * @author 芋道源码 | |
| 12 | - */ | |
| 13 | -@Getter | |
| 14 | -@AllArgsConstructor | |
| 15 | -public enum PayOrderStatusRespEnum { | |
| 16 | - | |
| 17 | - WAITING(0, "未支付"), | |
| 18 | - SUCCESS(10, "支付成功"), | |
| 19 | - REFUND(20, "已退款"), | |
| 20 | - CLOSED(30, "支付关闭"), | |
| 21 | - ; | |
| 22 | - | |
| 23 | - private final Integer status; | |
| 24 | - private final String name; | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 判断是否支付成功 | |
| 28 | - * | |
| 29 | - * @param status 状态 | |
| 30 | - * @return 是否支付成功 | |
| 31 | - */ | |
| 32 | - public static boolean isSuccess(Integer status) { | |
| 33 | - return Objects.equals(status, SUCCESS.getStatus()); | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 判断是否已退款 | |
| 38 | - * | |
| 39 | - * @param status 状态 | |
| 40 | - * @return 是否支付成功 | |
| 41 | - */ | |
| 42 | - public static boolean isRefund(Integer status) { | |
| 43 | - return Objects.equals(status, REFUND.getStatus()); | |
| 44 | - } | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 判断是否支付关闭 | |
| 48 | - * | |
| 49 | - * @param status 状态 | |
| 50 | - * @return 是否支付关闭 | |
| 51 | - */ | |
| 52 | - public static boolean isClosed(Integer status) { | |
| 53 | - return Objects.equals(status, CLOSED.getStatus()); | |
| 54 | - } | |
| 55 | - | |
| 56 | -} |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/refund/PayRefundStatusRespEnum.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.core.enums.refund; | |
| 2 | - | |
| 3 | -import lombok.AllArgsConstructor; | |
| 4 | -import lombok.Getter; | |
| 5 | - | |
| 6 | -import java.util.Objects; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 渠道的退款状态枚举 | |
| 10 | - * | |
| 11 | - * @author jason | |
| 12 | - */ | |
| 13 | -@Getter | |
| 14 | -@AllArgsConstructor | |
| 15 | -public enum PayRefundStatusRespEnum { | |
| 16 | - | |
| 17 | - WAITING(0, "等待退款"), | |
| 18 | - SUCCESS(10, "退款成功"), | |
| 19 | - FAILURE(20, "退款失败"); | |
| 20 | - | |
| 21 | - private final Integer status; | |
| 22 | - private final String name; | |
| 23 | - | |
| 24 | - public static boolean isSuccess(Integer status) { | |
| 25 | - return Objects.equals(status, SUCCESS.getStatus()); | |
| 26 | - } | |
| 27 | - | |
| 28 | - public static boolean isFailure(Integer status) { | |
| 29 | - return Objects.equals(status, FAILURE.getStatus()); | |
| 30 | - } | |
| 31 | - | |
| 32 | -} |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/transfer/PayTransferStatusRespEnum.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.core.enums.transfer; | |
| 2 | - | |
| 3 | -import lombok.AllArgsConstructor; | |
| 4 | -import lombok.Getter; | |
| 5 | - | |
| 6 | -import java.util.Objects; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 渠道的转账状态枚举 | |
| 10 | - * | |
| 11 | - * @author jason | |
| 12 | - */ | |
| 13 | -@Getter | |
| 14 | -@AllArgsConstructor | |
| 15 | -public enum PayTransferStatusRespEnum { | |
| 16 | - | |
| 17 | - WAITING(0, "等待转账"), | |
| 18 | - PROCESSING(5, "转账进行中"), | |
| 19 | - SUCCESS(10, "转账成功"), | |
| 20 | - CLOSED(20, "转账关闭"); | |
| 21 | - | |
| 22 | - private final Integer status; | |
| 23 | - private final String name; | |
| 24 | - | |
| 25 | - public static boolean isSuccess(Integer status) { | |
| 26 | - return Objects.equals(status, SUCCESS.getStatus()); | |
| 27 | - } | |
| 28 | - | |
| 29 | - public static boolean isClosed(Integer status) { | |
| 30 | - return Objects.equals(status, CLOSED.getStatus()); | |
| 31 | - } | |
| 32 | - | |
| 33 | - public static boolean isProcessing(Integer status) { | |
| 34 | - return Objects.equals(status, PROCESSING.getStatus()); | |
| 35 | - } | |
| 36 | - | |
| 37 | -} |
yudao-module-pay/yudao-spring-boot-starter-biz-pay/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted