From 402a3809a3c13385a4a55afa94df6ac6fa361965 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 29 Jul 2023 11:23:13 +0800 Subject: [PATCH 01/17] chore: up springboot 2.7.14 --- README.md | 2 +- pom.xml | 2 +- yudao-dependencies/pom.xml | 2 +- yudao-example/yudao-sso-demo-by-code/pom.xml | 2 +- yudao-example/yudao-sso-demo-by-password/pom.xml | 2 +- yudao-server/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 60310204c..bebf00543 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ | 框架 | 说明 | 版本 | 学习指南 | |---------------------------------------------------------------------------------------------|------------------|-------------|----------------------------------------------------------------| -| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.7.13 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | +| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.7.14 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 / 8.0+ | | | [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.18 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.3.1 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | diff --git a/pom.xml b/pom.xml index 180a620f8..d892b1a13 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 3.8.1 1.18.28 - 2.7.13 + 2.7.14 1.5.5.Final UTF-8 diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 19fd0e1a1..71c6e0e5e 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -16,7 +16,7 @@ 1.8.0-snapshot - 2.7.13 + 2.7.14 1.6.15 4.1.0 diff --git a/yudao-example/yudao-sso-demo-by-code/pom.xml b/yudao-example/yudao-sso-demo-by-code/pom.xml index dc0c0241e..e67bd8e93 100644 --- a/yudao-example/yudao-sso-demo-by-code/pom.xml +++ b/yudao-example/yudao-sso-demo-by-code/pom.xml @@ -21,7 +21,7 @@ 8 UTF-8 - 2.7.13 + 2.7.14 diff --git a/yudao-example/yudao-sso-demo-by-password/pom.xml b/yudao-example/yudao-sso-demo-by-password/pom.xml index ee5d05390..bccd1580f 100644 --- a/yudao-example/yudao-sso-demo-by-password/pom.xml +++ b/yudao-example/yudao-sso-demo-by-password/pom.xml @@ -21,7 +21,7 @@ 8 UTF-8 - 2.7.13 + 2.7.14 diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index b151e6ef2..cc383236c 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -111,7 +111,7 @@ org.springframework.boot spring-boot-maven-plugin - 2.7.13 + 2.7.14 true From 59e60065722c9b6ff84956719b7de94937bd0ebe Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 29 Jul 2023 11:26:06 +0800 Subject: [PATCH 02/17] chore: up deps version --- yudao-dependencies/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 71c6e0e5e..0d43f9a11 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -43,7 +43,7 @@ 6.8.0 - 1.0.5 + 1.0.6 1.15.4 1.18.28 1.5.5.Final @@ -68,7 +68,7 @@ 4.6.3 2.2.1 3.1.758 - 1.0.1 + 1.0.3 1.5.8 2.12.2 4.5.0 From b052c8457a190c1ae3bb19cc71308fcc2a963506 Mon Sep 17 00:00:00 2001 From: Wyl <574295441@qq.com> Date: Mon, 7 Aug 2023 13:37:37 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=88=97=E4=B8=8D=E8=AE=BE=E7=BD=AE=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E6=97=B6=E5=B8=83=E5=B1=80=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/assets/styles/ruoyi.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin/src/assets/styles/ruoyi.scss b/yudao-ui-admin/src/assets/styles/ruoyi.scss index c95bb0a55..2ea1f0ad4 100644 --- a/yudao-ui-admin/src/assets/styles/ruoyi.scss +++ b/yudao-ui-admin/src/assets/styles/ruoyi.scss @@ -95,7 +95,7 @@ font-size: 13px; } } - .el-table__body-wrapper { + .el-table__body-wrapper,.el-table__fixed-body-wrapper { .el-button [class*="el-icon-"] + span { margin-left: 1px; } From 14c7465bc6d281e8e7bb88176857b012723e5f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E7=BB=A7=E5=BC=BA?= <550257912@qq.com> Date: Tue, 8 Aug 2023 00:13:23 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=97=B6permission=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E7=BC=93=E5=AD=98KEY=20=E4=B8=BA=E7=A9=BA=E7=9A=84BUG?= =?UTF-8?q?=20=EF=BC=8C=E5=88=A4=E6=96=AD=20reqVO.permission=20=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=81=9A=20@CacheEvict=20?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/service/permission/MenuServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java index a108e8f77..1adc0a51e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java @@ -45,7 +45,7 @@ public class MenuServiceImpl implements MenuService { private TenantService tenantService; @Override - @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, key = "#reqVO.permission") + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, condition = "#reqVO.permission != null", key = "#reqVO.permission") public Long createMenu(MenuCreateReqVO reqVO) { // 校验父菜单存在 validateParentMenu(reqVO.getParentId(), null); From ead87413933203ba45961ed35e307d4a60d777bf Mon Sep 17 00:00:00 2001 From: xlsea Date: Tue, 8 Aug 2023 09:12:50 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=BE=AE=E4=BF=A1App?= =?UTF-8?q?=20v3=E6=94=AF=E4=BB=98=E6=B8=A0=E9=81=93=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/pay/core/client/impl/weixin/WxAppPayClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java index 85c0a6374..396694a75 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java @@ -53,7 +53,7 @@ public class WxAppPayClient extends AbstractWxPayClient { // 构建 WxPayUnifiedOrderV3Request 对象 WxPayUnifiedOrderV3Request request = buildPayUnifiedOrderRequestV3(reqDTO); // 执行请求 - WxPayUnifiedOrderV3Result.JsapiResult response = client.createOrderV3(TradeTypeEnum.APP, request); + WxPayUnifiedOrderV3Result.AppResult response = client.createOrderV3(TradeTypeEnum.APP, request); // 转换结果 return PayOrderRespDTO.waitingOf(PayOrderDisplayModeEnum.APP.getMode(), toJsonString(response), From bcf7dd09173e83afed6fa9f2865c844485159fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=B7=B2=E5=88=A0=E9=99=A4?= <1100014+leniy@user.noreply.gitee.com> Date: Wed, 9 Aug 2023 00:27:59 +0000 Subject: [PATCH 06/17] =?UTF-8?q?update=20yudao-ui-admin/src/views/infra/f?= =?UTF-8?q?ileConfig/index.vue.=20FTP=E4=BC=A0=E8=BE=93=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 账号已删除 <1100014+leniy@user.noreply.gitee.com> --- yudao-ui-admin/src/views/infra/fileConfig/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin/src/views/infra/fileConfig/index.vue b/yudao-ui-admin/src/views/infra/fileConfig/index.vue index 01e671fab..dcc45c67a 100755 --- a/yudao-ui-admin/src/views/infra/fileConfig/index.vue +++ b/yudao-ui-admin/src/views/infra/fileConfig/index.vue @@ -102,7 +102,7 @@ 主动模式 - 主动模式 + 被动模式 From f221f5897393a943c1ebbcee4f204389fd215e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E5=A4=A9=E5=86=99BUG?= Date: Wed, 9 Aug 2023 15:29:09 +0000 Subject: [PATCH 07/17] =?UTF-8?q?update=20sql/postgresql/ruoyi-vue-pro.sql?= =?UTF-8?q?.=20fix:=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA=E6=96=B0=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=EF=BC=8C=E7=94=B1=E4=BA=8Edata=5Fscope=5Fdept=5Fids?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=98=AF=20not=20null=20=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E6=98=AF=E7=A9=BA=E5=80=BC=E6=97=B6=E5=80=99=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E9=94=99=E8=AF=AF=EF=BC=8C=E6=8F=92=E5=85=A5=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 天天写BUG --- sql/postgresql/ruoyi-vue-pro.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/postgresql/ruoyi-vue-pro.sql b/sql/postgresql/ruoyi-vue-pro.sql index d279476bb..3b6fecc35 100644 --- a/sql/postgresql/ruoyi-vue-pro.sql +++ b/sql/postgresql/ruoyi-vue-pro.sql @@ -5552,7 +5552,7 @@ CREATE TABLE "system_role" "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL, "sort" int4 NOT NULL, "data_scope" int2 NOT NULL, - "data_scope_dept_ids" varchar(500) COLLATE "pg_catalog"."default" NOT NULL, + "data_scope_dept_ids" varchar(500) COLLATE "pg_catalog"."default" NOT NULL DEFAULT '', "status" int2 NOT NULL, "type" int2 NOT NULL, "remark" varchar(500) COLLATE "pg_catalog"."default", From 72d2dcc68f46e14a868838434b5bcf681beb55bc Mon Sep 17 00:00:00 2001 From: "jlc@yoc.tech" Date: Thu, 10 Aug 2023 11:26:44 +0800 Subject: [PATCH 08/17] =?UTF-8?q?feat:=20=E5=B0=86=20redisCache=20?= =?UTF-8?q?=E7=9A=84=E6=89=AB=E6=8F=8F=E7=AD=96=E7=95=A5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=88=90=20scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/YudaoTenantAutoConfiguration.java | 8 +++++-- .../config/YudaoCacheAutoConfiguration.java | 9 +++++--- .../redis/config/YudaoCacheProperties.java | 21 +++++++++++++++++++ .../src/main/resources/application.yaml | 2 ++ 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index bc53c244e..cd4193abf 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -4,6 +4,7 @@ import cn.hutool.core.annotation.AnnotationUtil; import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; +import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect; import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; @@ -27,6 +28,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -124,10 +126,12 @@ public class YudaoTenantAutoConfiguration { @Bean @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration) { + RedisCacheConfiguration redisCacheConfiguration, + YudaoCacheProperties yudaoCacheProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, + BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java index 1442e8a83..2797e2117 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java @@ -8,6 +8,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -23,7 +24,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio * Cache 配置类,基于 Redis 实现 */ @AutoConfiguration -@EnableConfigurationProperties({CacheProperties.class}) +@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class}) @EnableCaching public class YudaoCacheAutoConfiguration { @@ -62,10 +63,12 @@ public class YudaoCacheAutoConfiguration { @Bean public RedisCacheManager redisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration) { + RedisCacheConfiguration redisCacheConfiguration, + YudaoCacheProperties yudaoCacheProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, + BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java new file mode 100644 index 000000000..5b217f61f --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.framework.redis.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +/** + * Cache 配置项 + * + * @author + */ +@ConfigurationProperties("yudao.cache") +@Data +@Validated +public class YudaoCacheProperties { + + /** + * redis scan 一次返回数量 + */ + private Integer redisScanBatchSize = 30; +} diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 3bc4d5e62..54c817872 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -204,6 +204,8 @@ yudao: order: app-id: 1 # 商户编号 expire-time: 2h # 支付的过期时间 + cache: # spring cache 相关配置 + redis-scan-batch-size: 30 # redis scan 一次返回数量 debug: false From 47698bfc6c1d71d1e628595762e1984d10354c9c Mon Sep 17 00:00:00 2001 From: "jlc@yoc.tech" Date: Thu, 10 Aug 2023 11:50:18 +0800 Subject: [PATCH 09/17] =?UTF-8?q?feat:=20=E6=8B=93=E5=B1=95=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=20RedisCacheManager=20=E4=BD=BF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/core/TimeoutRedisCacheManager.java | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java index cfdee653d..4de7fe57c 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.redis.core; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import org.springframework.boot.convert.DurationStyle; import org.springframework.cache.annotation.Cacheable; @@ -13,8 +14,8 @@ import java.time.temporal.ChronoUnit; /** * 支持自定义过期时间的 {@link RedisCacheManager} 实现类 - * - * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为秒 + *

+ * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为最后一个字母(支持的单位有:d天,h小时,m分钟,s秒),默认单位为秒 * * @author 芋道源码 */ @@ -42,10 +43,41 @@ public class TimeoutRedisCacheManager extends RedisCacheManager { // 移除 # 后面的 : 以及后面的内容,避免影响解析 names[1] = StrUtil.subBefore(names[1], StrUtil.COLON, false); // 解析时间 - Duration duration = DurationStyle.detectAndParse(names[1], ChronoUnit.SECONDS); + Duration duration = parseDuration(names[1]); cacheConfig = cacheConfig.entryTtl(duration); } return super.createRedisCache(names[0], cacheConfig); } + /** + * 解析 Duration + * + * @param ttlStr + * @return + */ + private Duration parseDuration(String ttlStr) { + String timeUnit = StrUtil.subSuf(ttlStr, -1); + switch (timeUnit) { + case "d": + return Duration.ofDays(removeSuffix(ttlStr)); + case "h": + return Duration.ofHours(removeSuffix(ttlStr)); + case "m": + return Duration.ofMinutes(removeSuffix(ttlStr)); + case "s": + return Duration.ofSeconds(removeSuffix(ttlStr)); + default: + return Duration.ofSeconds(Long.parseLong(ttlStr)); + } + } + + /** + * 移除多余的后缀 + * + * @param ttlStr + * @return + */ + private Long removeSuffix(String ttlStr) { + return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1)); + } } From e1fe21f24c4769e7cc47a6e750787b7ce7f24040 Mon Sep 17 00:00:00 2001 From: wanwan <913752709@qq.com> Date: Thu, 10 Aug 2023 15:26:25 +0800 Subject: [PATCH 10/17] =?UTF-8?q?Revert=20"feat:=20=E5=B0=86=20redisCache?= =?UTF-8?q?=20=E7=9A=84=E6=89=AB=E6=8F=8F=E7=AD=96=E7=95=A5=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=88=90=20scan"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 72d2dcc68f46e14a868838434b5bcf681beb55bc. --- .../config/YudaoTenantAutoConfiguration.java | 8 ++----- .../config/YudaoCacheAutoConfiguration.java | 9 +++----- .../redis/config/YudaoCacheProperties.java | 21 ------------------- .../src/main/resources/application.yaml | 2 -- 4 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index cd4193abf..bc53c244e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -4,7 +4,6 @@ import cn.hutool.core.annotation.AnnotationUtil; import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; -import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect; import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; @@ -28,7 +27,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; -import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -126,12 +124,10 @@ public class YudaoTenantAutoConfiguration { @Bean @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration, - YudaoCacheProperties yudaoCacheProperties) { + RedisCacheConfiguration redisCacheConfiguration) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, - BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); // 创建 TenantRedisCacheManager 对象 return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java index 2797e2117..1442e8a83 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java @@ -8,7 +8,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; -import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio * Cache 配置类,基于 Redis 实现 */ @AutoConfiguration -@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class}) +@EnableConfigurationProperties({CacheProperties.class}) @EnableCaching public class YudaoCacheAutoConfiguration { @@ -63,12 +62,10 @@ public class YudaoCacheAutoConfiguration { @Bean public RedisCacheManager redisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration, - YudaoCacheProperties yudaoCacheProperties) { + RedisCacheConfiguration redisCacheConfiguration) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, - BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); // 创建 TenantRedisCacheManager 对象 return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java deleted file mode 100644 index 5b217f61f..000000000 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.framework.redis.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; - -/** - * Cache 配置项 - * - * @author - */ -@ConfigurationProperties("yudao.cache") -@Data -@Validated -public class YudaoCacheProperties { - - /** - * redis scan 一次返回数量 - */ - private Integer redisScanBatchSize = 30; -} diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 54c817872..3bc4d5e62 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -204,8 +204,6 @@ yudao: order: app-id: 1 # 商户编号 expire-time: 2h # 支付的过期时间 - cache: # spring cache 相关配置 - redis-scan-batch-size: 30 # redis scan 一次返回数量 debug: false From c4a7da92333ffae26f8a2d666e72fb1564dc25a1 Mon Sep 17 00:00:00 2001 From: wanwan <913752709@qq.com> Date: Thu, 10 Aug 2023 15:26:31 +0800 Subject: [PATCH 11/17] =?UTF-8?q?Revert=20"feat:=20=E6=8B=93=E5=B1=95=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=20RedisCacheManager=20=E4=BD=BF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8D=95=E4=BD=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 47698bfc6c1d71d1e628595762e1984d10354c9c. --- .../redis/core/TimeoutRedisCacheManager.java | 38 ++----------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java index 4de7fe57c..cfdee653d 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.framework.redis.core; -import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import org.springframework.boot.convert.DurationStyle; import org.springframework.cache.annotation.Cacheable; @@ -14,8 +13,8 @@ import java.time.temporal.ChronoUnit; /** * 支持自定义过期时间的 {@link RedisCacheManager} 实现类 - *

- * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为最后一个字母(支持的单位有:d天,h小时,m分钟,s秒),默认单位为秒 + * + * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为秒 * * @author 芋道源码 */ @@ -43,41 +42,10 @@ public class TimeoutRedisCacheManager extends RedisCacheManager { // 移除 # 后面的 : 以及后面的内容,避免影响解析 names[1] = StrUtil.subBefore(names[1], StrUtil.COLON, false); // 解析时间 - Duration duration = parseDuration(names[1]); + Duration duration = DurationStyle.detectAndParse(names[1], ChronoUnit.SECONDS); cacheConfig = cacheConfig.entryTtl(duration); } return super.createRedisCache(names[0], cacheConfig); } - /** - * 解析 Duration - * - * @param ttlStr - * @return - */ - private Duration parseDuration(String ttlStr) { - String timeUnit = StrUtil.subSuf(ttlStr, -1); - switch (timeUnit) { - case "d": - return Duration.ofDays(removeSuffix(ttlStr)); - case "h": - return Duration.ofHours(removeSuffix(ttlStr)); - case "m": - return Duration.ofMinutes(removeSuffix(ttlStr)); - case "s": - return Duration.ofSeconds(removeSuffix(ttlStr)); - default: - return Duration.ofSeconds(Long.parseLong(ttlStr)); - } - } - - /** - * 移除多余的后缀 - * - * @param ttlStr - * @return - */ - private Long removeSuffix(String ttlStr) { - return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1)); - } } From 64c8dd62929373bf627bf2d6a30918d66beedce2 Mon Sep 17 00:00:00 2001 From: wanwan <913752709@qq.com> Date: Thu, 10 Aug 2023 15:26:47 +0800 Subject: [PATCH 12/17] =?UTF-8?q?feat:=20=E6=8B=93=E5=B1=95=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=20RedisCacheManager=20=E4=BD=BF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/core/TimeoutRedisCacheManager.java | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java index cfdee653d..4de7fe57c 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.redis.core; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import org.springframework.boot.convert.DurationStyle; import org.springframework.cache.annotation.Cacheable; @@ -13,8 +14,8 @@ import java.time.temporal.ChronoUnit; /** * 支持自定义过期时间的 {@link RedisCacheManager} 实现类 - * - * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为秒 + *

+ * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为最后一个字母(支持的单位有:d天,h小时,m分钟,s秒),默认单位为秒 * * @author 芋道源码 */ @@ -42,10 +43,41 @@ public class TimeoutRedisCacheManager extends RedisCacheManager { // 移除 # 后面的 : 以及后面的内容,避免影响解析 names[1] = StrUtil.subBefore(names[1], StrUtil.COLON, false); // 解析时间 - Duration duration = DurationStyle.detectAndParse(names[1], ChronoUnit.SECONDS); + Duration duration = parseDuration(names[1]); cacheConfig = cacheConfig.entryTtl(duration); } return super.createRedisCache(names[0], cacheConfig); } + /** + * 解析 Duration + * + * @param ttlStr + * @return + */ + private Duration parseDuration(String ttlStr) { + String timeUnit = StrUtil.subSuf(ttlStr, -1); + switch (timeUnit) { + case "d": + return Duration.ofDays(removeSuffix(ttlStr)); + case "h": + return Duration.ofHours(removeSuffix(ttlStr)); + case "m": + return Duration.ofMinutes(removeSuffix(ttlStr)); + case "s": + return Duration.ofSeconds(removeSuffix(ttlStr)); + default: + return Duration.ofSeconds(Long.parseLong(ttlStr)); + } + } + + /** + * 移除多余的后缀 + * + * @param ttlStr + * @return + */ + private Long removeSuffix(String ttlStr) { + return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1)); + } } From 134e5ca20fb167d489bb53b7d5942fa89fc466bd Mon Sep 17 00:00:00 2001 From: wanwan <913752709@qq.com> Date: Thu, 10 Aug 2023 15:26:48 +0800 Subject: [PATCH 13/17] =?UTF-8?q?feat:=20=E5=B0=86=20redisCache=20?= =?UTF-8?q?=E7=9A=84=E6=89=AB=E6=8F=8F=E7=AD=96=E7=95=A5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=88=90=20scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/YudaoTenantAutoConfiguration.java | 8 +++++-- .../config/YudaoCacheAutoConfiguration.java | 9 +++++--- .../redis/config/YudaoCacheProperties.java | 21 +++++++++++++++++++ .../src/main/resources/application.yaml | 2 ++ 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index bc53c244e..cd4193abf 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -4,6 +4,7 @@ import cn.hutool.core.annotation.AnnotationUtil; import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; +import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect; import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; @@ -27,6 +28,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -124,10 +126,12 @@ public class YudaoTenantAutoConfiguration { @Bean @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration) { + RedisCacheConfiguration redisCacheConfiguration, + YudaoCacheProperties yudaoCacheProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, + BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java index 1442e8a83..2797e2117 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java @@ -8,6 +8,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; @@ -23,7 +24,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio * Cache 配置类,基于 Redis 实现 */ @AutoConfiguration -@EnableConfigurationProperties({CacheProperties.class}) +@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class}) @EnableCaching public class YudaoCacheAutoConfiguration { @@ -62,10 +63,12 @@ public class YudaoCacheAutoConfiguration { @Bean public RedisCacheManager redisCacheManager(RedisTemplate redisTemplate, - RedisCacheConfiguration redisCacheConfiguration) { + RedisCacheConfiguration redisCacheConfiguration, + YudaoCacheProperties yudaoCacheProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, + BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration); } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java new file mode 100644 index 000000000..5b217f61f --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.framework.redis.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +/** + * Cache 配置项 + * + * @author + */ +@ConfigurationProperties("yudao.cache") +@Data +@Validated +public class YudaoCacheProperties { + + /** + * redis scan 一次返回数量 + */ + private Integer redisScanBatchSize = 30; +} diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 3bc4d5e62..54c817872 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -204,6 +204,8 @@ yudao: order: app-id: 1 # 商户编号 expire-time: 2h # 支付的过期时间 + cache: # spring cache 相关配置 + redis-scan-batch-size: 30 # redis scan 一次返回数量 debug: false From 27b820205375bd9a46d095437f4af3760e73d7ad Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 11 Aug 2023 09:22:22 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=94=B6=E9=93=B6=E7=95=8C=E9=9D=A2=EF=BC=8C=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=20success=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/pay/cashier/index.vue | 6 +++--- yudao-ui-admin/src/views/pay/order/index.vue | 20 +------------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/yudao-ui-admin/src/views/pay/cashier/index.vue b/yudao-ui-admin/src/views/pay/cashier/index.vue index 465f41f3c..85d702760 100644 --- a/yudao-ui-admin/src/views/pay/cashier/index.vue +++ b/yudao-ui-admin/src/views/pay/cashier/index.vue @@ -238,7 +238,7 @@ export default { if (data.status === PayOrderStatusEnum.SUCCESS.status) { this.clearQueryInterval(); this.$message.success('支付成功!'); - this.goReturnUrl(); + this.goReturnUrl('success'); return } @@ -321,13 +321,13 @@ export default { if (response.data.status === PayOrderStatusEnum.SUCCESS.status) { this.clearQueryInterval(); this.$message.success('支付成功!'); - this.goReturnUrl(); + this.goReturnUrl('success'); } // 已取消 if (response.data.status === PayOrderStatusEnum.CLOSED.status) { this.clearQueryInterval(); this.$message.error('支付已关闭!'); - this.goReturnUrl(); + this.goReturnUrl('close'); } }) }, 1000 * 2) diff --git a/yudao-ui-admin/src/views/pay/order/index.vue b/yudao-ui-admin/src/views/pay/order/index.vue index 967ec97c4..146fb0feb 100755 --- a/yudao-ui-admin/src/views/pay/order/index.vue +++ b/yudao-ui-admin/src/views/pay/order/index.vue @@ -302,25 +302,7 @@ export default { font-weight: bold; } -.tag-purple { - color: #722ed1; - background: #f9f0ff; - border-color: #d3adf7; -} - -.tag-cyan { - color: #13c2c2; - background: #e6fffb; - border-color: #87e8de; -} - -.tag-pink { - color: #eb2f96; - background: #fff0f6; - border-color: #ffadd2; -} - -.order-font{ +.order-font { font-size: 12px; padding: 2px 0; } From b5515799dcd03575f2e618c58e2a7b6bd2a68d1e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 11 Aug 2023 19:32:26 +0800 Subject: [PATCH 15/17] =?UTF-8?q?!557=20=E4=BF=AE=E6=94=B9=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=8F=9C=E5=8D=95=E6=97=B6permission=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=EF=BC=8C=E7=BC=93=E5=AD=98KEY=20=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/system/service/permission/MenuServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java index 1adc0a51e..f06fd3474 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java @@ -45,7 +45,8 @@ public class MenuServiceImpl implements MenuService { private TenantService tenantService; @Override - @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, condition = "#reqVO.permission != null", key = "#reqVO.permission") + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, key = "#reqVO.permission", + condition = "#reqVO.permission != null") public Long createMenu(MenuCreateReqVO reqVO) { // 校验父菜单存在 validateParentMenu(reqVO.getParentId(), null); From 9ff67b479fd09fe500aa8ebdee57d0784aea0215 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 11 Aug 2023 21:46:53 +0800 Subject: [PATCH 16/17] =?UTF-8?q?!562=20=E4=BC=98=E5=8C=96=20redisCache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/config/YudaoCacheProperties.java | 10 +++++-- .../redis/core/TimeoutRedisCacheManager.java | 30 +++++++++---------- .../src/main/resources/application.yaml | 2 -- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java index 5b217f61f..c51219d0f 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java @@ -7,15 +7,21 @@ import org.springframework.validation.annotation.Validated; /** * Cache 配置项 * - * @author + * @author Wanwan */ @ConfigurationProperties("yudao.cache") @Data @Validated public class YudaoCacheProperties { + /** + * {@link #redisScanBatchSize} 默认值 + */ + private static final Integer REDIS_SCAN_BATCH_SIZE_DEFAULT = 30; + /** * redis scan 一次返回数量 */ - private Integer redisScanBatchSize = 30; + private Integer redisScanBatchSize = REDIS_SCAN_BATCH_SIZE_DEFAULT; + } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java index 4de7fe57c..bf34fc081 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.framework.redis.core; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; -import org.springframework.boot.convert.DurationStyle; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.redis.cache.RedisCache; import org.springframework.data.redis.cache.RedisCacheConfiguration; @@ -10,12 +9,12 @@ import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; import java.time.Duration; -import java.time.temporal.ChronoUnit; /** * 支持自定义过期时间的 {@link RedisCacheManager} 实现类 - *

- * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间,单位为最后一个字母(支持的单位有:d天,h小时,m分钟,s秒),默认单位为秒 + * + * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间。 + * 单位为最后一个字母(支持的单位有:d 天,h 小时,m 分钟,s 秒),默认单位为 s 秒 * * @author 芋道源码 */ @@ -50,34 +49,35 @@ public class TimeoutRedisCacheManager extends RedisCacheManager { } /** - * 解析 Duration + * 解析过期时间 Duration * - * @param ttlStr - * @return + * @param ttlStr 过期时间字符串 + * @return 过期时间 Duration */ private Duration parseDuration(String ttlStr) { String timeUnit = StrUtil.subSuf(ttlStr, -1); switch (timeUnit) { case "d": - return Duration.ofDays(removeSuffix(ttlStr)); + return Duration.ofDays(removeDurationSuffix(ttlStr)); case "h": - return Duration.ofHours(removeSuffix(ttlStr)); + return Duration.ofHours(removeDurationSuffix(ttlStr)); case "m": - return Duration.ofMinutes(removeSuffix(ttlStr)); + return Duration.ofMinutes(removeDurationSuffix(ttlStr)); case "s": - return Duration.ofSeconds(removeSuffix(ttlStr)); + return Duration.ofSeconds(removeDurationSuffix(ttlStr)); default: return Duration.ofSeconds(Long.parseLong(ttlStr)); } } /** - * 移除多余的后缀 + * 移除多余的后缀,返回具体的时间 * - * @param ttlStr - * @return + * @param ttlStr 过期时间字符串 + * @return 时间 */ - private Long removeSuffix(String ttlStr) { + private Long removeDurationSuffix(String ttlStr) { return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1)); } + } diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 54c817872..3bc4d5e62 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -204,8 +204,6 @@ yudao: order: app-id: 1 # 商户编号 expire-time: 2h # 支付的过期时间 - cache: # spring cache 相关配置 - redis-scan-batch-size: 30 # redis scan 一次返回数量 debug: false From ee53d2ad51c028c2ca5e5b56afec8ae8f8b482aa Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 11 Aug 2023 22:24:01 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E5=A5=97=E9=A4=90=E4=BF=AE=E6=94=B9=E6=97=B6=EF=BC=8C=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=92=E8=89=B2=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/service/tenant/TenantServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java index 226c939e4..fd49bf970 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java @@ -34,7 +34,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; @@ -175,7 +174,7 @@ public class TenantServiceImpl implements TenantService { public void updateTenantRoleMenu(Long tenantId, Set menuIds) { TenantUtils.execute(tenantId, () -> { // 获得所有角色 - List roles = roleService.getRoleListByStatus(null); + List roles = roleService.getRoleList(); roles.forEach(role -> Assert.isTrue(tenantId.equals(role.getTenantId()), "角色({}/{}) 租户不匹配", role.getId(), role.getTenantId(), tenantId)); // 兜底校验 // 重新分配每个角色的权限