Browse Source

Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/mall_product

YunaiV 2 năm trước cách đây
mục cha
commit
5fcd0a21da
18 tập tin đã thay đổi với 94 bổ sung46 xóa
  1. 1 1
      README.md
  2. 1 1
      pom.xml
  3. 1 1
      sql/postgresql/ruoyi-vue-pro.sql
  4. 3 3
      yudao-dependencies/pom.xml
  5. 1 1
      yudao-example/yudao-sso-demo-by-code/pom.xml
  6. 1 1
      yudao-example/yudao-sso-demo-by-password/pom.xml
  7. 1 1
      yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java
  8. 6 2
      yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java
  9. 6 3
      yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java
  10. 27 0
      yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java
  11. 36 4
      yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java
  12. 2 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java
  13. 1 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java
  14. 1 1
      yudao-server/pom.xml
  15. 1 1
      yudao-ui-admin/src/assets/styles/ruoyi.scss
  16. 1 1
      yudao-ui-admin/src/views/infra/fileConfig/index.vue
  17. 3 3
      yudao-ui-admin/src/views/pay/cashier/index.vue
  18. 1 19
      yudao-ui-admin/src/views/pay/order/index.vue

+ 1 - 1
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)         |

+ 1 - 1
pom.xml

@@ -39,7 +39,7 @@
         <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
         <!-- 看看咋放到 bom 里 -->
         <lombok.version>1.18.28</lombok.version>
-        <spring.boot.version>2.7.13</spring.boot.version>
+        <spring.boot.version>2.7.14</spring.boot.version>
         <mapstruct.version>1.5.5.Final</mapstruct.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>

+ 1 - 1
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",

+ 3 - 3
yudao-dependencies/pom.xml

@@ -16,7 +16,7 @@
     <properties>
         <revision>1.8.0-snapshot</revision>
         <!-- 统一依赖管理 -->
-        <spring.boot.version>2.7.13</spring.boot.version>
+        <spring.boot.version>2.7.14</spring.boot.version>
         <!-- Web 相关 -->
         <springdoc.version>1.6.15</springdoc.version>
         <knife4j.version>4.1.0</knife4j.version>
@@ -43,7 +43,7 @@
         <!-- Bpm 工作流相关 -->
         <flowable.version>6.8.0</flowable.version>
         <!-- 工具类相关 -->
-        <captcha-plus.version>1.0.5</captcha-plus.version>
+        <captcha-plus.version>1.0.6</captcha-plus.version>
         <jsoup.version>1.15.4</jsoup.version>
         <lombok.version>1.18.28</lombok.version>
         <mapstruct.version>1.5.5.Final</mapstruct.version>
@@ -68,7 +68,7 @@
         <aliyun-java-sdk-core.version>4.6.3</aliyun-java-sdk-core.version>
         <aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version>
         <tencentcloud-sdk-java.version>3.1.758</tencentcloud-sdk-java.version>
-        <justauth.version>1.0.1</justauth.version>
+        <justauth.version>1.0.3</justauth.version>
         <jimureport.version>1.5.8</jimureport.version>
         <xercesImpl.version>2.12.2</xercesImpl.version>
         <weixin-java.version>4.5.0</weixin-java.version>

+ 1 - 1
yudao-example/yudao-sso-demo-by-code/pom.xml

@@ -21,7 +21,7 @@
         <maven.compiler.target>8</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <!-- 统一依赖管理 -->
-        <spring.boot.version>2.7.13</spring.boot.version>
+        <spring.boot.version>2.7.14</spring.boot.version>
     </properties>
 
     <dependencyManagement>

+ 1 - 1
yudao-example/yudao-sso-demo-by-password/pom.xml

@@ -21,7 +21,7 @@
         <maven.compiler.target>8</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <!-- 统一依赖管理 -->
-        <spring.boot.version>2.7.13</spring.boot.version>
+        <spring.boot.version>2.7.14</spring.boot.version>
     </properties>
 
     <dependencyManagement>

+ 1 - 1
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),

+ 6 - 2
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<String, Object> 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);
     }

+ 6 - 3
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<String, Object> 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);
     }

+ 27 - 0
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java

@@ -0,0 +1,27 @@
+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 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 = REDIS_SCAN_BATCH_SIZE_DEFAULT;
+
+}

+ 36 - 4
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/core/TimeoutRedisCacheManager.java

@@ -1,7 +1,7 @@
 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;
@@ -9,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 为过期时间,单位为秒
+ * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间。
+ * 单位为最后一个字母(支持的单位有:d 天,h 小时,m 分钟,s 秒),默认单位为 s 秒
  *
  * @author 芋道源码
  */
@@ -42,10 +42,42 @@ 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 过期时间 Duration
+     */
+    private Duration parseDuration(String ttlStr) {
+        String timeUnit = StrUtil.subSuf(ttlStr, -1);
+        switch (timeUnit) {
+            case "d":
+                return Duration.ofDays(removeDurationSuffix(ttlStr));
+            case "h":
+                return Duration.ofHours(removeDurationSuffix(ttlStr));
+            case "m":
+                return Duration.ofMinutes(removeDurationSuffix(ttlStr));
+            case "s":
+                return Duration.ofSeconds(removeDurationSuffix(ttlStr));
+            default:
+                return Duration.ofSeconds(Long.parseLong(ttlStr));
+        }
+    }
+
+    /**
+     * 移除多余的后缀,返回具体的时间
+     *
+     * @param ttlStr 过期时间字符串
+     * @return 时间
+     */
+    private Long removeDurationSuffix(String ttlStr) {
+        return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1));
+    }
+
 }

+ 2 - 1
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, 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);

+ 1 - 2
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<Long> menuIds) {
         TenantUtils.execute(tenantId, () -> {
             // 获得所有角色
-            List<RoleDO> roles = roleService.getRoleListByStatus(null);
+            List<RoleDO> roles = roleService.getRoleList();
             roles.forEach(role -> Assert.isTrue(tenantId.equals(role.getTenantId()), "角色({}/{}) 租户不匹配",
                     role.getId(), role.getTenantId(), tenantId)); // 兜底校验
             // 重新分配每个角色的权限

+ 1 - 1
yudao-server/pom.xml

@@ -111,7 +111,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.7.13</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
+                <version>2.7.14</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
                 <configuration>
                     <fork>true</fork>
                 </configuration>

+ 1 - 1
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;
     }

+ 1 - 1
yudao-ui-admin/src/views/infra/fileConfig/index.vue

@@ -102,7 +102,7 @@
         <el-form-item v-if="form.storage === 11" label="连接模式" prop="config.mode">
           <el-radio-group v-model="form.config.mode">
             <el-radio key="Active" label="Active">主动模式</el-radio>
-            <el-radio key="Passive" label="Passive">动模式</el-radio>
+            <el-radio key="Passive" label="Passive">动模式</el-radio>
           </el-radio-group>
         </el-form-item>
         <!-- S3 -->

+ 3 - 3
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)

+ 1 - 19
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;
 }