Commit 9c2243419b2974f27c99679bc1f29203a062490a
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into develop
Showing
215 changed files
with
1367 additions
and
743 deletions
pom.xml
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> | 32 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> |
| 33 | 33 | ||
| 34 | <properties> | 34 | <properties> |
| 35 | - <revision>2.6.1-SNAPSHOT</revision> | 35 | + <revision>2025.08-SNAPSHOT</revision> |
| 36 | <!-- Maven 相关 --> | 36 | <!-- Maven 相关 --> |
| 37 | <java.version>17</java.version> | 37 | <java.version>17</java.version> |
| 38 | <maven.compiler.source>${java.version}</maven.compiler.source> | 38 | <maven.compiler.source>${java.version}</maven.compiler.source> |
yudao-dependencies/pom.xml
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> | 14 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> |
| 15 | 15 | ||
| 16 | <properties> | 16 | <properties> |
| 17 | - <revision>2.6.1-SNAPSHOT</revision> | 17 | + <revision>2025.08-SNAPSHOT</revision> |
| 18 | <flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version> | 18 | <flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version> |
| 19 | <!-- 统一依赖管理 --> | 19 | <!-- 统一依赖管理 --> |
| 20 | <spring.boot.version>3.4.5</spring.boot.version> | 20 | <spring.boot.version>3.4.5</spring.boot.version> |
| @@ -24,9 +24,9 @@ | @@ -24,9 +24,9 @@ | ||
| 24 | <!-- DB 相关 --> | 24 | <!-- DB 相关 --> |
| 25 | <druid.version>1.2.24</druid.version> | 25 | <druid.version>1.2.24</druid.version> |
| 26 | <mybatis.version>3.5.19</mybatis.version> | 26 | <mybatis.version>3.5.19</mybatis.version> |
| 27 | - <mybatis-plus.version>3.5.10.1</mybatis-plus.version> | 27 | + <mybatis-plus.version>3.5.12</mybatis-plus.version> |
| 28 | + <mybatis-plus-join.version>1.5.4</mybatis-plus-join.version> | ||
| 28 | <dynamic-datasource.version>4.3.1</dynamic-datasource.version> | 29 | <dynamic-datasource.version>4.3.1</dynamic-datasource.version> |
| 29 | - <mybatis-plus-join.version>1.4.13</mybatis-plus-join.version> | ||
| 30 | <easy-trans.version>3.0.6</easy-trans.version> | 30 | <easy-trans.version>3.0.6</easy-trans.version> |
| 31 | <redisson.version>3.41.0</redisson.version> | 31 | <redisson.version>3.41.0</redisson.version> |
| 32 | <dm8.jdbc.version>8.1.3.140</dm8.jdbc.version> | 32 | <dm8.jdbc.version>8.1.3.140</dm8.jdbc.version> |
| @@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
| 54 | <mapstruct.version>1.6.3</mapstruct.version> | 54 | <mapstruct.version>1.6.3</mapstruct.version> |
| 55 | <hutool-5.version>5.8.35</hutool-5.version> | 55 | <hutool-5.version>5.8.35</hutool-5.version> |
| 56 | <hutool-6.version>6.0.0-M19</hutool-6.version> | 56 | <hutool-6.version>6.0.0-M19</hutool-6.version> |
| 57 | - <easyexcel.version>4.0.3</easyexcel.version> | 57 | + <fastexcel.version>1.2.0</fastexcel.version> |
| 58 | <velocity.version>2.4.1</velocity.version> | 58 | <velocity.version>2.4.1</velocity.version> |
| 59 | <fastjson.version>1.2.83</fastjson.version> | 59 | <fastjson.version>1.2.83</fastjson.version> |
| 60 | <guava.version>33.4.8-jre</guava.version> | 60 | <guava.version>33.4.8-jre</guava.version> |
| @@ -69,8 +69,6 @@ | @@ -69,8 +69,6 @@ | ||
| 69 | <pf4j-spring.version>0.9.0</pf4j-spring.version> | 69 | <pf4j-spring.version>0.9.0</pf4j-spring.version> |
| 70 | <vertx.version>4.5.13</vertx.version> | 70 | <vertx.version>4.5.13</vertx.version> |
| 71 | <!-- 三方云服务相关 --> | 71 | <!-- 三方云服务相关 --> |
| 72 | - <commons-io.version>2.17.0</commons-io.version> | ||
| 73 | - <commons-compress.version>1.27.1</commons-compress.version> | ||
| 74 | <awssdk.version>2.30.14</awssdk.version> | 72 | <awssdk.version>2.30.14</awssdk.version> |
| 75 | <justauth.version>1.16.7</justauth.version> | 73 | <justauth.version>1.16.7</justauth.version> |
| 76 | <justauth-starter.version>1.4.0</justauth-starter.version> | 74 | <justauth-starter.version>1.4.0</justauth-starter.version> |
| @@ -480,20 +478,11 @@ | @@ -480,20 +478,11 @@ | ||
| 480 | </dependency> | 478 | </dependency> |
| 481 | 479 | ||
| 482 | <dependency> | 480 | <dependency> |
| 483 | - <groupId>com.alibaba</groupId> | ||
| 484 | - <artifactId>easyexcel</artifactId> | ||
| 485 | - <version>${easyexcel.version}</version> | ||
| 486 | - </dependency> | ||
| 487 | - <dependency> | ||
| 488 | - <groupId>commons-io</groupId> | ||
| 489 | - <artifactId>commons-io</artifactId> | ||
| 490 | - <version>${commons-io.version}</version> | ||
| 491 | - </dependency> | ||
| 492 | - <dependency> | ||
| 493 | - <groupId>org.apache.commons</groupId> | ||
| 494 | - <artifactId>commons-compress</artifactId> | ||
| 495 | - <version>${commons-compress.version}</version> | 481 | + <groupId>cn.idev.excel</groupId> |
| 482 | + <artifactId>fastexcel</artifactId> | ||
| 483 | + <version>${fastexcel.version}</version> | ||
| 496 | </dependency> | 484 | </dependency> |
| 485 | + | ||
| 497 | <dependency> | 486 | <dependency> |
| 498 | <groupId>org.apache.tika</groupId> | 487 | <groupId>org.apache.tika</groupId> |
| 499 | <artifactId>tika-core</artifactId> <!-- 文件类型的识别 --> | 488 | <artifactId>tika-core</artifactId> <!-- 文件类型的识别 --> |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java
| @@ -26,15 +26,15 @@ public class CommonResult<T> implements Serializable { | @@ -26,15 +26,15 @@ public class CommonResult<T> implements Serializable { | ||
| 26 | */ | 26 | */ |
| 27 | private Integer code; | 27 | private Integer code; |
| 28 | /** | 28 | /** |
| 29 | - * 返回数据 | ||
| 30 | - */ | ||
| 31 | - private T data; | ||
| 32 | - /** | ||
| 33 | * 错误提示,用户可阅读 | 29 | * 错误提示,用户可阅读 |
| 34 | * | 30 | * |
| 35 | * @see ErrorCode#getMsg() () | 31 | * @see ErrorCode#getMsg() () |
| 36 | */ | 32 | */ |
| 37 | private String msg; | 33 | private String msg; |
| 34 | + /** | ||
| 35 | + * 返回数据 | ||
| 36 | + */ | ||
| 37 | + private T data; | ||
| 38 | 38 | ||
| 39 | /** | 39 | /** |
| 40 | * 将传入的 result 对象,转换成另外一个泛型结果的对象 | 40 | * 将传入的 result 对象,转换成另外一个泛型结果的对象 |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageResult.java
| @@ -11,12 +11,12 @@ import java.util.List; | @@ -11,12 +11,12 @@ import java.util.List; | ||
| 11 | @Data | 11 | @Data |
| 12 | public final class PageResult<T> implements Serializable { | 12 | public final class PageResult<T> implements Serializable { |
| 13 | 13 | ||
| 14 | - @Schema(description = "数据", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 15 | - private List<T> list; | ||
| 16 | - | ||
| 17 | @Schema(description = "总量", requiredMode = Schema.RequiredMode.REQUIRED) | 14 | @Schema(description = "总量", requiredMode = Schema.RequiredMode.REQUIRED) |
| 18 | private Long total; | 15 | private Long total; |
| 19 | 16 | ||
| 17 | + @Schema(description = "数据", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 18 | + private List<T> list; | ||
| 19 | + | ||
| 20 | public PageResult() { | 20 | public PageResult() { |
| 21 | } | 21 | } |
| 22 | 22 |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/cache/CacheUtils.java
| @@ -15,6 +15,13 @@ import java.util.concurrent.Executors; | @@ -15,6 +15,13 @@ import java.util.concurrent.Executors; | ||
| 15 | public class CacheUtils { | 15 | public class CacheUtils { |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | + * 异步刷新的 LoadingCache 最大缓存数量 | ||
| 19 | + * | ||
| 20 | + * @see <a href="">本地缓存 CacheUtils 工具类建议</a> | ||
| 21 | + */ | ||
| 22 | + private static final Integer CACHE_MAX_SIZE = 10000; | ||
| 23 | + | ||
| 24 | + /** | ||
| 18 | * 构建异步刷新的 LoadingCache 对象 | 25 | * 构建异步刷新的 LoadingCache 对象 |
| 19 | * | 26 | * |
| 20 | * 注意:如果你的缓存和 ThreadLocal 有关系,要么自己处理 ThreadLocal 的传递,要么使用 {@link #buildCache(Duration, CacheLoader)} 方法 | 27 | * 注意:如果你的缓存和 ThreadLocal 有关系,要么自己处理 ThreadLocal 的传递,要么使用 {@link #buildCache(Duration, CacheLoader)} 方法 |
| @@ -29,6 +36,7 @@ public class CacheUtils { | @@ -29,6 +36,7 @@ public class CacheUtils { | ||
| 29 | */ | 36 | */ |
| 30 | public static <K, V> LoadingCache<K, V> buildAsyncReloadingCache(Duration duration, CacheLoader<K, V> loader) { | 37 | public static <K, V> LoadingCache<K, V> buildAsyncReloadingCache(Duration duration, CacheLoader<K, V> loader) { |
| 31 | return CacheBuilder.newBuilder() | 38 | return CacheBuilder.newBuilder() |
| 39 | + .maximumSize(CACHE_MAX_SIZE) | ||
| 32 | // 只阻塞当前数据加载线程,其他线程返回旧值 | 40 | // 只阻塞当前数据加载线程,其他线程返回旧值 |
| 33 | .refreshAfterWrite(duration) | 41 | .refreshAfterWrite(duration) |
| 34 | // 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程 | 42 | // 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程 |
| @@ -43,7 +51,11 @@ public class CacheUtils { | @@ -43,7 +51,11 @@ public class CacheUtils { | ||
| 43 | * @return LoadingCache 对象 | 51 | * @return LoadingCache 对象 |
| 44 | */ | 52 | */ |
| 45 | public static <K, V> LoadingCache<K, V> buildCache(Duration duration, CacheLoader<K, V> loader) { | 53 | public static <K, V> LoadingCache<K, V> buildCache(Duration duration, CacheLoader<K, V> loader) { |
| 46 | - return CacheBuilder.newBuilder().refreshAfterWrite(duration).build(loader); | 54 | + return CacheBuilder.newBuilder() |
| 55 | + .maximumSize(CACHE_MAX_SIZE) | ||
| 56 | + // 只阻塞当前数据加载线程,其他线程返回旧值 | ||
| 57 | + .refreshAfterWrite(duration) | ||
| 58 | + .build(loader); | ||
| 47 | } | 59 | } |
| 48 | 60 | ||
| 49 | } | 61 | } |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java
| @@ -74,30 +74,30 @@ public class DateUtils { | @@ -74,30 +74,30 @@ public class DateUtils { | ||
| 74 | * 创建指定时间 | 74 | * 创建指定时间 |
| 75 | * | 75 | * |
| 76 | * @param year 年 | 76 | * @param year 年 |
| 77 | - * @param mouth 月 | 77 | + * @param month 月 |
| 78 | * @param day 日 | 78 | * @param day 日 |
| 79 | * @return 指定时间 | 79 | * @return 指定时间 |
| 80 | */ | 80 | */ |
| 81 | - public static Date buildTime(int year, int mouth, int day) { | ||
| 82 | - return buildTime(year, mouth, day, 0, 0, 0); | 81 | + public static Date buildTime(int year, int month, int day) { |
| 82 | + return buildTime(year, month, day, 0, 0, 0); | ||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * 创建指定时间 | 86 | * 创建指定时间 |
| 87 | * | 87 | * |
| 88 | * @param year 年 | 88 | * @param year 年 |
| 89 | - * @param mouth 月 | 89 | + * @param month 月 |
| 90 | * @param day 日 | 90 | * @param day 日 |
| 91 | * @param hour 小时 | 91 | * @param hour 小时 |
| 92 | * @param minute 分钟 | 92 | * @param minute 分钟 |
| 93 | * @param second 秒 | 93 | * @param second 秒 |
| 94 | * @return 指定时间 | 94 | * @return 指定时间 |
| 95 | */ | 95 | */ |
| 96 | - public static Date buildTime(int year, int mouth, int day, | 96 | + public static Date buildTime(int year, int month, int day, |
| 97 | int hour, int minute, int second) { | 97 | int hour, int minute, int second) { |
| 98 | Calendar calendar = Calendar.getInstance(); | 98 | Calendar calendar = Calendar.getInstance(); |
| 99 | calendar.set(Calendar.YEAR, year); | 99 | calendar.set(Calendar.YEAR, year); |
| 100 | - calendar.set(Calendar.MONTH, mouth - 1); | 100 | + calendar.set(Calendar.MONTH, month - 1); |
| 101 | calendar.set(Calendar.DAY_OF_MONTH, day); | 101 | calendar.set(Calendar.DAY_OF_MONTH, day); |
| 102 | calendar.set(Calendar.HOUR_OF_DAY, hour); | 102 | calendar.set(Calendar.HOUR_OF_DAY, hour); |
| 103 | calendar.set(Calendar.MINUTE, minute); | 103 | calendar.set(Calendar.MINUTE, minute); |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| @@ -69,17 +69,17 @@ public class LocalDateTimeUtils { | @@ -69,17 +69,17 @@ public class LocalDateTimeUtils { | ||
| 69 | * 创建指定时间 | 69 | * 创建指定时间 |
| 70 | * | 70 | * |
| 71 | * @param year 年 | 71 | * @param year 年 |
| 72 | - * @param mouth 月 | 72 | + * @param month 月 |
| 73 | * @param day 日 | 73 | * @param day 日 |
| 74 | * @return 指定时间 | 74 | * @return 指定时间 |
| 75 | */ | 75 | */ |
| 76 | - public static LocalDateTime buildTime(int year, int mouth, int day) { | ||
| 77 | - return LocalDateTime.of(year, mouth, day, 0, 0, 0); | 76 | + public static LocalDateTime buildTime(int year, int month, int day) { |
| 77 | + return LocalDateTime.of(year, month, day, 0, 0, 0); | ||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | - public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1, | ||
| 81 | - int year2, int mouth2, int day2) { | ||
| 82 | - return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)}; | 80 | + public static LocalDateTime[] buildBetweenTime(int year1, int month1, int day1, |
| 81 | + int year2, int month2, int day2) { | ||
| 82 | + return new LocalDateTime[]{buildTime(year1, month1, day1), buildTime(year2, month2, day2)}; | ||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDeptDataPermissionAutoConfiguration.java
| @@ -18,7 +18,7 @@ import java.util.List; | @@ -18,7 +18,7 @@ import java.util.List; | ||
| 18 | */ | 18 | */ |
| 19 | @AutoConfiguration | 19 | @AutoConfiguration |
| 20 | @ConditionalOnClass(LoginUser.class) | 20 | @ConditionalOnClass(LoginUser.class) |
| 21 | -@ConditionalOnBean(value = {PermissionCommonApi.class, DeptDataPermissionRuleCustomizer.class}) | 21 | +@ConditionalOnBean(value = {DeptDataPermissionRuleCustomizer.class}) |
| 22 | public class YudaoDeptDataPermissionAutoConfiguration { | 22 | public class YudaoDeptDataPermissionAutoConfiguration { |
| 23 | 23 | ||
| 24 | @Bean | 24 | @Bean |
yudao-framework/yudao-spring-boot-starter-excel/pom.xml
| @@ -42,18 +42,19 @@ | @@ -42,18 +42,19 @@ | ||
| 42 | 42 | ||
| 43 | <!-- 工具类相关 --> | 43 | <!-- 工具类相关 --> |
| 44 | <dependency> | 44 | <dependency> |
| 45 | - <groupId>com.alibaba</groupId> | ||
| 46 | - <artifactId>easyexcel</artifactId> | 45 | + <groupId>cn.idev.excel</groupId> |
| 46 | + <artifactId>fastexcel</artifactId> | ||
| 47 | </dependency> | 47 | </dependency> |
| 48 | 48 | ||
| 49 | <dependency> | 49 | <dependency> |
| 50 | - <groupId>com.google.guava</groupId> | ||
| 51 | - <artifactId>guava</artifactId> | 50 | + <groupId>jakarta.validation</groupId> |
| 51 | + <artifactId>jakarta.validation-api</artifactId> | ||
| 52 | + <scope>provided</scope> | ||
| 52 | </dependency> | 53 | </dependency> |
| 53 | 54 | ||
| 54 | <dependency> | 55 | <dependency> |
| 55 | - <groupId>org.apache.commons</groupId> | ||
| 56 | - <artifactId>commons-compress</artifactId> <!-- 解决 https://github.com/alibaba/easyexcel/issues/3954 问题 --> | 56 | + <groupId>com.google.guava</groupId> |
| 57 | + <artifactId>guava</artifactId> | ||
| 57 | </dependency> | 58 | </dependency> |
| 58 | 59 | ||
| 59 | <dependency> | 60 | <dependency> |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/dict/core/DictFrameworkUtils.java
| @@ -76,4 +76,9 @@ public class DictFrameworkUtils { | @@ -76,4 +76,9 @@ public class DictFrameworkUtils { | ||
| 76 | return dictData!= null ? dictData.getValue(): null; | 76 | return dictData!= null ? dictData.getValue(): null; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | + @SneakyThrows | ||
| 80 | + public static List<String> getDictDataValueList(String dictType) { | ||
| 81 | + List<DictDataRespDTO> dictDatas = GET_DICT_DATA_CACHE.get(dictType); | ||
| 82 | + return convertList(dictDatas, DictDataRespDTO::getValue); | ||
| 83 | + } | ||
| 79 | } | 84 | } |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/dict/validation/InDict.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.dict.validation; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.Constraint; | ||
| 4 | +import jakarta.validation.Payload; | ||
| 5 | + | ||
| 6 | +import java.lang.annotation.Documented; | ||
| 7 | +import java.lang.annotation.ElementType; | ||
| 8 | +import java.lang.annotation.Retention; | ||
| 9 | +import java.lang.annotation.RetentionPolicy; | ||
| 10 | +import java.lang.annotation.Target; | ||
| 11 | + | ||
| 12 | +@Target({ | ||
| 13 | + ElementType.METHOD, | ||
| 14 | + ElementType.FIELD, | ||
| 15 | + ElementType.ANNOTATION_TYPE, | ||
| 16 | + ElementType.CONSTRUCTOR, | ||
| 17 | + ElementType.PARAMETER, | ||
| 18 | + ElementType.TYPE_USE | ||
| 19 | +}) | ||
| 20 | +@Retention(RetentionPolicy.RUNTIME) | ||
| 21 | +@Documented | ||
| 22 | +@Constraint( | ||
| 23 | + validatedBy = {InDictValidator.class, InDictCollectionValidator.class} | ||
| 24 | +) | ||
| 25 | +public @interface InDict { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 数据字典 type | ||
| 29 | + */ | ||
| 30 | + String type(); | ||
| 31 | + | ||
| 32 | + String message() default "必须在指定范围 {value}"; | ||
| 33 | + | ||
| 34 | + Class<?>[] groups() default {}; | ||
| 35 | + | ||
| 36 | + Class<? extends Payload>[] payload() default {}; | ||
| 37 | + | ||
| 38 | +} |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/dict/validation/InDictCollectionValidator.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.dict.validation; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | ||
| 5 | +import jakarta.validation.ConstraintValidator; | ||
| 6 | +import jakarta.validation.ConstraintValidatorContext; | ||
| 7 | + | ||
| 8 | +import java.util.Collection; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +public class InDictCollectionValidator implements ConstraintValidator<InDict, Collection<?>> { | ||
| 12 | + | ||
| 13 | + private String dictType; | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public void initialize(InDict annotation) { | ||
| 17 | + this.dictType = annotation.type(); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public boolean isValid(Collection<?> list, ConstraintValidatorContext context) { | ||
| 22 | + // 为空时,默认不校验,即认为通过 | ||
| 23 | + if (CollUtil.isEmpty(list)) { | ||
| 24 | + return true; | ||
| 25 | + } | ||
| 26 | + // 校验全部通过 | ||
| 27 | + List<String> dbValues = DictFrameworkUtils.getDictDataValueList(dictType); | ||
| 28 | + boolean match = list.stream().allMatch(v -> dbValues.stream() | ||
| 29 | + .anyMatch(dbValue -> dbValue.equalsIgnoreCase(v.toString()))); | ||
| 30 | + if (match) { | ||
| 31 | + return true; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + // 校验不通过,自定义提示语句 | ||
| 35 | + context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值 | ||
| 36 | + context.buildConstraintViolationWithTemplate( | ||
| 37 | + context.getDefaultConstraintMessageTemplate().replaceAll("\\{value}", dbValues.toString()) | ||
| 38 | + ).addConstraintViolation(); // 重新添加错误提示语句 | ||
| 39 | + return false; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | +} | ||
| 43 | + |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/dict/validation/InDictValidator.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.dict.validation; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | ||
| 5 | +import jakarta.validation.ConstraintValidator; | ||
| 6 | +import jakarta.validation.ConstraintValidatorContext; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +public class InDictValidator implements ConstraintValidator<InDict, Object> { | ||
| 11 | + | ||
| 12 | + private String dictType; | ||
| 13 | + | ||
| 14 | + @Override | ||
| 15 | + public void initialize(InDict annotation) { | ||
| 16 | + this.dictType = annotation.type(); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public boolean isValid(Object value, ConstraintValidatorContext context) { | ||
| 21 | + // 为空时,默认不校验,即认为通过 | ||
| 22 | + if (value == null) { | ||
| 23 | + return true; | ||
| 24 | + } | ||
| 25 | + // 校验通过 | ||
| 26 | + final List<String> values = DictFrameworkUtils.getDictDataValueList(dictType); | ||
| 27 | + boolean match = values.stream().anyMatch(v -> StrUtil.equalsIgnoreCase(v, value.toString())); | ||
| 28 | + if (match) { | ||
| 29 | + return true; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + // 校验不通过,自定义提示语句 | ||
| 33 | + context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值 | ||
| 34 | + context.buildConstraintViolationWithTemplate( | ||
| 35 | + context.getDefaultConstraintMessageTemplate().replaceAll("\\{value}", values.toString()) | ||
| 36 | + ).addConstraintViolation(); // 重新添加错误提示语句 | ||
| 37 | + return false; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | +} | ||
| 41 | + |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/AreaConvert.java
| @@ -3,11 +3,11 @@ package cn.iocoder.yudao.framework.excel.core.convert; | @@ -3,11 +3,11 @@ package cn.iocoder.yudao.framework.excel.core.convert; | ||
| 3 | import cn.hutool.core.convert.Convert; | 3 | import cn.hutool.core.convert.Convert; |
| 4 | import cn.iocoder.yudao.framework.ip.core.Area; | 4 | import cn.iocoder.yudao.framework.ip.core.Area; |
| 5 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 5 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 6 | -import com.alibaba.excel.converters.Converter; | ||
| 7 | -import com.alibaba.excel.enums.CellDataTypeEnum; | ||
| 8 | -import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 9 | -import com.alibaba.excel.metadata.data.ReadCellData; | ||
| 10 | -import com.alibaba.excel.metadata.property.ExcelContentProperty; | 6 | +import cn.idev.excel.converters.Converter; |
| 7 | +import cn.idev.excel.enums.CellDataTypeEnum; | ||
| 8 | +import cn.idev.excel.metadata.GlobalConfiguration; | ||
| 9 | +import cn.idev.excel.metadata.data.ReadCellData; | ||
| 10 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | ||
| 11 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/DictConvert.java
| @@ -3,12 +3,12 @@ package cn.iocoder.yudao.framework.excel.core.convert; | @@ -3,12 +3,12 @@ package cn.iocoder.yudao.framework.excel.core.convert; | ||
| 3 | import cn.hutool.core.convert.Convert; | 3 | import cn.hutool.core.convert.Convert; |
| 4 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | 4 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| 5 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 5 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 6 | -import com.alibaba.excel.converters.Converter; | ||
| 7 | -import com.alibaba.excel.enums.CellDataTypeEnum; | ||
| 8 | -import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 9 | -import com.alibaba.excel.metadata.data.ReadCellData; | ||
| 10 | -import com.alibaba.excel.metadata.data.WriteCellData; | ||
| 11 | -import com.alibaba.excel.metadata.property.ExcelContentProperty; | 6 | +import cn.idev.excel.converters.Converter; |
| 7 | +import cn.idev.excel.enums.CellDataTypeEnum; | ||
| 8 | +import cn.idev.excel.metadata.GlobalConfiguration; | ||
| 9 | +import cn.idev.excel.metadata.data.ReadCellData; | ||
| 10 | +import cn.idev.excel.metadata.data.WriteCellData; | ||
| 11 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | ||
| 12 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/JsonConvert.java
| 1 | package cn.iocoder.yudao.framework.excel.core.convert; | 1 | package cn.iocoder.yudao.framework.excel.core.convert; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | -import com.alibaba.excel.converters.Converter; | ||
| 5 | -import com.alibaba.excel.enums.CellDataTypeEnum; | ||
| 6 | -import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 7 | -import com.alibaba.excel.metadata.data.WriteCellData; | ||
| 8 | -import com.alibaba.excel.metadata.property.ExcelContentProperty; | 4 | +import cn.idev.excel.converters.Converter; |
| 5 | +import cn.idev.excel.enums.CellDataTypeEnum; | ||
| 6 | +import cn.idev.excel.metadata.GlobalConfiguration; | ||
| 7 | +import cn.idev.excel.metadata.data.WriteCellData; | ||
| 8 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | ||
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Excel Json 转换器 | 11 | * Excel Json 转换器 |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/MoneyConvert.java
| 1 | package cn.iocoder.yudao.framework.excel.core.convert; | 1 | package cn.iocoder.yudao.framework.excel.core.convert; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.converters.Converter; | ||
| 4 | -import com.alibaba.excel.enums.CellDataTypeEnum; | ||
| 5 | -import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 6 | -import com.alibaba.excel.metadata.data.WriteCellData; | ||
| 7 | -import com.alibaba.excel.metadata.property.ExcelContentProperty; | 3 | +import cn.idev.excel.converters.Converter; |
| 4 | +import cn.idev.excel.enums.CellDataTypeEnum; | ||
| 5 | +import cn.idev.excel.metadata.GlobalConfiguration; | ||
| 6 | +import cn.idev.excel.metadata.data.WriteCellData; | ||
| 7 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | ||
| 8 | 8 | ||
| 9 | import java.math.BigDecimal; | 9 | import java.math.BigDecimal; |
| 10 | import java.math.RoundingMode; | 10 | import java.math.RoundingMode; |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/ColumnWidthMatchStyleStrategy.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.excel.core.handler; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.idev.excel.enums.CellDataTypeEnum; | ||
| 5 | +import cn.idev.excel.metadata.Head; | ||
| 6 | +import cn.idev.excel.metadata.data.WriteCellData; | ||
| 7 | +import cn.idev.excel.util.MapUtils; | ||
| 8 | +import cn.idev.excel.write.metadata.holder.WriteSheetHolder; | ||
| 9 | +import cn.idev.excel.write.style.column.AbstractColumnWidthStyleStrategy; | ||
| 10 | +import cn.idev.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | ||
| 11 | +import org.apache.poi.ss.usermodel.Cell; | ||
| 12 | + | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Excel 自适应列宽处理器 | ||
| 19 | + * | ||
| 20 | + * 相比 {@link LongestMatchColumnWidthStyleStrategy} 来说,额外处理了 DATE 类型! | ||
| 21 | + * | ||
| 22 | + * @see <a href="https://github.com/YunaiV/yudao-cloud/pull/196/">添加自适应列宽处理器,并替换默认列宽策略</a> | ||
| 23 | + * @author hmb | ||
| 24 | + */ | ||
| 25 | +public class ColumnWidthMatchStyleStrategy extends AbstractColumnWidthStyleStrategy { | ||
| 26 | + | ||
| 27 | + private static final int MAX_COLUMN_WIDTH = 255; | ||
| 28 | + | ||
| 29 | + private final Map<Integer, Map<Integer, Integer>> cache = MapUtils.newHashMapWithExpectedSize(8); | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<WriteCellData<?>> cellDataList, Cell cell, | ||
| 33 | + Head head, Integer relativeRowIndex, Boolean isHead) { | ||
| 34 | + boolean needSetWidth = isHead || CollUtil.isNotEmpty(cellDataList); | ||
| 35 | + if (!needSetWidth) { | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | + Map<Integer, Integer> maxColumnWidthMap = cache.computeIfAbsent(writeSheetHolder.getSheetNo(), | ||
| 39 | + key -> new HashMap<>(16)); | ||
| 40 | + Integer columnWidth = dataLength(cellDataList, cell, isHead); | ||
| 41 | + if (columnWidth < 0) { | ||
| 42 | + return; | ||
| 43 | + } | ||
| 44 | + if (columnWidth > MAX_COLUMN_WIDTH) { | ||
| 45 | + columnWidth = MAX_COLUMN_WIDTH; | ||
| 46 | + } | ||
| 47 | + Integer maxColumnWidth = maxColumnWidthMap.get(cell.getColumnIndex()); | ||
| 48 | + if (maxColumnWidth == null || columnWidth > maxColumnWidth) { | ||
| 49 | + maxColumnWidthMap.put(cell.getColumnIndex(), columnWidth); | ||
| 50 | + writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(), columnWidth * 256); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @SuppressWarnings("EnhancedSwitchMigration") | ||
| 55 | + private Integer dataLength(List<WriteCellData<?>> cellDataList, Cell cell, Boolean isHead) { | ||
| 56 | + if (isHead) { | ||
| 57 | + return cell.getStringCellValue().getBytes().length; | ||
| 58 | + } | ||
| 59 | + WriteCellData<?> cellData = cellDataList.get(0); | ||
| 60 | + CellDataTypeEnum type = cellData.getType(); | ||
| 61 | + if (type == null) { | ||
| 62 | + return -1; | ||
| 63 | + } | ||
| 64 | + switch (type) { | ||
| 65 | + case STRING: | ||
| 66 | + return cellData.getStringValue().getBytes().length; | ||
| 67 | + case BOOLEAN: | ||
| 68 | + return cellData.getBooleanValue().toString().getBytes().length; | ||
| 69 | + case NUMBER: | ||
| 70 | + return cellData.getNumberValue().toString().getBytes().length; | ||
| 71 | + case DATE: | ||
| 72 | + return cellData.getDateValue().toString().getBytes().length; | ||
| 73 | + default: | ||
| 74 | + return -1; | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | +} | ||
| 0 | \ No newline at end of file | 79 | \ No newline at end of file |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java
| @@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.excel.core.handler; | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.excel.core.handler; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.lang.Assert; | 4 | import cn.hutool.core.lang.Assert; |
| 5 | import cn.hutool.core.util.ObjectUtil; | 5 | import cn.hutool.core.util.ObjectUtil; |
| 6 | -import cn.hutool.core.util.ReflectUtil; | ||
| 7 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 8 | import cn.hutool.extra.spring.SpringUtil; | 7 | import cn.hutool.extra.spring.SpringUtil; |
| 9 | import cn.hutool.poi.excel.ExcelUtil; | 8 | import cn.hutool.poi.excel.ExcelUtil; |
| @@ -11,12 +10,12 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; | @@ -11,12 +10,12 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; | ||
| 11 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | 10 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| 12 | import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect; | 11 | import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect; |
| 13 | import cn.iocoder.yudao.framework.excel.core.function.ExcelColumnSelectFunction; | 12 | import cn.iocoder.yudao.framework.excel.core.function.ExcelColumnSelectFunction; |
| 14 | -import com.alibaba.excel.annotation.ExcelIgnore; | ||
| 15 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 16 | -import com.alibaba.excel.annotation.ExcelProperty; | ||
| 17 | -import com.alibaba.excel.write.handler.SheetWriteHandler; | ||
| 18 | -import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; | ||
| 19 | -import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; | 13 | +import cn.idev.excel.annotation.ExcelIgnore; |
| 14 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 15 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 16 | +import cn.idev.excel.write.handler.SheetWriteHandler; | ||
| 17 | +import cn.idev.excel.write.metadata.holder.WriteSheetHolder; | ||
| 18 | +import cn.idev.excel.write.metadata.holder.WriteWorkbookHolder; | ||
| 20 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
| 21 | import org.apache.poi.hssf.usermodel.HSSFDataValidation; | 20 | import org.apache.poi.hssf.usermodel.HSSFDataValidation; |
| 22 | import org.apache.poi.ss.usermodel.*; | 21 | import org.apache.poi.ss.usermodel.*; |
| @@ -87,7 +86,7 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | @@ -87,7 +86,7 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | ||
| 87 | 86 | ||
| 88 | /** | 87 | /** |
| 89 | * 判断字段是否是静态的、最终的、 transient 的 | 88 | * 判断字段是否是静态的、最终的、 transient 的 |
| 90 | - * 原因:EasyExcel 默认是忽略 static final 或 transient 的字段,所以需要判断 | 89 | + * 原因:FastExcel 默认是忽略 static final 或 transient 的字段,所以需要判断 |
| 91 | * | 90 | * |
| 92 | * @param field 字段 | 91 | * @param field 字段 |
| 93 | * @return 是否是静态的、最终的、transient 的 | 92 | * @return 是否是静态的、最终的、transient 的 |
| @@ -185,4 +184,4 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | @@ -185,4 +184,4 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | ||
| 185 | writeSheetHolder.getSheet().addValidationData(validation); | 184 | writeSheetHolder.getSheet().addValidationData(validation); |
| 186 | } | 185 | } |
| 187 | 186 | ||
| 188 | -} | ||
| 189 | \ No newline at end of file | 187 | \ No newline at end of file |
| 188 | +} |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
| 1 | package cn.iocoder.yudao.framework.excel.core.util; | 1 | package cn.iocoder.yudao.framework.excel.core.util; |
| 2 | 2 | ||
| 3 | +import cn.idev.excel.FastExcelFactory; | ||
| 4 | +import cn.idev.excel.converters.longconverter.LongStringConverter; | ||
| 3 | import cn.iocoder.yudao.framework.common.util.http.HttpUtils; | 5 | import cn.iocoder.yudao.framework.common.util.http.HttpUtils; |
| 6 | +import cn.iocoder.yudao.framework.excel.core.handler.ColumnWidthMatchStyleStrategy; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler; | 7 | import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler; |
| 5 | -import com.alibaba.excel.EasyExcel; | ||
| 6 | -import com.alibaba.excel.converters.longconverter.LongStringConverter; | ||
| 7 | -import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | ||
| 8 | import jakarta.servlet.http.HttpServletResponse; | 8 | import jakarta.servlet.http.HttpServletResponse; |
| 9 | import org.springframework.web.multipart.MultipartFile; | 9 | import org.springframework.web.multipart.MultipartFile; |
| 10 | 10 | ||
| @@ -32,9 +32,9 @@ public class ExcelUtils { | @@ -32,9 +32,9 @@ public class ExcelUtils { | ||
| 32 | public static <T> void write(HttpServletResponse response, String filename, String sheetName, | 32 | public static <T> void write(HttpServletResponse response, String filename, String sheetName, |
| 33 | Class<T> head, List<T> data) throws IOException { | 33 | Class<T> head, List<T> data) throws IOException { |
| 34 | // 输出 Excel | 34 | // 输出 Excel |
| 35 | - EasyExcel.write(response.getOutputStream(), head) | 35 | + FastExcelFactory.write(response.getOutputStream(), head) |
| 36 | .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 | 36 | .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 |
| 37 | - .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度 | 37 | + .registerWriteHandler(new ColumnWidthMatchStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度 |
| 38 | .registerWriteHandler(new SelectSheetWriteHandler(head)) // 基于固定 sheet 实现下拉框 | 38 | .registerWriteHandler(new SelectSheetWriteHandler(head)) // 基于固定 sheet 实现下拉框 |
| 39 | .registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度 | 39 | .registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度 |
| 40 | .sheet(sheetName).doWrite(data); | 40 | .sheet(sheetName).doWrite(data); |
| @@ -44,7 +44,7 @@ public class ExcelUtils { | @@ -44,7 +44,7 @@ public class ExcelUtils { | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | public static <T> List<T> read(MultipartFile file, Class<T> head) throws IOException { | 46 | public static <T> List<T> read(MultipartFile file, Class<T> head) throws IOException { |
| 47 | - return EasyExcel.read(file.getInputStream(), head, null) | 47 | + return FastExcelFactory.read(file.getInputStream(), head, null) |
| 48 | .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 | 48 | .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 |
| 49 | .doReadAllSync(); | 49 | .doReadAllSync(); |
| 50 | } | 50 | } |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/package-info.java
yudao-framework/yudao-spring-boot-starter-monitor/pom.xml
| @@ -44,29 +44,35 @@ | @@ -44,29 +44,35 @@ | ||
| 44 | <dependency> | 44 | <dependency> |
| 45 | <groupId>io.opentracing</groupId> | 45 | <groupId>io.opentracing</groupId> |
| 46 | <artifactId>opentracing-util</artifactId> | 46 | <artifactId>opentracing-util</artifactId> |
| 47 | + <optional>true</optional> | ||
| 47 | </dependency> | 48 | </dependency> |
| 48 | <dependency> | 49 | <dependency> |
| 49 | <groupId>org.apache.skywalking</groupId> | 50 | <groupId>org.apache.skywalking</groupId> |
| 50 | <artifactId>apm-toolkit-trace</artifactId> | 51 | <artifactId>apm-toolkit-trace</artifactId> |
| 52 | + <optional>true</optional> | ||
| 51 | </dependency> | 53 | </dependency> |
| 52 | <dependency> | 54 | <dependency> |
| 53 | <groupId>org.apache.skywalking</groupId> | 55 | <groupId>org.apache.skywalking</groupId> |
| 54 | <artifactId>apm-toolkit-logback-1.x</artifactId> | 56 | <artifactId>apm-toolkit-logback-1.x</artifactId> |
| 57 | + <optional>true</optional> | ||
| 55 | </dependency> | 58 | </dependency> |
| 56 | <dependency> | 59 | <dependency> |
| 57 | <groupId>org.apache.skywalking</groupId> | 60 | <groupId>org.apache.skywalking</groupId> |
| 58 | <artifactId>apm-toolkit-opentracing</artifactId> | 61 | <artifactId>apm-toolkit-opentracing</artifactId> |
| 62 | + <optional>true</optional> | ||
| 59 | </dependency> | 63 | </dependency> |
| 60 | 64 | ||
| 61 | <!-- Micrometer 对 Prometheus 的支持 --> | 65 | <!-- Micrometer 对 Prometheus 的支持 --> |
| 62 | <dependency> | 66 | <dependency> |
| 63 | <groupId>io.micrometer</groupId> | 67 | <groupId>io.micrometer</groupId> |
| 64 | <artifactId>micrometer-registry-prometheus</artifactId> | 68 | <artifactId>micrometer-registry-prometheus</artifactId> |
| 69 | + <optional>true</optional> | ||
| 65 | </dependency> | 70 | </dependency> |
| 66 | 71 | ||
| 67 | <dependency> | 72 | <dependency> |
| 68 | <groupId>de.codecentric</groupId> | 73 | <groupId>de.codecentric</groupId> |
| 69 | - <artifactId>spring-boot-admin-starter-client</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 --> | 74 | + <artifactId>spring-boot-admin-starter-client</artifactId> <!-- 实现 Spring Boot Admin Client 客户端 --> |
| 75 | + <optional>true</optional> | ||
| 70 | </dependency> | 76 | </dependency> |
| 71 | </dependencies> | 77 | </dependencies> |
| 72 | 78 |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java
| @@ -3,6 +3,9 @@ package cn.iocoder.yudao.framework.tracer.config; | @@ -3,6 +3,9 @@ package cn.iocoder.yudao.framework.tracer.config; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; |
| 4 | import cn.iocoder.yudao.framework.tracer.core.aop.BizTraceAspect; | 4 | import cn.iocoder.yudao.framework.tracer.core.aop.BizTraceAspect; |
| 5 | import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter; | 5 | import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter; |
| 6 | +import io.opentracing.Tracer; | ||
| 7 | +import io.opentracing.util.GlobalTracer; | ||
| 8 | +import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer; | ||
| 6 | import org.springframework.boot.autoconfigure.AutoConfiguration; | 9 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 11 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| @@ -16,30 +19,32 @@ import org.springframework.context.annotation.Bean; | @@ -16,30 +19,32 @@ import org.springframework.context.annotation.Bean; | ||
| 16 | * @author mashu | 19 | * @author mashu |
| 17 | */ | 20 | */ |
| 18 | @AutoConfiguration | 21 | @AutoConfiguration |
| 19 | -@ConditionalOnClass({BizTraceAspect.class}) | 22 | +@ConditionalOnClass(name = { |
| 23 | + "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer", | ||
| 24 | + "io.opentracing.Tracer" | ||
| 25 | +}) | ||
| 20 | @EnableConfigurationProperties(TracerProperties.class) | 26 | @EnableConfigurationProperties(TracerProperties.class) |
| 21 | @ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) | 27 | @ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) |
| 22 | public class YudaoTracerAutoConfiguration { | 28 | public class YudaoTracerAutoConfiguration { |
| 23 | 29 | ||
| 24 | - // TODO @芋艿:重要。目前 opentracing 版本存在冲突,要么保证 skywalking,要么保证阿里云短信 sdk | ||
| 25 | -// @Bean | ||
| 26 | -// public TracerProperties bizTracerProperties() { | ||
| 27 | -// return new TracerProperties(); | ||
| 28 | -// } | ||
| 29 | -// | ||
| 30 | -// @Bean | ||
| 31 | -// public BizTraceAspect bizTracingAop() { | ||
| 32 | -// return new BizTraceAspect(tracer()); | ||
| 33 | -// } | ||
| 34 | -// | ||
| 35 | -// @Bean | ||
| 36 | -// public Tracer tracer() { | ||
| 37 | -// // 创建 SkywalkingTracer 对象 | ||
| 38 | -// SkywalkingTracer tracer = new SkywalkingTracer(); | ||
| 39 | -// // 设置为 GlobalTracer 的追踪器 | ||
| 40 | -// GlobalTracer.register(tracer); | ||
| 41 | -// return tracer; | ||
| 42 | -// } | 30 | + @Bean |
| 31 | + public TracerProperties bizTracerProperties() { | ||
| 32 | + return new TracerProperties(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Bean | ||
| 36 | + public BizTraceAspect bizTracingAop() { | ||
| 37 | + return new BizTraceAspect(tracer()); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Bean | ||
| 41 | + public Tracer tracer() { | ||
| 42 | + // 创建 SkywalkingTracer 对象 | ||
| 43 | + SkywalkingTracer tracer = new SkywalkingTracer(); | ||
| 44 | + // 设置为 GlobalTracer 的追踪器 | ||
| 45 | + GlobalTracer.registerIfAbsent(tracer); | ||
| 46 | + return tracer; | ||
| 47 | + } | ||
| 43 | 48 | ||
| 44 | /** | 49 | /** |
| 45 | * 创建 TraceFilter 过滤器,响应 header 设置 traceId | 50 | * 创建 TraceFilter 过滤器,响应 header 设置 traceId |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/MPJLambdaWrapperX.java
| @@ -118,7 +118,6 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -118,7 +118,6 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 118 | 118 | ||
| 119 | @Override | 119 | @Override |
| 120 | public <X> MPJLambdaWrapperX<T> orderByDesc(SFunction<X, ?> column) { | 120 | public <X> MPJLambdaWrapperX<T> orderByDesc(SFunction<X, ?> column) { |
| 121 | - //noinspection unchecked | ||
| 122 | super.orderByDesc(true, column); | 121 | super.orderByDesc(true, column); |
| 123 | return this; | 122 | return this; |
| 124 | } | 123 | } |
| @@ -208,7 +207,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -208,7 +207,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | @Override | 209 | @Override |
| 211 | - public <S, X> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, String alias) { | 210 | + public <S> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, String alias) { |
| 212 | super.selectCount(column, alias); | 211 | super.selectCount(column, alias); |
| 213 | return this; | 212 | return this; |
| 214 | } | 213 | } |
| @@ -226,7 +225,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -226,7 +225,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 226 | } | 225 | } |
| 227 | 226 | ||
| 228 | @Override | 227 | @Override |
| 229 | - public <S, X> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, String alias) { | 228 | + public <S> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, String alias) { |
| 230 | super.selectSum(column, alias); | 229 | super.selectSum(column, alias); |
| 231 | return this; | 230 | return this; |
| 232 | } | 231 | } |
| @@ -244,7 +243,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -244,7 +243,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 244 | } | 243 | } |
| 245 | 244 | ||
| 246 | @Override | 245 | @Override |
| 247 | - public <S, X> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, String alias) { | 246 | + public <S> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, String alias) { |
| 248 | super.selectMax(column, alias); | 247 | super.selectMax(column, alias); |
| 249 | return this; | 248 | return this; |
| 250 | } | 249 | } |
| @@ -262,7 +261,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -262,7 +261,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 262 | } | 261 | } |
| 263 | 262 | ||
| 264 | @Override | 263 | @Override |
| 265 | - public <S, X> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, String alias) { | 264 | + public <S> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, String alias) { |
| 266 | super.selectMin(column, alias); | 265 | super.selectMin(column, alias); |
| 267 | return this; | 266 | return this; |
| 268 | } | 267 | } |
| @@ -280,7 +279,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -280,7 +279,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 280 | } | 279 | } |
| 281 | 280 | ||
| 282 | @Override | 281 | @Override |
| 283 | - public <S, X> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, String alias) { | 282 | + public <S> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, String alias) { |
| 284 | super.selectAvg(column, alias); | 283 | super.selectAvg(column, alias); |
| 285 | return this; | 284 | return this; |
| 286 | } | 285 | } |
| @@ -298,7 +297,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | @@ -298,7 +297,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { | ||
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | @Override | 299 | @Override |
| 301 | - public <S, X> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, String alias) { | 300 | + public <S> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, String alias) { |
| 302 | super.selectLen(column, alias); | 301 | super.selectLen(column, alias); |
| 303 | return this; | 302 | return this; |
| 304 | } | 303 | } |
yudao-framework/yudao-spring-boot-starter-web/pom.xml
| @@ -53,7 +53,13 @@ | @@ -53,7 +53,13 @@ | ||
| 53 | <scope>provided</scope> <!-- 设置为 provided,主要是 GlobalExceptionHandler 使用 --> | 53 | <scope>provided</scope> <!-- 设置为 provided,主要是 GlobalExceptionHandler 使用 --> |
| 54 | </dependency> | 54 | </dependency> |
| 55 | 55 | ||
| 56 | - <!-- xss --> | 56 | + <!-- 工具类相关 --> |
| 57 | + <dependency> | ||
| 58 | + <groupId>com.google.guava</groupId> | ||
| 59 | + <artifactId>guava</artifactId> | ||
| 60 | + <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> | ||
| 61 | + </dependency> | ||
| 62 | + | ||
| 57 | <dependency> | 63 | <dependency> |
| 58 | <groupId>org.jsoup</groupId> | 64 | <groupId>org.jsoup</groupId> |
| 59 | <artifactId>jsoup</artifactId> | 65 | <artifactId>jsoup</artifactId> |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java
| 1 | package cn.iocoder.yudao.framework.web.core.filter; | 1 | package cn.iocoder.yudao.framework.web.core.filter; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | 4 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 4 | import org.springframework.web.filter.OncePerRequestFilter; | 5 | import org.springframework.web.filter.OncePerRequestFilter; |
| 5 | 6 | ||
| @@ -16,6 +17,14 @@ import java.io.IOException; | @@ -16,6 +17,14 @@ import java.io.IOException; | ||
| 16 | */ | 17 | */ |
| 17 | public class CacheRequestBodyFilter extends OncePerRequestFilter { | 18 | public class CacheRequestBodyFilter extends OncePerRequestFilter { |
| 18 | 19 | ||
| 20 | + /** | ||
| 21 | + * 需要排除的 URI | ||
| 22 | + * | ||
| 23 | + * 1. 排除 Spring Boot Admin 相关请求,避免客户端连接中断导致的异常。 | ||
| 24 | + * 例如说:<a href="https://github.com/YunaiV/ruoyi-vue-pro/issues/795">795 ISSUE</a> | ||
| 25 | + */ | ||
| 26 | + private static final String[] IGNORE_URIS = {"/admin/", "/actuator/"}; | ||
| 27 | + | ||
| 19 | @Override | 28 | @Override |
| 20 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | 29 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) |
| 21 | throws IOException, ServletException { | 30 | throws IOException, ServletException { |
| @@ -24,7 +33,13 @@ public class CacheRequestBodyFilter extends OncePerRequestFilter { | @@ -24,7 +33,13 @@ public class CacheRequestBodyFilter extends OncePerRequestFilter { | ||
| 24 | 33 | ||
| 25 | @Override | 34 | @Override |
| 26 | protected boolean shouldNotFilter(HttpServletRequest request) { | 35 | protected boolean shouldNotFilter(HttpServletRequest request) { |
| 27 | - // 只处理 json 请求内容 | 36 | + // 1. 校验是否为排除的 URL |
| 37 | + String requestURI = request.getRequestURI(); | ||
| 38 | + if (StrUtil.startWithAny(requestURI, IGNORE_URIS)) { | ||
| 39 | + return true; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + // 2. 只处理 json 请求内容 | ||
| 28 | return !ServletUtils.isJsonRequest(request); | 43 | return !ServletUtils.isJsonRequest(request); |
| 29 | } | 44 | } |
| 30 | 45 |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
| @@ -5,7 +5,6 @@ import cn.hutool.core.exceptions.ExceptionUtil; | @@ -5,7 +5,6 @@ import cn.hutool.core.exceptions.ExceptionUtil; | ||
| 5 | import cn.hutool.core.map.MapUtil; | 5 | import cn.hutool.core.map.MapUtil; |
| 6 | import cn.hutool.core.util.ObjUtil; | 6 | import cn.hutool.core.util.ObjUtil; |
| 7 | import cn.hutool.core.util.StrUtil; | 7 | import cn.hutool.core.util.StrUtil; |
| 8 | -import cn.hutool.extra.servlet.JakartaServletUtil; | ||
| 9 | import cn.iocoder.yudao.framework.common.biz.infra.logger.ApiErrorLogCommonApi; | 8 | import cn.iocoder.yudao.framework.common.biz.infra.logger.ApiErrorLogCommonApi; |
| 10 | import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO; | 9 | import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO; |
| 11 | import cn.iocoder.yudao.framework.common.exception.ServiceException; | 10 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| @@ -17,6 +16,7 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | @@ -17,6 +16,7 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | ||
| 17 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | 16 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 18 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; | 17 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 19 | import com.fasterxml.jackson.databind.exc.InvalidFormatException; | 18 | import com.fasterxml.jackson.databind.exc.InvalidFormatException; |
| 19 | +import com.google.common.util.concurrent.UncheckedExecutionException; | ||
| 20 | import jakarta.servlet.http.HttpServletRequest; | 20 | import jakarta.servlet.http.HttpServletRequest; |
| 21 | import jakarta.validation.ConstraintViolation; | 21 | import jakarta.validation.ConstraintViolation; |
| 22 | import jakarta.validation.ConstraintViolationException; | 22 | import jakarta.validation.ConstraintViolationException; |
| @@ -111,6 +111,9 @@ public class GlobalExceptionHandler { | @@ -111,6 +111,9 @@ public class GlobalExceptionHandler { | ||
| 111 | if (ex instanceof AccessDeniedException) { | 111 | if (ex instanceof AccessDeniedException) { |
| 112 | return accessDeniedExceptionHandler(request, (AccessDeniedException) ex); | 112 | return accessDeniedExceptionHandler(request, (AccessDeniedException) ex); |
| 113 | } | 113 | } |
| 114 | + if (ex instanceof UncheckedExecutionException && ex.getCause() != ex) { | ||
| 115 | + return allExceptionHandler(request, ex.getCause()); | ||
| 116 | + } | ||
| 114 | return defaultExceptionHandler(request, ex); | 117 | return defaultExceptionHandler(request, ex); |
| 115 | } | 118 | } |
| 116 | 119 | ||
| @@ -267,6 +270,16 @@ public class GlobalExceptionHandler { | @@ -267,6 +270,16 @@ public class GlobalExceptionHandler { | ||
| 267 | } | 270 | } |
| 268 | 271 | ||
| 269 | /** | 272 | /** |
| 273 | + * 处理 Guava UncheckedExecutionException | ||
| 274 | + * | ||
| 275 | + * 例如说,缓存加载报错,可见 <a href="https://t.zsxq.com/UszdH">https://t.zsxq.com/UszdH</a> | ||
| 276 | + */ | ||
| 277 | + @ExceptionHandler(value = UncheckedExecutionException.class) | ||
| 278 | + public CommonResult<?> uncheckedExecutionExceptionHandler(HttpServletRequest req, UncheckedExecutionException ex) { | ||
| 279 | + return allExceptionHandler(req, ex.getCause()); | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + /** | ||
| 270 | * 处理业务异常 ServiceException | 283 | * 处理业务异常 ServiceException |
| 271 | * | 284 | * |
| 272 | * 例如说,商品库存不足,用户手机号已存在。 | 285 | * 例如说,商品库存不足,用户手机号已存在。 |
| @@ -344,12 +357,12 @@ public class GlobalExceptionHandler { | @@ -344,12 +357,12 @@ public class GlobalExceptionHandler { | ||
| 344 | errorLog.setApplicationName(applicationName); | 357 | errorLog.setApplicationName(applicationName); |
| 345 | errorLog.setRequestUrl(request.getRequestURI()); | 358 | errorLog.setRequestUrl(request.getRequestURI()); |
| 346 | Map<String, Object> requestParams = MapUtil.<String, Object>builder() | 359 | Map<String, Object> requestParams = MapUtil.<String, Object>builder() |
| 347 | - .put("query", JakartaServletUtil.getParamMap(request)) | ||
| 348 | - .put("body", JakartaServletUtil.getBody(request)).build(); | 360 | + .put("query", ServletUtils.getParamMap(request)) |
| 361 | + .put("body", ServletUtils.getBody(request)).build(); | ||
| 349 | errorLog.setRequestParams(JsonUtils.toJsonString(requestParams)); | 362 | errorLog.setRequestParams(JsonUtils.toJsonString(requestParams)); |
| 350 | errorLog.setRequestMethod(request.getMethod()); | 363 | errorLog.setRequestMethod(request.getMethod()); |
| 351 | errorLog.setUserAgent(ServletUtils.getUserAgent(request)); | 364 | errorLog.setUserAgent(ServletUtils.getUserAgent(request)); |
| 352 | - errorLog.setUserIp(JakartaServletUtil.getClientIP(request)); | 365 | + errorLog.setUserIp(ServletUtils.getClientIP(request)); |
| 353 | errorLog.setExceptionTime(LocalDateTime.now()); | 366 | errorLog.setExceptionTime(LocalDateTime.now()); |
| 354 | } | 367 | } |
| 355 | 368 |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/config/YudaoXssAutoConfiguration.java
| @@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.xss.core.clean.JsoupXssCleaner; | @@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.xss.core.clean.JsoupXssCleaner; | ||
| 5 | import cn.iocoder.yudao.framework.xss.core.clean.XssCleaner; | 5 | import cn.iocoder.yudao.framework.xss.core.clean.XssCleaner; |
| 6 | import cn.iocoder.yudao.framework.xss.core.filter.XssFilter; | 6 | import cn.iocoder.yudao.framework.xss.core.filter.XssFilter; |
| 7 | import cn.iocoder.yudao.framework.xss.core.json.XssStringJsonDeserializer; | 7 | import cn.iocoder.yudao.framework.xss.core.json.XssStringJsonDeserializer; |
| 8 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 9 | import org.springframework.boot.autoconfigure.AutoConfiguration; | 8 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
| 11 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| @@ -42,13 +41,13 @@ public class YudaoXssAutoConfiguration implements WebMvcConfigurer { | @@ -42,13 +41,13 @@ public class YudaoXssAutoConfiguration implements WebMvcConfigurer { | ||
| 42 | */ | 41 | */ |
| 43 | @Bean | 42 | @Bean |
| 44 | @ConditionalOnMissingBean(name = "xssJacksonCustomizer") | 43 | @ConditionalOnMissingBean(name = "xssJacksonCustomizer") |
| 45 | - @ConditionalOnBean(ObjectMapper.class) | ||
| 46 | @ConditionalOnProperty(value = "yudao.xss.enable", havingValue = "true") | 44 | @ConditionalOnProperty(value = "yudao.xss.enable", havingValue = "true") |
| 47 | public Jackson2ObjectMapperBuilderCustomizer xssJacksonCustomizer(XssProperties properties, | 45 | public Jackson2ObjectMapperBuilderCustomizer xssJacksonCustomizer(XssProperties properties, |
| 48 | PathMatcher pathMatcher, | 46 | PathMatcher pathMatcher, |
| 49 | XssCleaner xssCleaner) { | 47 | XssCleaner xssCleaner) { |
| 50 | // 在反序列化时进行 xss 过滤,可以替换使用 XssStringJsonSerializer,在序列化时进行处理 | 48 | // 在反序列化时进行 xss 过滤,可以替换使用 XssStringJsonSerializer,在序列化时进行处理 |
| 51 | - return builder -> builder.deserializerByType(String.class, new XssStringJsonDeserializer(properties, pathMatcher, xssCleaner)); | 49 | + return builder -> |
| 50 | + builder.deserializerByType(String.class, new XssStringJsonDeserializer(properties, pathMatcher, xssCleaner)); | ||
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | /** | 53 | /** |
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/AiChatConversationController.java
| @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.chat.vo.conversation.AiChatCo | @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.chat.vo.conversation.AiChatCo | ||
| 12 | import cn.iocoder.yudao.module.ai.dal.dataobject.chat.AiChatConversationDO; | 12 | import cn.iocoder.yudao.module.ai.dal.dataobject.chat.AiChatConversationDO; |
| 13 | import cn.iocoder.yudao.module.ai.service.chat.AiChatConversationService; | 13 | import cn.iocoder.yudao.module.ai.service.chat.AiChatConversationService; |
| 14 | import cn.iocoder.yudao.module.ai.service.chat.AiChatMessageService; | 14 | import cn.iocoder.yudao.module.ai.service.chat.AiChatMessageService; |
| 15 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 15 | import io.swagger.v3.oas.annotations.Operation; | 16 | import io.swagger.v3.oas.annotations.Operation; |
| 16 | import io.swagger.v3.oas.annotations.Parameter; | 17 | import io.swagger.v3.oas.annotations.Parameter; |
| 17 | import io.swagger.v3.oas.annotations.tags.Tag; | 18 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -54,6 +55,7 @@ public class AiChatConversationController { | @@ -54,6 +55,7 @@ public class AiChatConversationController { | ||
| 54 | 55 | ||
| 55 | @GetMapping("/my-list") | 56 | @GetMapping("/my-list") |
| 56 | @Operation(summary = "获得【我的】聊天对话列表") | 57 | @Operation(summary = "获得【我的】聊天对话列表") |
| 58 | + @TransMethodResult | ||
| 57 | public CommonResult<List<AiChatConversationRespVO>> getChatConversationMyList() { | 59 | public CommonResult<List<AiChatConversationRespVO>> getChatConversationMyList() { |
| 58 | List<AiChatConversationDO> list = chatConversationService.getChatConversationListByUserId(getLoginUserId()); | 60 | List<AiChatConversationDO> list = chatConversationService.getChatConversationListByUserId(getLoginUserId()); |
| 59 | return success(BeanUtils.toBean(list, AiChatConversationRespVO.class)); | 61 | return success(BeanUtils.toBean(list, AiChatConversationRespVO.class)); |
| @@ -62,6 +64,7 @@ public class AiChatConversationController { | @@ -62,6 +64,7 @@ public class AiChatConversationController { | ||
| 62 | @GetMapping("/get-my") | 64 | @GetMapping("/get-my") |
| 63 | @Operation(summary = "获得【我的】聊天对话") | 65 | @Operation(summary = "获得【我的】聊天对话") |
| 64 | @Parameter(name = "id", required = true, description = "对话编号", example = "1024") | 66 | @Parameter(name = "id", required = true, description = "对话编号", example = "1024") |
| 67 | + @TransMethodResult | ||
| 65 | public CommonResult<AiChatConversationRespVO> getChatConversationMy(@RequestParam("id") Long id) { | 68 | public CommonResult<AiChatConversationRespVO> getChatConversationMy(@RequestParam("id") Long id) { |
| 66 | AiChatConversationDO conversation = chatConversationService.getChatConversation(id); | 69 | AiChatConversationDO conversation = chatConversationService.getChatConversation(id); |
| 67 | if (conversation != null && ObjUtil.notEqual(conversation.getUserId(), getLoginUserId())) { | 70 | if (conversation != null && ObjUtil.notEqual(conversation.getUserId(), getLoginUserId())) { |
| @@ -90,6 +93,7 @@ public class AiChatConversationController { | @@ -90,6 +93,7 @@ public class AiChatConversationController { | ||
| 90 | @GetMapping("/page") | 93 | @GetMapping("/page") |
| 91 | @Operation(summary = "获得对话分页", description = "用于【对话管理】菜单") | 94 | @Operation(summary = "获得对话分页", description = "用于【对话管理】菜单") |
| 92 | @PreAuthorize("@ss.hasPermission('ai:chat-conversation:query')") | 95 | @PreAuthorize("@ss.hasPermission('ai:chat-conversation:query')") |
| 96 | + @TransMethodResult | ||
| 93 | public CommonResult<PageResult<AiChatConversationRespVO>> getChatConversationPage(AiChatConversationPageReqVO pageReqVO) { | 97 | public CommonResult<PageResult<AiChatConversationRespVO>> getChatConversationPage(AiChatConversationPageReqVO pageReqVO) { |
| 94 | PageResult<AiChatConversationDO> pageResult = chatConversationService.getChatConversationPage(pageReqVO); | 98 | PageResult<AiChatConversationDO> pageResult = chatConversationService.getChatConversationPage(pageReqVO); |
| 95 | if (CollUtil.isEmpty(pageResult.getList())) { | 99 | if (CollUtil.isEmpty(pageResult.getList())) { |
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/model/AiChatRoleController.java
| @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.model.vo.chatRole.AiChatRoleS | @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.ai.controller.admin.model.vo.chatRole.AiChatRoleS | ||
| 10 | import cn.iocoder.yudao.module.ai.controller.admin.model.vo.chatRole.AiChatRoleSaveReqVO; | 10 | import cn.iocoder.yudao.module.ai.controller.admin.model.vo.chatRole.AiChatRoleSaveReqVO; |
| 11 | import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO; | 11 | import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO; |
| 12 | import cn.iocoder.yudao.module.ai.service.model.AiChatRoleService; | 12 | import cn.iocoder.yudao.module.ai.service.model.AiChatRoleService; |
| 13 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 13 | import io.swagger.v3.oas.annotations.Operation; | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 14 | import io.swagger.v3.oas.annotations.Parameter; | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| 15 | import io.swagger.v3.oas.annotations.tags.Tag; | 16 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -35,6 +36,7 @@ public class AiChatRoleController { | @@ -35,6 +36,7 @@ public class AiChatRoleController { | ||
| 35 | 36 | ||
| 36 | @GetMapping("/my-page") | 37 | @GetMapping("/my-page") |
| 37 | @Operation(summary = "获得【我的】聊天角色分页") | 38 | @Operation(summary = "获得【我的】聊天角色分页") |
| 39 | + @TransMethodResult | ||
| 38 | public CommonResult<PageResult<AiChatRoleRespVO>> getChatRoleMyPage(@Valid AiChatRolePageReqVO pageReqVO) { | 40 | public CommonResult<PageResult<AiChatRoleRespVO>> getChatRoleMyPage(@Valid AiChatRolePageReqVO pageReqVO) { |
| 39 | PageResult<AiChatRoleDO> pageResult = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId()); | 41 | PageResult<AiChatRoleDO> pageResult = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId()); |
| 40 | return success(BeanUtils.toBean(pageResult, AiChatRoleRespVO.class)); | 42 | return success(BeanUtils.toBean(pageResult, AiChatRoleRespVO.class)); |
| @@ -43,6 +45,7 @@ public class AiChatRoleController { | @@ -43,6 +45,7 @@ public class AiChatRoleController { | ||
| 43 | @GetMapping("/get-my") | 45 | @GetMapping("/get-my") |
| 44 | @Operation(summary = "获得【我的】聊天角色") | 46 | @Operation(summary = "获得【我的】聊天角色") |
| 45 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 47 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 48 | + @TransMethodResult | ||
| 46 | public CommonResult<AiChatRoleRespVO> getChatRoleMy(@RequestParam("id") Long id) { | 49 | public CommonResult<AiChatRoleRespVO> getChatRoleMy(@RequestParam("id") Long id) { |
| 47 | AiChatRoleDO chatRole = chatRoleService.getChatRole(id); | 50 | AiChatRoleDO chatRole = chatRoleService.getChatRole(id); |
| 48 | if (ObjUtil.notEqual(chatRole.getUserId(), getLoginUserId())) { | 51 | if (ObjUtil.notEqual(chatRole.getUserId(), getLoginUserId())) { |
| @@ -108,6 +111,7 @@ public class AiChatRoleController { | @@ -108,6 +111,7 @@ public class AiChatRoleController { | ||
| 108 | @Operation(summary = "获得聊天角色") | 111 | @Operation(summary = "获得聊天角色") |
| 109 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 112 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 110 | @PreAuthorize("@ss.hasPermission('ai:chat-role:query')") | 113 | @PreAuthorize("@ss.hasPermission('ai:chat-role:query')") |
| 114 | + @TransMethodResult | ||
| 111 | public CommonResult<AiChatRoleRespVO> getChatRole(@RequestParam("id") Long id) { | 115 | public CommonResult<AiChatRoleRespVO> getChatRole(@RequestParam("id") Long id) { |
| 112 | AiChatRoleDO chatRole = chatRoleService.getChatRole(id); | 116 | AiChatRoleDO chatRole = chatRoleService.getChatRole(id); |
| 113 | return success(BeanUtils.toBean(chatRole, AiChatRoleRespVO.class)); | 117 | return success(BeanUtils.toBean(chatRole, AiChatRoleRespVO.class)); |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionRespVO.java
| 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression; | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelProperty; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| @@ -27,4 +27,4 @@ public class BpmProcessExpressionRespVO { | @@ -27,4 +27,4 @@ public class BpmProcessExpressionRespVO { | ||
| 27 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 27 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 28 | private LocalDateTime createTime; | 28 | private LocalDateTime createTime; |
| 29 | 29 | ||
| 30 | -} | ||
| 31 | \ No newline at end of file | 30 | \ No newline at end of file |
| 31 | +} |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
| @@ -40,7 +40,7 @@ public interface ErrorCodeConstants { | @@ -40,7 +40,7 @@ public interface ErrorCodeConstants { | ||
| 40 | ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "任务({})的候选人({})不存在"); | 40 | ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "任务({})的候选人({})不存在"); |
| 41 | ErrorCode PROCESS_INSTANCE_START_USER_CAN_START = new ErrorCode(1_009_004_005, "发起流程失败,你没有权限发起该流程"); | 41 | ErrorCode PROCESS_INSTANCE_START_USER_CAN_START = new ErrorCode(1_009_004_005, "发起流程失败,你没有权限发起该流程"); |
| 42 | ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_005, "流程取消失败,该流程不允许取消"); | 42 | ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_005, "流程取消失败,该流程不允许取消"); |
| 43 | - ErrorCode PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR = new ErrorCode(1_009_004_006, "流程 Http 触发器请求调用失败"); | 43 | + ErrorCode PROCESS_INSTANCE_HTTP_CALL_ERROR = new ErrorCode(1_009_004_006, "流程 Http 请求调用失败"); |
| 44 | ErrorCode PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_007, "下一个任务({})的审批人未配置"); | 44 | ErrorCode PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_007, "下一个任务({})的审批人未配置"); |
| 45 | ErrorCode PROCESS_INSTANCE_CANCEL_CHILD_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_008, "子流程取消失败,子流程不允许取消"); | 45 | ErrorCode PROCESS_INSTANCE_CANCEL_CHILD_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_008, "子流程取消失败,子流程不允许取消"); |
| 46 | 46 | ||
| @@ -58,7 +58,6 @@ public interface ErrorCodeConstants { | @@ -58,7 +58,6 @@ public interface ErrorCodeConstants { | ||
| 58 | ErrorCode TASK_SIGN_DELETE_NO_PARENT = new ErrorCode(1_009_005_012, "任务减签失败,被减签的任务必须是通过加签生成的任务"); | 58 | ErrorCode TASK_SIGN_DELETE_NO_PARENT = new ErrorCode(1_009_005_012, "任务减签失败,被减签的任务必须是通过加签生成的任务"); |
| 59 | ErrorCode TASK_TRANSFER_FAIL_USER_REPEAT = new ErrorCode(1_009_005_013, "任务转办失败,转办人和当前审批人为同一人"); | 59 | ErrorCode TASK_TRANSFER_FAIL_USER_REPEAT = new ErrorCode(1_009_005_013, "任务转办失败,转办人和当前审批人为同一人"); |
| 60 | ErrorCode TASK_TRANSFER_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_014, "任务转办失败,转办人不存在"); | 60 | ErrorCode TASK_TRANSFER_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_014, "任务转办失败,转办人不存在"); |
| 61 | - ErrorCode TASK_CREATE_FAIL_NO_CANDIDATE_USER = new ErrorCode(1_009_006_003, "操作失败,原因:找不到任务的审批人!"); | ||
| 62 | ErrorCode TASK_SIGNATURE_NOT_EXISTS = new ErrorCode(1_009_005_015, "签名不能为空!"); | 61 | ErrorCode TASK_SIGNATURE_NOT_EXISTS = new ErrorCode(1_009_005_015, "签名不能为空!"); |
| 63 | ErrorCode TASK_REASON_REQUIRE = new ErrorCode(1_009_005_016, "审批意见不能为空!"); | 62 | ErrorCode TASK_REASON_REQUIRE = new ErrorCode(1_009_005_016, "审批意见不能为空!"); |
| 64 | ErrorCode TASK_WITHDRAW_FAIL_PROCESS_NOT_RUNNING = new ErrorCode(1_009_005_017, "撤回失败,流程实例未运行!"); | 63 | ErrorCode TASK_WITHDRAW_FAIL_PROCESS_NOT_RUNNING = new ErrorCode(1_009_005_017, "撤回失败,流程实例未运行!"); |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java
| @@ -7,44 +7,35 @@ import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCand | @@ -7,44 +7,35 @@ import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCand | ||
| 7 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; | 7 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; |
| 8 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; | 8 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; |
| 9 | import lombok.Setter; | 9 | import lombok.Setter; |
| 10 | -import org.flowable.bpmn.model.Activity; | ||
| 11 | -import org.flowable.bpmn.model.CallActivity; | ||
| 12 | -import org.flowable.bpmn.model.FlowElement; | ||
| 13 | -import org.flowable.bpmn.model.UserTask; | 10 | +import org.flowable.bpmn.model.*; |
| 14 | import org.flowable.engine.delegate.DelegateExecution; | 11 | import org.flowable.engine.delegate.DelegateExecution; |
| 15 | import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; | 12 | import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; |
| 16 | -import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; | 13 | +import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| 14 | +import org.flowable.engine.impl.persistence.entity.ExecutionEntity; | ||
| 17 | 15 | ||
| 18 | import java.util.List; | 16 | import java.util.List; |
| 19 | import java.util.Set; | 17 | import java.util.Set; |
| 20 | 18 | ||
| 21 | /** | 19 | /** |
| 22 | - * 自定义的【并行】的【多个】流程任务的 assignee 负责人的分配 | ||
| 23 | - * 第一步,基于分配规则,计算出分配任务的【多个】候选人们。 | ||
| 24 | - * 第二步,将【多个】任务候选人们,设置到 DelegateExecution 的 collectionVariable 变量中,以便 BpmUserTaskActivityBehavior 使用它 | 20 | + * 自定义的【串行】的【多个】流程任务的 assignee 负责人的分配 |
| 25 | * | 21 | * |
| 26 | - * @author kemengkai | ||
| 27 | - * @since 2022-04-21 16:57 | 22 | + * 本质上,实现和 {@link BpmParallelMultiInstanceBehavior} 一样,只是继承的类不一样 |
| 23 | + * | ||
| 24 | + * @author 芋道源码 | ||
| 28 | */ | 25 | */ |
| 29 | @Setter | 26 | @Setter |
| 30 | -public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehavior { | 27 | +public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceBehavior { |
| 31 | 28 | ||
| 32 | private BpmTaskCandidateInvoker taskCandidateInvoker; | 29 | private BpmTaskCandidateInvoker taskCandidateInvoker; |
| 33 | 30 | ||
| 34 | - public BpmParallelMultiInstanceBehavior(Activity activity, | ||
| 35 | - AbstractBpmnActivityBehavior innerActivityBehavior) { | 31 | + public BpmSequentialMultiInstanceBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) { |
| 36 | super(activity, innerActivityBehavior); | 32 | super(activity, innerActivityBehavior); |
| 37 | } | 33 | } |
| 38 | 34 | ||
| 39 | /** | 35 | /** |
| 40 | - * 重写该方法,主要实现两个功能: | ||
| 41 | - * 1. 忽略原有的 collectionVariable、collectionElementVariable 表达式,而是采用自己定义的 | ||
| 42 | - * 2. 获得任务的处理人,并设置到 collectionVariable 中,用于 BpmUserTaskActivityBehavior 从中可以获取任务的处理人 | ||
| 43 | - * | ||
| 44 | - * 注意,多个任务实例,每个任务实例对应一个处理人,所以返回的数量就是任务处理人的数量 | 36 | + * 逻辑和 {@link BpmParallelMultiInstanceBehavior#resolveNrOfInstances(DelegateExecution)} 类似 |
| 45 | * | 37 | * |
| 46 | - * @param execution 执行任务 | ||
| 47 | - * @return 数量 | 38 | + * 差异的点:是在【第二步】的时候,需要返回 LinkedHashSet 集合!因为它需要有序! |
| 48 | */ | 39 | */ |
| 49 | @Override | 40 | @Override |
| 50 | protected int resolveNrOfInstances(DelegateExecution execution) { | 41 | protected int resolveNrOfInstances(DelegateExecution execution) { |
| @@ -58,8 +49,9 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav | @@ -58,8 +49,9 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav | ||
| 58 | super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); | 49 | super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); |
| 59 | 50 | ||
| 60 | // 第二步,获取任务的所有处理人 | 51 | // 第二步,获取任务的所有处理人 |
| 52 | + // 不使用 execution.getVariable 原因:目前依次审批任务回退后 collectionVariable 变量没有清理, 如果重新进入该任务不会重新分配审批人 | ||
| 61 | @SuppressWarnings("unchecked") | 53 | @SuppressWarnings("unchecked") |
| 62 | - Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class); | 54 | + Set<Long> assigneeUserIds = (Set<Long>) execution.getVariableLocal(super.collectionVariable, Set.class); |
| 63 | if (assigneeUserIds == null) { | 55 | if (assigneeUserIds == null) { |
| 64 | assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution); | 56 | assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution); |
| 65 | if (CollUtil.isEmpty(assigneeUserIds)) { | 57 | if (CollUtil.isEmpty(assigneeUserIds)) { |
| @@ -88,4 +80,19 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav | @@ -88,4 +80,19 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav | ||
| 88 | return super.resolveNrOfInstances(execution); | 80 | return super.resolveNrOfInstances(execution); |
| 89 | } | 81 | } |
| 90 | 82 | ||
| 83 | + @Override | ||
| 84 | + protected void executeOriginalBehavior(DelegateExecution execution, ExecutionEntity multiInstanceRootExecution, int loopCounter) { | ||
| 85 | + // 参见 https://t.zsxq.com/53Meo 情况 | ||
| 86 | + if (execution.getCurrentFlowElement() instanceof CallActivity | ||
| 87 | + || execution.getCurrentFlowElement() instanceof SubProcess) { | ||
| 88 | + super.executeOriginalBehavior(execution, multiInstanceRootExecution, loopCounter); | ||
| 89 | + return; | ||
| 90 | + } | ||
| 91 | + // 参见 https://gitee.com/zhijiantianya/yudao-cloud/issues/IC239F | ||
| 92 | + super.collectionExpression = null; | ||
| 93 | + super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId()); | ||
| 94 | + super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); | ||
| 95 | + super.executeOriginalBehavior(execution, multiInstanceRootExecution, loopCounter); | ||
| 96 | + } | ||
| 97 | + | ||
| 91 | } | 98 | } |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmHttpRequestUtils.java
| @@ -6,15 +6,15 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; | @@ -6,15 +6,15 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 8 | import cn.iocoder.yudao.framework.common.util.spring.SpringUtils; | 8 | import cn.iocoder.yudao.framework.common.util.spring.SpringUtils; |
| 9 | +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; | ||
| 9 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO; | 11 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO; |
| 10 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmHttpRequestParamTypeEnum; | 12 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmHttpRequestParamTypeEnum; |
| 11 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; | 13 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; |
| 12 | import com.fasterxml.jackson.core.type.TypeReference; | 14 | import com.fasterxml.jackson.core.type.TypeReference; |
| 13 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 14 | import org.flowable.engine.runtime.ProcessInstance; | 16 | import org.flowable.engine.runtime.ProcessInstance; |
| 15 | -import org.springframework.http.HttpEntity; | ||
| 16 | -import org.springframework.http.HttpMethod; | ||
| 17 | -import org.springframework.http.ResponseEntity; | 17 | +import org.springframework.http.*; |
| 18 | import org.springframework.util.LinkedMultiValueMap; | 18 | import org.springframework.util.LinkedMultiValueMap; |
| 19 | import org.springframework.util.MultiValueMap; | 19 | import org.springframework.util.MultiValueMap; |
| 20 | import org.springframework.web.client.RestClientException; | 20 | import org.springframework.web.client.RestClientException; |
| @@ -26,7 +26,7 @@ import java.util.Map; | @@ -26,7 +26,7 @@ import java.util.Map; | ||
| 26 | 26 | ||
| 27 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 27 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 28 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; | 28 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; |
| 29 | -import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR; | 29 | +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_HTTP_CALL_ERROR; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 工作流发起 HTTP 请求工具类 | 32 | * 工作流发起 HTTP 请求工具类 |
| @@ -42,7 +42,6 @@ public class BpmHttpRequestUtils { | @@ -42,7 +42,6 @@ public class BpmHttpRequestUtils { | ||
| 42 | List<BpmSimpleModelNodeVO.HttpRequestParam> bodyParams, | 42 | List<BpmSimpleModelNodeVO.HttpRequestParam> bodyParams, |
| 43 | Boolean handleResponse, | 43 | Boolean handleResponse, |
| 44 | List<KeyValue<String, String>> response) { | 44 | List<KeyValue<String, String>> response) { |
| 45 | - RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class); | ||
| 46 | BpmProcessInstanceService processInstanceService = SpringUtils.getBean(BpmProcessInstanceService.class); | 45 | BpmProcessInstanceService processInstanceService = SpringUtils.getBean(BpmProcessInstanceService.class); |
| 47 | 46 | ||
| 48 | // 1.1 设置请求头 | 47 | // 1.1 设置请求头 |
| @@ -51,6 +50,7 @@ public class BpmHttpRequestUtils { | @@ -51,6 +50,7 @@ public class BpmHttpRequestUtils { | ||
| 51 | MultiValueMap<String, String> body = buildHttpBody(processInstance, bodyParams); | 50 | MultiValueMap<String, String> body = buildHttpBody(processInstance, bodyParams); |
| 52 | 51 | ||
| 53 | // 2. 发起请求 | 52 | // 2. 发起请求 |
| 53 | + RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class); | ||
| 54 | ResponseEntity<String> responseEntity = sendHttpRequest(url, headers, body, restTemplate); | 54 | ResponseEntity<String> responseEntity = sendHttpRequest(url, headers, body, restTemplate); |
| 55 | 55 | ||
| 56 | // 3. 处理返回 | 56 | // 3. 处理返回 |
| @@ -78,27 +78,55 @@ public class BpmHttpRequestUtils { | @@ -78,27 +78,55 @@ public class BpmHttpRequestUtils { | ||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | + public static void executeBpmHttpRequest(BpmProcessInstanceStatusEvent event, | ||
| 82 | + String url) { | ||
| 83 | + // 1.1 设置请求头 | ||
| 84 | + HttpHeaders headers = new HttpHeaders(); | ||
| 85 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 86 | + if (TenantContextHolder.getTenantId() != null) { | ||
| 87 | + headers.add(HEADER_TENANT_ID, String.valueOf(TenantContextHolder.getTenantId())); | ||
| 88 | + } else { | ||
| 89 | + BpmProcessInstanceService processInstanceService = SpringUtils.getBean(BpmProcessInstanceService.class); | ||
| 90 | + ProcessInstance processInstance = processInstanceService.getProcessInstance(event.getId()); | ||
| 91 | + if (processInstance != null) { | ||
| 92 | + headers.add(HEADER_TENANT_ID, String.valueOf(TenantContextHolder.getTenantId())); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + // 1.2 设置请求体 | ||
| 96 | +// MultiValueMap<String, String> body = new LinkedMultiValueMap<>(); | ||
| 97 | +// body.add("id", event.getId()); | ||
| 98 | +// body.add("processDefinitionKey", event.getProcessDefinitionKey()); | ||
| 99 | +// body.add("status", event.getStatus().toString()); | ||
| 100 | +// if (StrUtil.isNotEmpty(event.getBusinessKey())) { | ||
| 101 | +// body.add("businessKey", event.getBusinessKey()); | ||
| 102 | +// } | ||
| 103 | + | ||
| 104 | + // 2. 发起请求 | ||
| 105 | + RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class); | ||
| 106 | + sendHttpRequest(url, headers, event, restTemplate); | ||
| 107 | + } | ||
| 108 | + | ||
| 81 | public static ResponseEntity<String> sendHttpRequest(String url, | 109 | public static ResponseEntity<String> sendHttpRequest(String url, |
| 82 | MultiValueMap<String, String> headers, | 110 | MultiValueMap<String, String> headers, |
| 83 | - MultiValueMap<String, String> body, | 111 | + Object body, |
| 84 | RestTemplate restTemplate) { | 112 | RestTemplate restTemplate) { |
| 85 | - HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(body, headers); | 113 | + HttpEntity<Object> requestEntity = new HttpEntity<>(body, headers); |
| 86 | ResponseEntity<String> responseEntity; | 114 | ResponseEntity<String> responseEntity; |
| 87 | try { | 115 | try { |
| 88 | responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); | 116 | responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); |
| 89 | - log.info("[sendHttpRequest][HTTP 触发器,请求头:{},请求体:{},响应结果:{}]", headers, body, responseEntity); | 117 | + log.info("[sendHttpRequest][HTTP 请求,请求头:{},请求体:{},响应结果:{}]", headers, body, responseEntity); |
| 90 | } catch (RestClientException e) { | 118 | } catch (RestClientException e) { |
| 91 | - log.error("[sendHttpRequest][HTTP 触发器,请求头:{},请求体:{},请求出错:{}]", headers, body, e.getMessage()); | ||
| 92 | - throw exception(PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR); | 119 | + log.error("[sendHttpRequest][HTTP 请求,请求头:{},请求体:{},请求出错:{}]", headers, body, e.getMessage()); |
| 120 | + throw exception(PROCESS_INSTANCE_HTTP_CALL_ERROR); | ||
| 93 | } | 121 | } |
| 94 | return responseEntity; | 122 | return responseEntity; |
| 95 | } | 123 | } |
| 96 | 124 | ||
| 97 | public static MultiValueMap<String, String> buildHttpHeaders(ProcessInstance processInstance, | 125 | public static MultiValueMap<String, String> buildHttpHeaders(ProcessInstance processInstance, |
| 98 | List<BpmSimpleModelNodeVO.HttpRequestParam> headerSettings) { | 126 | List<BpmSimpleModelNodeVO.HttpRequestParam> headerSettings) { |
| 99 | - Map<String, Object> processVariables = processInstance.getProcessVariables(); | ||
| 100 | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); | 127 | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| 101 | headers.add(HEADER_TENANT_ID, processInstance.getTenantId()); | 128 | headers.add(HEADER_TENANT_ID, processInstance.getTenantId()); |
| 129 | + Map<String, Object> processVariables = processInstance.getProcessVariables(); | ||
| 102 | addHttpRequestParam(headers, headerSettings, processVariables); | 130 | addHttpRequestParam(headers, headerSettings, processVariables); |
| 103 | return headers; | 131 | return headers; |
| 104 | } | 132 | } |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| @@ -67,7 +67,6 @@ import java.util.*; | @@ -67,7 +67,6 @@ import java.util.*; | ||
| 67 | 67 | ||
| 68 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 68 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 69 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | 69 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 70 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 71 | import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; | 70 | import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; |
| 72 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | 71 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 73 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; | 72 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; |
| @@ -221,11 +220,6 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -221,11 +220,6 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 221 | List<ActivityNode> simulateActivityNodes = getSimulateApproveNodeList(startUserId, bpmnModel, | 220 | List<ActivityNode> simulateActivityNodes = getSimulateApproveNodeList(startUserId, bpmnModel, |
| 222 | processDefinitionInfo, | 221 | processDefinitionInfo, |
| 223 | processVariables, activities); | 222 | processVariables, activities); |
| 224 | - // 3.3 如果是发起动作,activityId 为开始节点,不校验审批人自选节点 | ||
| 225 | - if (ObjUtil.equals(reqVO.getActivityId(), BpmnModelConstants.START_USER_NODE_ID)) { | ||
| 226 | - simulateActivityNodes.removeIf(node -> | ||
| 227 | - BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy().equals(node.getCandidateStrategy())); | ||
| 228 | - } | ||
| 229 | 223 | ||
| 230 | // 4. 拼接最终数据 | 224 | // 4. 拼接最终数据 |
| 231 | return buildApprovalDetail(reqVO, bpmnModel, processDefinition, processDefinitionInfo, historicProcessInstance, | 225 | return buildApprovalDetail(reqVO, bpmnModel, processDefinition, processDefinitionInfo, historicProcessInstance, |
| @@ -415,7 +409,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -415,7 +409,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 415 | endActivities.forEach(activity -> { | 409 | endActivities.forEach(activity -> { |
| 416 | // StartEvent:只处理 BPMN 的场景。因为,SIMPLE 情况下,已经有 START_USER_NODE 节点 | 410 | // StartEvent:只处理 BPMN 的场景。因为,SIMPLE 情况下,已经有 START_USER_NODE 节点 |
| 417 | if (ELEMENT_EVENT_START.equals(activity.getActivityType()) | 411 | if (ELEMENT_EVENT_START.equals(activity.getActivityType()) |
| 418 | - && BpmModelTypeEnum.BPMN.getType().equals(processDefinitionInfo.getModelType())) { | 412 | + && BpmModelTypeEnum.BPMN.getType().equals(processDefinitionInfo.getModelType()) |
| 413 | + && !CollUtil.contains(activities, // 特殊:如果已经存在用户手动创建的 START_USER_NODE_ID 节点,则忽略 StartEvent | ||
| 414 | + historicActivity -> historicActivity.getActivityId().equals(START_USER_NODE_ID))) { | ||
| 419 | ActivityNodeTask startTask = new ActivityNodeTask().setId(BpmnModelConstants.START_USER_NODE_ID) | 415 | ActivityNodeTask startTask = new ActivityNodeTask().setId(BpmnModelConstants.START_USER_NODE_ID) |
| 420 | .setAssignee(startUserId).setStatus(BpmTaskStatusEnum.APPROVE.getStatus()); | 416 | .setAssignee(startUserId).setStatus(BpmTaskStatusEnum.APPROVE.getStatus()); |
| 421 | ActivityNode startNode = new ActivityNode().setId(startTask.getId()) | 417 | ActivityNode startNode = new ActivityNode().setId(startTask.getId()) |
| @@ -555,7 +551,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -555,7 +551,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 555 | // 情况一:BPMN 设计器 | 551 | // 情况一:BPMN 设计器 |
| 556 | if (Objects.equals(BpmModelTypeEnum.BPMN.getType(), processDefinitionInfo.getModelType())) { | 552 | if (Objects.equals(BpmModelTypeEnum.BPMN.getType(), processDefinitionInfo.getModelType())) { |
| 557 | List<FlowElement> flowElements = BpmnModelUtils.simulateProcess(bpmnModel, processVariables); | 553 | List<FlowElement> flowElements = BpmnModelUtils.simulateProcess(bpmnModel, processVariables); |
| 558 | - return convertList(flowElements, flowElement -> buildNotRunApproveNodeForBpmn(startUserId, bpmnModel, | 554 | + return convertList(flowElements, flowElement -> buildNotRunApproveNodeForBpmn( |
| 555 | + startUserId, bpmnModel, flowElements, | ||
| 559 | processDefinitionInfo, processVariables, flowElement, runActivityIds)); | 556 | processDefinitionInfo, processVariables, flowElement, runActivityIds)); |
| 560 | } | 557 | } |
| 561 | // 情况二:SIMPLE 设计器 | 558 | // 情况二:SIMPLE 设计器 |
| @@ -563,7 +560,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -563,7 +560,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 563 | BpmSimpleModelNodeVO simpleModel = JsonUtils.parseObject(processDefinitionInfo.getSimpleModel(), | 560 | BpmSimpleModelNodeVO simpleModel = JsonUtils.parseObject(processDefinitionInfo.getSimpleModel(), |
| 564 | BpmSimpleModelNodeVO.class); | 561 | BpmSimpleModelNodeVO.class); |
| 565 | List<BpmSimpleModelNodeVO> simpleNodes = SimpleModelUtils.simulateProcess(simpleModel, processVariables); | 562 | List<BpmSimpleModelNodeVO> simpleNodes = SimpleModelUtils.simulateProcess(simpleModel, processVariables); |
| 566 | - return convertList(simpleNodes, simpleNode -> buildNotRunApproveNodeForSimple(startUserId, bpmnModel, | 563 | + return convertList(simpleNodes, simpleNode -> buildNotRunApproveNodeForSimple( |
| 564 | + startUserId, bpmnModel, | ||
| 567 | processDefinitionInfo, processVariables, simpleNode, runActivityIds)); | 565 | processDefinitionInfo, processVariables, simpleNode, runActivityIds)); |
| 568 | } | 566 | } |
| 569 | throw new IllegalArgumentException("未知设计器类型:" + processDefinitionInfo.getModelType()); | 567 | throw new IllegalArgumentException("未知设计器类型:" + processDefinitionInfo.getModelType()); |
| @@ -618,8 +616,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -618,8 +616,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 618 | return null; | 616 | return null; |
| 619 | } | 617 | } |
| 620 | 618 | ||
| 621 | - private ActivityNode buildNotRunApproveNodeForBpmn(Long startUserId, BpmnModel bpmnModel, | ||
| 622 | - BpmProcessDefinitionInfoDO processDefinitionInfo, Map<String, Object> processVariables, | 619 | + private ActivityNode buildNotRunApproveNodeForBpmn(Long startUserId, BpmnModel bpmnModel, List<FlowElement> flowElements, |
| 620 | + BpmProcessDefinitionInfoDO processDefinitionInfo, | ||
| 621 | + Map<String, Object> processVariables, | ||
| 623 | FlowElement node, Set<String> runActivityIds) { | 622 | FlowElement node, Set<String> runActivityIds) { |
| 624 | if (runActivityIds.contains(node.getId())) { | 623 | if (runActivityIds.contains(node.getId())) { |
| 625 | return null; | 624 | return null; |
| @@ -634,6 +633,10 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -634,6 +633,10 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 634 | 633 | ||
| 635 | // 1. 开始节点 | 634 | // 1. 开始节点 |
| 636 | if (node instanceof StartEvent) { | 635 | if (node instanceof StartEvent) { |
| 636 | + if (CollUtil.contains(flowElements, // 特殊:如果已经存在用户手动创建的 START_USER_NODE_ID 节点,则忽略 StartEvent | ||
| 637 | + flowElement -> flowElement.getId().equals(START_USER_NODE_ID))) { | ||
| 638 | + return null; | ||
| 639 | + } | ||
| 637 | return activityNode.setName(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getName()) | 640 | return activityNode.setName(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getName()) |
| 638 | .setNodeType(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()); | 641 | .setNodeType(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()); |
| 639 | } | 642 | } |
yudao-module-bpm/src/test/java/cn/iocoder/yudao/module/bpm/service/category/BpmCategoryServiceImplTest.java
| @@ -8,9 +8,11 @@ import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category.BpmCa | @@ -8,9 +8,11 @@ import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category.BpmCa | ||
| 8 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO; | 8 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO; |
| 9 | import cn.iocoder.yudao.module.bpm.dal.mysql.category.BpmCategoryMapper; | 9 | import cn.iocoder.yudao.module.bpm.dal.mysql.category.BpmCategoryMapper; |
| 10 | import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryServiceImpl; | 10 | import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryServiceImpl; |
| 11 | +import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; | ||
| 11 | import jakarta.annotation.Resource; | 12 | import jakarta.annotation.Resource; |
| 12 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 13 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 14 | 16 | ||
| 15 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| 16 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; |
| @@ -32,6 +34,9 @@ public class BpmCategoryServiceImplTest extends BaseDbUnitTest { | @@ -32,6 +34,9 @@ public class BpmCategoryServiceImplTest extends BaseDbUnitTest { | ||
| 32 | @Resource | 34 | @Resource |
| 33 | private BpmCategoryServiceImpl categoryService; | 35 | private BpmCategoryServiceImpl categoryService; |
| 34 | 36 | ||
| 37 | + @MockitoBean | ||
| 38 | + private BpmModelService modelService; | ||
| 39 | + | ||
| 35 | @Resource | 40 | @Resource |
| 36 | private BpmCategoryMapper categoryMapper; | 41 | private BpmCategoryMapper categoryMapper; |
| 37 | 42 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.AllArgsConstructor; | 6 | import lombok.AllArgsConstructor; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.clue.vo; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.clue.vo; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | import lombok.ToString; | 10 | import lombok.ToString; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | import lombok.ToString; | 10 | import lombok.ToString; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.AllArgsConstructor; | 6 | import lombok.AllArgsConstructor; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportExcelVO.java
| @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect; | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect; | ||
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.AreaConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.AreaConvert; |
| 6 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 6 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 7 | import cn.iocoder.yudao.module.crm.framework.excel.core.AreaExcelColumnSelectFunction; | 7 | import cn.iocoder.yudao.module.crm.framework.excel.core.AreaExcelColumnSelectFunction; |
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | 8 | +import cn.idev.excel.annotation.ExcelProperty; |
| 9 | import lombok.AllArgsConstructor; | 9 | import lombok.AllArgsConstructor; |
| 10 | import lombok.Builder; | 10 | import lombok.Builder; |
| 11 | import lombok.Data; | 11 | import lombok.Data; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.followup.vo; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.followup.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -61,4 +61,4 @@ public class CrmFollowUpRecordRespVO { | @@ -61,4 +61,4 @@ public class CrmFollowUpRecordRespVO { | ||
| 61 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 61 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 62 | private LocalDateTime createTime; | 62 | private LocalDateTime createTime; |
| 63 | 63 | ||
| 64 | -} | ||
| 65 | \ No newline at end of file | 64 | \ No newline at end of file |
| 65 | +} |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/vo/CrmOperateLogRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.operatelog.vo; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.operatelog.vo; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java
| @@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | @@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | ||
| 14 | import cn.iocoder.yudao.module.crm.enums.product.CrmProductStatusEnum; | 14 | import cn.iocoder.yudao.module.crm.enums.product.CrmProductStatusEnum; |
| 15 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; | 15 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; |
| 16 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 16 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| 17 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 17 | import io.swagger.v3.oas.annotations.Operation; | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | import io.swagger.v3.oas.annotations.Parameter; | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| 19 | import io.swagger.v3.oas.annotations.tags.Tag; | 20 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -70,6 +71,7 @@ public class CrmProductController { | @@ -70,6 +71,7 @@ public class CrmProductController { | ||
| 70 | @Operation(summary = "获得产品") | 71 | @Operation(summary = "获得产品") |
| 71 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 72 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 72 | @PreAuthorize("@ss.hasPermission('crm:product:query')") | 73 | @PreAuthorize("@ss.hasPermission('crm:product:query')") |
| 74 | + @TransMethodResult | ||
| 73 | public CommonResult<CrmProductRespVO> getProduct(@RequestParam("id") Long id) { | 75 | public CommonResult<CrmProductRespVO> getProduct(@RequestParam("id") Long id) { |
| 74 | CrmProductDO product = productService.getProduct(id); | 76 | CrmProductDO product = productService.getProduct(id); |
| 75 | return success(BeanUtils.toBean(product, CrmProductRespVO.class)); | 77 | return success(BeanUtils.toBean(product, CrmProductRespVO.class)); |
| @@ -86,6 +88,7 @@ public class CrmProductController { | @@ -86,6 +88,7 @@ public class CrmProductController { | ||
| 86 | @GetMapping("/page") | 88 | @GetMapping("/page") |
| 87 | @Operation(summary = "获得产品分页") | 89 | @Operation(summary = "获得产品分页") |
| 88 | @PreAuthorize("@ss.hasPermission('crm:product:query')") | 90 | @PreAuthorize("@ss.hasPermission('crm:product:query')") |
| 91 | + @TransMethodResult | ||
| 89 | public CommonResult<PageResult<CrmProductRespVO>> getProductPage(@Valid CrmProductPageReqVO pageVO) { | 92 | public CommonResult<PageResult<CrmProductRespVO>> getProductPage(@Valid CrmProductPageReqVO pageVO) { |
| 90 | PageResult<CrmProductDO> pageResult = productService.getProductPage(pageVO); | 93 | PageResult<CrmProductDO> pageResult = productService.getProductPage(pageVO); |
| 91 | return success(BeanUtils.toBean(pageResult, CrmProductRespVO.class)); | 94 | return success(BeanUtils.toBean(pageResult, CrmProductRespVO.class)); |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryListReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo.category; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo.category; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelProperty; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductRespVO.java
| @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; |
| 6 | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 8 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 9 | import com.fhs.core.trans.anno.Trans; | 9 | import com.fhs.core.trans.anno.Trans; |
| 10 | import com.fhs.core.trans.constant.TransType; | 10 | import com.fhs.core.trans.constant.TransType; |
| 11 | import com.fhs.core.trans.vo.VO; | 11 | import com.fhs.core.trans.vo.VO; |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; | 3 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; |
| 4 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 5 | -import com.alibaba.excel.annotation.ExcelProperty; | 4 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 5 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| 8 | 8 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java
| @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; |
| 6 | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 8 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 9 | import io.swagger.v3.oas.annotations.media.Schema; | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | import lombok.Data; | 10 | import lombok.Data; |
| 11 | 11 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -159,10 +159,10 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -159,10 +159,10 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 159 | // 2. 删除联系人 | 159 | // 2. 删除联系人 |
| 160 | contactMapper.deleteById(id); | 160 | contactMapper.deleteById(id); |
| 161 | 161 | ||
| 162 | - // 4.1 删除数据权限 | ||
| 163 | - permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id); | ||
| 164 | - // 4.2 删除商机关联 | 162 | + // 4.1 删除商机关联 |
| 165 | contactBusinessService.deleteContactBusinessByContactId(id); | 163 | contactBusinessService.deleteContactBusinessByContactId(id); |
| 164 | + // 4.2 删除数据权限 | ||
| 165 | + permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id); | ||
| 166 | 166 | ||
| 167 | // 记录操作日志上下文 | 167 | // 记录操作日志上下文 |
| 168 | LogRecordContext.putVariable("contactName", contact.getName()); | 168 | LogRecordContext.putVariable("contactName", contact.getName()); |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/util/CrmPermissionUtils.java
| @@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.crm.util; | @@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.crm.util; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.extra.spring.SpringUtil; | 4 | import cn.hutool.extra.spring.SpringUtil; |
| 5 | +import cn.iocoder.yudao.framework.common.biz.system.permission.PermissionCommonApi; | ||
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; |
| 6 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | 7 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 7 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | 8 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| 8 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | 9 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 9 | -import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | ||
| 10 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 10 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| 11 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 11 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 12 | import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; | 12 | import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; |
| @@ -32,7 +32,7 @@ public class CrmPermissionUtils { | @@ -32,7 +32,7 @@ public class CrmPermissionUtils { | ||
| 32 | * @return 是/否 | 32 | * @return 是/否 |
| 33 | */ | 33 | */ |
| 34 | public static boolean isCrmAdmin() { | 34 | public static boolean isCrmAdmin() { |
| 35 | - PermissionApi permissionApi = SpringUtil.getBean(PermissionApi.class); | 35 | + PermissionCommonApi permissionApi = SpringUtil.getBean(PermissionCommonApi.class); |
| 36 | return permissionApi.hasAnyRoles(getLoginUserId(), RoleCodeEnum.CRM_ADMIN.getCode()); | 36 | return permissionApi.hasAnyRoles(getLoginUserId(), RoleCodeEnum.CRM_ADMIN.getCode()); |
| 37 | } | 37 | } |
| 38 | 38 |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/account/ErpAccountRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 4 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -47,4 +47,4 @@ public class ErpAccountRespVO { | @@ -47,4 +47,4 @@ public class ErpAccountRespVO { | ||
| 47 | @ExcelProperty("创建时间") | 47 | @ExcelProperty("创建时间") |
| 48 | private LocalDateTime createTime; | 48 | private LocalDateTime createTime; |
| 49 | 49 | ||
| 50 | -} | ||
| 51 | \ No newline at end of file | 50 | \ No newline at end of file |
| 51 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -96,4 +96,4 @@ public class ErpFinancePaymentRespVO { | @@ -96,4 +96,4 @@ public class ErpFinancePaymentRespVO { | ||
| 96 | 96 | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | -} | ||
| 100 | \ No newline at end of file | 99 | \ No newline at end of file |
| 100 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/receipt/ErpFinanceReceiptRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.receipt; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.receipt; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -96,4 +96,4 @@ public class ErpFinanceReceiptRespVO { | @@ -96,4 +96,4 @@ public class ErpFinanceReceiptRespVO { | ||
| 96 | 96 | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | -} | ||
| 100 | \ No newline at end of file | 99 | \ No newline at end of file |
| 100 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/product/vo/category/ErpProductCategoryRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.product.vo.category; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.product.vo.category; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -44,4 +44,4 @@ public class ErpProductCategoryRespVO { | @@ -44,4 +44,4 @@ public class ErpProductCategoryRespVO { | ||
| 44 | @ExcelProperty("创建时间") | 44 | @ExcelProperty("创建时间") |
| 45 | private LocalDateTime createTime; | 45 | private LocalDateTime createTime; |
| 46 | 46 | ||
| 47 | -} | ||
| 48 | \ No newline at end of file | 47 | \ No newline at end of file |
| 48 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/product/vo/product/ErpProductRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| @@ -73,4 +73,4 @@ public class ErpProductRespVO { | @@ -73,4 +73,4 @@ public class ErpProductRespVO { | ||
| 73 | @ExcelProperty("创建时间") | 73 | @ExcelProperty("创建时间") |
| 74 | private LocalDateTime createTime; | 74 | private LocalDateTime createTime; |
| 75 | 75 | ||
| 76 | -} | ||
| 77 | \ No newline at end of file | 76 | \ No newline at end of file |
| 77 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/product/vo/unit/ErpProductUnitRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 4 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -31,4 +31,4 @@ public class ErpProductUnitRespVO { | @@ -31,4 +31,4 @@ public class ErpProductUnitRespVO { | ||
| 31 | @ExcelProperty("创建时间") | 31 | @ExcelProperty("创建时间") |
| 32 | private LocalDateTime createTime; | 32 | private LocalDateTime createTime; |
| 33 | 33 | ||
| 34 | -} | ||
| 35 | \ No newline at end of file | 34 | \ No newline at end of file |
| 35 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -142,4 +142,4 @@ public class ErpPurchaseInRespVO { | @@ -142,4 +142,4 @@ public class ErpPurchaseInRespVO { | ||
| 142 | 142 | ||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | -} | ||
| 146 | \ No newline at end of file | 145 | \ No newline at end of file |
| 146 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -149,4 +149,4 @@ public class ErpPurchaseOrderRespVO { | @@ -149,4 +149,4 @@ public class ErpPurchaseOrderRespVO { | ||
| 149 | 149 | ||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | -} | ||
| 153 | \ No newline at end of file | 152 | \ No newline at end of file |
| 153 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -142,4 +142,4 @@ public class ErpPurchaseReturnRespVO { | @@ -142,4 +142,4 @@ public class ErpPurchaseReturnRespVO { | ||
| 142 | 142 | ||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | -} | ||
| 146 | \ No newline at end of file | 145 | \ No newline at end of file |
| 146 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/supplier/ErpSupplierRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -81,4 +81,4 @@ public class ErpSupplierRespVO { | @@ -81,4 +81,4 @@ public class ErpSupplierRespVO { | ||
| 81 | @ExcelProperty("创建时间") | 81 | @ExcelProperty("创建时间") |
| 82 | private LocalDateTime createTime; | 82 | private LocalDateTime createTime; |
| 83 | 83 | ||
| 84 | -} | ||
| 85 | \ No newline at end of file | 84 | \ No newline at end of file |
| 85 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/customer/ErpCustomerRespVO.java
| @@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer; | @@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer; | ||
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.*; | 4 | import lombok.*; |
| 5 | -import java.util.*; | ||
| 6 | -import java.util.*; | ||
| 7 | import java.math.BigDecimal; | 5 | import java.math.BigDecimal; |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 10 | -import com.alibaba.excel.annotation.*; | 7 | +import cn.idev.excel.annotation.*; |
| 11 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 8 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 12 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 9 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 13 | 10 | ||
| @@ -81,4 +78,4 @@ public class ErpCustomerRespVO { | @@ -81,4 +78,4 @@ public class ErpCustomerRespVO { | ||
| 81 | @ExcelProperty("创建时间") | 78 | @ExcelProperty("创建时间") |
| 82 | private LocalDateTime createTime; | 79 | private LocalDateTime createTime; |
| 83 | 80 | ||
| 84 | -} | ||
| 85 | \ No newline at end of file | 81 | \ No newline at end of file |
| 82 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/order/ErpSaleOrderRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -152,4 +152,4 @@ public class ErpSaleOrderRespVO { | @@ -152,4 +152,4 @@ public class ErpSaleOrderRespVO { | ||
| 152 | 152 | ||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | -} | ||
| 156 | \ No newline at end of file | 155 | \ No newline at end of file |
| 156 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -145,4 +145,4 @@ public class ErpSaleOutRespVO { | @@ -145,4 +145,4 @@ public class ErpSaleOutRespVO { | ||
| 145 | 145 | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | -} | ||
| 149 | \ No newline at end of file | 148 | \ No newline at end of file |
| 149 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -145,4 +145,4 @@ public class ErpSaleReturnRespVO { | @@ -145,4 +145,4 @@ public class ErpSaleReturnRespVO { | ||
| 145 | 145 | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | -} | ||
| 149 | \ No newline at end of file | 148 | \ No newline at end of file |
| 149 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/check/ErpStockCheckRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import jakarta.validation.constraints.NotNull; | 8 | import jakarta.validation.constraints.NotNull; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| @@ -108,4 +108,4 @@ public class ErpStockCheckRespVO { | @@ -108,4 +108,4 @@ public class ErpStockCheckRespVO { | ||
| 108 | 108 | ||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | -} | ||
| 112 | \ No newline at end of file | 111 | \ No newline at end of file |
| 112 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/in/ErpStockInRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -107,4 +107,4 @@ public class ErpStockInRespVO { | @@ -107,4 +107,4 @@ public class ErpStockInRespVO { | ||
| 107 | 107 | ||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | -} | ||
| 111 | \ No newline at end of file | 110 | \ No newline at end of file |
| 111 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/move/ErpStockMoveRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -104,4 +104,4 @@ public class ErpStockMoveRespVO { | @@ -104,4 +104,4 @@ public class ErpStockMoveRespVO { | ||
| 104 | 104 | ||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | -} | ||
| 108 | \ No newline at end of file | 107 | \ No newline at end of file |
| 108 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/out/ErpStockOutRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -107,4 +107,4 @@ public class ErpStockOutRespVO { | @@ -107,4 +107,4 @@ public class ErpStockOutRespVO { | ||
| 107 | 107 | ||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | -} | ||
| 111 | \ No newline at end of file | 110 | \ No newline at end of file |
| 111 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/record/ErpStockRecordRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.erp.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.erp.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -84,4 +84,4 @@ public class ErpStockRecordRespVO { | @@ -84,4 +84,4 @@ public class ErpStockRecordRespVO { | ||
| 84 | @ExcelProperty("创建人") | 84 | @ExcelProperty("创建人") |
| 85 | private String creatorName; | 85 | private String creatorName; |
| 86 | 86 | ||
| 87 | -} | ||
| 88 | \ No newline at end of file | 87 | \ No newline at end of file |
| 88 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/stock/ErpStockRespVO.java
| 1 | package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock; | 1 | package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| @@ -46,4 +46,4 @@ public class ErpStockRespVO { | @@ -46,4 +46,4 @@ public class ErpStockRespVO { | ||
| 46 | @ExcelProperty("仓库名称") | 46 | @ExcelProperty("仓库名称") |
| 47 | private String warehouseName; | 47 | private String warehouseName; |
| 48 | 48 | ||
| 49 | -} | ||
| 50 | \ No newline at end of file | 49 | \ No newline at end of file |
| 50 | +} |
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/warehouse/ErpWarehouseRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -61,4 +61,4 @@ public class ErpWarehouseRespVO { | @@ -61,4 +61,4 @@ public class ErpWarehouseRespVO { | ||
| 61 | @ExcelProperty("创建时间") | 61 | @ExcelProperty("创建时间") |
| 62 | private LocalDateTime createTime; | 62 | private LocalDateTime createTime; |
| 63 | 63 | ||
| 64 | -} | ||
| 65 | \ No newline at end of file | 64 | \ No newline at end of file |
| 65 | +} |
yudao-module-infra/pom.xml
| @@ -92,6 +92,7 @@ | @@ -92,6 +92,7 @@ | ||
| 92 | <dependency> | 92 | <dependency> |
| 93 | <groupId>de.codecentric</groupId> | 93 | <groupId>de.codecentric</groupId> |
| 94 | <artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 --> | 94 | <artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 --> |
| 95 | + <optional>true</optional> | ||
| 95 | </dependency> | 96 | </dependency> |
| 96 | 97 | ||
| 97 | <!-- 三方云服务相关 --> | 98 | <!-- 三方云服务相关 --> |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApiImpl.java
| 1 | package cn.iocoder.yudao.module.infra.api.websocket; | 1 | package cn.iocoder.yudao.module.infra.api.websocket; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; | 3 | import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; |
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 5 | 6 | ||
| 6 | -import jakarta.annotation.Resource; | ||
| 7 | - | ||
| 8 | /** | 7 | /** |
| 9 | * WebSocket 发送器的 API 实现类 | 8 | * WebSocket 发送器的 API 实现类 |
| 10 | * | 9 | * |
| @@ -13,7 +12,8 @@ import jakarta.annotation.Resource; | @@ -13,7 +12,8 @@ import jakarta.annotation.Resource; | ||
| 13 | @Component | 12 | @Component |
| 14 | public class WebSocketSenderApiImpl implements WebSocketSenderApi { | 13 | public class WebSocketSenderApiImpl implements WebSocketSenderApi { |
| 15 | 14 | ||
| 16 | - @Resource | 15 | + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") |
| 16 | + @Autowired(required = false) // 由于 yudao.websocket.enable 配置项,可以关闭 WebSocket 的功能,所以这里只能不强制注入 | ||
| 17 | private WebSocketMessageSender webSocketMessageSender; | 17 | private WebSocketMessageSender webSocketMessageSender; |
| 18 | 18 | ||
| 19 | @Override | 19 | @Override |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.config.vo; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.config.vo; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -43,4 +43,4 @@ public class Demo01ContactRespVO { | @@ -43,4 +43,4 @@ public class Demo01ContactRespVO { | ||
| 43 | @ExcelProperty("创建时间") | 43 | @ExcelProperty("创建时间") |
| 44 | private LocalDateTime createTime; | 44 | private LocalDateTime createTime; |
| 45 | 45 | ||
| 46 | -} | ||
| 47 | \ No newline at end of file | 46 | \ No newline at end of file |
| 47 | +} |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/vo/Demo02CategoryRespVO.java
| 1 | package cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo; | 1 | package cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| @@ -28,4 +28,4 @@ public class Demo02CategoryRespVO { | @@ -28,4 +28,4 @@ public class Demo02CategoryRespVO { | ||
| 28 | @ExcelProperty("创建时间") | 28 | @ExcelProperty("创建时间") |
| 29 | private LocalDateTime createTime; | 29 | private LocalDateTime createTime; |
| 30 | 30 | ||
| 31 | -} | ||
| 32 | \ No newline at end of file | 31 | \ No newline at end of file |
| 32 | +} |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -39,4 +39,4 @@ public class Demo03StudentErpRespVO { | @@ -39,4 +39,4 @@ public class Demo03StudentErpRespVO { | ||
| 39 | @ExcelProperty("创建时间") | 39 | @ExcelProperty("创建时间") |
| 40 | private LocalDateTime createTime; | 40 | private LocalDateTime createTime; |
| 41 | 41 | ||
| 42 | -} | ||
| 43 | \ No newline at end of file | 42 | \ No newline at end of file |
| 43 | +} |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -39,4 +39,4 @@ public class Demo03StudentInnerRespVO { | @@ -39,4 +39,4 @@ public class Demo03StudentInnerRespVO { | ||
| 39 | @ExcelProperty("创建时间") | 39 | @ExcelProperty("创建时间") |
| 40 | private LocalDateTime createTime; | 40 | private LocalDateTime createTime; |
| 41 | 41 | ||
| 42 | -} | ||
| 43 | \ No newline at end of file | 42 | \ No newline at end of file |
| 43 | +} |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -39,4 +39,4 @@ public class Demo03StudentNormalRespVO { | @@ -39,4 +39,4 @@ public class Demo03StudentNormalRespVO { | ||
| 39 | @ExcelProperty("创建时间") | 39 | @ExcelProperty("创建时间") |
| 40 | private LocalDateTime createTime; | 40 | private LocalDateTime createTime; |
| 41 | 41 | ||
| 42 | -} | ||
| 43 | \ No newline at end of file | 42 | \ No newline at end of file |
| 43 | +} |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
| @@ -43,7 +43,7 @@ public class FileController { | @@ -43,7 +43,7 @@ public class FileController { | ||
| 43 | 43 | ||
| 44 | @PostMapping("/upload") | 44 | @PostMapping("/upload") |
| 45 | @Operation(summary = "上传文件", description = "模式一:后端上传文件") | 45 | @Operation(summary = "上传文件", description = "模式一:后端上传文件") |
| 46 | - public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception { | 46 | + public CommonResult<String> uploadFile(@Valid FileUploadReqVO uploadReqVO) throws Exception { |
| 47 | MultipartFile file = uploadReqVO.getFile(); | 47 | MultipartFile file = uploadReqVO.getFile(); |
| 48 | byte[] content = IoUtil.readBytes(file.getInputStream()); | 48 | byte[] content = IoUtil.readBytes(file.getInputStream()); |
| 49 | return success(fileService.createFile(content, file.getOriginalFilename(), | 49 | return success(fileService.createFile(content, file.getOriginalFilename(), |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import jakarta.validation.constraints.NotNull; | 9 | import jakarta.validation.constraints.NotNull; |
| 10 | import lombok.Data; | 10 | import lombok.Data; |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
| @@ -139,85 +139,85 @@ public class CodegenEngine { | @@ -139,85 +139,85 @@ public class CodegenEngine { | ||
| 139 | vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 139 | vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 140 | // VUE3_VBEN2_ANTD_SCHEMA | 140 | // VUE3_VBEN2_ANTD_SCHEMA |
| 141 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/data.ts"), | 141 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/data.ts"), |
| 142 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/${classNameVar}.data.ts")) | 142 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/${classNameVar}.data.ts")) |
| 143 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/index.vue"), | 143 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/index.vue"), |
| 144 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) | 144 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) |
| 145 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/form.vue"), | 145 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("views/form.vue"), |
| 146 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/${simpleClassName}Modal.vue")) | 146 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/${simpleClassName}Modal.vue")) |
| 147 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("api/api.ts"), | 147 | .put(CodegenFrontTypeEnum.VUE3_VBEN2_ANTD_SCHEMA.getType(), vue3VbenTemplatePath("api/api.ts"), |
| 148 | - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 148 | + vue3VbenFilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 149 | // VUE3_VBEN5_ANTD_SCHEMA | 149 | // VUE3_VBEN5_ANTD_SCHEMA |
| 150 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/data.ts"), | 150 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/data.ts"), |
| 151 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/data.ts")) | 151 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/data.ts")) |
| 152 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/index.vue"), | 152 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/index.vue"), |
| 153 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) | 153 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) |
| 154 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/form.vue"), | 154 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/form.vue"), |
| 155 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) | 155 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) |
| 156 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("api/api.ts"), | 156 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("api/api.ts"), |
| 157 | - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 157 | + vue3VbenFilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 158 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 | 158 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 |
| 159 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 159 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 160 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 | 160 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 161 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 161 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 162 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 | 162 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 163 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 163 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 164 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 | 164 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 165 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 165 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 166 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 | 166 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_SCHEMA.getType(), vue3Vben5AntdSchemaTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 167 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 167 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 168 | // VUE3_VBEN5_ANTD | 168 | // VUE3_VBEN5_ANTD |
| 169 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/index.vue"), | 169 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/index.vue"), |
| 170 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) | 170 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) |
| 171 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/form.vue"), | 171 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/form.vue"), |
| 172 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) | 172 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) |
| 173 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("api/api.ts"), | 173 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("api/api.ts"), |
| 174 | - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 174 | + vue3VbenFilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 175 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 | 175 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 |
| 176 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 176 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 177 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 | 177 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 178 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 178 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 179 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 | 179 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 180 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 180 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 181 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 | 181 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 182 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 182 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 183 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 | 183 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 184 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 184 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 185 | // VUE3_VBEN5_EP_SCHEMA | 185 | // VUE3_VBEN5_EP_SCHEMA |
| 186 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/data.ts"), | 186 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/data.ts"), |
| 187 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/data.ts")) | 187 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/data.ts")) |
| 188 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/index.vue"), | 188 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/index.vue"), |
| 189 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) | 189 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) |
| 190 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/form.vue"), | 190 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/form.vue"), |
| 191 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) | 191 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) |
| 192 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("api/api.ts"), | 192 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("api/api.ts"), |
| 193 | - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 193 | + vue3VbenFilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 194 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 | 194 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 |
| 195 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 195 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 196 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 | 196 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 197 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 197 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 198 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 | 198 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 199 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 199 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 200 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 | 200 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 201 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 201 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 202 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 | 202 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 203 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 203 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 204 | // VUE3_VBEN5_EP | 204 | // VUE3_VBEN5_EP |
| 205 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/index.vue"), | 205 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/index.vue"), |
| 206 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) | 206 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) |
| 207 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/form.vue"), | 207 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/form.vue"), |
| 208 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) | 208 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue")) |
| 209 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("api/api.ts"), | 209 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("api/api.ts"), |
| 210 | - vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) | 210 | + vue3VbenFilePath("api/${table.moduleName}/${table.businessName}/index.ts")) |
| 211 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 | 211 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑 |
| 212 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 212 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 213 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 | 213 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 214 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 214 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 215 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 | 215 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 216 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) | 216 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue")) |
| 217 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 | 217 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑 |
| 218 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 218 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 219 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 | 219 | .put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑 |
| 220 | - vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) | 220 | + vue3VbenFilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue")) |
| 221 | .build(); | 221 | .build(); |
| 222 | 222 | ||
| 223 | @Resource | 223 | @Resource |
| @@ -614,6 +614,11 @@ public class CodegenEngine { | @@ -614,6 +614,11 @@ public class CodegenEngine { | ||
| 614 | "src/" + path; | 614 | "src/" + path; |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | + private static String vue3VbenFilePath(String path) { | ||
| 618 | + return "yudao-ui-${sceneEnum.basePackage}-vben/" + // 顶级目录 | ||
| 619 | + "src/" + path; | ||
| 620 | + } | ||
| 621 | + | ||
| 617 | private static String vue3VbenTemplatePath(String path) { | 622 | private static String vue3VbenTemplatePath(String path) { |
| 618 | return "codegen/vue3_vben/" + path + ".vm"; | 623 | return "codegen/vue3_vben/" + path + ".vm"; |
| 619 | } | 624 | } |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
| @@ -40,11 +40,16 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { | @@ -40,11 +40,16 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { | ||
| 40 | ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) | 40 | ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) |
| 41 | .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); | 41 | .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); |
| 42 | apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); | 42 | apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); |
| 43 | - if (TenantContextHolder.getTenantId() != null) { | ||
| 44 | - apiErrorLogMapper.insert(apiErrorLog); | ||
| 45 | - } else { | ||
| 46 | - // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败! | ||
| 47 | - TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog)); | 43 | + try { |
| 44 | + if (TenantContextHolder.getTenantId() != null) { | ||
| 45 | + apiErrorLogMapper.insert(apiErrorLog); | ||
| 46 | + } else { | ||
| 47 | + // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败! | ||
| 48 | + TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog)); | ||
| 49 | + } | ||
| 50 | + } catch (Exception ex) { | ||
| 51 | + // 兜底处理,目前只有 yudao-cloud 会发生:https://gitee.com/yudaocode/yudao-cloud-mini/issues/IC1O0A | ||
| 52 | + log.error("[createApiErrorLog][记录时({}) 发生异常]", createDTO, ex); | ||
| 48 | } | 53 | } |
| 49 | } | 54 | } |
| 50 | 55 |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/websocket/DemoWebSocketMessageListener.java
| @@ -6,11 +6,10 @@ import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; | @@ -6,11 +6,10 @@ import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; | ||
| 6 | import cn.iocoder.yudao.framework.websocket.core.util.WebSocketFrameworkUtils; | 6 | import cn.iocoder.yudao.framework.websocket.core.util.WebSocketFrameworkUtils; |
| 7 | import cn.iocoder.yudao.module.infra.websocket.message.DemoReceiveMessage; | 7 | import cn.iocoder.yudao.module.infra.websocket.message.DemoReceiveMessage; |
| 8 | import cn.iocoder.yudao.module.infra.websocket.message.DemoSendMessage; | 8 | import cn.iocoder.yudao.module.infra.websocket.message.DemoSendMessage; |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 10 | import org.springframework.web.socket.WebSocketSession; | 11 | import org.springframework.web.socket.WebSocketSession; |
| 11 | 12 | ||
| 12 | -import jakarta.annotation.Resource; | ||
| 13 | - | ||
| 14 | /** | 13 | /** |
| 15 | * WebSocket 示例:单发消息 | 14 | * WebSocket 示例:单发消息 |
| 16 | * | 15 | * |
| @@ -19,7 +18,8 @@ import jakarta.annotation.Resource; | @@ -19,7 +18,8 @@ import jakarta.annotation.Resource; | ||
| 19 | @Component | 18 | @Component |
| 20 | public class DemoWebSocketMessageListener implements WebSocketMessageListener<DemoSendMessage> { | 19 | public class DemoWebSocketMessageListener implements WebSocketMessageListener<DemoSendMessage> { |
| 21 | 20 | ||
| 22 | - @Resource | 21 | + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") |
| 22 | + @Autowired(required = false) // 由于 yudao.websocket.enable 配置项,可以关闭 WebSocket 的功能,所以这里只能不强制注入 | ||
| 23 | private WebSocketMessageSender webSocketMessageSender; | 23 | private WebSocketMessageSender webSocketMessageSender; |
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
yudao-module-infra/src/main/resources/codegen/java/controller/vo/respVO.vm
| @@ -19,7 +19,7 @@ import java.time.LocalDateTime; | @@ -19,7 +19,7 @@ import java.time.LocalDateTime; | ||
| 19 | #end | 19 | #end |
| 20 | #end | 20 | #end |
| 21 | ## 处理 Excel 导出 | 21 | ## 处理 Excel 导出 |
| 22 | -import com.alibaba.excel.annotation.*; | 22 | +import cn.idev.excel.annotation.*; |
| 23 | #foreach ($column in $columns) | 23 | #foreach ($column in $columns) |
| 24 | #if ("$!column.dictType" != "")## 有设置数据字典 | 24 | #if ("$!column.dictType" != "")## 有设置数据字典 |
| 25 | import ${DictFormatClassName}; | 25 | import ${DictFormatClassName}; |
| @@ -50,4 +50,4 @@ public class ${sceneEnum.prefixClass}${table.className}RespVO { | @@ -50,4 +50,4 @@ public class ${sceneEnum.prefixClass}${table.className}RespVO { | ||
| 50 | 50 | ||
| 51 | #end | 51 | #end |
| 52 | #end | 52 | #end |
| 53 | -} | ||
| 54 | \ No newline at end of file | 53 | \ No newline at end of file |
| 54 | +} |
yudao-module-infra/src/main/resources/codegen/java/dal/do.vm
| @@ -15,7 +15,7 @@ import ${BaseDOClassName}; | @@ -15,7 +15,7 @@ import ${BaseDOClassName}; | ||
| 15 | ## 处理 Excel 导出 + Schema 注解(仅 DO 模式) | 15 | ## 处理 Excel 导出 + Schema 注解(仅 DO 模式) |
| 16 | #if ($voType == 20) | 16 | #if ($voType == 20) |
| 17 | import io.swagger.v3.oas.annotations.media.Schema; | 17 | import io.swagger.v3.oas.annotations.media.Schema; |
| 18 | -import com.alibaba.excel.annotation.*; | 18 | +import cn.idev.excel.annotation.*; |
| 19 | #foreach ($column in $columns) | 19 | #foreach ($column in $columns) |
| 20 | #if ("$!column.dictType" != "")## 有设置数据字典 | 20 | #if ("$!column.dictType" != "")## 有设置数据字典 |
| 21 | import ${DictFormatClassName}; | 21 | import ${DictFormatClassName}; |
| @@ -100,4 +100,4 @@ public class ${table.className}DO extends BaseDO { | @@ -100,4 +100,4 @@ public class ${table.className}DO extends BaseDO { | ||
| 100 | #end | 100 | #end |
| 101 | #end | 101 | #end |
| 102 | 102 | ||
| 103 | -} | ||
| 104 | \ No newline at end of file | 103 | \ No newline at end of file |
| 104 | +} |
yudao-module-infra/src/main/resources/codegen/java/test/serviceTest.vm
| @@ -2,7 +2,6 @@ package ${basePackage}.module.${table.moduleName}.service.${table.businessName}; | @@ -2,7 +2,6 @@ package ${basePackage}.module.${table.moduleName}.service.${table.businessName}; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import ${jakartaPackage}.annotation.Resource; | 6 | import ${jakartaPackage}.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm
| @@ -138,6 +138,7 @@ watch( | @@ -138,6 +138,7 @@ watch( | ||
| 138 | () => props.${subJoinColumn.javaField}, | 138 | () => props.${subJoinColumn.javaField}, |
| 139 | (val: number) => { | 139 | (val: number) => { |
| 140 | if (!val) { | 140 | if (!val) { |
| 141 | + list.value = [] // 清空列表 | ||
| 141 | return | 142 | return |
| 142 | } | 143 | } |
| 143 | queryParams.${subJoinColumn.javaField} = val | 144 | queryParams.${subJoinColumn.javaField} = val |
yudao-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm
| @@ -353,6 +353,7 @@ const handleDelete = async (id: number) => { | @@ -353,6 +353,7 @@ const handleDelete = async (id: number) => { | ||
| 353 | // 发起删除 | 353 | // 发起删除 |
| 354 | await ${simpleClassName}Api.delete${simpleClassName}(id) | 354 | await ${simpleClassName}Api.delete${simpleClassName}(id) |
| 355 | message.success(t('common.delSuccess')) | 355 | message.success(t('common.delSuccess')) |
| 356 | + currentRow.value = {} | ||
| 356 | // 刷新列表 | 357 | // 刷新列表 |
| 357 | await getList() | 358 | await getList() |
| 358 | } catch {} | 359 | } catch {} |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImplTest.java
| @@ -24,8 +24,8 @@ import com.baomidou.mybatisplus.generator.config.po.TableField; | @@ -24,8 +24,8 @@ import com.baomidou.mybatisplus.generator.config.po.TableField; | ||
| 24 | import com.baomidou.mybatisplus.generator.config.po.TableInfo; | 24 | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| 25 | import jakarta.annotation.Resource; | 25 | import jakarta.annotation.Resource; |
| 26 | import org.junit.jupiter.api.Test; | 26 | import org.junit.jupiter.api.Test; |
| 27 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 28 | import org.springframework.context.annotation.Import; | 27 | import org.springframework.context.annotation.Import; |
| 28 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 29 | 29 | ||
| 30 | import java.util.Arrays; | 30 | import java.util.Arrays; |
| 31 | import java.util.Collections; | 31 | import java.util.Collections; |
| @@ -60,15 +60,15 @@ public class CodegenServiceImplTest extends BaseDbUnitTest { | @@ -60,15 +60,15 @@ public class CodegenServiceImplTest extends BaseDbUnitTest { | ||
| 60 | @Resource | 60 | @Resource |
| 61 | private CodegenColumnMapper codegenColumnMapper; | 61 | private CodegenColumnMapper codegenColumnMapper; |
| 62 | 62 | ||
| 63 | - @MockBean | 63 | + @MockitoBean |
| 64 | private DatabaseTableService databaseTableService; | 64 | private DatabaseTableService databaseTableService; |
| 65 | 65 | ||
| 66 | - @MockBean | 66 | + @MockitoBean |
| 67 | private CodegenBuilder codegenBuilder; | 67 | private CodegenBuilder codegenBuilder; |
| 68 | - @MockBean | 68 | + @MockitoBean |
| 69 | private CodegenEngine codegenEngine; | 69 | private CodegenEngine codegenEngine; |
| 70 | 70 | ||
| 71 | - @MockBean | 71 | + @MockitoBean |
| 72 | private CodegenProperties codegenProperties; | 72 | private CodegenProperties codegenProperties; |
| 73 | 73 | ||
| 74 | @Test | 74 | @Test |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImplTest.java
| @@ -11,14 +11,14 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; | @@ -11,14 +11,14 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; | ||
| 11 | import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper; | 11 | import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper; |
| 12 | import com.baomidou.dynamic.datasource.creator.DataSourceProperty; | 12 | import com.baomidou.dynamic.datasource.creator.DataSourceProperty; |
| 13 | import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; | 13 | import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; |
| 14 | +import jakarta.annotation.Resource; | ||
| 14 | import org.junit.jupiter.api.BeforeEach; | 15 | import org.junit.jupiter.api.BeforeEach; |
| 15 | import org.junit.jupiter.api.Test; | 16 | import org.junit.jupiter.api.Test; |
| 16 | import org.mockito.MockedStatic; | 17 | import org.mockito.MockedStatic; |
| 17 | import org.mockito.stubbing.Answer; | 18 | import org.mockito.stubbing.Answer; |
| 18 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 19 | import org.springframework.context.annotation.Import; | 19 | import org.springframework.context.annotation.Import; |
| 20 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 20 | 21 | ||
| 21 | -import jakarta.annotation.Resource; | ||
| 22 | import java.util.List; | 22 | import java.util.List; |
| 23 | 23 | ||
| 24 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 24 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| @@ -46,10 +46,10 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { | @@ -46,10 +46,10 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { | ||
| 46 | @Resource | 46 | @Resource |
| 47 | private DataSourceConfigMapper dataSourceConfigMapper; | 47 | private DataSourceConfigMapper dataSourceConfigMapper; |
| 48 | 48 | ||
| 49 | - @MockBean | 49 | + @MockitoBean |
| 50 | private AES aes; | 50 | private AES aes; |
| 51 | 51 | ||
| 52 | - @MockBean | 52 | + @MockitoBean |
| 53 | private DynamicDataSourceProperties dynamicDataSourceProperties; | 53 | private DynamicDataSourceProperties dynamicDataSourceProperties; |
| 54 | 54 | ||
| 55 | @BeforeEach | 55 | @BeforeEach |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImplTest.java
| @@ -5,12 +5,12 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; | @@ -5,12 +5,12 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; | ||
| 5 | import com.baomidou.mybatisplus.generator.config.po.TableField; | 5 | import com.baomidou.mybatisplus.generator.config.po.TableField; |
| 6 | import com.baomidou.mybatisplus.generator.config.po.TableInfo; | 6 | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| 7 | import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; | 7 | import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; |
| 8 | +import jakarta.annotation.Resource; | ||
| 8 | import org.apache.ibatis.type.JdbcType; | 9 | import org.apache.ibatis.type.JdbcType; |
| 9 | import org.junit.jupiter.api.Test; | 10 | import org.junit.jupiter.api.Test; |
| 10 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 11 | import org.springframework.context.annotation.Import; | 11 | import org.springframework.context.annotation.Import; |
| 12 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 12 | 13 | ||
| 13 | -import jakarta.annotation.Resource; | ||
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | 15 | ||
| 16 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | 16 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; |
| @@ -24,7 +24,7 @@ public class DatabaseTableServiceImplTest extends BaseDbUnitTest { | @@ -24,7 +24,7 @@ public class DatabaseTableServiceImplTest extends BaseDbUnitTest { | ||
| 24 | @Resource | 24 | @Resource |
| 25 | private DatabaseTableServiceImpl databaseTableService; | 25 | private DatabaseTableServiceImpl databaseTableService; |
| 26 | 26 | ||
| 27 | - @MockBean | 27 | + @MockitoBean |
| 28 | private DataSourceConfigService dataSourceConfigService; | 28 | private DataSourceConfigService dataSourceConfigService; |
| 29 | 29 | ||
| 30 | @Test | 30 | @Test |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java
| @@ -4,24 +4,24 @@ import cn.hutool.core.date.DatePattern; | @@ -4,24 +4,24 @@ import cn.hutool.core.date.DatePattern; | ||
| 4 | import cn.hutool.core.date.LocalDateTimeUtil; | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 5 | import cn.hutool.core.map.MapUtil; | 5 | import cn.hutool.core.map.MapUtil; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper; | ||
| 7 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient; | 12 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient; |
| 8 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig; | 13 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig; |
| 9 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientFactory; | 14 | import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientFactory; |
| 10 | import cn.iocoder.yudao.module.infra.framework.file.core.client.local.LocalFileClient; | 15 | import cn.iocoder.yudao.module.infra.framework.file.core.client.local.LocalFileClient; |
| 11 | import cn.iocoder.yudao.module.infra.framework.file.core.client.local.LocalFileClientConfig; | 16 | import cn.iocoder.yudao.module.infra.framework.file.core.client.local.LocalFileClientConfig; |
| 12 | import cn.iocoder.yudao.module.infra.framework.file.core.enums.FileStorageEnum; | 17 | import cn.iocoder.yudao.module.infra.framework.file.core.enums.FileStorageEnum; |
| 13 | -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 14 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; | ||
| 15 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO; | ||
| 16 | -import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; | ||
| 17 | -import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper; | 18 | +import jakarta.annotation.Resource; |
| 19 | +import jakarta.validation.Validator; | ||
| 18 | import lombok.Data; | 20 | import lombok.Data; |
| 19 | import org.junit.jupiter.api.Test; | 21 | import org.junit.jupiter.api.Test; |
| 20 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 21 | import org.springframework.context.annotation.Import; | 22 | import org.springframework.context.annotation.Import; |
| 23 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 22 | 24 | ||
| 23 | -import jakarta.annotation.Resource; | ||
| 24 | -import jakarta.validation.Validator; | ||
| 25 | import java.io.Serializable; | 25 | import java.io.Serializable; |
| 26 | import java.time.LocalDateTime; | 26 | import java.time.LocalDateTime; |
| 27 | import java.util.Map; | 27 | import java.util.Map; |
| @@ -53,9 +53,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { | @@ -53,9 +53,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { | ||
| 53 | @Resource | 53 | @Resource |
| 54 | private FileConfigMapper fileConfigMapper; | 54 | private FileConfigMapper fileConfigMapper; |
| 55 | 55 | ||
| 56 | - @MockBean | 56 | + @MockitoBean |
| 57 | private Validator validator; | 57 | private Validator validator; |
| 58 | - @MockBean | 58 | + @MockitoBean |
| 59 | private FileClientFactory fileClientFactory; | 59 | private FileClientFactory fileClientFactory; |
| 60 | 60 | ||
| 61 | @Test | 61 | @Test |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImplTest.java
| @@ -12,8 +12,8 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient; | @@ -12,8 +12,8 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient; | ||
| 12 | import jakarta.annotation.Resource; | 12 | import jakarta.annotation.Resource; |
| 13 | import org.junit.jupiter.api.BeforeEach; | 13 | import org.junit.jupiter.api.BeforeEach; |
| 14 | import org.junit.jupiter.api.Test; | 14 | import org.junit.jupiter.api.Test; |
| 15 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 16 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 16 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 17 | ||
| 18 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 19 | import java.util.concurrent.atomic.AtomicReference; | 19 | import java.util.concurrent.atomic.AtomicReference; |
| @@ -35,7 +35,7 @@ public class FileServiceImplTest extends BaseDbUnitTest { | @@ -35,7 +35,7 @@ public class FileServiceImplTest extends BaseDbUnitTest { | ||
| 35 | @Resource | 35 | @Resource |
| 36 | private FileMapper fileMapper; | 36 | private FileMapper fileMapper; |
| 37 | 37 | ||
| 38 | - @MockBean | 38 | + @MockitoBean |
| 39 | private FileConfigService fileConfigService; | 39 | private FileConfigService fileConfigService; |
| 40 | 40 | ||
| 41 | @BeforeEach | 41 | @BeforeEach |
yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImplTest.java
| @@ -10,13 +10,12 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | @@ -10,13 +10,12 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 10 | import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; | 10 | import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; |
| 11 | import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; | 11 | import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; |
| 12 | import cn.iocoder.yudao.module.infra.job.job.JobLogCleanJob; | 12 | import cn.iocoder.yudao.module.infra.job.job.JobLogCleanJob; |
| 13 | +import jakarta.annotation.Resource; | ||
| 13 | import org.junit.jupiter.api.Test; | 14 | import org.junit.jupiter.api.Test; |
| 14 | import org.mockito.MockedStatic; | 15 | import org.mockito.MockedStatic; |
| 15 | import org.quartz.SchedulerException; | 16 | import org.quartz.SchedulerException; |
| 16 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 17 | import org.springframework.context.annotation.Import; | 17 | import org.springframework.context.annotation.Import; |
| 18 | - | ||
| 19 | -import jakarta.annotation.Resource; | 18 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; |
| 20 | 19 | ||
| 21 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 20 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| 22 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 21 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| @@ -36,10 +35,10 @@ public class JobServiceImplTest extends BaseDbUnitTest { | @@ -36,10 +35,10 @@ public class JobServiceImplTest extends BaseDbUnitTest { | ||
| 36 | private JobServiceImpl jobService; | 35 | private JobServiceImpl jobService; |
| 37 | @Resource | 36 | @Resource |
| 38 | private JobMapper jobMapper; | 37 | private JobMapper jobMapper; |
| 39 | - @MockBean | 38 | + @MockitoBean |
| 40 | private SchedulerManager schedulerManager; | 39 | private SchedulerManager schedulerManager; |
| 41 | 40 | ||
| 42 | - @MockBean | 41 | + @MockitoBean |
| 43 | private JobLogCleanJob jobLogCleanJob; | 42 | private JobLogCleanJob jobLogCleanJob; |
| 44 | 43 | ||
| 45 | @Test | 44 | @Test |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_inner/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_inner/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_normal/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_normal/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_one/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_one/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_tree/java/InfraCategoryRespVO
| @@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | @@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | import lombok.*; | 4 | import lombok.*; |
| 5 | import java.util.*; | 5 | import java.util.*; |
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | -import com.alibaba.excel.annotation.*; | 7 | +import cn.idev.excel.annotation.*; |
| 8 | 8 | ||
| 9 | @Schema(description = "管理后台 - 分类 Response VO") | 9 | @Schema(description = "管理后台 - 分类 Response VO") |
| 10 | @Data | 10 | @Data |
| @@ -23,4 +23,4 @@ public class InfraCategoryRespVO { | @@ -23,4 +23,4 @@ public class InfraCategoryRespVO { | ||
| 23 | @ExcelProperty("父编号") | 23 | @ExcelProperty("父编号") |
| 24 | private Long parentId; | 24 | private Long parentId; |
| 25 | 25 | ||
| 26 | -} | ||
| 27 | \ No newline at end of file | 26 | \ No newline at end of file |
| 27 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue2_tree/java/InfraCategoryServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_erp/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_erp/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_inner/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_inner/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_normal/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_master_normal/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_one/java/InfraStudentRespVO
| @@ -6,7 +6,7 @@ import java.util.*; | @@ -6,7 +6,7 @@ import java.util.*; | ||
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | 9 | +import cn.idev.excel.annotation.*; |
| 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 10 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 11 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 12 | 12 | ||
| @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | @@ -57,4 +57,4 @@ public class InfraStudentRespVO { | ||
| 57 | @ExcelProperty("创建时间") | 57 | @ExcelProperty("创建时间") |
| 58 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 59 | 59 | ||
| 60 | -} | ||
| 61 | \ No newline at end of file | 60 | \ No newline at end of file |
| 61 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_one/java/InfraStudentServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_tree/java/InfraCategoryRespVO
| @@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | @@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | import lombok.*; | 4 | import lombok.*; |
| 5 | import java.util.*; | 5 | import java.util.*; |
| 6 | import java.util.*; | 6 | import java.util.*; |
| 7 | -import com.alibaba.excel.annotation.*; | 7 | +import cn.idev.excel.annotation.*; |
| 8 | 8 | ||
| 9 | @Schema(description = "管理后台 - 分类 Response VO") | 9 | @Schema(description = "管理后台 - 分类 Response VO") |
| 10 | @Data | 10 | @Data |
| @@ -23,4 +23,4 @@ public class InfraCategoryRespVO { | @@ -23,4 +23,4 @@ public class InfraCategoryRespVO { | ||
| 23 | @ExcelProperty("父编号") | 23 | @ExcelProperty("父编号") |
| 24 | private Long parentId; | 24 | private Long parentId; |
| 25 | 25 | ||
| 26 | -} | ||
| 27 | \ No newline at end of file | 26 | \ No newline at end of file |
| 27 | +} |
yudao-module-infra/src/test/resources/codegen/windows10/vue3_tree/java/InfraCategoryServiceImplTest
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.demo; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| 8 | 7 |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDeviceImportExcelVO.java
| 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelProperty; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import jakarta.validation.constraints.NotEmpty; | 5 | import jakarta.validation.constraints.NotEmpty; |
| 6 | import lombok.AllArgsConstructor; | 6 | import lombok.AllArgsConstructor; |
| @@ -34,4 +34,4 @@ public class IotDeviceImportExcelVO { | @@ -34,4 +34,4 @@ public class IotDeviceImportExcelVO { | ||
| 34 | @ExcelProperty("设备分组") | 34 | @ExcelProperty("设备分组") |
| 35 | private String groupNames; | 35 | private String groupNames; |
| 36 | 36 | ||
| 37 | -} | ||
| 38 | \ No newline at end of file | 37 | \ No newline at end of file |
| 38 | +} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDeviceMqttConnectionParamsRespVO.java
| 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| @@ -22,4 +22,4 @@ public class IotDeviceMqttConnectionParamsRespVO { | @@ -22,4 +22,4 @@ public class IotDeviceMqttConnectionParamsRespVO { | ||
| 22 | @ExcelProperty("MQTT 密码") | 22 | @ExcelProperty("MQTT 密码") |
| 23 | private String mqttPassword; | 23 | private String mqttPassword; |
| 24 | 24 | ||
| 25 | -} | ||
| 26 | \ No newline at end of file | 25 | \ No newline at end of file |
| 26 | +} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDeviceRespVO.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| @@ -90,4 +90,4 @@ public class IotDeviceRespVO { | @@ -90,4 +90,4 @@ public class IotDeviceRespVO { | ||
| 90 | @ExcelProperty("创建时间") | 90 | @ExcelProperty("创建时间") |
| 91 | private LocalDateTime createTime; | 91 | private LocalDateTime createTime; |
| 92 | 92 | ||
| 93 | -} | ||
| 94 | \ No newline at end of file | 93 | \ No newline at end of file |
| 94 | +} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaFirmwareController.java
| @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwa | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwa | ||
| 9 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareUpdateReqVO; | 9 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareUpdateReqVO; |
| 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; |
| 11 | import cn.iocoder.yudao.module.iot.service.ota.IotOtaFirmwareService; | 11 | import cn.iocoder.yudao.module.iot.service.ota.IotOtaFirmwareService; |
| 12 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 12 | import io.swagger.v3.oas.annotations.Operation; | 13 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | import io.swagger.v3.oas.annotations.tags.Tag; | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 14 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| @@ -46,6 +47,7 @@ public class IotOtaFirmwareController { | @@ -46,6 +47,7 @@ public class IotOtaFirmwareController { | ||
| 46 | @GetMapping("/get") | 47 | @GetMapping("/get") |
| 47 | @Operation(summary = "获得 OTA 固件") | 48 | @Operation(summary = "获得 OTA 固件") |
| 48 | @PreAuthorize("@ss.hasPermission('iot:ota-firmware:query')") | 49 | @PreAuthorize("@ss.hasPermission('iot:ota-firmware:query')") |
| 50 | + @TransMethodResult | ||
| 49 | public CommonResult<IotOtaFirmwareRespVO> getOtaFirmware(@RequestParam("id") Long id) { | 51 | public CommonResult<IotOtaFirmwareRespVO> getOtaFirmware(@RequestParam("id") Long id) { |
| 50 | IotOtaFirmwareDO otaFirmware = otaFirmwareService.getOtaFirmware(id); | 52 | IotOtaFirmwareDO otaFirmware = otaFirmwareService.getOtaFirmware(id); |
| 51 | return success(BeanUtils.toBean(otaFirmware, IotOtaFirmwareRespVO.class)); | 53 | return success(BeanUtils.toBean(otaFirmware, IotOtaFirmwareRespVO.class)); |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaUpgradeRecordController.java
| @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOta | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOta | ||
| 7 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOtaUpgradeRecordRespVO; | 7 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOtaUpgradeRecordRespVO; |
| 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeRecordDO; | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeRecordDO; |
| 9 | import cn.iocoder.yudao.module.iot.service.ota.IotOtaUpgradeRecordService; | 9 | import cn.iocoder.yudao.module.iot.service.ota.IotOtaUpgradeRecordService; |
| 10 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 10 | import io.swagger.v3.oas.annotations.Operation; | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | import io.swagger.v3.oas.annotations.Parameter; | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| 12 | import io.swagger.v3.oas.annotations.tags.Tag; | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -48,6 +49,7 @@ public class IotOtaUpgradeRecordController { | @@ -48,6 +49,7 @@ public class IotOtaUpgradeRecordController { | ||
| 48 | @GetMapping("/page") | 49 | @GetMapping("/page") |
| 49 | @Operation(summary = "获得升级记录分页") | 50 | @Operation(summary = "获得升级记录分页") |
| 50 | @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | 51 | @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") |
| 52 | + @TransMethodResult | ||
| 51 | public CommonResult<PageResult<IotOtaUpgradeRecordRespVO>> getUpgradeRecordPage( | 53 | public CommonResult<PageResult<IotOtaUpgradeRecordRespVO>> getUpgradeRecordPage( |
| 52 | @Valid IotOtaUpgradeRecordPageReqVO pageReqVO) { | 54 | @Valid IotOtaUpgradeRecordPageReqVO pageReqVO) { |
| 53 | PageResult<IotOtaUpgradeRecordDO> pageResult = upgradeRecordService.getUpgradeRecordPage(pageReqVO); | 55 | PageResult<IotOtaUpgradeRecordDO> pageResult = upgradeRecordService.getUpgradeRecordPage(pageReqVO); |
| @@ -58,6 +60,7 @@ public class IotOtaUpgradeRecordController { | @@ -58,6 +60,7 @@ public class IotOtaUpgradeRecordController { | ||
| 58 | @Operation(summary = "获得升级记录") | 60 | @Operation(summary = "获得升级记录") |
| 59 | @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | 61 | @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") |
| 60 | @Parameter(name = "id", description = "升级记录编号", required = true, example = "1024") | 62 | @Parameter(name = "id", description = "升级记录编号", required = true, example = "1024") |
| 63 | + @TransMethodResult | ||
| 61 | public CommonResult<IotOtaUpgradeRecordRespVO> getUpgradeRecord(@RequestParam("id") Long id) { | 64 | public CommonResult<IotOtaUpgradeRecordRespVO> getUpgradeRecord(@RequestParam("id") Long id) { |
| 62 | IotOtaUpgradeRecordDO upgradeRecord = upgradeRecordService.getUpgradeRecord(id); | 65 | IotOtaUpgradeRecordDO upgradeRecord = upgradeRecordService.getUpgradeRecord(id); |
| 63 | return success(BeanUtils.toBean(upgradeRecord, IotOtaUpgradeRecordRespVO.class)); | 66 | return success(BeanUtils.toBean(upgradeRecord, IotOtaUpgradeRecordRespVO.class)); |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/product/IotProductRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.iot.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.iot.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -84,4 +84,4 @@ public class IotProductRespVO { | @@ -84,4 +84,4 @@ public class IotProductRespVO { | ||
| 84 | @ExcelProperty("创建时间") | 84 | @ExcelProperty("创建时间") |
| 85 | private LocalDateTime createTime; | 85 | private LocalDateTime createTime; |
| 86 | 86 | ||
| 87 | -} | ||
| 88 | \ No newline at end of file | 87 | \ No newline at end of file |
| 88 | +} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/vo/IotThingModelRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; | ||
| 3 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | 3 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; |
| 4 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | 4 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; |
| 5 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | 5 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 | ||
| @@ -51,4 +51,4 @@ public class IotThingModelRespVO { | @@ -51,4 +51,4 @@ public class IotThingModelRespVO { | ||
| 51 | @ExcelProperty("创建时间") | 51 | @ExcelProperty("创建时间") |
| 52 | private LocalDateTime createTime; | 52 | private LocalDateTime createTime; |
| 53 | 53 | ||
| 54 | -} | ||
| 55 | \ No newline at end of file | 54 | \ No newline at end of file |
| 55 | +} |
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/controller/admin/history/vo/ProductBrowseHistoryRespVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.history.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.history.vo; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 |
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
| @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; |
| 6 | import cn.iocoder.yudao.module.product.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.product.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 8 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 9 | import io.swagger.v3.oas.annotations.media.Schema; | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | import lombok.Data; | 10 | import lombok.Data; |
| 11 | 11 |
yudao-module-mall/yudao-module-product/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
| @@ -18,9 +18,9 @@ import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | @@ -18,9 +18,9 @@ import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | ||
| 18 | import jakarta.annotation.Resource; | 18 | import jakarta.annotation.Resource; |
| 19 | import org.junit.jupiter.api.Disabled; | 19 | import org.junit.jupiter.api.Disabled; |
| 20 | import org.junit.jupiter.api.Test; | 20 | import org.junit.jupiter.api.Test; |
| 21 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 22 | import org.springframework.context.annotation.Import; | 21 | import org.springframework.context.annotation.Import; |
| 23 | import org.springframework.context.annotation.Lazy; | 22 | import org.springframework.context.annotation.Lazy; |
| 23 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 24 | 24 | ||
| 25 | import java.time.LocalDateTime; | 25 | import java.time.LocalDateTime; |
| 26 | import java.util.Date; | 26 | import java.util.Date; |
| @@ -48,9 +48,9 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -48,9 +48,9 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 48 | @Lazy | 48 | @Lazy |
| 49 | private ProductCommentServiceImpl productCommentService; | 49 | private ProductCommentServiceImpl productCommentService; |
| 50 | 50 | ||
| 51 | - @MockBean | 51 | + @MockitoBean |
| 52 | private ProductSpuService productSpuService; | 52 | private ProductSpuService productSpuService; |
| 53 | - @MockBean | 53 | + @MockitoBean |
| 54 | private ProductSkuService productSkuService; | 54 | private ProductSkuService productSkuService; |
| 55 | 55 | ||
| 56 | public String generateNo() { | 56 | public String generateNo() { |
yudao-module-mall/yudao-module-product/src/test/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceTest.java
| @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | ||
| 10 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; | 10 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; |
| 11 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; | 11 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| 12 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | 12 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 13 | +import jakarta.annotation.Resource; | ||
| 13 | import org.junit.jupiter.api.Disabled; | 14 | import org.junit.jupiter.api.Disabled; |
| 14 | import org.junit.jupiter.api.Test; | 15 | import org.junit.jupiter.api.Test; |
| 15 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 16 | import org.springframework.context.annotation.Import; | 16 | import org.springframework.context.annotation.Import; |
| 17 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 18 | ||
| 18 | -import jakarta.annotation.Resource; | ||
| 19 | import java.util.Arrays; | 19 | import java.util.Arrays; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | 21 | ||
| @@ -44,11 +44,11 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | @@ -44,11 +44,11 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | ||
| 44 | @Resource | 44 | @Resource |
| 45 | private ProductSkuMapper productSkuMapper; | 45 | private ProductSkuMapper productSkuMapper; |
| 46 | 46 | ||
| 47 | - @MockBean | 47 | + @MockitoBean |
| 48 | private ProductSpuService productSpuService; | 48 | private ProductSpuService productSpuService; |
| 49 | - @MockBean | 49 | + @MockitoBean |
| 50 | private ProductPropertyService productPropertyService; | 50 | private ProductPropertyService productPropertyService; |
| 51 | - @MockBean | 51 | + @MockitoBean |
| 52 | private ProductPropertyValueService productPropertyValueService; | 52 | private ProductPropertyValueService productPropertyValueService; |
| 53 | 53 | ||
| 54 | public Long generateId() { | 54 | public Long generateId() { |
yudao-module-mall/yudao-module-product/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
| @@ -22,8 +22,8 @@ import jakarta.annotation.Resource; | @@ -22,8 +22,8 @@ import jakarta.annotation.Resource; | ||
| 22 | import org.junit.jupiter.api.Assertions; | 22 | import org.junit.jupiter.api.Assertions; |
| 23 | import org.junit.jupiter.api.Disabled; | 23 | import org.junit.jupiter.api.Disabled; |
| 24 | import org.junit.jupiter.api.Test; | 24 | import org.junit.jupiter.api.Test; |
| 25 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 26 | import org.springframework.context.annotation.Import; | 25 | import org.springframework.context.annotation.Import; |
| 26 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 27 | 27 | ||
| 28 | import java.math.RoundingMode; | 28 | import java.math.RoundingMode; |
| 29 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
| @@ -58,15 +58,15 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -58,15 +58,15 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 58 | @Resource | 58 | @Resource |
| 59 | private ProductSpuMapper productSpuMapper; | 59 | private ProductSpuMapper productSpuMapper; |
| 60 | 60 | ||
| 61 | - @MockBean | 61 | + @MockitoBean |
| 62 | private ProductSkuServiceImpl productSkuService; | 62 | private ProductSkuServiceImpl productSkuService; |
| 63 | - @MockBean | 63 | + @MockitoBean |
| 64 | private ProductCategoryServiceImpl categoryService; | 64 | private ProductCategoryServiceImpl categoryService; |
| 65 | - @MockBean | 65 | + @MockitoBean |
| 66 | private ProductBrandServiceImpl brandService; | 66 | private ProductBrandServiceImpl brandService; |
| 67 | - @MockBean | 67 | + @MockitoBean |
| 68 | private ProductPropertyService productPropertyService; | 68 | private ProductPropertyService productPropertyService; |
| 69 | - @MockBean | 69 | + @MockitoBean |
| 70 | private ProductPropertyValueService productPropertyValueService; | 70 | private ProductPropertyValueService productPropertyValueService; |
| 71 | 71 | ||
| 72 | public String generateNo() { | 72 | public String generateNo() { |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/vo/message/KeFuMessageRespVO.java
| @@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | @@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | import lombok.*; | 4 | import lombok.*; |
| 5 | 5 | ||
| 6 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 7 | -import com.alibaba.excel.annotation.*; | ||
| 8 | 7 | ||
| 9 | @Schema(description = "管理后台 - 客服消息 Response VO") | 8 | @Schema(description = "管理后台 - 客服消息 Response VO") |
| 10 | @Data | 9 | @Data |
| @@ -42,4 +41,4 @@ public class KeFuMessageRespVO { | @@ -42,4 +41,4 @@ public class KeFuMessageRespVO { | ||
| 42 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 41 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 43 | private LocalDateTime createTime; | 42 | private LocalDateTime createTime; |
| 44 | 43 | ||
| 45 | -} | ||
| 46 | \ No newline at end of file | 44 | \ No newline at end of file |
| 45 | +} |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityRespVO.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity; | 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product.PointProductRespVO; | 3 | import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product.PointProductRespVO; |
| 4 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 5 | -import com.alibaba.excel.annotation.ExcelProperty; | 4 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 5 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| 8 | 8 | ||
| @@ -69,4 +69,4 @@ public class PointActivityRespVO { | @@ -69,4 +69,4 @@ public class PointActivityRespVO { | ||
| 69 | @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | 69 | @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") |
| 70 | private Integer price; | 70 | private Integer price; |
| 71 | 71 | ||
| 72 | -} | ||
| 73 | \ No newline at end of file | 72 | \ No newline at end of file |
| 73 | +} |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/product/PointProductRespVO.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product; | 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| @@ -36,4 +36,4 @@ public class PointProductRespVO { | @@ -36,4 +36,4 @@ public class PointProductRespVO { | ||
| 36 | @Schema(description = "积分商城商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 36 | @Schema(description = "积分商城商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 37 | private Integer activityStatus; | 37 | private Integer activityStatus; |
| 38 | 38 | ||
| 39 | -} | ||
| 40 | \ No newline at end of file | 39 | \ No newline at end of file |
| 40 | +} |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | 1 | package cn.iocoder.yudao.module.promotion.controller.app.point.vo; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelProperty; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java
| @@ -222,6 +222,7 @@ public class PointActivityServiceImpl implements PointActivityService { | @@ -222,6 +222,7 @@ public class PointActivityServiceImpl implements PointActivityService { | ||
| 222 | if (spu == null) { | 222 | if (spu == null) { |
| 223 | throw exception(SPU_NOT_EXISTS); | 223 | throw exception(SPU_NOT_EXISTS); |
| 224 | } | 224 | } |
| 225 | + products.forEach(product -> product.setSpuId(spuId)); | ||
| 225 | 226 | ||
| 226 | // 2. 校验商品 sku 都存在 | 227 | // 2. 校验商品 sku 都存在 |
| 227 | List<ProductSkuRespDTO> skus = productSkuApi.getSkuListBySpuId(singletonList(spuId)); | 228 | List<ProductSkuRespDTO> skus = productSkuApi.getSkuListBySpuId(singletonList(spuId)); |
yudao-module-mall/yudao-module-statistics/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/product/vo/ProductStatisticsRespVO.java
| 1 | package cn.iocoder.yudao.module.statistics.controller.admin.product.vo; | 1 | package cn.iocoder.yudao.module.statistics.controller.admin.product.vo; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | import com.fasterxml.jackson.annotation.JsonFormat; | 5 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -78,4 +78,4 @@ public class ProductStatisticsRespVO { | @@ -78,4 +78,4 @@ public class ProductStatisticsRespVO { | ||
| 78 | @Schema(description = "访客支付转化率(百分比)", requiredMode = Schema.RequiredMode.REQUIRED, example = "15") | 78 | @Schema(description = "访客支付转化率(百分比)", requiredMode = Schema.RequiredMode.REQUIRED, example = "15") |
| 79 | private Integer browseConvertPercent; | 79 | private Integer browseConvertPercent; |
| 80 | 80 | ||
| 81 | -} | ||
| 82 | \ No newline at end of file | 81 | \ No newline at end of file |
| 82 | +} |
yudao-module-mall/yudao-module-statistics/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryExcelVO.java
| 1 | package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; | 1 | package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; | 3 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; |
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | ||
| 5 | -import com.alibaba.excel.annotation.format.DateTimeFormat; | 4 | +import cn.idev.excel.annotation.ExcelProperty; |
| 5 | +import cn.idev.excel.annotation.format.DateTimeFormat; | ||
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| 8 | import java.time.LocalDate; | 8 | import java.time.LocalDate; |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressExcelVO.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelProperty; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| 8 | 8 | ||
| 9 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleConvert.java
| @@ -43,7 +43,7 @@ public interface AfterSaleConvert { | @@ -43,7 +43,7 @@ public interface AfterSaleConvert { | ||
| 43 | @Mapping(source = "afterSale.id", target = "merchantRefundId"), | 43 | @Mapping(source = "afterSale.id", target = "merchantRefundId"), |
| 44 | @Mapping(source = "afterSale.applyReason", target = "reason"), | 44 | @Mapping(source = "afterSale.applyReason", target = "reason"), |
| 45 | @Mapping(source = "afterSale.refundPrice", target = "price"), | 45 | @Mapping(source = "afterSale.refundPrice", target = "price"), |
| 46 | - @Mapping(source = "orderProperties.payAppKey", target = "appKey") | 46 | + @Mapping(source = "orderProperties.payAppKey", target = "appKey"), |
| 47 | }) | 47 | }) |
| 48 | PayRefundCreateReqDTO convert(String userIp, AfterSaleDO afterSale, TradeOrderProperties orderProperties); | 48 | PayRefundCreateReqDTO convert(String userIp, AfterSaleDO afterSale, TradeOrderProperties orderProperties); |
| 49 | 49 |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.convert.order; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.convert.order; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.BooleanUtil; | 3 | import cn.hutool.core.util.BooleanUtil; |
| 4 | import cn.hutool.core.util.StrUtil; | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 7 | import cn.iocoder.yudao.framework.common.util.string.StrUtils; | 8 | import cn.iocoder.yudao.framework.common.util.string.StrUtils; |
| @@ -101,7 +102,8 @@ public interface TradeOrderConvert { | @@ -101,7 +102,8 @@ public interface TradeOrderConvert { | ||
| 101 | default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, | 102 | default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 102 | TradeOrderProperties orderProperties) { | 103 | TradeOrderProperties orderProperties) { |
| 103 | PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO() | 104 | PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO() |
| 104 | - .setAppKey(orderProperties.getPayAppKey()).setUserIp(order.getUserIp()); | 105 | + .setAppKey(orderProperties.getPayAppKey()).setUserIp(order.getUserIp()) |
| 106 | + .setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()); | ||
| 105 | // 商户相关字段 | 107 | // 商户相关字段 |
| 106 | createReqDTO.setMerchantOrderId(String.valueOf(order.getId())); | 108 | createReqDTO.setMerchantOrderId(String.valueOf(order.getId())); |
| 107 | String subject = orderItems.get(0).getSpuName(); | 109 | String subject = orderItems.get(0).getSpuName(); |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/framework/delivery/core/client/dto/kd100/Kd100ExpressQueryRespDTO.java
| @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.kd100; | @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.kd100; | ||
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | import com.fasterxml.jackson.annotation.JsonProperty; | 4 | import com.fasterxml.jackson.annotation.JsonProperty; |
| 5 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| 6 | +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; | ||
| 5 | import lombok.Data; | 7 | import lombok.Data; |
| 6 | 8 | ||
| 7 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| @@ -59,8 +61,8 @@ public class Kd100ExpressQueryRespDTO { | @@ -59,8 +61,8 @@ public class Kd100ExpressQueryRespDTO { | ||
| 59 | * 轨迹发生时间 | 61 | * 轨迹发生时间 |
| 60 | */ | 62 | */ |
| 61 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) | 63 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) |
| 64 | + @JsonDeserialize(using = LocalDateTimeDeserializer.class) | ||
| 62 | private LocalDateTime time; | 65 | private LocalDateTime time; |
| 63 | - | ||
| 64 | /** | 66 | /** |
| 65 | * 轨迹描述 | 67 | * 轨迹描述 |
| 66 | */ | 68 | */ |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.service.aftersale; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.service.aftersale; | ||
| 3 | import cn.hutool.core.map.MapUtil; | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | import cn.hutool.core.util.StrUtil; | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 8 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 8 | import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; | 9 | import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; |
| @@ -362,6 +363,7 @@ public class AfterSaleServiceImpl implements AfterSaleService { | @@ -362,6 +363,7 @@ public class AfterSaleServiceImpl implements AfterSaleService { | ||
| 362 | private void createPayRefund(String userIp, AfterSaleDO afterSale) { | 363 | private void createPayRefund(String userIp, AfterSaleDO afterSale) { |
| 363 | // 创建退款单 | 364 | // 创建退款单 |
| 364 | PayRefundCreateReqDTO createReqDTO = AfterSaleConvert.INSTANCE.convert(userIp, afterSale, tradeOrderProperties) | 365 | PayRefundCreateReqDTO createReqDTO = AfterSaleConvert.INSTANCE.convert(userIp, afterSale, tradeOrderProperties) |
| 366 | + .setUserId(afterSale.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) | ||
| 365 | .setReason(StrUtil.format("退款【{}】", afterSale.getSpuName())); | 367 | .setReason(StrUtil.format("退款【{}】", afterSale.getSpuName())); |
| 366 | Long payRefundId = payRefundApi.createRefund(createReqDTO); | 368 | Long payRefundId = payRefundApi.createRefund(createReqDTO); |
| 367 | 369 |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java
| @@ -151,6 +151,7 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -151,6 +151,7 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 151 | .setAppKey(tradeOrderProperties.getPayAppKey()).setChannelCode(channelCode) | 151 | .setAppKey(tradeOrderProperties.getPayAppKey()).setChannelCode(channelCode) |
| 152 | .setMerchantTransferId(withdraw.getId().toString()).setSubject("佣金提现").setPrice(withdraw.getPrice()) | 152 | .setMerchantTransferId(withdraw.getId().toString()).setSubject("佣金提现").setPrice(withdraw.getPrice()) |
| 153 | .setUserAccount(userAccount).setUserName(userName).setUserIp(getClientIP()) | 153 | .setUserAccount(userAccount).setUserName(userName).setUserIp(getClientIP()) |
| 154 | + .setUserId(withdraw.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) // 用户信息 | ||
| 154 | .setChannelExtras(channelExtras); | 155 | .setChannelExtras(channelExtras); |
| 155 | // 1.3 发起请求 | 156 | // 1.3 发起请求 |
| 156 | PayTransferCreateRespDTO transferRespDTO = payTransferApi.createTransfer(transferReqDTO); | 157 | PayTransferCreateRespDTO transferRespDTO = payTransferApi.createTransfer(transferReqDTO); |
yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java
| @@ -952,6 +952,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -952,6 +952,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 952 | payRefundApi.createRefund(new PayRefundCreateReqDTO() | 952 | payRefundApi.createRefund(new PayRefundCreateReqDTO() |
| 953 | .setAppKey(tradeOrderProperties.getPayAppKey()) // 支付应用 | 953 | .setAppKey(tradeOrderProperties.getPayAppKey()) // 支付应用 |
| 954 | .setUserIp(NetUtil.getLocalhostStr()) // 使用本机 IP,因为是服务器发起退款的 | 954 | .setUserIp(NetUtil.getLocalhostStr()) // 使用本机 IP,因为是服务器发起退款的 |
| 955 | + .setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) // 用户信息 | ||
| 955 | .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 | 956 | .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 |
| 956 | // 特殊:因为订单支持 AfterSale 单个售后退款,也支持整单退款,所以需要通过 order- 进行下区分 | 957 | // 特殊:因为订单支持 AfterSale 单个售后退款,也支持整单退款,所以需要通过 order- 进行下区分 |
| 957 | // 具体可见 AfterSaleController 的 updateAfterSaleRefunded 方法 | 958 | // 具体可见 AfterSaleController 的 updateAfterSaleRefunded 方法 |
yudao-module-mall/yudao-module-trade/src/test/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceTest.java
| @@ -20,12 +20,12 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; | @@ -20,12 +20,12 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; | ||
| 20 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; | 20 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 21 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; | 21 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| 22 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; | 22 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; |
| 23 | +import jakarta.annotation.Resource; | ||
| 23 | import org.junit.jupiter.api.Disabled; | 24 | import org.junit.jupiter.api.Disabled; |
| 24 | import org.junit.jupiter.api.Test; | 25 | import org.junit.jupiter.api.Test; |
| 25 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 26 | import org.springframework.context.annotation.Import; | 26 | import org.springframework.context.annotation.Import; |
| 27 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 27 | 28 | ||
| 28 | -import jakarta.annotation.Resource; | ||
| 29 | import java.time.LocalDateTime; | 29 | import java.time.LocalDateTime; |
| 30 | 30 | ||
| 31 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | 31 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; |
| @@ -54,15 +54,15 @@ public class AfterSaleServiceTest extends BaseDbUnitTest { | @@ -54,15 +54,15 @@ public class AfterSaleServiceTest extends BaseDbUnitTest { | ||
| 54 | @Resource | 54 | @Resource |
| 55 | private AfterSaleLogMapper tradeAfterSaleLogMapper; | 55 | private AfterSaleLogMapper tradeAfterSaleLogMapper; |
| 56 | 56 | ||
| 57 | - @MockBean | 57 | + @MockitoBean |
| 58 | private TradeOrderUpdateService tradeOrderUpdateService; | 58 | private TradeOrderUpdateService tradeOrderUpdateService; |
| 59 | @Resource | 59 | @Resource |
| 60 | private TradeOrderQueryService tradeOrderQueryService; | 60 | private TradeOrderQueryService tradeOrderQueryService; |
| 61 | 61 | ||
| 62 | - @MockBean | 62 | + @MockitoBean |
| 63 | private PayRefundApi payRefundApi; | 63 | private PayRefundApi payRefundApi; |
| 64 | 64 | ||
| 65 | - @MockBean | 65 | + @MockitoBean |
| 66 | private TradeOrderProperties tradeOrderProperties; | 66 | private TradeOrderProperties tradeOrderProperties; |
| 67 | 67 | ||
| 68 | @Test | 68 | @Test |
yudao-module-mall/yudao-module-trade/src/test/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImplTest.java
| @@ -7,12 +7,12 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.Broker | @@ -7,12 +7,12 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.Broker | ||
| 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; |
| 8 | import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper; | 8 | import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper; |
| 9 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; | 9 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; |
| 10 | +import jakarta.annotation.Resource; | ||
| 10 | import org.junit.jupiter.api.Disabled; | 11 | import org.junit.jupiter.api.Disabled; |
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 13 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 14 | 15 | ||
| 15 | -import jakarta.annotation.Resource; | ||
| 16 | import java.math.RoundingMode; | 16 | import java.math.RoundingMode; |
| 17 | 17 | ||
| 18 | import static cn.hutool.core.util.RandomUtil.randomEle; | 18 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| @@ -39,9 +39,9 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest { | @@ -39,9 +39,9 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest { | ||
| 39 | @Resource | 39 | @Resource |
| 40 | private BrokerageRecordMapper brokerageRecordMapper; | 40 | private BrokerageRecordMapper brokerageRecordMapper; |
| 41 | 41 | ||
| 42 | - @MockBean | 42 | + @MockitoBean |
| 43 | private TradeConfigService tradeConfigService; | 43 | private TradeConfigService tradeConfigService; |
| 44 | - @MockBean | 44 | + @MockitoBean |
| 45 | private BrokerageUserService brokerageUserService; | 45 | private BrokerageUserService brokerageUserService; |
| 46 | 46 | ||
| 47 | @Test | 47 | @Test |
yudao-module-mall/yudao-module-trade/src/test/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImplTest.java
| @@ -11,8 +11,8 @@ import jakarta.annotation.Resource; | @@ -11,8 +11,8 @@ import jakarta.annotation.Resource; | ||
| 11 | import jakarta.validation.Validator; | 11 | import jakarta.validation.Validator; |
| 12 | import org.junit.jupiter.api.Disabled; | 12 | import org.junit.jupiter.api.Disabled; |
| 13 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 14 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 15 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 16 | 16 | ||
| 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| 18 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 18 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| @@ -36,14 +36,14 @@ public class BrokerageWithdrawServiceImplTest extends BaseDbUnitTest { | @@ -36,14 +36,14 @@ public class BrokerageWithdrawServiceImplTest extends BaseDbUnitTest { | ||
| 36 | @Resource | 36 | @Resource |
| 37 | private BrokerageWithdrawMapper brokerageWithdrawMapper; | 37 | private BrokerageWithdrawMapper brokerageWithdrawMapper; |
| 38 | 38 | ||
| 39 | - @MockBean | 39 | + @MockitoBean |
| 40 | private BrokerageRecordService brokerageRecordService; | 40 | private BrokerageRecordService brokerageRecordService; |
| 41 | - @MockBean | 41 | + @MockitoBean |
| 42 | private BrokerageUserService brokerageUserService; | 42 | private BrokerageUserService brokerageUserService; |
| 43 | - @MockBean | 43 | + @MockitoBean |
| 44 | private TradeConfigService tradeConfigService; | 44 | private TradeConfigService tradeConfigService; |
| 45 | 45 | ||
| 46 | - @MockBean | 46 | + @MockitoBean |
| 47 | private NotifyMessageSendApi notifyMessageSendApi; | 47 | private NotifyMessageSendApi notifyMessageSendApi; |
| 48 | 48 | ||
| 49 | @Resource | 49 | @Resource |
yudao-module-mall/yudao-module-trade/src/test/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceTest.java
| @@ -35,8 +35,8 @@ import jakarta.annotation.Resource; | @@ -35,8 +35,8 @@ import jakarta.annotation.Resource; | ||
| 35 | import org.junit.jupiter.api.BeforeEach; | 35 | import org.junit.jupiter.api.BeforeEach; |
| 36 | import org.junit.jupiter.api.Disabled; | 36 | import org.junit.jupiter.api.Disabled; |
| 37 | import org.junit.jupiter.api.Test; | 37 | import org.junit.jupiter.api.Test; |
| 38 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 39 | import org.springframework.context.annotation.Import; | 38 | import org.springframework.context.annotation.Import; |
| 39 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 40 | 40 | ||
| 41 | import java.time.Duration; | 41 | import java.time.Duration; |
| 42 | 42 | ||
| @@ -67,34 +67,34 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest { | @@ -67,34 +67,34 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest { | ||
| 67 | @Resource | 67 | @Resource |
| 68 | private TradeOrderItemMapper tradeOrderItemMapper; | 68 | private TradeOrderItemMapper tradeOrderItemMapper; |
| 69 | 69 | ||
| 70 | - @MockBean | 70 | + @MockitoBean |
| 71 | private MemberUserApi memberUserApi; | 71 | private MemberUserApi memberUserApi; |
| 72 | - @MockBean | 72 | + @MockitoBean |
| 73 | private ProductSpuApi productSpuApi; | 73 | private ProductSpuApi productSpuApi; |
| 74 | - @MockBean | 74 | + @MockitoBean |
| 75 | private ProductSkuApi productSkuApi; | 75 | private ProductSkuApi productSkuApi; |
| 76 | - @MockBean | 76 | + @MockitoBean |
| 77 | private ProductCommentApi productCommentApi; | 77 | private ProductCommentApi productCommentApi; |
| 78 | - // @MockBean | 78 | + // @MockitoBean |
| 79 | // private PriceApi priceApi; | 79 | // private PriceApi priceApi; |
| 80 | - @MockBean | 80 | + @MockitoBean |
| 81 | private PayOrderApi payOrderApi; | 81 | private PayOrderApi payOrderApi; |
| 82 | - @MockBean | 82 | + @MockitoBean |
| 83 | private MemberAddressApi addressApi; | 83 | private MemberAddressApi addressApi; |
| 84 | - @MockBean | 84 | + @MockitoBean |
| 85 | private CouponApi couponApi; | 85 | private CouponApi couponApi; |
| 86 | 86 | ||
| 87 | - @MockBean | 87 | + @MockitoBean |
| 88 | private TradeOrderProperties tradeOrderProperties; | 88 | private TradeOrderProperties tradeOrderProperties; |
| 89 | - @MockBean | 89 | + @MockitoBean |
| 90 | private TradeNoRedisDAO tradeNoRedisDAO; | 90 | private TradeNoRedisDAO tradeNoRedisDAO; |
| 91 | - @MockBean | 91 | + @MockitoBean |
| 92 | private TradeOrderHandler tradeOrderHandler; | 92 | private TradeOrderHandler tradeOrderHandler; |
| 93 | - @MockBean | 93 | + @MockitoBean |
| 94 | private TradePriceCalculator tradePriceCalculator; | 94 | private TradePriceCalculator tradePriceCalculator; |
| 95 | - @MockBean | 95 | + @MockitoBean |
| 96 | private NotifyMessageSendApi notifyMessageSendApi; | 96 | private NotifyMessageSendApi notifyMessageSendApi; |
| 97 | - @MockBean | 97 | + @MockitoBean |
| 98 | private DeliveryExpressService deliveryExpressService; | 98 | private DeliveryExpressService deliveryExpressService; |
| 99 | 99 | ||
| 100 | @BeforeEach | 100 | @BeforeEach |
yudao-module-member/src/test/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceTest.java
| 1 | package cn.iocoder.yudao.module.member.service.auth; | 1 | package cn.iocoder.yudao.module.member.service.auth; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.biz.system.oauth2.OAuth2TokenCommonApi; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | 5 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 5 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | 6 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; |
| @@ -8,14 +9,13 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | @@ -8,14 +9,13 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | ||
| 8 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; | 9 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; |
| 9 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; | 10 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; |
| 10 | import cn.iocoder.yudao.module.system.api.logger.LoginLogApi; | 11 | import cn.iocoder.yudao.module.system.api.logger.LoginLogApi; |
| 11 | -import cn.iocoder.yudao.framework.common.biz.system.oauth2.OAuth2TokenCommonApi; | ||
| 12 | import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; | 12 | import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; |
| 13 | import cn.iocoder.yudao.module.system.api.social.SocialUserApi; | 13 | import cn.iocoder.yudao.module.system.api.social.SocialUserApi; |
| 14 | -import org.springframework.boot.test.mock.mockito.MockBean; | 14 | +import jakarta.annotation.Resource; |
| 15 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 16 | import org.springframework.security.crypto.password.PasswordEncoder; | 16 | import org.springframework.security.crypto.password.PasswordEncoder; |
| 17 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 18 | ||
| 18 | -import jakarta.annotation.Resource; | ||
| 19 | import java.util.function.Consumer; | 19 | import java.util.function.Consumer; |
| 20 | 20 | ||
| 21 | import static cn.hutool.core.util.RandomUtil.randomEle; | 21 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| @@ -36,17 +36,17 @@ public class MemberAuthServiceTest extends BaseDbAndRedisUnitTest { | @@ -36,17 +36,17 @@ public class MemberAuthServiceTest extends BaseDbAndRedisUnitTest { | ||
| 36 | @Resource | 36 | @Resource |
| 37 | private MemberAuthServiceImpl authService; | 37 | private MemberAuthServiceImpl authService; |
| 38 | 38 | ||
| 39 | - @MockBean | 39 | + @MockitoBean |
| 40 | private MemberUserService userService; | 40 | private MemberUserService userService; |
| 41 | - @MockBean | 41 | + @MockitoBean |
| 42 | private SmsCodeApi smsCodeApi; | 42 | private SmsCodeApi smsCodeApi; |
| 43 | - @MockBean | 43 | + @MockitoBean |
| 44 | private LoginLogApi loginLogApi; | 44 | private LoginLogApi loginLogApi; |
| 45 | - @MockBean | 45 | + @MockitoBean |
| 46 | private OAuth2TokenCommonApi oauth2TokenApi; | 46 | private OAuth2TokenCommonApi oauth2TokenApi; |
| 47 | - @MockBean | 47 | + @MockitoBean |
| 48 | private SocialUserApi socialUserApi; | 48 | private SocialUserApi socialUserApi; |
| 49 | - @MockBean | 49 | + @MockitoBean |
| 50 | private PasswordEncoder passwordEncoder; | 50 | private PasswordEncoder passwordEncoder; |
| 51 | 51 | ||
| 52 | @Resource | 52 | @Resource |
yudao-module-member/src/test/java/cn/iocoder/yudao/module/member/service/group/MemberGroupServiceImplTest.java
| @@ -9,11 +9,10 @@ import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupUpdat | @@ -9,11 +9,10 @@ import cn.iocoder.yudao.module.member.controller.admin.group.vo.MemberGroupUpdat | ||
| 9 | import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO; | 9 | import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO; |
| 10 | import cn.iocoder.yudao.module.member.dal.mysql.group.MemberGroupMapper; | 10 | import cn.iocoder.yudao.module.member.dal.mysql.group.MemberGroupMapper; |
| 11 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; | 11 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; |
| 12 | +import jakarta.annotation.Resource; | ||
| 12 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 13 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 14 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | - | ||
| 16 | -import jakarta.annotation.Resource; | 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; |
| 17 | 16 | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| 19 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; |
| @@ -42,7 +41,7 @@ public class MemberGroupServiceImplTest extends BaseDbUnitTest { | @@ -42,7 +41,7 @@ public class MemberGroupServiceImplTest extends BaseDbUnitTest { | ||
| 42 | @Resource | 41 | @Resource |
| 43 | private MemberGroupMapper groupMapper; | 42 | private MemberGroupMapper groupMapper; |
| 44 | 43 | ||
| 45 | - @MockBean | 44 | + @MockitoBean |
| 46 | private MemberUserService memberUserService; | 45 | private MemberUserService memberUserService; |
| 47 | 46 | ||
| 48 | @Test | 47 | @Test |
yudao-module-member/src/test/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImplTest.java
| @@ -9,11 +9,11 @@ import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLeve | @@ -9,11 +9,11 @@ import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLeve | ||
| 9 | import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; | 9 | import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; |
| 10 | import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper; | 10 | import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper; |
| 11 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; | 11 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; |
| 12 | +import jakarta.annotation.Resource; | ||
| 12 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 13 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 14 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 15 | 16 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | import java.util.function.Consumer; | 18 | import java.util.function.Consumer; |
| 19 | 19 | ||
| @@ -40,11 +40,11 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest { | @@ -40,11 +40,11 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest { | ||
| 40 | @Resource | 40 | @Resource |
| 41 | private MemberLevelMapper memberlevelMapper; | 41 | private MemberLevelMapper memberlevelMapper; |
| 42 | 42 | ||
| 43 | - @MockBean | 43 | + @MockitoBean |
| 44 | private MemberLevelRecordService memberLevelRecordService; | 44 | private MemberLevelRecordService memberLevelRecordService; |
| 45 | - @MockBean | 45 | + @MockitoBean |
| 46 | private MemberExperienceRecordService memberExperienceRecordService; | 46 | private MemberExperienceRecordService memberExperienceRecordService; |
| 47 | - @MockBean | 47 | + @MockitoBean |
| 48 | private MemberUserService memberUserService; | 48 | private MemberUserService memberUserService; |
| 49 | 49 | ||
| 50 | @Test | 50 | @Test |
yudao-module-member/src/test/java/cn/iocoder/yudao/module/member/service/tag/MemberTagServiceImplTest.java
| @@ -8,11 +8,10 @@ import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagUpdateReq | @@ -8,11 +8,10 @@ import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagUpdateReq | ||
| 8 | import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO; | 8 | import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO; |
| 9 | import cn.iocoder.yudao.module.member.dal.mysql.tag.MemberTagMapper; | 9 | import cn.iocoder.yudao.module.member.dal.mysql.tag.MemberTagMapper; |
| 10 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; | 10 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; |
| 11 | +import jakarta.annotation.Resource; | ||
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 13 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | - | ||
| 15 | -import jakarta.annotation.Resource; | 14 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; |
| 16 | 15 | ||
| 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 16 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | 17 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; |
| @@ -39,7 +38,7 @@ public class MemberTagServiceImplTest extends BaseDbUnitTest { | @@ -39,7 +38,7 @@ public class MemberTagServiceImplTest extends BaseDbUnitTest { | ||
| 39 | @Resource | 38 | @Resource |
| 40 | private MemberTagMapper tagMapper; | 39 | private MemberTagMapper tagMapper; |
| 41 | 40 | ||
| 42 | - @MockBean | 41 | + @MockitoBean |
| 43 | private MemberUserService memberUserService; | 42 | private MemberUserService memberUserService; |
| 44 | 43 | ||
| 45 | @Test | 44 | @Test |
yudao-module-member/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java
| @@ -13,10 +13,10 @@ import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; | @@ -13,10 +13,10 @@ import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; | ||
| 13 | import jakarta.annotation.Resource; | 13 | import jakarta.annotation.Resource; |
| 14 | import org.junit.jupiter.api.Disabled; | 14 | import org.junit.jupiter.api.Disabled; |
| 15 | import org.junit.jupiter.api.Test; | 15 | import org.junit.jupiter.api.Test; |
| 16 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 17 | import org.springframework.context.annotation.Import; | 16 | import org.springframework.context.annotation.Import; |
| 18 | import org.springframework.data.redis.core.StringRedisTemplate; | 17 | import org.springframework.data.redis.core.StringRedisTemplate; |
| 19 | import org.springframework.security.crypto.password.PasswordEncoder; | 18 | import org.springframework.security.crypto.password.PasswordEncoder; |
| 19 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 20 | 20 | ||
| 21 | import java.util.function.Consumer; | 21 | import java.util.function.Consumer; |
| 22 | 22 | ||
| @@ -44,13 +44,13 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | @@ -44,13 +44,13 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | ||
| 44 | @Resource | 44 | @Resource |
| 45 | private MemberUserMapper userMapper; | 45 | private MemberUserMapper userMapper; |
| 46 | 46 | ||
| 47 | - @MockBean | 47 | + @MockitoBean |
| 48 | private MemberAuthServiceImpl authService; | 48 | private MemberAuthServiceImpl authService; |
| 49 | 49 | ||
| 50 | - @MockBean | 50 | + @MockitoBean |
| 51 | private PasswordEncoder passwordEncoder; | 51 | private PasswordEncoder passwordEncoder; |
| 52 | 52 | ||
| 53 | - @MockBean | 53 | + @MockitoBean |
| 54 | private SmsCodeApi smsCodeApi; | 54 | private SmsCodeApi smsCodeApi; |
| 55 | 55 | ||
| 56 | // TODO 芋艿:后续重构这个单测 | 56 | // TODO 芋艿:后续重构这个单测 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/api/order/dto/PayOrderCreateReqDTO.java
| 1 | package cn.iocoder.yudao.module.pay.api.order.dto; | 1 | package cn.iocoder.yudao.module.pay.api.order.dto; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import jakarta.validation.constraints.DecimalMin; | 5 | import jakarta.validation.constraints.DecimalMin; |
| 4 | import jakarta.validation.constraints.NotEmpty; | 6 | import jakarta.validation.constraints.NotEmpty; |
| 5 | import jakarta.validation.constraints.NotNull; | 7 | import jakarta.validation.constraints.NotNull; |
| @@ -22,12 +24,23 @@ public class PayOrderCreateReqDTO implements Serializable { | @@ -22,12 +24,23 @@ public class PayOrderCreateReqDTO implements Serializable { | ||
| 22 | */ | 24 | */ |
| 23 | @NotNull(message = "应用标识不能为空") | 25 | @NotNull(message = "应用标识不能为空") |
| 24 | private String appKey; | 26 | private String appKey; |
| 27 | + | ||
| 25 | /** | 28 | /** |
| 26 | * 用户 IP | 29 | * 用户 IP |
| 27 | */ | 30 | */ |
| 28 | @NotEmpty(message = "用户 IP 不能为空") | 31 | @NotEmpty(message = "用户 IP 不能为空") |
| 29 | private String userIp; | 32 | private String userIp; |
| 30 | 33 | ||
| 34 | + /** | ||
| 35 | + * 用户编号 | ||
| 36 | + */ | ||
| 37 | + private Long userId; | ||
| 38 | + /** | ||
| 39 | + * 用户类型 | ||
| 40 | + */ | ||
| 41 | + @InEnum(UserTypeEnum.class) | ||
| 42 | + private Integer userType; | ||
| 43 | + | ||
| 31 | // ========== 商户相关字段 ========== | 44 | // ========== 商户相关字段 ========== |
| 32 | 45 | ||
| 33 | /** | 46 | /** |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/api/refund/dto/PayRefundCreateReqDTO.java
| 1 | package cn.iocoder.yudao.module.pay.api.refund.dto; | 1 | package cn.iocoder.yudao.module.pay.api.refund.dto; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import jakarta.validation.constraints.Min; | 5 | import jakarta.validation.constraints.Min; |
| 4 | import jakarta.validation.constraints.NotEmpty; | 6 | import jakarta.validation.constraints.NotEmpty; |
| 5 | import jakarta.validation.constraints.NotNull; | 7 | import jakarta.validation.constraints.NotNull; |
| @@ -19,12 +21,23 @@ public class PayRefundCreateReqDTO { | @@ -19,12 +21,23 @@ public class PayRefundCreateReqDTO { | ||
| 19 | */ | 21 | */ |
| 20 | @NotNull(message = "应用标识不能为空") | 22 | @NotNull(message = "应用标识不能为空") |
| 21 | private String appKey; | 23 | private String appKey; |
| 24 | + | ||
| 22 | /** | 25 | /** |
| 23 | * 用户 IP | 26 | * 用户 IP |
| 24 | */ | 27 | */ |
| 25 | @NotEmpty(message = "用户 IP 不能为空") | 28 | @NotEmpty(message = "用户 IP 不能为空") |
| 26 | private String userIp; | 29 | private String userIp; |
| 27 | 30 | ||
| 31 | + /** | ||
| 32 | + * 用户编号 | ||
| 33 | + */ | ||
| 34 | + private Long userId; | ||
| 35 | + /** | ||
| 36 | + * 用户类型 | ||
| 37 | + */ | ||
| 38 | + @InEnum(UserTypeEnum.class) | ||
| 39 | + private Integer userType; | ||
| 40 | + | ||
| 28 | // ========== 商户相关字段 ========== | 41 | // ========== 商户相关字段 ========== |
| 29 | /** | 42 | /** |
| 30 | * 商户订单编号 | 43 | * 商户订单编号 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/api/transfer/dto/PayTransferCreateReqDTO.java
| 1 | package cn.iocoder.yudao.module.pay.api.transfer.dto; | 1 | package cn.iocoder.yudao.module.pay.api.transfer.dto; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.StrUtil; | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 5 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 6 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 5 | import jakarta.validation.constraints.Min; | 7 | import jakarta.validation.constraints.Min; |
| 6 | import jakarta.validation.constraints.NotEmpty; | 8 | import jakarta.validation.constraints.NotEmpty; |
| 7 | import jakarta.validation.constraints.NotNull; | 9 | import jakarta.validation.constraints.NotNull; |
| @@ -27,22 +29,22 @@ public class PayTransferCreateReqDTO { | @@ -27,22 +29,22 @@ public class PayTransferCreateReqDTO { | ||
| 27 | private String appKey; | 29 | private String appKey; |
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | - * 转账渠道 | 32 | + * 用户 IP |
| 31 | */ | 33 | */ |
| 32 | - @NotEmpty(message = "转账渠道不能为空") | ||
| 33 | - private String channelCode; | 34 | + @NotEmpty(message = "用户 IP 不能为空") |
| 35 | + private String userIp; | ||
| 34 | 36 | ||
| 35 | /** | 37 | /** |
| 36 | - * 转账渠道的额外参数 | 38 | + * 用户编号 |
| 37 | */ | 39 | */ |
| 38 | - private Map<String, String> channelExtras; | ||
| 39 | - | 40 | + private Long userId; |
| 40 | /** | 41 | /** |
| 41 | - * 用户 IP | 42 | + * 用户类型 |
| 42 | */ | 43 | */ |
| 43 | - @NotEmpty(message = "用户 IP 不能为空") | ||
| 44 | - private String userIp; | 44 | + @InEnum(UserTypeEnum.class) |
| 45 | + private Integer userType; | ||
| 45 | 46 | ||
| 47 | + // ========== 商户相关字段 ========== | ||
| 46 | /** | 48 | /** |
| 47 | * 商户转账单编号 | 49 | * 商户转账单编号 |
| 48 | */ | 50 | */ |
| @@ -76,6 +78,17 @@ public class PayTransferCreateReqDTO { | @@ -76,6 +78,17 @@ public class PayTransferCreateReqDTO { | ||
| 76 | private String userName; | 78 | private String userName; |
| 77 | 79 | ||
| 78 | /** | 80 | /** |
| 81 | + * 转账渠道 | ||
| 82 | + */ | ||
| 83 | + @NotEmpty(message = "转账渠道不能为空") | ||
| 84 | + private String channelCode; | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 转账渠道的额外参数 | ||
| 88 | + */ | ||
| 89 | + private Map<String, String> channelExtras; | ||
| 90 | + | ||
| 91 | + /** | ||
| 79 | * 【微信】现金营销场景 | 92 | * 【微信】现金营销场景 |
| 80 | * | 93 | * |
| 81 | * @param activityName 活动名称 | 94 | * @param activityName 活动名称 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/demo/PayDemoWithdrawController.java
| @@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated; | @@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated; | ||
| 19 | import org.springframework.web.bind.annotation.*; | 19 | import org.springframework.web.bind.annotation.*; |
| 20 | 20 | ||
| 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 22 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 22 | 23 | ||
| 23 | @Tag(name = "管理后台 - 示例提现订单") // 目的:演示转账功能 | 24 | @Tag(name = "管理后台 - 示例提现订单") // 目的:演示转账功能 |
| 24 | @RestController | 25 | @RestController |
| @@ -40,7 +41,7 @@ public class PayDemoWithdrawController { | @@ -40,7 +41,7 @@ public class PayDemoWithdrawController { | ||
| 40 | @Operation(summary = "提现单转账") | 41 | @Operation(summary = "提现单转账") |
| 41 | @Parameter(name = "id", required = true, description = "提现单编号", example = "1024") | 42 | @Parameter(name = "id", required = true, description = "提现单编号", example = "1024") |
| 42 | public CommonResult<Long> transferDemoWithdraw(@RequestParam("id") Long id) { | 43 | public CommonResult<Long> transferDemoWithdraw(@RequestParam("id") Long id) { |
| 43 | - Long payTransferId = demoWithdrawService.transferDemoWithdraw(id); | 44 | + Long payTransferId = demoWithdrawService.transferDemoWithdraw(id, getLoginUserId()); |
| 44 | return success(payTransferId); | 45 | return success(payTransferId); |
| 45 | } | 46 | } |
| 46 | 47 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExcelVO.java
| @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; |
| 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelProperty; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| 10 | import java.time.LocalDateTime; | 10 | import java.time.LocalDateTime; |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java
| @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; |
| 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelProperty; |
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | 9 | ||
| 10 | import java.time.LocalDateTime; | 10 | import java.time.LocalDateTime; |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/transfer/vo/PayTransferRespVO.java
| @@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | @@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert; |
| 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; |
| 7 | 7 | ||
| 8 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 9 | -import com.alibaba.excel.annotation.ExcelProperty; | 8 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 9 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 10 | import io.swagger.v3.oas.annotations.media.Schema; | 10 | import io.swagger.v3.oas.annotations.media.Schema; |
| 11 | import lombok.*; | 11 | import lombok.*; |
| 12 | import java.time.LocalDateTime; | 12 | import java.time.LocalDateTime; |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java
| 1 | package cn.iocoder.yudao.module.pay.controller.app.order; | 1 | package cn.iocoder.yudao.module.pay.controller.app.order; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.ObjUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderRespVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderRespVO; |
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO; | 8 | import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO; |
| 8 | import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO; | 9 | import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO; |
| 9 | -import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert; | ||
| 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; |
| 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 12 | import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | 12 | import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; |
| @@ -52,6 +52,15 @@ public class AppPayOrderController { | @@ -52,6 +52,15 @@ public class AppPayOrderController { | ||
| 52 | public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id, | 52 | public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id, |
| 53 | @RequestParam(value = "sync", required = false) Boolean sync) { | 53 | @RequestParam(value = "sync", required = false) Boolean sync) { |
| 54 | PayOrderDO order = payOrderService.getOrder(id); | 54 | PayOrderDO order = payOrderService.getOrder(id); |
| 55 | + if (order== null) { | ||
| 56 | + return success(null); | ||
| 57 | + } | ||
| 58 | + // 重要:校验订单是否是当前用户,避免越权 | ||
| 59 | + if (order.getUserId() != null // 特殊:早期订单未存储 userId,所以忽略 | ||
| 60 | + && ObjUtil.notEqual(order.getUserId(), getLoginUserId())) { | ||
| 61 | + return success(null); | ||
| 62 | + } | ||
| 63 | + | ||
| 55 | // sync 仅在等待支付 | 64 | // sync 仅在等待支付 |
| 56 | if (Boolean.TRUE.equals(sync) && PayOrderStatusEnum.isWaiting(order.getStatus())) { | 65 | if (Boolean.TRUE.equals(sync) && PayOrderStatusEnum.isWaiting(order.getStatus())) { |
| 57 | payOrderService.syncOrderQuietly(order.getId()); | 66 | payOrderService.syncOrderQuietly(order.getId()); |
| @@ -75,7 +84,7 @@ public class AppPayOrderController { | @@ -75,7 +84,7 @@ public class AppPayOrderController { | ||
| 75 | 84 | ||
| 76 | // 2. 提交支付 | 85 | // 2. 提交支付 |
| 77 | PayOrderSubmitRespVO respVO = payOrderService.submitOrder(reqVO, getClientIP()); | 86 | PayOrderSubmitRespVO respVO = payOrderService.submitOrder(reqVO, getClientIP()); |
| 78 | - return success(PayOrderConvert.INSTANCE.convert3(respVO)); | 87 | + return success(BeanUtils.toBean(respVO, AppPayOrderSubmitRespVO.class)); |
| 79 | } | 88 | } |
| 80 | 89 | ||
| 81 | } | 90 | } |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java
| @@ -3,14 +3,13 @@ package cn.iocoder.yudao.module.pay.convert.order; | @@ -3,14 +3,13 @@ package cn.iocoder.yudao.module.pay.convert.order; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | -import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 7 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 6 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 8 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; | 7 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; |
| 9 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; | 8 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; |
| 10 | -import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO; | ||
| 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; |
| 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; |
| 13 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; | 11 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 14 | import org.mapstruct.Mapper; | 13 | import org.mapstruct.Mapper; |
| 15 | import org.mapstruct.Mapping; | 14 | import org.mapstruct.Mapping; |
| 16 | import org.mapstruct.factory.Mappers; | 15 | import org.mapstruct.factory.Mappers; |
| @@ -69,6 +68,4 @@ public interface PayOrderConvert { | @@ -69,6 +68,4 @@ public interface PayOrderConvert { | ||
| 69 | @Mapping(source = "order.status", target = "status") | 68 | @Mapping(source = "order.status", target = "status") |
| 70 | PayOrderSubmitRespVO convert(PayOrderDO order, cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO respDTO); | 69 | PayOrderSubmitRespVO convert(PayOrderDO order, cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO respDTO); |
| 71 | 70 | ||
| 72 | - AppPayOrderSubmitRespVO convert3(PayOrderSubmitRespVO bean); | ||
| 73 | - | ||
| 74 | } | 71 | } |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java
| @@ -49,6 +49,15 @@ public class PayOrderDO extends BaseDO { | @@ -49,6 +49,15 @@ public class PayOrderDO extends BaseDO { | ||
| 49 | */ | 49 | */ |
| 50 | private String channelCode; | 50 | private String channelCode; |
| 51 | 51 | ||
| 52 | + /** | ||
| 53 | + * 用户编号 | ||
| 54 | + */ | ||
| 55 | + private Long userId; | ||
| 56 | + /** | ||
| 57 | + * 用户类型 | ||
| 58 | + */ | ||
| 59 | + private Integer userType; | ||
| 60 | + | ||
| 52 | // ========== 商户相关字段 ========== | 61 | // ========== 商户相关字段 ========== |
| 53 | 62 | ||
| 54 | /** | 63 | /** |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java
| @@ -77,6 +77,15 @@ public class PayRefundDO extends BaseDO { | @@ -77,6 +77,15 @@ public class PayRefundDO extends BaseDO { | ||
| 77 | */ | 77 | */ |
| 78 | private String orderNo; | 78 | private String orderNo; |
| 79 | 79 | ||
| 80 | + /** | ||
| 81 | + * 用户编号 | ||
| 82 | + */ | ||
| 83 | + private Long userId; | ||
| 84 | + /** | ||
| 85 | + * 用户类型 | ||
| 86 | + */ | ||
| 87 | + private Integer userType; | ||
| 88 | + | ||
| 80 | // ========== 商户相关字段 ========== | 89 | // ========== 商户相关字段 ========== |
| 81 | /** | 90 | /** |
| 82 | * 商户订单编号 | 91 | * 商户订单编号 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java
| @@ -30,7 +30,6 @@ public class PayTransferDO extends BaseDO { | @@ -30,7 +30,6 @@ public class PayTransferDO extends BaseDO { | ||
| 30 | */ | 30 | */ |
| 31 | @TableId | 31 | @TableId |
| 32 | private Long id; | 32 | private Long id; |
| 33 | - | ||
| 34 | /** | 33 | /** |
| 35 | * 转账单号 | 34 | * 转账单号 |
| 36 | */ | 35 | */ |
| @@ -42,14 +41,12 @@ public class PayTransferDO extends BaseDO { | @@ -42,14 +41,12 @@ public class PayTransferDO extends BaseDO { | ||
| 42 | * 关联 {@link PayAppDO#getId()} | 41 | * 关联 {@link PayAppDO#getId()} |
| 43 | */ | 42 | */ |
| 44 | private Long appId; | 43 | private Long appId; |
| 45 | - | ||
| 46 | /** | 44 | /** |
| 47 | * 转账渠道编号 | 45 | * 转账渠道编号 |
| 48 | * | 46 | * |
| 49 | * 关联 {@link PayChannelDO#getId()} | 47 | * 关联 {@link PayChannelDO#getId()} |
| 50 | */ | 48 | */ |
| 51 | private Long channelId; | 49 | private Long channelId; |
| 52 | - | ||
| 53 | /** | 50 | /** |
| 54 | * 转账渠道编码 | 51 | * 转账渠道编码 |
| 55 | * | 52 | * |
| @@ -57,6 +54,15 @@ public class PayTransferDO extends BaseDO { | @@ -57,6 +54,15 @@ public class PayTransferDO extends BaseDO { | ||
| 57 | */ | 54 | */ |
| 58 | private String channelCode; | 55 | private String channelCode; |
| 59 | 56 | ||
| 57 | + /** | ||
| 58 | + * 用户编号 | ||
| 59 | + */ | ||
| 60 | + private Long userId; | ||
| 61 | + /** | ||
| 62 | + * 用户类型 | ||
| 63 | + */ | ||
| 64 | + private Integer userType; | ||
| 65 | + | ||
| 60 | // ========== 商户相关字段 ========== | 66 | // ========== 商户相关字段 ========== |
| 61 | /** | 67 | /** |
| 62 | * 商户转账单编号 | 68 | * 商户转账单编号 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.demo; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.demo; | ||
| 3 | import cn.hutool.core.lang.Assert; | 3 | import cn.hutool.core.lang.Assert; |
| 4 | import cn.hutool.core.util.ObjUtil; | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | import cn.hutool.core.util.ObjectUtil; | 5 | import cn.hutool.core.util.ObjectUtil; |
| 6 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | import cn.iocoder.yudao.module.pay.api.order.PayOrderApi; | 9 | import cn.iocoder.yudao.module.pay.api.order.PayOrderApi; |
| @@ -90,6 +91,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService { | @@ -90,6 +91,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService { | ||
| 90 | // 2.1 创建支付单 | 91 | // 2.1 创建支付单 |
| 91 | Long payOrderId = payOrderApi.createOrder(new PayOrderCreateReqDTO() | 92 | Long payOrderId = payOrderApi.createOrder(new PayOrderCreateReqDTO() |
| 92 | .setAppKey(PAY_APP_KEY).setUserIp(getClientIP()) // 支付应用 | 93 | .setAppKey(PAY_APP_KEY).setUserIp(getClientIP()) // 支付应用 |
| 94 | + .setUserId(userId).setUserType(UserTypeEnum.ADMIN.getValue()) // 用户信息 | ||
| 93 | .setMerchantOrderId(demoOrder.getId().toString()) // 业务的订单编号 | 95 | .setMerchantOrderId(demoOrder.getId().toString()) // 业务的订单编号 |
| 94 | .setSubject(spuName).setBody("").setPrice(price) // 价格信息 | 96 | .setSubject(spuName).setBody("").setPrice(price) // 价格信息 |
| 95 | .setExpireTime(addTime(Duration.ofHours(2L)))); // 支付的过期时间 | 97 | .setExpireTime(addTime(Duration.ofHours(2L)))); // 支付的过期时间 |
| @@ -189,6 +191,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService { | @@ -189,6 +191,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService { | ||
| 189 | // 2.2 创建退款单 | 191 | // 2.2 创建退款单 |
| 190 | Long payRefundId = payRefundApi.createRefund(new PayRefundCreateReqDTO() | 192 | Long payRefundId = payRefundApi.createRefund(new PayRefundCreateReqDTO() |
| 191 | .setAppKey(PAY_APP_KEY).setUserIp(getClientIP()) // 支付应用 | 193 | .setAppKey(PAY_APP_KEY).setUserIp(getClientIP()) // 支付应用 |
| 194 | + .setUserId(order.getUserId()).setUserType(UserTypeEnum.ADMIN.getValue()) // 用户信息 | ||
| 192 | .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 | 195 | .setMerchantOrderId(String.valueOf(order.getId())) // 支付单号 |
| 193 | .setMerchantRefundId(refundId) | 196 | .setMerchantRefundId(refundId) |
| 194 | .setReason("想退钱").setPrice(order.getPrice()));// 价格信息 | 197 | .setReason("想退钱").setPrice(order.getPrice()));// 价格信息 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoWithdrawService.java
| @@ -26,9 +26,10 @@ public interface PayDemoWithdrawService { | @@ -26,9 +26,10 @@ public interface PayDemoWithdrawService { | ||
| 26 | * 提现单转账 | 26 | * 提现单转账 |
| 27 | * | 27 | * |
| 28 | * @param id 提现单编号 | 28 | * @param id 提现单编号 |
| 29 | + * @param userId 用户编号 | ||
| 29 | * @return 转账编号 | 30 | * @return 转账编号 |
| 30 | */ | 31 | */ |
| 31 | - Long transferDemoWithdraw(Long id); | 32 | + Long transferDemoWithdraw(Long id, Long userId); |
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * 获得示例提现单分页 | 35 | * 获得示例提现单分页 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoWithdrawServiceImpl.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.demo; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.demo; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.lang.Assert; | 3 | import cn.hutool.core.lang.Assert; |
| 4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 8 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| @@ -60,7 +61,7 @@ public class PayDemoWithdrawServiceImpl implements PayDemoWithdrawService { | @@ -60,7 +61,7 @@ public class PayDemoWithdrawServiceImpl implements PayDemoWithdrawService { | ||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | @Override | 63 | @Override |
| 63 | - public Long transferDemoWithdraw(Long id) { | 64 | + public Long transferDemoWithdraw(Long id, Long userId) { |
| 64 | // 1.1 校验提现单 | 65 | // 1.1 校验提现单 |
| 65 | PayDemoWithdrawDO withdraw = validateDemoWithdrawCanTransfer(id); | 66 | PayDemoWithdrawDO withdraw = validateDemoWithdrawCanTransfer(id); |
| 66 | // 1.2 特殊:如果是转账失败的情况,需要充值下 | 67 | // 1.2 特殊:如果是转账失败的情况,需要充值下 |
| @@ -76,6 +77,7 @@ public class PayDemoWithdrawServiceImpl implements PayDemoWithdrawService { | @@ -76,6 +77,7 @@ public class PayDemoWithdrawServiceImpl implements PayDemoWithdrawService { | ||
| 76 | // 2.1 创建支付单 | 77 | // 2.1 创建支付单 |
| 77 | PayTransferCreateReqDTO transferReqDTO = new PayTransferCreateReqDTO() | 78 | PayTransferCreateReqDTO transferReqDTO = new PayTransferCreateReqDTO() |
| 78 | .setAppKey(PAY_APP_KEY).setChannelCode(withdraw.getTransferChannelCode()).setUserIp(getClientIP()) // 支付应用 | 79 | .setAppKey(PAY_APP_KEY).setChannelCode(withdraw.getTransferChannelCode()).setUserIp(getClientIP()) // 支付应用 |
| 80 | + .setUserId(userId).setUserType(UserTypeEnum.ADMIN.getValue()) // 用户信息 | ||
| 79 | .setMerchantTransferId(String.valueOf(withdraw.getId())) // 业务的订单编号 | 81 | .setMerchantTransferId(String.valueOf(withdraw.getId())) // 业务的订单编号 |
| 80 | .setSubject(withdraw.getSubject()).setPrice(withdraw.getPrice()) // 价格信息 | 82 | .setSubject(withdraw.getSubject()).setPrice(withdraw.getPrice()) // 价格信息 |
| 81 | .setUserAccount(withdraw.getUserAccount()).setUserName(withdraw.getUserName()); // 收款信息 | 83 | .setUserAccount(withdraw.getUserAccount()).setUserName(withdraw.getUserName()); // 收款信息 |
yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
| @@ -64,8 +64,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | @@ -64,8 +64,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | ||
| 64 | private PayWalletService payWalletService; | 64 | private PayWalletService payWalletService; |
| 65 | @Resource | 65 | @Resource |
| 66 | private PayOrderService payOrderService; | 66 | private PayOrderService payOrderService; |
| 67 | -// @Resource | ||
| 68 | -// private PayRefundService payRefundService; | ||
| 69 | @Resource | 67 | @Resource |
| 70 | private PayWalletRechargePackageService payWalletRechargePackageService; | 68 | private PayWalletRechargePackageService payWalletRechargePackageService; |
| 71 | 69 | ||
| @@ -99,6 +97,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | @@ -99,6 +97,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | ||
| 99 | // 2.1 创建支付单 | 97 | // 2.1 创建支付单 |
| 100 | Long payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO() | 98 | Long payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO() |
| 101 | .setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp) | 99 | .setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp) |
| 100 | + .setUserId(userId).setUserType(userType) // 用户信息 | ||
| 102 | .setMerchantOrderId(recharge.getId().toString()) // 业务的订单编号 | 101 | .setMerchantOrderId(recharge.getId().toString()) // 业务的订单编号 |
| 103 | .setSubject(WALLET_RECHARGE_ORDER_SUBJECT).setBody("") | 102 | .setSubject(WALLET_RECHARGE_ORDER_SUBJECT).setBody("") |
| 104 | .setPrice(recharge.getPayPrice()) | 103 | .setPrice(recharge.getPayPrice()) |
| @@ -209,6 +208,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | @@ -209,6 +208,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | ||
| 209 | String refundId = walletRechargeId + "-refund"; | 208 | String refundId = walletRechargeId + "-refund"; |
| 210 | Long payRefundId = payRefundApi.createRefund(new PayRefundCreateReqDTO() | 209 | Long payRefundId = payRefundApi.createRefund(new PayRefundCreateReqDTO() |
| 211 | .setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp) | 210 | .setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp) |
| 211 | + .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()) // 用户信息 | ||
| 212 | .setMerchantOrderId(walletRechargeId) | 212 | .setMerchantOrderId(walletRechargeId) |
| 213 | .setMerchantRefundId(refundId) | 213 | .setMerchantRefundId(refundId) |
| 214 | .setReason("想退钱").setPrice(walletRecharge.getPayPrice())); | 214 | .setReason("想退钱").setPrice(walletRecharge.getPayPrice())); |
yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java
| @@ -11,12 +11,12 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; | @@ -11,12 +11,12 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; | ||
| 11 | import cn.iocoder.yudao.module.pay.dal.mysql.app.PayAppMapper; | 11 | import cn.iocoder.yudao.module.pay.dal.mysql.app.PayAppMapper; |
| 12 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | 12 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 13 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; | 13 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; |
| 14 | +import jakarta.annotation.Resource; | ||
| 14 | import org.junit.jupiter.api.Disabled; | 15 | import org.junit.jupiter.api.Disabled; |
| 15 | import org.junit.jupiter.api.Test; | 16 | import org.junit.jupiter.api.Test; |
| 16 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 17 | import org.springframework.context.annotation.Import; | 17 | import org.springframework.context.annotation.Import; |
| 18 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 18 | 19 | ||
| 19 | -import jakarta.annotation.Resource; | ||
| 20 | import java.util.Map; | 20 | import java.util.Map; |
| 21 | 21 | ||
| 22 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 22 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| @@ -46,9 +46,9 @@ public class PayAppServiceTest extends BaseDbUnitTest { | @@ -46,9 +46,9 @@ public class PayAppServiceTest extends BaseDbUnitTest { | ||
| 46 | @Resource | 46 | @Resource |
| 47 | private PayAppMapper appMapper; | 47 | private PayAppMapper appMapper; |
| 48 | 48 | ||
| 49 | - @MockBean | 49 | + @MockitoBean |
| 50 | private PayOrderService orderService; | 50 | private PayOrderService orderService; |
| 51 | - @MockBean | 51 | + @MockitoBean |
| 52 | private PayRefundService refundService; | 52 | private PayRefundService refundService; |
| 53 | 53 | ||
| 54 | @Test | 54 | @Test |
yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
| @@ -2,23 +2,23 @@ package cn.iocoder.yudao.module.pay.service.channel; | @@ -2,23 +2,23 @@ package cn.iocoder.yudao.module.pay.service.channel; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 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 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 5 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 11 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; |
| 12 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; |
| 13 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; |
| 14 | import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; | 9 | import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper; |
| 10 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | ||
| 11 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | ||
| 12 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClientFactory; | ||
| 13 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | ||
| 14 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.WxPayClientConfig; | ||
| 15 | import com.alibaba.fastjson.JSON; | 15 | import com.alibaba.fastjson.JSON; |
| 16 | +import jakarta.annotation.Resource; | ||
| 17 | +import jakarta.validation.Validator; | ||
| 16 | import org.junit.jupiter.api.Test; | 18 | import org.junit.jupiter.api.Test; |
| 17 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 18 | import org.springframework.context.annotation.Import; | 19 | import org.springframework.context.annotation.Import; |
| 20 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 19 | 21 | ||
| 20 | -import jakarta.annotation.Resource; | ||
| 21 | -import jakarta.validation.Validator; | ||
| 22 | import java.util.Collections; | 22 | import java.util.Collections; |
| 23 | import java.util.List; | 23 | import java.util.List; |
| 24 | 24 | ||
| @@ -28,7 +28,8 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | @@ -28,7 +28,8 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | ||
| 28 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; | 28 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; |
| 29 | import static org.junit.jupiter.api.Assertions.*; | 29 | import static org.junit.jupiter.api.Assertions.*; |
| 30 | import static org.mockito.ArgumentMatchers.eq; | 30 | import static org.mockito.ArgumentMatchers.eq; |
| 31 | -import static org.mockito.Mockito.*; | 31 | +import static org.mockito.Mockito.mock; |
| 32 | +import static org.mockito.Mockito.when; | ||
| 32 | 33 | ||
| 33 | @Import({PayChannelServiceImpl.class}) | 34 | @Import({PayChannelServiceImpl.class}) |
| 34 | public class PayChannelServiceTest extends BaseDbUnitTest { | 35 | public class PayChannelServiceTest extends BaseDbUnitTest { |
| @@ -39,9 +40,9 @@ public class PayChannelServiceTest extends BaseDbUnitTest { | @@ -39,9 +40,9 @@ public class PayChannelServiceTest extends BaseDbUnitTest { | ||
| 39 | @Resource | 40 | @Resource |
| 40 | private PayChannelMapper channelMapper; | 41 | private PayChannelMapper channelMapper; |
| 41 | 42 | ||
| 42 | - @MockBean | 43 | + @MockitoBean |
| 43 | private PayClientFactory payClientFactory; | 44 | private PayClientFactory payClientFactory; |
| 44 | - @MockBean | 45 | + @MockitoBean |
| 45 | private Validator validator; | 46 | private Validator validator; |
| 46 | 47 | ||
| 47 | @Test | 48 | @Test |
yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java
| @@ -18,15 +18,15 @@ import cn.iocoder.yudao.module.pay.framework.job.config.PayJobConfiguration; | @@ -18,15 +18,15 @@ import cn.iocoder.yudao.module.pay.framework.job.config.PayJobConfiguration; | ||
| 18 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | 18 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 19 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; | 19 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; |
| 20 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundServiceImpl; | 20 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundServiceImpl; |
| 21 | +import jakarta.annotation.Resource; | ||
| 21 | import org.junit.jupiter.api.Disabled; | 22 | import org.junit.jupiter.api.Disabled; |
| 22 | import org.junit.jupiter.api.Test; | 23 | import org.junit.jupiter.api.Test; |
| 23 | import org.mockito.MockedStatic; | 24 | import org.mockito.MockedStatic; |
| 24 | import org.redisson.api.RLock; | 25 | import org.redisson.api.RLock; |
| 25 | import org.redisson.api.RedissonClient; | 26 | import org.redisson.api.RedissonClient; |
| 26 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 27 | import org.springframework.context.annotation.Import; | 27 | import org.springframework.context.annotation.Import; |
| 28 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 28 | 29 | ||
| 29 | -import jakarta.annotation.Resource; | ||
| 30 | import java.time.Duration; | 30 | import java.time.Duration; |
| 31 | import java.util.List; | 31 | import java.util.List; |
| 32 | 32 | ||
| @@ -54,9 +54,9 @@ public class PayNotifyServiceTest extends BaseDbUnitTest { | @@ -54,9 +54,9 @@ public class PayNotifyServiceTest extends BaseDbUnitTest { | ||
| 54 | @Resource | 54 | @Resource |
| 55 | private PayNotifyServiceImpl notifyService; | 55 | private PayNotifyServiceImpl notifyService; |
| 56 | 56 | ||
| 57 | - @MockBean | 57 | + @MockitoBean |
| 58 | private PayOrderService orderService; | 58 | private PayOrderService orderService; |
| 59 | - @MockBean | 59 | + @MockitoBean |
| 60 | private PayRefundService refundService; | 60 | private PayRefundService refundService; |
| 61 | 61 | ||
| 62 | @Resource | 62 | @Resource |
| @@ -64,7 +64,7 @@ public class PayNotifyServiceTest extends BaseDbUnitTest { | @@ -64,7 +64,7 @@ public class PayNotifyServiceTest extends BaseDbUnitTest { | ||
| 64 | @Resource | 64 | @Resource |
| 65 | private PayNotifyLogMapper notifyLogMapper; | 65 | private PayNotifyLogMapper notifyLogMapper; |
| 66 | 66 | ||
| 67 | - @MockBean | 67 | + @MockitoBean |
| 68 | private RedissonClient redissonClient; | 68 | private RedissonClient redissonClient; |
| 69 | 69 | ||
| 70 | @Test | 70 | @Test |
yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
| @@ -2,10 +2,6 @@ package cn.iocoder.yudao.module.pay.service.order; | @@ -2,10 +2,6 @@ package cn.iocoder.yudao.module.pay.service.order; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.extra.spring.SpringUtil; | 3 | import cn.hutool.extra.spring.SpringUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 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; | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; | 5 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; |
| 10 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 6 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 11 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| @@ -19,9 +15,13 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; | @@ -19,9 +15,13 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; | ||
| 19 | import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderExtensionMapper; | 15 | import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderExtensionMapper; |
| 20 | import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; | 16 | import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; |
| 21 | import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; | 17 | import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; |
| 18 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | ||
| 22 | import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; | 19 | import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; |
| 23 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | 20 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 24 | import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties; | 21 | import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties; |
| 22 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | ||
| 23 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO; | ||
| 24 | +import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum; | ||
| 25 | import cn.iocoder.yudao.module.pay.service.app.PayAppService; | 25 | import cn.iocoder.yudao.module.pay.service.app.PayAppService; |
| 26 | import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; | 26 | import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; |
| 27 | import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; | 27 | import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; |
| @@ -29,8 +29,8 @@ import jakarta.annotation.Resource; | @@ -29,8 +29,8 @@ import jakarta.annotation.Resource; | ||
| 29 | import org.junit.jupiter.api.BeforeEach; | 29 | import org.junit.jupiter.api.BeforeEach; |
| 30 | import org.junit.jupiter.api.Test; | 30 | import org.junit.jupiter.api.Test; |
| 31 | import org.mockito.MockedStatic; | 31 | import org.mockito.MockedStatic; |
| 32 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 33 | import org.springframework.context.annotation.Import; | 32 | import org.springframework.context.annotation.Import; |
| 33 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 34 | 34 | ||
| 35 | import java.time.Duration; | 35 | import java.time.Duration; |
| 36 | import java.time.LocalDateTime; | 36 | import java.time.LocalDateTime; |
| @@ -65,13 +65,13 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { | @@ -65,13 +65,13 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { | ||
| 65 | @Resource | 65 | @Resource |
| 66 | private PayOrderExtensionMapper orderExtensionMapper; | 66 | private PayOrderExtensionMapper orderExtensionMapper; |
| 67 | 67 | ||
| 68 | - @MockBean | 68 | + @MockitoBean |
| 69 | private PayProperties properties; | 69 | private PayProperties properties; |
| 70 | - @MockBean | 70 | + @MockitoBean |
| 71 | private PayAppService appService; | 71 | private PayAppService appService; |
| 72 | - @MockBean | 72 | + @MockitoBean |
| 73 | private PayChannelService channelService; | 73 | private PayChannelService channelService; |
| 74 | - @MockBean | 74 | + @MockitoBean |
| 75 | private PayNotifyService notifyService; | 75 | private PayNotifyService notifyService; |
| 76 | 76 | ||
| 77 | @BeforeEach | 77 | @BeforeEach |
yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
| @@ -2,10 +2,6 @@ package cn.iocoder.yudao.module.pay.service.refund; | @@ -2,10 +2,6 @@ package cn.iocoder.yudao.module.pay.service.refund; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.extra.spring.SpringUtil; | 3 | import cn.hutool.extra.spring.SpringUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 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; | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; | 5 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; |
| 10 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; | 6 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 11 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| @@ -16,21 +12,25 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | @@ -16,21 +12,25 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | ||
| 16 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; | 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; |
| 17 | import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; | 13 | import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; |
| 18 | import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; | 14 | import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO; |
| 15 | +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum; | ||
| 19 | import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; | 16 | import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; |
| 20 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | 17 | import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; |
| 21 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | 18 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; |
| 22 | import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties; | 19 | import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties; |
| 20 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.PayClient; | ||
| 21 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO; | ||
| 22 | +import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 23 | import cn.iocoder.yudao.module.pay.service.app.PayAppService; | 23 | import cn.iocoder.yudao.module.pay.service.app.PayAppService; |
| 24 | import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; | 24 | import cn.iocoder.yudao.module.pay.service.channel.PayChannelService; |
| 25 | import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; | 25 | import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; |
| 26 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | 26 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 27 | +import jakarta.annotation.Resource; | ||
| 27 | import org.junit.jupiter.api.BeforeEach; | 28 | import org.junit.jupiter.api.BeforeEach; |
| 28 | import org.junit.jupiter.api.Test; | 29 | import org.junit.jupiter.api.Test; |
| 29 | import org.mockito.MockedStatic; | 30 | import org.mockito.MockedStatic; |
| 30 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 31 | import org.springframework.context.annotation.Import; | 31 | import org.springframework.context.annotation.Import; |
| 32 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 32 | 33 | ||
| 33 | -import jakarta.annotation.Resource; | ||
| 34 | import java.util.List; | 34 | import java.util.List; |
| 35 | 35 | ||
| 36 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 36 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| @@ -62,15 +62,15 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { | @@ -62,15 +62,15 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest { | ||
| 62 | @Resource | 62 | @Resource |
| 63 | private PayRefundMapper refundMapper; | 63 | private PayRefundMapper refundMapper; |
| 64 | 64 | ||
| 65 | - @MockBean | 65 | + @MockitoBean |
| 66 | private PayProperties payProperties; | 66 | private PayProperties payProperties; |
| 67 | - @MockBean | 67 | + @MockitoBean |
| 68 | private PayOrderService orderService; | 68 | private PayOrderService orderService; |
| 69 | - @MockBean | 69 | + @MockitoBean |
| 70 | private PayAppService appService; | 70 | private PayAppService appService; |
| 71 | - @MockBean | 71 | + @MockitoBean |
| 72 | private PayChannelService channelService; | 72 | private PayChannelService channelService; |
| 73 | - @MockBean | 73 | + @MockitoBean |
| 74 | private PayNotifyService notifyService; | 74 | private PayNotifyService notifyService; |
| 75 | 75 | ||
| 76 | @BeforeEach | 76 | @BeforeEach |
yudao-module-pay/src/test/resources/sql/clean.sql
| @@ -3,5 +3,6 @@ DELETE FROM pay_channel; | @@ -3,5 +3,6 @@ DELETE FROM pay_channel; | ||
| 3 | DELETE FROM pay_order; | 3 | DELETE FROM pay_order; |
| 4 | DELETE FROM pay_order_extension; | 4 | DELETE FROM pay_order_extension; |
| 5 | DELETE FROM pay_refund; | 5 | DELETE FROM pay_refund; |
| 6 | +DELETE FROM pay_transfer; | ||
| 6 | DELETE FROM pay_notify_task; | 7 | DELETE FROM pay_notify_task; |
| 7 | DELETE FROM pay_notify_log; | 8 | DELETE FROM pay_notify_log; |
yudao-module-pay/src/test/resources/sql/create_tables.sql
| @@ -45,6 +45,8 @@ CREATE TABLE IF NOT EXISTS `pay_order` ( | @@ -45,6 +45,8 @@ CREATE TABLE IF NOT EXISTS `pay_order` ( | ||
| 45 | `channel_fee_price` bigint(20) DEFAULT 0, | 45 | `channel_fee_price` bigint(20) DEFAULT 0, |
| 46 | `status` tinyint(4) NOT NULL, | 46 | `status` tinyint(4) NOT NULL, |
| 47 | `user_ip` varchar(50) NOT NULL, | 47 | `user_ip` varchar(50) NOT NULL, |
| 48 | + `user_id` bigint(20) DEFAULT NULL, | ||
| 49 | + `user_type` tinyint(4) DEFAULT NULL, | ||
| 48 | `expire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | 50 | `expire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 49 | `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, | 51 | `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, |
| 50 | `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, | 52 | `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP, |
| @@ -97,6 +99,8 @@ CREATE TABLE IF NOT EXISTS `pay_refund` ( | @@ -97,6 +99,8 @@ CREATE TABLE IF NOT EXISTS `pay_refund` ( | ||
| 97 | `refund_price` bigint(20) NOT NULL, | 99 | `refund_price` bigint(20) NOT NULL, |
| 98 | `reason` varchar(256) NOT NULL, | 100 | `reason` varchar(256) NOT NULL, |
| 99 | `user_ip` varchar(50) NULL DEFAULT NULL, | 101 | `user_ip` varchar(50) NULL DEFAULT NULL, |
| 102 | + `user_id` bigint(20) NULL DEFAULT NULL, | ||
| 103 | + `user_type` tinyint(4) NULL DEFAULT NULL, | ||
| 100 | `channel_order_no` varchar(64) NOT NULL, | 104 | `channel_order_no` varchar(64) NOT NULL, |
| 101 | `channel_refund_no` varchar(64) NULL DEFAULT NULL, | 105 | `channel_refund_no` varchar(64) NULL DEFAULT NULL, |
| 102 | `success_time` datetime(0) NULL DEFAULT NULL, | 106 | `success_time` datetime(0) NULL DEFAULT NULL, |
| @@ -145,3 +149,32 @@ CREATE TABLE IF NOT EXISTS `pay_notify_log` ( | @@ -145,3 +149,32 @@ CREATE TABLE IF NOT EXISTS `pay_notify_log` ( | ||
| 145 | `deleted` bit(1) NOT NULL DEFAULT FALSE, | 149 | `deleted` bit(1) NOT NULL DEFAULT FALSE, |
| 146 | PRIMARY KEY ("id") | 150 | PRIMARY KEY ("id") |
| 147 | ) COMMENT = '支付通知日志'; | 151 | ) COMMENT = '支付通知日志'; |
| 152 | + | ||
| 153 | +CREATE TABLE IF NOT EXISTS `pay_transfer` ( | ||
| 154 | + "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 155 | + `no` varchar(64) NOT NULL, | ||
| 156 | + `app_id` bigint(20) NOT NULL, | ||
| 157 | + `channel_id` bigint(20) NOT NULL, | ||
| 158 | + `channel_code` varchar(32) NOT NULL, | ||
| 159 | + `user_id` bigint(20) NULL DEFAULT NULL, | ||
| 160 | + `user_type` tinyint(4) NULL DEFAULT NULL, | ||
| 161 | + `merchant_transfer_id` varchar(64) NOT NULL, | ||
| 162 | + `price` bigint(20) NOT NULL, | ||
| 163 | + `subject` varchar(256) NOT NULL, | ||
| 164 | + `user_account` varchar(256) NOT NULL, | ||
| 165 | + `user_name` varchar(64) NULL DEFAULT NULL, | ||
| 166 | + `status` tinyint(4) NOT NULL, | ||
| 167 | + `notify_url` varchar(1024) NULL DEFAULT NULL, | ||
| 168 | + `channel_transfer_no` varchar(64) NULL DEFAULT NULL, | ||
| 169 | + `success_time` datetime(0) NULL DEFAULT NULL, | ||
| 170 | + `channel_error_code` varchar(128) NULL DEFAULT NULL, | ||
| 171 | + `channel_error_msg` varchar(256) NULL DEFAULT NULL, | ||
| 172 | + `channel_notify_data` varchar(1024) NULL DEFAULT NULL, | ||
| 173 | + `channel_extras` varchar(1024) NULL DEFAULT NULL, | ||
| 174 | + `creator` varchar(64) NULL DEFAULT '', | ||
| 175 | + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 176 | + `updater` varchar(64) NULL DEFAULT '', | ||
| 177 | + `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 178 | + `deleted` bit(1) NOT NULL DEFAULT FALSE, | ||
| 179 | + PRIMARY KEY ("id") | ||
| 180 | +) COMMENT = '转账单'; |
yudao-module-report/src/test/java/cn/iocoder/yudao/module/report/service/goview/GoViewDataServiceImplTest.java
| @@ -2,14 +2,14 @@ package cn.iocoder.yudao.module.report.service.goview; | @@ -2,14 +2,14 @@ package cn.iocoder.yudao.module.report.service.goview; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 4 | import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO; | 4 | import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO; |
| 5 | +import jakarta.annotation.Resource; | ||
| 5 | import org.junit.jupiter.api.Test; | 6 | import org.junit.jupiter.api.Test; |
| 6 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 7 | import org.springframework.context.annotation.Import; | 7 | import org.springframework.context.annotation.Import; |
| 8 | import org.springframework.jdbc.core.JdbcTemplate; | 8 | import org.springframework.jdbc.core.JdbcTemplate; |
| 9 | import org.springframework.jdbc.support.rowset.SqlRowSet; | 9 | import org.springframework.jdbc.support.rowset.SqlRowSet; |
| 10 | import org.springframework.jdbc.support.rowset.SqlRowSetMetaData; | 10 | import org.springframework.jdbc.support.rowset.SqlRowSetMetaData; |
| 11 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 11 | 12 | ||
| 12 | -import jakarta.annotation.Resource; | ||
| 13 | import java.util.Arrays; | 13 | import java.util.Arrays; |
| 14 | 14 | ||
| 15 | import static org.junit.jupiter.api.Assertions.assertEquals; | 15 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| @@ -23,7 +23,7 @@ public class GoViewDataServiceImplTest extends BaseDbUnitTest { | @@ -23,7 +23,7 @@ public class GoViewDataServiceImplTest extends BaseDbUnitTest { | ||
| 23 | @Resource | 23 | @Resource |
| 24 | private GoViewDataServiceImpl goViewDataService; | 24 | private GoViewDataServiceImpl goViewDataService; |
| 25 | 25 | ||
| 26 | - @MockBean | 26 | + @MockitoBean |
| 27 | private JdbcTemplate jdbcTemplate; | 27 | private JdbcTemplate jdbcTemplate; |
| 28 | 28 | ||
| 29 | @Test | 29 | @Test |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostSimpleRespVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; | 1 | package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; |
| 2 | 2 | ||
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | 3 | +import cn.idev.excel.annotation.ExcelProperty; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java
| @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.Oper | @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.Oper | ||
| 11 | import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogRespVO; | 11 | import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogRespVO; |
| 12 | import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; | 12 | import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; |
| 13 | import cn.iocoder.yudao.module.system.service.logger.OperateLogService; | 13 | import cn.iocoder.yudao.module.system.service.logger.OperateLogService; |
| 14 | +import com.fhs.core.trans.anno.TransMethodResult; | ||
| 14 | import io.swagger.v3.oas.annotations.Operation; | 15 | import io.swagger.v3.oas.annotations.Operation; |
| 15 | import io.swagger.v3.oas.annotations.tags.Tag; | 16 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 16 | import jakarta.annotation.Resource; | 17 | import jakarta.annotation.Resource; |
| @@ -40,6 +41,7 @@ public class OperateLogController { | @@ -40,6 +41,7 @@ public class OperateLogController { | ||
| 40 | @GetMapping("/page") | 41 | @GetMapping("/page") |
| 41 | @Operation(summary = "查看操作日志分页列表") | 42 | @Operation(summary = "查看操作日志分页列表") |
| 42 | @PreAuthorize("@ss.hasPermission('system:operate-log:query')") | 43 | @PreAuthorize("@ss.hasPermission('system:operate-log:query')") |
| 44 | + @TransMethodResult | ||
| 43 | public CommonResult<PageResult<OperateLogRespVO>> pageOperateLog(@Valid OperateLogPageReqVO pageReqVO) { | 45 | public CommonResult<PageResult<OperateLogRespVO>> pageOperateLog(@Valid OperateLogPageReqVO pageReqVO) { |
| 44 | PageResult<OperateLogDO> pageResult = operateLogService.getOperateLogPage(pageReqVO); | 46 | PageResult<OperateLogDO> pageResult = operateLogService.getOperateLogPage(pageReqVO); |
| 45 | return success(BeanUtils.toBean(pageResult, OperateLogRespVO.class)); | 47 | return success(BeanUtils.toBean(pageResult, OperateLogRespVO.class)); |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogRespVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog; | 1 | package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | 3 | import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; |
| 4 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 5 | -import com.alibaba.excel.annotation.ExcelProperty; | 4 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 5 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 6 | import com.fhs.core.trans.anno.Trans; | 6 | import com.fhs.core.trans.anno.Trans; |
| 7 | import com.fhs.core.trans.constant.TransType; | 7 | import com.fhs.core.trans.constant.TransType; |
| 8 | import com.fhs.core.trans.vo.VO; | 8 | import com.fhs.core.trans.vo.VO; |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.permission.vo.role; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.permission.vo.role; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import jakarta.validation.constraints.NotBlank; | 9 | import jakarta.validation.constraints.NotBlank; |
| 10 | import lombok.Data; | 10 | import lombok.Data; |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogRespVO.java
| @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert; |
| 6 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 6 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 7 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | 7 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 8 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 9 | import io.swagger.v3.oas.annotations.media.Schema; | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | import lombok.Data; | 10 | import lombok.Data; |
| 11 | 11 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserImportExcelVO.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelProperty; |
| 7 | import lombok.AllArgsConstructor; | 7 | import lombok.AllArgsConstructor; |
| 8 | import lombok.Builder; | 8 | import lombok.Builder; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.system.enums.DictTypeConstants; |
| 6 | -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | 10 |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserUpdateStatusReqVO.java
| @@ -2,10 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | @@ -2,10 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 5 | +import cn.iocoder.yudao.framework.dict.validation.InDict; | ||
| 6 | +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import lombok.Data; | ||
| 7 | - | ||
| 8 | import jakarta.validation.constraints.NotNull; | 8 | import jakarta.validation.constraints.NotNull; |
| 9 | +import lombok.Data; | ||
| 9 | 10 | ||
| 10 | @Schema(description = "管理后台 - 用户更新状态 Request VO") | 11 | @Schema(description = "管理后台 - 用户更新状态 Request VO") |
| 11 | @Data | 12 | @Data |
| @@ -18,6 +19,7 @@ public class UserUpdateStatusReqVO { | @@ -18,6 +19,7 @@ public class UserUpdateStatusReqVO { | ||
| 18 | @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 19 | @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 19 | @NotNull(message = "状态不能为空") | 20 | @NotNull(message = "状态不能为空") |
| 20 | @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") | 21 | @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") |
| 22 | + @InDict(type = DictTypeConstants.COMMON_STATUS) | ||
| 21 | private Integer status; | 23 | private Integer status; |
| 22 | 24 | ||
| 23 | } | 25 | } |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/PictureWordCaptchaServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.framework.captcha.core; | ||
| 2 | + | ||
| 3 | +import com.anji.captcha.model.common.RepCodeEnum; | ||
| 4 | +import com.anji.captcha.model.common.ResponseModel; | ||
| 5 | +import com.anji.captcha.model.vo.CaptchaVO; | ||
| 6 | +import com.anji.captcha.service.impl.AbstractCaptchaService; | ||
| 7 | +import com.anji.captcha.service.impl.CaptchaServiceFactory; | ||
| 8 | +import com.anji.captcha.util.AESUtil; | ||
| 9 | +import com.anji.captcha.util.ImageUtils; | ||
| 10 | +import com.anji.captcha.util.RandomUtils; | ||
| 11 | +import org.apache.commons.lang3.StringUtils; | ||
| 12 | +import cn.hutool.core.util.RandomUtil; | ||
| 13 | + | ||
| 14 | +import java.awt.*; | ||
| 15 | +import java.awt.geom.AffineTransform; | ||
| 16 | +import java.awt.image.BufferedImage; | ||
| 17 | +import java.util.Properties; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 图片文字验证码 | ||
| 21 | + * | ||
| 22 | + * @author Tsui | ||
| 23 | + * @since 2025/7/23 20:44 | ||
| 24 | + */ | ||
| 25 | +public class PictureWordCaptchaServiceImpl extends AbstractCaptchaService { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 验证码的基础字符 | ||
| 29 | + */ | ||
| 30 | + private static final String CHARACTERS = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; | ||
| 31 | + /** | ||
| 32 | + * 验证码长度 | ||
| 33 | + */ | ||
| 34 | + private static final Integer LENGTH = 4; | ||
| 35 | + | ||
| 36 | + private static final int WIDTH = 120; | ||
| 37 | + private static final int HEIGHT = 40; | ||
| 38 | + private static final int LINES = 10; | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void init(Properties config) { | ||
| 42 | + super.init(config); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void destroy(Properties config) { | ||
| 47 | + logger.info("start-clear-history-data-{}", captchaType()); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public String captchaType() { | ||
| 52 | + return "pictureWord"; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public ResponseModel get(CaptchaVO captchaVO) { | ||
| 57 | + String text = generateRandomText(LENGTH); | ||
| 58 | + CaptchaVO imageData = getImageData(text); | ||
| 59 | + // pointJson 不传到前端,只做后端校验,测试时放开 | ||
| 60 | +// imageData.setPointJson(text); | ||
| 61 | + return ResponseModel.successData(imageData); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public ResponseModel check(CaptchaVO captchaVO) { | ||
| 66 | + ResponseModel r = super.check(captchaVO); | ||
| 67 | + if (!validatedReq(r)) { | ||
| 68 | + return r; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + // 取出验证码 | ||
| 72 | + String codeKey = String.format(REDIS_CAPTCHA_KEY, captchaVO.getToken()); | ||
| 73 | + if (!CaptchaServiceFactory.getCache(cacheType).exists(codeKey)) { | ||
| 74 | + return ResponseModel.errorMsg(RepCodeEnum.API_CAPTCHA_INVALID); | ||
| 75 | + } | ||
| 76 | + // 正确的验证码 | ||
| 77 | + String codeValue = CaptchaServiceFactory.getCache(cacheType).get(codeKey); | ||
| 78 | + String code = getCodeByCodeValue(codeValue); | ||
| 79 | + String secretKey = getSecretKeyByCodeValue(codeValue); | ||
| 80 | + // 验证码只用一次,即刻失效 | ||
| 81 | + CaptchaServiceFactory.getCache(cacheType).delete(codeKey); | ||
| 82 | + | ||
| 83 | + // 用户输入的验证码(CaptchaVO 中 没有预留字段,暂时用 pointJson 无需加解密) | ||
| 84 | + String userCode = captchaVO.getPointJson(); | ||
| 85 | + if (!StringUtils.equalsIgnoreCase(code, userCode)) { | ||
| 86 | + afterValidateFail(captchaVO); | ||
| 87 | + return ResponseModel.errorMsg(RepCodeEnum.API_CAPTCHA_COORDINATE_ERROR); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + // 校验成功,将信息存入缓存 | ||
| 91 | + String value; | ||
| 92 | + try { | ||
| 93 | + value = AESUtil.aesEncrypt(captchaVO.getToken().concat("---").concat(userCode), secretKey); | ||
| 94 | + } catch (Exception e) { | ||
| 95 | + logger.error("AES 加密失败", e); | ||
| 96 | + afterValidateFail(captchaVO); | ||
| 97 | + return ResponseModel.errorMsg(e.getMessage()); | ||
| 98 | + } | ||
| 99 | + String secondKey = String.format(REDIS_SECOND_CAPTCHA_KEY, value); | ||
| 100 | + CaptchaServiceFactory.getCache(cacheType).set(secondKey, captchaVO.getToken(), EXPIRESIN_THREE); | ||
| 101 | + captchaVO.setResult(true); | ||
| 102 | + captchaVO.resetClientFlag(); | ||
| 103 | + return ResponseModel.successData(captchaVO); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + @Override | ||
| 107 | + public ResponseModel verification(CaptchaVO captchaVO) { | ||
| 108 | + ResponseModel r = super.verification(captchaVO); | ||
| 109 | + if (!validatedReq(r)) { | ||
| 110 | + return r; | ||
| 111 | + } | ||
| 112 | + try { | ||
| 113 | + String codeKey = String.format(REDIS_SECOND_CAPTCHA_KEY, captchaVO.getCaptchaVerification()); | ||
| 114 | + if (!CaptchaServiceFactory.getCache(cacheType).exists(codeKey)) { | ||
| 115 | + return ResponseModel.errorMsg(RepCodeEnum.API_CAPTCHA_INVALID); | ||
| 116 | + } | ||
| 117 | + // 二次校验取值后,即刻失效 | ||
| 118 | + CaptchaServiceFactory.getCache(cacheType).delete(codeKey); | ||
| 119 | + } catch (Exception e) { | ||
| 120 | + logger.error("验证码解析失败", e); | ||
| 121 | + return ResponseModel.errorMsg(e.getMessage()); | ||
| 122 | + } | ||
| 123 | + return ResponseModel.success(); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + private CaptchaVO getImageData(String text) { | ||
| 128 | + CaptchaVO dataVO = new CaptchaVO(); | ||
| 129 | + BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); | ||
| 130 | + Graphics2D g = image.createGraphics(); | ||
| 131 | + | ||
| 132 | + // 设置背景色 | ||
| 133 | + g.setColor(getRandomColor(200, 250)); | ||
| 134 | + g.fillRect(0, 0, WIDTH, HEIGHT); | ||
| 135 | + // 绘制干扰线 | ||
| 136 | + for (int i = 0; i < LINES; i++) { | ||
| 137 | + g.setColor(getRandomColor(100, 200)); | ||
| 138 | + int x1 = RandomUtil.randomInt(WIDTH); | ||
| 139 | + int y1 = RandomUtil.randomInt(HEIGHT); | ||
| 140 | + int x2 = RandomUtil.randomInt(WIDTH); | ||
| 141 | + int y2 = RandomUtil.randomInt(HEIGHT); | ||
| 142 | + g.drawLine(x1, y1, x2, y2); | ||
| 143 | + } | ||
| 144 | + // 设置字体 | ||
| 145 | + g.setFont(new Font("Arial", Font.BOLD, 24)); | ||
| 146 | + // 绘制验证码文本 | ||
| 147 | + for (int i = 0; i < text.length(); i++) { | ||
| 148 | + g.setColor(getRandomColor(20, 130)); | ||
| 149 | + // 文字旋转 | ||
| 150 | + AffineTransform affineTransform = new AffineTransform(); | ||
| 151 | + int x = 20 + i * 20; | ||
| 152 | + int y = 24 + RandomUtil.randomInt(8); | ||
| 153 | + // 旋转范围 -45 ~ 45 | ||
| 154 | + affineTransform.setToRotation(Math.toRadians(RandomUtil.randomInt(-45, 45)), x, y); | ||
| 155 | + g.setTransform(affineTransform); | ||
| 156 | + g.drawString(text.charAt(i) + "", x, y); | ||
| 157 | + } | ||
| 158 | + // 添加噪点 | ||
| 159 | + for (int i = 0; i < 100; i++) { | ||
| 160 | + int x = RandomUtil.randomInt(WIDTH); | ||
| 161 | + int y = RandomUtil.randomInt(HEIGHT); | ||
| 162 | + image.setRGB(x, y, getRandomColor(0, 255).getRGB()); | ||
| 163 | + } | ||
| 164 | + g.dispose(); | ||
| 165 | + | ||
| 166 | + String secretKey = null; | ||
| 167 | + if (captchaAesStatus) { | ||
| 168 | + secretKey = AESUtil.getKey(); | ||
| 169 | + } | ||
| 170 | + dataVO.setSecretKey(secretKey); | ||
| 171 | + | ||
| 172 | + dataVO.setOriginalImageBase64(ImageUtils.getImageToBase64Str(image).replaceAll("\r|\n", "")); | ||
| 173 | + dataVO.setToken(RandomUtils.getUUID()); | ||
| 174 | +// dataVO.setSecretKey(secretKey); | ||
| 175 | + // 将坐标信息存入 redis 中 | ||
| 176 | + String codeKey = String.format(REDIS_CAPTCHA_KEY, dataVO.getToken()); | ||
| 177 | + CaptchaServiceFactory.getCache(cacheType).set(codeKey, getCodeValue(text, secretKey), EXPIRESIN_SECONDS); | ||
| 178 | + return dataVO; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + private String getCodeValue(String text, String secretKey) { | ||
| 182 | + return text + "," + secretKey; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + private String getCodeByCodeValue(String codeValue) { | ||
| 186 | + return codeValue.split(",")[0]; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + private String getSecretKeyByCodeValue(String codeValue) { | ||
| 190 | + return codeValue.split(",")[1]; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + private Color getRandomColor(int min, int max) { | ||
| 194 | + int minVal = Math.min(min, max); | ||
| 195 | + int maxVal = Math.max(min, max); | ||
| 196 | + int r = RandomUtil.randomInt(minVal, maxVal); | ||
| 197 | + int g = RandomUtil.randomInt(minVal, maxVal); | ||
| 198 | + int b = RandomUtil.randomInt(minVal, maxVal); | ||
| 199 | + return new Color(r, g, b); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 生成指定长度的随机字符串 | ||
| 204 | + * | ||
| 205 | + * @param length 长度 | ||
| 206 | + * @return {@link String} | ||
| 207 | + */ | ||
| 208 | + public static String generateRandomText(int length) { | ||
| 209 | + return RandomUtil.randomString(CHARACTERS, length); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | +} | ||
| 0 | \ No newline at end of file | 213 | \ No newline at end of file |
yudao-module-system/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaService
0 → 100644
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java
| @@ -26,8 +26,8 @@ import jakarta.validation.Validation; | @@ -26,8 +26,8 @@ import jakarta.validation.Validation; | ||
| 26 | import jakarta.validation.Validator; | 26 | import jakarta.validation.Validator; |
| 27 | import org.junit.jupiter.api.BeforeEach; | 27 | import org.junit.jupiter.api.BeforeEach; |
| 28 | import org.junit.jupiter.api.Test; | 28 | import org.junit.jupiter.api.Test; |
| 29 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 30 | import org.springframework.context.annotation.Import; | 29 | import org.springframework.context.annotation.Import; |
| 30 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 31 | 31 | ||
| 32 | import static cn.hutool.core.util.RandomUtil.randomEle; | 32 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 33 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 33 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| @@ -45,21 +45,21 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | @@ -45,21 +45,21 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | ||
| 45 | @Resource | 45 | @Resource |
| 46 | private AdminAuthServiceImpl authService; | 46 | private AdminAuthServiceImpl authService; |
| 47 | 47 | ||
| 48 | - @MockBean | 48 | + @MockitoBean |
| 49 | private AdminUserService userService; | 49 | private AdminUserService userService; |
| 50 | - @MockBean | 50 | + @MockitoBean |
| 51 | private CaptchaService captchaService; | 51 | private CaptchaService captchaService; |
| 52 | - @MockBean | 52 | + @MockitoBean |
| 53 | private LoginLogService loginLogService; | 53 | private LoginLogService loginLogService; |
| 54 | - @MockBean | 54 | + @MockitoBean |
| 55 | private SocialUserService socialUserService; | 55 | private SocialUserService socialUserService; |
| 56 | - @MockBean | 56 | + @MockitoBean |
| 57 | private SmsCodeApi smsCodeApi; | 57 | private SmsCodeApi smsCodeApi; |
| 58 | - @MockBean | 58 | + @MockitoBean |
| 59 | private OAuth2TokenService oauth2TokenService; | 59 | private OAuth2TokenService oauth2TokenService; |
| 60 | - @MockBean | 60 | + @MockitoBean |
| 61 | private MemberService memberService; | 61 | private MemberService memberService; |
| 62 | - @MockBean | 62 | + @MockitoBean |
| 63 | private Validator validator; | 63 | private Validator validator; |
| 64 | 64 | ||
| 65 | @BeforeEach | 65 | @BeforeEach |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImplTest.java
| @@ -9,11 +9,11 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSave | @@ -9,11 +9,11 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSave | ||
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; |
| 10 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; | 10 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; |
| 11 | import cn.iocoder.yudao.module.system.dal.mysql.dict.DictDataMapper; | 11 | import cn.iocoder.yudao.module.system.dal.mysql.dict.DictDataMapper; |
| 12 | +import jakarta.annotation.Resource; | ||
| 12 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 13 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 14 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 15 | 16 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | import java.util.function.Consumer; | 18 | import java.util.function.Consumer; |
| 19 | 19 | ||
| @@ -35,7 +35,7 @@ public class DictDataServiceImplTest extends BaseDbUnitTest { | @@ -35,7 +35,7 @@ public class DictDataServiceImplTest extends BaseDbUnitTest { | ||
| 35 | 35 | ||
| 36 | @Resource | 36 | @Resource |
| 37 | private DictDataMapper dictDataMapper; | 37 | private DictDataMapper dictDataMapper; |
| 38 | - @MockBean | 38 | + @MockitoBean |
| 39 | private DictTypeService dictTypeService; | 39 | private DictTypeService dictTypeService; |
| 40 | 40 | ||
| 41 | @Test | 41 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImplTest.java
| @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypePage | @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypePage | ||
| 8 | import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSaveReqVO; | 8 | import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSaveReqVO; |
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; |
| 10 | import cn.iocoder.yudao.module.system.dal.mysql.dict.DictTypeMapper; | 10 | import cn.iocoder.yudao.module.system.dal.mysql.dict.DictTypeMapper; |
| 11 | +import jakarta.annotation.Resource; | ||
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 13 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 14 | 15 | ||
| 15 | -import jakarta.annotation.Resource; | ||
| 16 | import java.util.List; | 16 | import java.util.List; |
| 17 | import java.util.function.Consumer; | 17 | import java.util.function.Consumer; |
| 18 | 18 | ||
| @@ -36,7 +36,7 @@ public class DictTypeServiceImplTest extends BaseDbUnitTest { | @@ -36,7 +36,7 @@ public class DictTypeServiceImplTest extends BaseDbUnitTest { | ||
| 36 | 36 | ||
| 37 | @Resource | 37 | @Resource |
| 38 | private DictTypeMapper dictTypeMapper; | 38 | private DictTypeMapper dictTypeMapper; |
| 39 | - @MockBean | 39 | + @MockitoBean |
| 40 | private DictDataService dictDataService; | 40 | private DictDataService dictDataService; |
| 41 | 41 | ||
| 42 | @Test | 42 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImplTest.java
| @@ -6,11 +6,11 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccou | @@ -6,11 +6,11 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccou | ||
| 6 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountSaveReqVO; | 6 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; |
| 8 | import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper; | 8 | import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper; |
| 9 | +import jakarta.annotation.Resource; | ||
| 9 | import org.junit.jupiter.api.Test; | 10 | import org.junit.jupiter.api.Test; |
| 10 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 11 | import org.springframework.context.annotation.Import; | 11 | import org.springframework.context.annotation.Import; |
| 12 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 12 | 13 | ||
| 13 | -import jakarta.annotation.Resource; | ||
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | 15 | ||
| 16 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 16 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| @@ -36,7 +36,7 @@ public class MailAccountServiceImplTest extends BaseDbUnitTest { | @@ -36,7 +36,7 @@ public class MailAccountServiceImplTest extends BaseDbUnitTest { | ||
| 36 | @Resource | 36 | @Resource |
| 37 | private MailAccountMapper mailAccountMapper; | 37 | private MailAccountMapper mailAccountMapper; |
| 38 | 38 | ||
| 39 | - @MockBean | 39 | + @MockitoBean |
| 40 | private MailTemplateService mailTemplateService; | 40 | private MailTemplateService mailTemplateService; |
| 41 | 41 | ||
| 42 | @Test | 42 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2ApproveServiceImplTest.java
| @@ -8,21 +8,23 @@ import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | @@ -8,21 +8,23 @@ import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 8 | import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ApproveDO; | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ApproveDO; |
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO; |
| 10 | import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2ApproveMapper; | 10 | import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2ApproveMapper; |
| 11 | +import jakarta.annotation.Resource; | ||
| 11 | import org.assertj.core.util.Lists; | 12 | import org.assertj.core.util.Lists; |
| 12 | import org.junit.jupiter.api.Test; | 13 | import org.junit.jupiter.api.Test; |
| 13 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 14 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 15 | 16 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import java.time.LocalDateTime; | 17 | import java.time.LocalDateTime; |
| 18 | import java.time.ZoneId; | 18 | import java.time.ZoneId; |
| 19 | import java.time.temporal.ChronoUnit; | 19 | import java.time.temporal.ChronoUnit; |
| 20 | -import java.util.*; | 20 | +import java.util.LinkedHashMap; |
| 21 | +import java.util.List; | ||
| 22 | +import java.util.Map; | ||
| 21 | 23 | ||
| 22 | import static cn.hutool.core.util.RandomUtil.*; | 24 | import static cn.hutool.core.util.RandomUtil.*; |
| 23 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 25 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 24 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; | ||
| 25 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | 26 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 27 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; | ||
| 26 | import static org.junit.jupiter.api.Assertions.*; | 28 | import static org.junit.jupiter.api.Assertions.*; |
| 27 | import static org.mockito.ArgumentMatchers.eq; | 29 | import static org.mockito.ArgumentMatchers.eq; |
| 28 | import static org.mockito.Mockito.when; | 30 | import static org.mockito.Mockito.when; |
| @@ -41,7 +43,7 @@ public class OAuth2ApproveServiceImplTest extends BaseDbUnitTest { | @@ -41,7 +43,7 @@ public class OAuth2ApproveServiceImplTest extends BaseDbUnitTest { | ||
| 41 | @Resource | 43 | @Resource |
| 42 | private OAuth2ApproveMapper oauth2ApproveMapper; | 44 | private OAuth2ApproveMapper oauth2ApproveMapper; |
| 43 | 45 | ||
| 44 | - @MockBean | 46 | + @MockitoBean |
| 45 | private OAuth2ClientService oauth2ClientService; | 47 | private OAuth2ClientService oauth2ClientService; |
| 46 | 48 | ||
| 47 | @Test | 49 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2TokenServiceImplTest.java
| @@ -19,8 +19,8 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService; | @@ -19,8 +19,8 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService; | ||
| 19 | import jakarta.annotation.Resource; | 19 | import jakarta.annotation.Resource; |
| 20 | import org.assertj.core.util.Lists; | 20 | import org.assertj.core.util.Lists; |
| 21 | import org.junit.jupiter.api.Test; | 21 | import org.junit.jupiter.api.Test; |
| 22 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 23 | import org.springframework.context.annotation.Import; | 22 | import org.springframework.context.annotation.Import; |
| 23 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 24 | 24 | ||
| 25 | import java.time.LocalDateTime; | 25 | import java.time.LocalDateTime; |
| 26 | import java.util.List; | 26 | import java.util.List; |
| @@ -52,9 +52,9 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest { | @@ -52,9 +52,9 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest { | ||
| 52 | @Resource | 52 | @Resource |
| 53 | private OAuth2AccessTokenRedisDAO oauth2AccessTokenRedisDAO; | 53 | private OAuth2AccessTokenRedisDAO oauth2AccessTokenRedisDAO; |
| 54 | 54 | ||
| 55 | - @MockBean | 55 | + @MockitoBean |
| 56 | private OAuth2ClientService oauth2ClientService; | 56 | private OAuth2ClientService oauth2ClientService; |
| 57 | - @MockBean | 57 | + @MockitoBean |
| 58 | private AdminUserService adminUserService; | 58 | private AdminUserService adminUserService; |
| 59 | 59 | ||
| 60 | @Test | 60 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImplTest.java
| @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; | @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; | ||
| 8 | import cn.iocoder.yudao.module.system.dal.mysql.permission.MenuMapper; | 8 | import cn.iocoder.yudao.module.system.dal.mysql.permission.MenuMapper; |
| 9 | import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; | 9 | import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; |
| 10 | import cn.iocoder.yudao.module.system.service.tenant.TenantService; | 10 | import cn.iocoder.yudao.module.system.service.tenant.TenantService; |
| 11 | +import jakarta.annotation.Resource; | ||
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 13 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 14 | 15 | ||
| 15 | -import jakarta.annotation.Resource; | ||
| 16 | import java.util.Collection; | 16 | import java.util.Collection; |
| 17 | import java.util.Collections; | 17 | import java.util.Collections; |
| 18 | import java.util.List; | 18 | import java.util.List; |
| @@ -40,9 +40,9 @@ public class MenuServiceImplTest extends BaseDbUnitTest { | @@ -40,9 +40,9 @@ public class MenuServiceImplTest extends BaseDbUnitTest { | ||
| 40 | @Resource | 40 | @Resource |
| 41 | private MenuMapper menuMapper; | 41 | private MenuMapper menuMapper; |
| 42 | 42 | ||
| 43 | - @MockBean | 43 | + @MockitoBean |
| 44 | private PermissionService permissionService; | 44 | private PermissionService permissionService; |
| 45 | - @MockBean | 45 | + @MockitoBean |
| 46 | private TenantService tenantService; | 46 | private TenantService tenantService; |
| 47 | 47 | ||
| 48 | @Test | 48 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceTest.java
| @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.system.service.permission; | @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.system.service.permission; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.extra.spring.SpringUtil; | 4 | import cn.hutool.extra.spring.SpringUtil; |
| 5 | +import cn.iocoder.yudao.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | ||
| 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 6 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 7 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 7 | -import cn.iocoder.yudao.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | ||
| 8 | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; |
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; |
| 10 | import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; | 10 | import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; |
| @@ -16,12 +16,12 @@ import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper; | @@ -16,12 +16,12 @@ import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper; | ||
| 16 | import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum; | 16 | import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum; |
| 17 | import cn.iocoder.yudao.module.system.service.dept.DeptService; | 17 | import cn.iocoder.yudao.module.system.service.dept.DeptService; |
| 18 | import cn.iocoder.yudao.module.system.service.user.AdminUserService; | 18 | import cn.iocoder.yudao.module.system.service.user.AdminUserService; |
| 19 | +import jakarta.annotation.Resource; | ||
| 19 | import org.junit.jupiter.api.Test; | 20 | import org.junit.jupiter.api.Test; |
| 20 | import org.mockito.MockedStatic; | 21 | import org.mockito.MockedStatic; |
| 21 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 22 | import org.springframework.context.annotation.Import; | 22 | import org.springframework.context.annotation.Import; |
| 23 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 23 | 24 | ||
| 24 | -import jakarta.annotation.Resource; | ||
| 25 | import java.util.Collection; | 25 | import java.util.Collection; |
| 26 | import java.util.List; | 26 | import java.util.List; |
| 27 | import java.util.Set; | 27 | import java.util.Set; |
| @@ -48,13 +48,13 @@ public class PermissionServiceTest extends BaseDbUnitTest { | @@ -48,13 +48,13 @@ public class PermissionServiceTest extends BaseDbUnitTest { | ||
| 48 | @Resource | 48 | @Resource |
| 49 | private UserRoleMapper userRoleMapper; | 49 | private UserRoleMapper userRoleMapper; |
| 50 | 50 | ||
| 51 | - @MockBean | 51 | + @MockitoBean |
| 52 | private RoleService roleService; | 52 | private RoleService roleService; |
| 53 | - @MockBean | 53 | + @MockitoBean |
| 54 | private MenuService menuService; | 54 | private MenuService menuService; |
| 55 | - @MockBean | 55 | + @MockitoBean |
| 56 | private DeptService deptService; | 56 | private DeptService deptService; |
| 57 | - @MockBean | 57 | + @MockitoBean |
| 58 | private AdminUserService userService; | 58 | private AdminUserService userService; |
| 59 | 59 | ||
| 60 | @Test | 60 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImplTest.java
| @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; | @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; | ||
| 10 | import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; | 10 | import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; |
| 11 | import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum; | 11 | import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum; |
| 12 | import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum; | 12 | import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum; |
| 13 | +import jakarta.annotation.Resource; | ||
| 13 | import org.junit.jupiter.api.Test; | 14 | import org.junit.jupiter.api.Test; |
| 14 | import org.mockito.MockedStatic; | 15 | import org.mockito.MockedStatic; |
| 15 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 16 | import org.springframework.context.annotation.Import; | 16 | import org.springframework.context.annotation.Import; |
| 17 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 18 | ||
| 18 | -import jakarta.annotation.Resource; | ||
| 19 | import java.util.Collection; | 19 | import java.util.Collection; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | import java.util.Set; | 21 | import java.util.Set; |
| @@ -44,7 +44,7 @@ public class RoleServiceImplTest extends BaseDbUnitTest { | @@ -44,7 +44,7 @@ public class RoleServiceImplTest extends BaseDbUnitTest { | ||
| 44 | @Resource | 44 | @Resource |
| 45 | private RoleMapper roleMapper; | 45 | private RoleMapper roleMapper; |
| 46 | 46 | ||
| 47 | - @MockBean | 47 | + @MockitoBean |
| 48 | private PermissionService permissionService; | 48 | private PermissionService permissionService; |
| 49 | 49 | ||
| 50 | @Test | 50 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java
| @@ -3,19 +3,19 @@ package cn.iocoder.yudao.module.system.service.sms; | @@ -3,19 +3,19 @@ package cn.iocoder.yudao.module.system.service.sms; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | -import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient; | ||
| 7 | -import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClientFactory; | ||
| 8 | -import cn.iocoder.yudao.module.system.framework.sms.core.property.SmsChannelProperties; | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; | 7 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; |
| 11 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; | 8 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; |
| 12 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 13 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper; | 10 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper; |
| 11 | +import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient; | ||
| 12 | +import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClientFactory; | ||
| 13 | +import cn.iocoder.yudao.module.system.framework.sms.core.property.SmsChannelProperties; | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 14 | import org.junit.jupiter.api.Test; | 15 | import org.junit.jupiter.api.Test; |
| 15 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 16 | import org.springframework.context.annotation.Import; | 16 | import org.springframework.context.annotation.Import; |
| 17 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 18 | ||
| 18 | -import jakarta.annotation.Resource; | ||
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ||
| 21 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 21 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| @@ -28,7 +28,8 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNE | @@ -28,7 +28,8 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNE | ||
| 28 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS; | 28 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS; |
| 29 | import static org.junit.jupiter.api.Assertions.*; | 29 | import static org.junit.jupiter.api.Assertions.*; |
| 30 | import static org.mockito.ArgumentMatchers.eq; | 30 | import static org.mockito.ArgumentMatchers.eq; |
| 31 | -import static org.mockito.Mockito.*; | 31 | +import static org.mockito.Mockito.mock; |
| 32 | +import static org.mockito.Mockito.when; | ||
| 32 | 33 | ||
| 33 | @Import(SmsChannelServiceImpl.class) | 34 | @Import(SmsChannelServiceImpl.class) |
| 34 | public class SmsChannelServiceTest extends BaseDbUnitTest { | 35 | public class SmsChannelServiceTest extends BaseDbUnitTest { |
| @@ -39,9 +40,9 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { | @@ -39,9 +40,9 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { | ||
| 39 | @Resource | 40 | @Resource |
| 40 | private SmsChannelMapper smsChannelMapper; | 41 | private SmsChannelMapper smsChannelMapper; |
| 41 | 42 | ||
| 42 | - @MockBean | 43 | + @MockitoBean |
| 43 | private SmsClientFactory smsClientFactory; | 44 | private SmsClientFactory smsClientFactory; |
| 44 | - @MockBean | 45 | + @MockitoBean |
| 45 | private SmsTemplateService smsTemplateService; | 46 | private SmsTemplateService smsTemplateService; |
| 46 | 47 | ||
| 47 | @Test | 48 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsCodeServiceImplTest.java
| @@ -12,8 +12,8 @@ import cn.iocoder.yudao.module.system.framework.sms.config.SmsCodeProperties; | @@ -12,8 +12,8 @@ import cn.iocoder.yudao.module.system.framework.sms.config.SmsCodeProperties; | ||
| 12 | import jakarta.annotation.Resource; | 12 | import jakarta.annotation.Resource; |
| 13 | import org.junit.jupiter.api.BeforeEach; | 13 | import org.junit.jupiter.api.BeforeEach; |
| 14 | import org.junit.jupiter.api.Test; | 14 | import org.junit.jupiter.api.Test; |
| 15 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 16 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 16 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 17 | 17 | ||
| 18 | import java.time.Duration; | 18 | import java.time.Duration; |
| 19 | import java.time.LocalDateTime; | 19 | import java.time.LocalDateTime; |
| @@ -38,9 +38,9 @@ public class SmsCodeServiceImplTest extends BaseDbUnitTest { | @@ -38,9 +38,9 @@ public class SmsCodeServiceImplTest extends BaseDbUnitTest { | ||
| 38 | @Resource | 38 | @Resource |
| 39 | private SmsCodeMapper smsCodeMapper; | 39 | private SmsCodeMapper smsCodeMapper; |
| 40 | 40 | ||
| 41 | - @MockBean | 41 | + @MockitoBean |
| 42 | private SmsCodeProperties smsCodeProperties; | 42 | private SmsCodeProperties smsCodeProperties; |
| 43 | - @MockBean | 43 | + @MockitoBean |
| 44 | private SmsSendService smsSendService; | 44 | private SmsSendService smsSendService; |
| 45 | 45 | ||
| 46 | @BeforeEach | 46 | @BeforeEach |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImplTest.java
| @@ -5,9 +5,6 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | @@ -5,9 +5,6 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 8 | -import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient; | ||
| 9 | -import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO; | ||
| 10 | -import cn.iocoder.yudao.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum; | ||
| 11 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 12 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; | 9 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; |
| 13 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO; | 10 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO; |
| @@ -15,12 +12,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | @@ -15,12 +12,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | ||
| 15 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; | 12 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 16 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsTemplateMapper; | 13 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsTemplateMapper; |
| 17 | import cn.iocoder.yudao.module.system.enums.sms.SmsTemplateTypeEnum; | 14 | import cn.iocoder.yudao.module.system.enums.sms.SmsTemplateTypeEnum; |
| 15 | +import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient; | ||
| 16 | +import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO; | ||
| 17 | +import cn.iocoder.yudao.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum; | ||
| 18 | import com.google.common.collect.Lists; | 18 | import com.google.common.collect.Lists; |
| 19 | +import jakarta.annotation.Resource; | ||
| 19 | import org.junit.jupiter.api.Test; | 20 | import org.junit.jupiter.api.Test; |
| 20 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 21 | import org.springframework.context.annotation.Import; | 21 | import org.springframework.context.annotation.Import; |
| 22 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 22 | 23 | ||
| 23 | -import jakarta.annotation.Resource; | ||
| 24 | import java.util.List; | 24 | import java.util.List; |
| 25 | import java.util.Map; | 25 | import java.util.Map; |
| 26 | import java.util.function.Consumer; | 26 | import java.util.function.Consumer; |
| @@ -45,9 +45,9 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { | @@ -45,9 +45,9 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { | ||
| 45 | @Resource | 45 | @Resource |
| 46 | private SmsTemplateMapper smsTemplateMapper; | 46 | private SmsTemplateMapper smsTemplateMapper; |
| 47 | 47 | ||
| 48 | - @MockBean | 48 | + @MockitoBean |
| 49 | private SmsChannelService smsChannelService; | 49 | private SmsChannelService smsChannelService; |
| 50 | - @MockBean | 50 | + @MockitoBean |
| 51 | private SmsClient smsClient; | 51 | private SmsClient smsClient; |
| 52 | 52 | ||
| 53 | @Test | 53 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImplTest.java
| @@ -28,9 +28,9 @@ import me.zhyd.oauth.request.AuthRequest; | @@ -28,9 +28,9 @@ import me.zhyd.oauth.request.AuthRequest; | ||
| 28 | import me.zhyd.oauth.utils.AuthStateUtils; | 28 | import me.zhyd.oauth.utils.AuthStateUtils; |
| 29 | import org.junit.jupiter.api.Test; | 29 | import org.junit.jupiter.api.Test; |
| 30 | import org.mockito.MockedStatic; | 30 | import org.mockito.MockedStatic; |
| 31 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 32 | import org.springframework.context.annotation.Import; | 31 | import org.springframework.context.annotation.Import; |
| 33 | import org.springframework.data.redis.core.StringRedisTemplate; | 32 | import org.springframework.data.redis.core.StringRedisTemplate; |
| 33 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 34 | 34 | ||
| 35 | import static cn.hutool.core.util.RandomUtil.randomEle; | 35 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 36 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 36 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| @@ -55,18 +55,18 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | @@ -55,18 +55,18 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | ||
| 55 | @Resource | 55 | @Resource |
| 56 | private SocialClientMapper socialClientMapper; | 56 | private SocialClientMapper socialClientMapper; |
| 57 | 57 | ||
| 58 | - @MockBean | 58 | + @MockitoBean |
| 59 | private AuthRequestFactory authRequestFactory; | 59 | private AuthRequestFactory authRequestFactory; |
| 60 | 60 | ||
| 61 | - @MockBean | 61 | + @MockitoBean |
| 62 | private WxMpService wxMpService; | 62 | private WxMpService wxMpService; |
| 63 | - @MockBean | 63 | + @MockitoBean |
| 64 | private WxMpProperties wxMpProperties; | 64 | private WxMpProperties wxMpProperties; |
| 65 | - @MockBean | 65 | + @MockitoBean |
| 66 | private StringRedisTemplate stringRedisTemplate; | 66 | private StringRedisTemplate stringRedisTemplate; |
| 67 | - @MockBean | 67 | + @MockitoBean |
| 68 | private WxMaService wxMaService; | 68 | private WxMaService wxMaService; |
| 69 | - @MockBean | 69 | + @MockitoBean |
| 70 | private WxMaProperties wxMaProperties; | 70 | private WxMaProperties wxMaProperties; |
| 71 | 71 | ||
| 72 | @Test | 72 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
| @@ -14,8 +14,8 @@ import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | @@ -14,8 +14,8 @@ import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | ||
| 14 | import jakarta.annotation.Resource; | 14 | import jakarta.annotation.Resource; |
| 15 | import me.zhyd.oauth.model.AuthUser; | 15 | import me.zhyd.oauth.model.AuthUser; |
| 16 | import org.junit.jupiter.api.Test; | 16 | import org.junit.jupiter.api.Test; |
| 17 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 18 | import org.springframework.context.annotation.Import; | 17 | import org.springframework.context.annotation.Import; |
| 18 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 19 | 19 | ||
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | 21 | ||
| @@ -50,7 +50,7 @@ public class SocialUserServiceImplTest extends BaseDbUnitTest { | @@ -50,7 +50,7 @@ public class SocialUserServiceImplTest extends BaseDbUnitTest { | ||
| 50 | @Resource | 50 | @Resource |
| 51 | private SocialUserBindMapper socialUserBindMapper; | 51 | private SocialUserBindMapper socialUserBindMapper; |
| 52 | 52 | ||
| 53 | - @MockBean | 53 | + @MockitoBean |
| 54 | private SocialClientService socialClientService; | 54 | private SocialClientService socialClientService; |
| 55 | 55 | ||
| 56 | @Test | 56 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImplTest.java
| @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.Tenant | @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.Tenant | ||
| 8 | import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; |
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO; |
| 10 | import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantPackageMapper; | 10 | import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantPackageMapper; |
| 11 | +import jakarta.annotation.Resource; | ||
| 11 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 12 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 13 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 14 | 15 | ||
| 15 | -import jakarta.annotation.Resource; | ||
| 16 | import java.util.List; | 16 | import java.util.List; |
| 17 | 17 | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | 18 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| @@ -42,7 +42,7 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest { | @@ -42,7 +42,7 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest { | ||
| 42 | @Resource | 42 | @Resource |
| 43 | private TenantPackageMapper tenantPackageMapper; | 43 | private TenantPackageMapper tenantPackageMapper; |
| 44 | 44 | ||
| 45 | - @MockBean | 45 | + @MockitoBean |
| 46 | private TenantService tenantService; | 46 | private TenantService tenantService; |
| 47 | 47 | ||
| 48 | @Test | 48 | @Test |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java
| @@ -20,12 +20,12 @@ import cn.iocoder.yudao.module.system.service.permission.RoleService; | @@ -20,12 +20,12 @@ import cn.iocoder.yudao.module.system.service.permission.RoleService; | ||
| 20 | import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler; | 20 | import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler; |
| 21 | import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler; | 21 | import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler; |
| 22 | import cn.iocoder.yudao.module.system.service.user.AdminUserService; | 22 | import cn.iocoder.yudao.module.system.service.user.AdminUserService; |
| 23 | +import jakarta.annotation.Resource; | ||
| 23 | import org.junit.jupiter.api.BeforeEach; | 24 | import org.junit.jupiter.api.BeforeEach; |
| 24 | import org.junit.jupiter.api.Test; | 25 | import org.junit.jupiter.api.Test; |
| 25 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 26 | import org.springframework.context.annotation.Import; | 26 | import org.springframework.context.annotation.Import; |
| 27 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 27 | 28 | ||
| 28 | -import jakarta.annotation.Resource; | ||
| 29 | import java.time.LocalDateTime; | 29 | import java.time.LocalDateTime; |
| 30 | import java.util.Arrays; | 30 | import java.util.Arrays; |
| 31 | import java.util.Collections; | 31 | import java.util.Collections; |
| @@ -60,17 +60,17 @@ public class TenantServiceImplTest extends BaseDbUnitTest { | @@ -60,17 +60,17 @@ public class TenantServiceImplTest extends BaseDbUnitTest { | ||
| 60 | @Resource | 60 | @Resource |
| 61 | private TenantMapper tenantMapper; | 61 | private TenantMapper tenantMapper; |
| 62 | 62 | ||
| 63 | - @MockBean | 63 | + @MockitoBean |
| 64 | private TenantProperties tenantProperties; | 64 | private TenantProperties tenantProperties; |
| 65 | - @MockBean | 65 | + @MockitoBean |
| 66 | private TenantPackageService tenantPackageService; | 66 | private TenantPackageService tenantPackageService; |
| 67 | - @MockBean | 67 | + @MockitoBean |
| 68 | private AdminUserService userService; | 68 | private AdminUserService userService; |
| 69 | - @MockBean | 69 | + @MockitoBean |
| 70 | private RoleService roleService; | 70 | private RoleService roleService; |
| 71 | - @MockBean | 71 | + @MockitoBean |
| 72 | private MenuService menuService; | 72 | private MenuService menuService; |
| 73 | - @MockBean | 73 | + @MockitoBean |
| 74 | private PermissionService permissionService; | 74 | private PermissionService permissionService; |
| 75 | 75 | ||
| 76 | @BeforeEach | 76 | @BeforeEach |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java
| @@ -31,9 +31,9 @@ import jakarta.annotation.Resource; | @@ -31,9 +31,9 @@ import jakarta.annotation.Resource; | ||
| 31 | import org.junit.jupiter.api.BeforeEach; | 31 | import org.junit.jupiter.api.BeforeEach; |
| 32 | import org.junit.jupiter.api.Test; | 32 | import org.junit.jupiter.api.Test; |
| 33 | import org.mockito.stubbing.Answer; | 33 | import org.mockito.stubbing.Answer; |
| 34 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 35 | import org.springframework.context.annotation.Import; | 34 | import org.springframework.context.annotation.Import; |
| 36 | import org.springframework.security.crypto.password.PasswordEncoder; | 35 | import org.springframework.security.crypto.password.PasswordEncoder; |
| 36 | +import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
| 37 | 37 | ||
| 38 | import java.util.Collection; | 38 | import java.util.Collection; |
| 39 | import java.util.List; | 39 | import java.util.List; |
| @@ -68,19 +68,19 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { | @@ -68,19 +68,19 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { | ||
| 68 | @Resource | 68 | @Resource |
| 69 | private UserPostMapper userPostMapper; | 69 | private UserPostMapper userPostMapper; |
| 70 | 70 | ||
| 71 | - @MockBean | 71 | + @MockitoBean |
| 72 | private DeptService deptService; | 72 | private DeptService deptService; |
| 73 | - @MockBean | 73 | + @MockitoBean |
| 74 | private PostService postService; | 74 | private PostService postService; |
| 75 | - @MockBean | 75 | + @MockitoBean |
| 76 | private PermissionService permissionService; | 76 | private PermissionService permissionService; |
| 77 | - @MockBean | 77 | + @MockitoBean |
| 78 | private PasswordEncoder passwordEncoder; | 78 | private PasswordEncoder passwordEncoder; |
| 79 | - @MockBean | 79 | + @MockitoBean |
| 80 | private TenantService tenantService; | 80 | private TenantService tenantService; |
| 81 | - @MockBean | 81 | + @MockitoBean |
| 82 | private FileApi fileApi; | 82 | private FileApi fileApi; |
| 83 | - @MockBean | 83 | + @MockitoBean |
| 84 | private ConfigApi configApi; | 84 | private ConfigApi configApi; |
| 85 | 85 | ||
| 86 | @BeforeEach | 86 | @BeforeEach |
yudao-server/src/main/resources/application-dev.yaml
| @@ -5,6 +5,7 @@ server: | @@ -5,6 +5,7 @@ server: | ||
| 5 | 5 | ||
| 6 | spring: | 6 | spring: |
| 7 | autoconfigure: | 7 | autoconfigure: |
| 8 | + # noinspection SpringBootApplicationYaml | ||
| 8 | exclude: | 9 | exclude: |
| 9 | - org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration # 禁用 AI 模块的 Qdrant,手动创建 | 10 | - org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration # 禁用 AI 模块的 Qdrant,手动创建 |
| 10 | - org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus,手动创建 | 11 | - org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus,手动创建 |
| @@ -33,14 +34,16 @@ spring: | @@ -33,14 +34,16 @@ spring: | ||
| 33 | initial-size: 5 # 初始连接数 | 34 | initial-size: 5 # 初始连接数 |
| 34 | min-idle: 10 # 最小连接池数量 | 35 | min-idle: 10 # 最小连接池数量 |
| 35 | max-active: 20 # 最大连接池数量 | 36 | max-active: 20 # 最大连接池数量 |
| 36 | - max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 | ||
| 37 | - time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 | ||
| 38 | - min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 | ||
| 39 | - max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 | ||
| 40 | - validation-query: SELECT 1 # 配置检测连接是否有效 | 37 | + max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟) |
| 38 | + time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟) | ||
| 39 | + min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟) | ||
| 40 | + max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟) | ||
| 41 | + validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 | ||
| 41 | test-while-idle: true | 42 | test-while-idle: true |
| 42 | test-on-borrow: false | 43 | test-on-borrow: false |
| 43 | test-on-return: false | 44 | test-on-return: false |
| 45 | + pool-prepared-statements: true # 是否开启 PreparedStatement 缓存 | ||
| 46 | + max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量 | ||
| 44 | primary: master | 47 | primary: master |
| 45 | datasource: | 48 | datasource: |
| 46 | master: | 49 | master: |
yudao-server/src/main/resources/application-local.yaml
| @@ -7,9 +7,6 @@ spring: | @@ -7,9 +7,6 @@ spring: | ||
| 7 | # noinspection SpringBootApplicationYaml | 7 | # noinspection SpringBootApplicationYaml |
| 8 | exclude: | 8 | exclude: |
| 9 | - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置 | 9 | - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置 |
| 10 | - - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 | ||
| 11 | - - de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置 | ||
| 12 | - - de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置 | ||
| 13 | - org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration # 禁用 AI 模块的 Qdrant,手动创建 | 10 | - org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration # 禁用 AI 模块的 Qdrant,手动创建 |
| 14 | - org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus,手动创建 | 11 | - org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus,手动创建 |
| 15 | # 数据源配置项 | 12 | # 数据源配置项 |
| @@ -37,14 +34,16 @@ spring: | @@ -37,14 +34,16 @@ spring: | ||
| 37 | initial-size: 1 # 初始连接数 | 34 | initial-size: 1 # 初始连接数 |
| 38 | min-idle: 1 # 最小连接池数量 | 35 | min-idle: 1 # 最小连接池数量 |
| 39 | max-active: 20 # 最大连接池数量 | 36 | max-active: 20 # 最大连接池数量 |
| 40 | - max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 | ||
| 41 | - time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 | ||
| 42 | - min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 | ||
| 43 | - max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 | 37 | + max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟) |
| 38 | + time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟) | ||
| 39 | + min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟) | ||
| 40 | + max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟) | ||
| 44 | validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 | 41 | validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 |
| 45 | test-while-idle: true | 42 | test-while-idle: true |
| 46 | test-on-borrow: false | 43 | test-on-borrow: false |
| 47 | test-on-return: false | 44 | test-on-return: false |
| 45 | + pool-prepared-statements: true # 是否开启 PreparedStatement 缓存 | ||
| 46 | + max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量 | ||
| 48 | primary: master | 47 | primary: master |
| 49 | datasource: | 48 | datasource: |
| 50 | master: | 49 | master: |
yudao-server/src/main/resources/application.yaml
| @@ -96,7 +96,7 @@ spring: | @@ -96,7 +96,7 @@ spring: | ||
| 96 | 96 | ||
| 97 | # VO 转换(数据翻译)相关 | 97 | # VO 转换(数据翻译)相关 |
| 98 | easy-trans: | 98 | easy-trans: |
| 99 | - is-enable-global: true # 启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口 | 99 | + is-enable-global: false # 【默认禁用,对性能确认压力大】启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口 |
| 100 | 100 | ||
| 101 | --- #################### 验证码相关配置 #################### | 101 | --- #################### 验证码相关配置 #################### |
| 102 | 102 | ||
| @@ -107,7 +107,7 @@ aj: | @@ -107,7 +107,7 @@ aj: | ||
| 107 | cache-type: redis # 缓存 local/redis... | 107 | cache-type: redis # 缓存 local/redis... |
| 108 | cache-number: 1000 # local 缓存的阈值,达到这个值,清除缓存 | 108 | cache-number: 1000 # local 缓存的阈值,达到这个值,清除缓存 |
| 109 | timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行 | 109 | timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行 |
| 110 | - type: blockPuzzle # 验证码类型 default两种都实例化。 blockPuzzle 滑块拼图 clickWord 文字点选 | 110 | + type: blockPuzzle # 验证码类型 default 三种都实例化。blockPuzzle 滑块拼图、clickWord 文字点选、pictureWord 文本输入 |
| 111 | water-mark: 芋道源码 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 Unicode,Linux 可能需要转 unicode | 111 | water-mark: 芋道源码 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 Unicode,Linux 可能需要转 unicode |
| 112 | interference-options: 0 # 滑动干扰项(0/1/2) | 112 | interference-options: 0 # 滑动干扰项(0/1/2) |
| 113 | req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false | 113 | req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false |
yudao-server/src/main/resources/logback-spring.xml
| 1 | <configuration> | 1 | <configuration> |
| 2 | - <!-- 引用 Spring Boot 的 logback 基础配置 --> | ||
| 3 | - <include resource="org/springframework/boot/logging/logback/defaults.xml" /> | ||
| 4 | - <!-- 变量 yudao.info.base-package,基础业务包 --> | ||
| 5 | - <springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/> | ||
| 6 | - <!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 --> | ||
| 7 | - <property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> | 2 | + <!-- 参考 org/springframework/boot/logging/logback/defaults.xml 配置,优化 CONSOLE_LOG_PATTERN、FILE_LOG_PATTERN --> |
| 3 | + <!-- 格式化输出:%d 表示日期,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 --> | ||
| 4 | + <!-- CONSOLE_LOG_PATTERN 相比 FILE_LOG_PATTERN 多了 highlight、cyan 等高亮 --> | ||
| 5 | + <property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n"/> | ||
| 6 | + <property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n"/> | ||
| 8 | 7 | ||
| 9 | <!-- 控制台 Appender --> | 8 | <!-- 控制台 Appender --> |
| 10 | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | 9 | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| 11 | - <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> | ||
| 12 | - <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> | ||
| 13 | - <pattern>${PATTERN_DEFAULT}</pattern> | ||
| 14 | - </layout> | 10 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| 11 | + <pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
| 15 | </encoder> | 12 | </encoder> |
| 16 | </appender> | 13 | </appender> |
| 17 | 14 | ||
| 18 | <!-- 文件 Appender --> | 15 | <!-- 文件 Appender --> |
| 19 | <!-- 参考 Spring Boot 的 file-appender.xml 编写 --> | 16 | <!-- 参考 Spring Boot 的 file-appender.xml 编写 --> |
| 20 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 17 | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| 21 | - <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> | ||
| 22 | - <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> | ||
| 23 | - <pattern>${PATTERN_DEFAULT}</pattern> | ||
| 24 | - </layout> | 18 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| 19 | + <pattern>${FILE_LOG_PATTERN}</pattern> | ||
| 25 | </encoder> | 20 | </encoder> |
| 26 | <!-- 日志文件名 --> | 21 | <!-- 日志文件名 --> |
| 27 | <file>${LOG_FILE}</file> | 22 | <file>${LOG_FILE}</file> |
| 23 | + <!-- 滚动策略:基于【每天 + 大小】创建日志文件 --> | ||
| 28 | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | 24 | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| 29 | - <!-- 滚动后的日志文件名 --> | ||
| 30 | - <fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern> | ||
| 31 | - <!-- 启动服务时,是否清理历史日志,一般不建议清理 --> | ||
| 32 | - <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart> | ||
| 33 | - <!-- 日志文件,到达多少容量,进行滚动 --> | ||
| 34 | - <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize> | ||
| 35 | - <!-- 日志文件的总大小,0 表示不限制 --> | ||
| 36 | - <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap> | ||
| 37 | - <!-- 日志文件的保留天数 --> | ||
| 38 | - <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory> | 25 | + <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- 日志文件输出的文件名 --> |
| 26 | + <maxHistory>30</maxHistory> <!-- 日志文件的保留天数 --> | ||
| 27 | + <maxFileSize>10MB</maxFileSize> <!-- 日志文件,到达多少容量,进行滚动 --> | ||
| 39 | </rollingPolicy> | 28 | </rollingPolicy> |
| 40 | </appender> | 29 | </appender> |
| 41 | <!-- 异步写入日志,提升性能 --> | 30 | <!-- 异步写入日志,提升性能 --> |
| 42 | <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> | 31 | <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
| 43 | - <!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 --> | ||
| 44 | - <discardingThreshold>0</discardingThreshold> | ||
| 45 | - <!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 --> | ||
| 46 | - <queueSize>256</queueSize> | 32 | + <discardingThreshold>0</discardingThreshold> <!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 --> |
| 33 | + <queueSize>512</queueSize> <!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 --> | ||
| 47 | <appender-ref ref="FILE"/> | 34 | <appender-ref ref="FILE"/> |
| 48 | </appender> | 35 | </appender> |
| 49 | 36 | ||
| 50 | - <!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 --> | ||
| 51 | - <appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> | 37 | + <!-- SkyWalking Appender:GRPC 日志收集,实现日志中心 --> |
| 38 | + <!-- | ||
| 39 | + <appender name="SKYWALKING" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> | ||
| 52 | <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> | 40 | <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> |
| 53 | <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> | 41 | <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> |
| 54 | - <pattern>${PATTERN_DEFAULT}</pattern> | 42 | + <pattern>[%tid] ${FILE_LOG_PATTERN}</pattern> |
| 55 | </layout> | 43 | </layout> |
| 56 | </encoder> | 44 | </encoder> |
| 57 | </appender> | 45 | </appender> |
| 46 | + --> | ||
| 58 | 47 | ||
| 59 | - <!-- 本地环境 --> | ||
| 60 | - <springProfile name="local"> | ||
| 61 | - <root level="INFO"> | ||
| 62 | - <appender-ref ref="STDOUT"/> | ||
| 63 | - <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> | ||
| 64 | - <appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> | ||
| 65 | - </root> | ||
| 66 | - </springProfile> | ||
| 67 | - <!-- 其它环境 --> | ||
| 68 | - <springProfile name="dev,test,stage,prod,default"> | ||
| 69 | - <root level="INFO"> | ||
| 70 | - <appender-ref ref="STDOUT"/> | ||
| 71 | - <appender-ref ref="ASYNC"/> | ||
| 72 | - <appender-ref ref="GRPC"/> | ||
| 73 | - </root> | ||
| 74 | - </springProfile> | 48 | + <root level="INFO"> |
| 49 | + <appender-ref ref="STDOUT"/> | ||
| 50 | + <!-- 本地环境下,如果不想【FILE】打印日志,可以注释掉本行 --> | ||
| 51 | + <appender-ref ref="ASYNC"/> | ||
| 52 | + <!-- 如果想接入【SkyWalking 日志服务】,可以取消注释掉本行 --> | ||
| 53 | + <!-- <appender-ref ref="SKYWALKING"/> --> | ||
| 54 | + </root> | ||
| 75 | 55 | ||
| 76 | </configuration> | 56 | </configuration> |