From f6995953d8a1c9068741d0ce8abfa65f7304d32d Mon Sep 17 00:00:00 2001 From: konbai <1527468660@qq.com> Date: Fri, 6 May 2022 22:42:32 +0800 Subject: [PATCH] =?UTF-8?q?sync=20--=20=E5=90=8C=E6=AD=A5=20RuoYi-Vue-Plus?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0=E3=80=82=20=E4=BD=BF=E7=94=A8=20spring=20?= =?UTF-8?q?cglib=20=E6=9B=BF=E6=8D=A2=20=E5=81=9C=E6=AD=A2=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4=E7=9A=84=20cglib=20=E4=BF=AE=E5=A4=8D=20cos=5Fapi=20b?= =?UTF-8?q?cprov-jdk15on=20=E6=BC=8F=E6=B4=9E=20=E4=BF=AE=E5=A4=8D=20guava?= =?UTF-8?q?=20=E6=BC=8F=E6=B4=9E=20=E7=BB=9F=E4=B8=80=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20=E4=BF=AE=E5=A4=8D=20tlog=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=BC=8F=E6=B4=9E=20=E4=BC=98=E5=8C=96=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=A4=B1=E8=B4=A5=E7=9B=B8=E5=85=B3=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E3=80=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA=E6=96=87=E4=BB=B6=E5=8E=9F?= =?UTF-8?q?=E5=90=8D=E4=BE=BF=E4=BA=8E=E5=90=8E=E7=BB=AD=E5=A4=84=E7=90=86?= =?UTF-8?q?,=20=E5=AE=8C=E5=96=84=E7=BB=84=E4=BB=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20springboot=202.6.6=20=3D>=202.6.7=20?= =?UTF-8?q?=E5=8F=91=E5=B8=83=204.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/ISSUE_TEMPLATE.zh-CN.md | 2 +- pom.xml | 46 +- ruoyi-admin/pom.xml | 2 +- .../system/SysOssConfigController.java | 2 +- .../controller/system/SysOssController.java | 5 +- .../src/main/resources/application-dev.yml | 117 ++-- .../src/main/resources/application-prod.yml | 123 ++-- .../src/main/resources/application.yml | 25 - ruoyi-common/pom.xml | 7 +- .../core/domain/entity/SysDictType.java | 2 + .../com/ruoyi/common/enums/LoginType.java | 39 ++ .../enums/ThreadPoolRejectedPolicy.java | 26 - .../com/ruoyi/common/utils/BeanCopyUtils.java | 75 +- ruoyi-demo/pom.xml | 2 +- ruoyi-extend/pom.xml | 2 +- ruoyi-extend/ruoyi-monitor-admin/pom.xml | 2 +- ruoyi-extend/ruoyi-xxl-job-admin/pom.xml | 2 +- ruoyi-flowable/pom.xml | 2 +- ruoyi-framework/pom.xml | 2 +- .../framework/aspectj/RepeatSubmitAspect.java | 5 +- .../ruoyi/framework/config/RedisConfig.java | 16 +- .../framework/config/ThreadPoolConfig.java | 16 +- .../config/properties/RedissonProperties.java | 31 - .../properties/RepeatSubmitProperties.java | 22 - .../properties/ThreadPoolProperties.java | 16 - ruoyi-generator/pom.xml | 2 +- .../main/resources/vm/vue/index-tree.vue.vm | 24 +- .../resources/vm/vue/v3/index-tree.vue.vm | 22 +- ruoyi-job/pom.xml | 2 +- ruoyi-oss/pom.xml | 6 +- .../oss/service/impl/MinioOssStrategy.java | 2 + ruoyi-system/pom.xml | 2 +- .../system/service/ISysOssConfigService.java | 2 +- .../ruoyi/system/service/SysLoginService.java | 97 ++- .../service/impl/SysOssConfigServiceImpl.java | 2 +- .../resources/mapper/system/SysUserMapper.xml | 2 + ruoyi-ui/README.md | 2 +- ruoyi-ui/bin/package.bat | 6 +- ruoyi-ui/package.json | 6 +- ruoyi-ui/src/components/FileUpload/index.vue | 25 +- ruoyi-ui/src/components/ImageUpload/index.vue | 23 +- ruoyi-ui/src/components/TopNav/index.vue | 14 +- ruoyi-ui/src/plugins/tab.js | 4 +- ruoyi-ui/src/views/demo/tree/index.vue | 28 +- ruoyi-ui/src/views/index.vue | 651 +----------------- ruoyi-ui/src/views/tool/gen/index.vue | 4 +- script/docker/docker-compose.yml | 8 +- script/sql/mysql/mysql_ry_20220404.sql | 2 +- .../sql/mysql/update/update_ry_20200319.sql | 2 + script/sql/oracle/oracle_ry_20220404.sql | 2 +- script/sql/postgres/postgres_ry_20220404.sql | 2 +- script/sql/sqlserver/sqlserver_ry_vue_4.X.sql | 2 +- 52 files changed, 451 insertions(+), 1082 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RepeatSubmitProperties.java diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md index 22cb51d5..b6fcbea8 100644 --- a/.gitee/ISSUE_TEMPLATE.zh-CN.md +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -1,4 +1,4 @@ -### 使用版本 +### 使用版本(未按照模板填写直接删除) ### 问题描述 diff --git a/pom.xml b/pom.xml index 546643a4..cdbd69a0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,15 +6,15 @@ com.ruoyi ruoyi-flowable-plus - 4.0.1 + 4.1.0 RuoYi-Flowable-Plus https://gitee.com/KonBAI-Q/ruoyi-flowable-plus RuoYi-Flowable-Plus后台管理系统 - 4.0.1 - 2.6.6 + 4.1.0 + 2.6.7 UTF-8 UTF-8 1.8 @@ -26,14 +26,13 @@ 4.1.2 1.21 3.0.5 - 3.3.0 2.3 1.29.0 3.5.1 3.9.1 5.7.22 - 4.9.2 - 2.6.5 + 4.9.3 + 2.6.6 3.17.0 2.2.1 3.5.1 @@ -43,12 +42,14 @@ 3.0.1 + + 30.0-jre - 7.9.3 + 7.9.5 3.14.0 - 5.6.68 - 8.3.7 + 5.6.72 + 8.3.8 localhost @@ -135,12 +136,6 @@ - - cglib - cglib - ${cglib.version} - - org.apache.velocity @@ -232,6 +227,20 @@ com.yomahub tlog-web-spring-boot-starter ${tlog.version} + + + log4j + log4j + + + dom4j + dom4j + + + commons-beanutils + commons-beanutils + + @@ -240,6 +249,13 @@ ${tlog.version} + + + com.google.guava + guava + ${guava.version} + + org.flowable diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index ae492433..b6dc9c49 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 jar diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java index e344dea9..cf2fd117 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java @@ -59,7 +59,7 @@ public class SysOssConfigController extends BaseController { @GetMapping("/{ossConfigId}") public R getInfo(@ApiParam("OSS配置ID") @NotNull(message = "主键不能为空") - @PathVariable("ossConfigId") Integer ossConfigId) { + @PathVariable("ossConfigId") Long ossConfigId) { return R.ok(iSysOssConfigService.queryById(ossConfigId)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java index 4342716f..a128a15f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java @@ -18,7 +18,6 @@ import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.system.domain.SysOss; import com.ruoyi.system.domain.bo.SysOssBo; import com.ruoyi.system.domain.vo.SysOssVo; -import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysOssService; import io.swagger.annotations.*; import lombok.RequiredArgsConstructor; @@ -48,7 +47,6 @@ import java.util.Map; public class SysOssController extends BaseController { private final ISysOssService iSysOssService; - private final ISysConfigService iSysConfigService; /** * 查询OSS对象存储列表 @@ -77,7 +75,8 @@ public class SysOssController extends BaseController { SysOss oss = iSysOssService.upload(file); Map map = new HashMap<>(2); map.put("url", oss.getUrl()); - map.put("fileName", oss.getFileName()); + map.put("fileName", oss.getOriginalName()); + map.put("ossId", oss.getOssId().toString()); return R.ok(map); } diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 6bc5414a..a99c5bac 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,41 +1,34 @@ ---- # 监控配置 -spring: - boot: - admin: - # Spring Boot Admin Client 客户端的相关配置 - client: - # 增加客户端开关 - enabled: true - # 设置 Spring Boot Admin Server 地址 - url: http://localhost:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 +--- # 监控中心配置 +spring.boot.admin.client: + # 增加客户端开关 + enabled: true + url: http://localhost:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 --- # xxl-job 配置 -xxl: - job: - # 执行器开关 - enabled: false - # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 - admin-addresses: http://localhost:9100/xxl-job-admin - # 执行器通讯TOKEN:非空时启用 - access-token: xxl-job - # 执行器配置 - executor: - # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 - appname: xxl-job-executor - # 执行器端口号 执行器从9101开始往后写 - port: 9101 - # 执行器注册:默认IP:PORT - address: - # 执行器IP:默认自动获取IP - ip: - # 执行器运行日志文件存储磁盘路径 - logpath: ./logs/xxl-job - # 执行器日志文件保存天数:大于3生效 - logretentiondays: 30 +xxl.job: + # 执行器开关 + enabled: false + # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 + admin-addresses: http://localhost:9100/xxl-job-admin + # 执行器通讯TOKEN:非空时启用 + access-token: xxl-job + executor: + # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 + appname: xxl-job-executor + # 执行器端口号 执行器从9101开始往后写 + port: 9101 + # 执行器注册:默认IP:PORT + address: + # 执行器IP:默认自动获取IP + ip: + # 执行器运行日志文件存储磁盘路径 + logpath: ./logs/xxl-job + # 执行器日志文件保存天数:大于3生效 + logretentiondays: 30 --- # 数据源配置 spring: @@ -55,7 +48,7 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) - url: jdbc:mysql://localhost:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://localhost:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true username: root password: root # 从库数据源 @@ -106,29 +99,27 @@ spring: filters: stat --- # druid 配置 -spring: - datasource: - druid: - webStatFilter: - enabled: true - statViewServlet: - enabled: true - # 设置白名单,不填则允许所有访问 - allow: - url-pattern: /druid/* - # 控制台管理用户名和密码 - login-username: ruoyi - login-password: 123456 - filter: - stat: - enabled: true - # 慢SQL记录 - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: true - wall: - config: - multi-statement-allow: true +spring.datasource.druid: + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) spring: @@ -151,8 +142,6 @@ redisson: threads: 4 # Netty线程池数量 nettyThreads: 8 - # 传输模式 - transportMode: "NIO" # 单节点配置 singleServerConfig: # 客户端名称 @@ -165,9 +154,5 @@ redisson: idleConnectionTimeout: 10000 # 命令等待超时,单位:毫秒 timeout: 3000 - # 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - retryAttempts: 3 - # 命令重试发送时间间隔,单位:毫秒 - retryInterval: 1500 # 发布和订阅连接池大小 subscriptionConnectionPoolSize: 50 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 0b9b9878..6a28bccf 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -1,48 +1,37 @@ ---- # 配置临时路径存储 -spring: - servlet: - multipart: - # 临时文件存储位置 避免临时文件被系统清理报错 - location: /ruoyi/server/temp +--- # 临时文件存储位置 避免临时文件被系统清理报错 +spring.servlet.multipart.location: /ruoyi/server/temp ---- # 监控配置 -spring: - boot: - admin: - # Spring Boot Admin Client 客户端的相关配置 - client: - # 增加客户端开关 - enabled: true - # 设置 Spring Boot Admin Server 地址 - url: http://172.30.0.90:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 +--- # 监控中心配置 +spring.boot.admin.client: + # 增加客户端开关 + enabled: true + url: http://172.30.0.90:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 --- # xxl-job 配置 -xxl: - job: - # 执行器开关 - enabled: true - # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 - admin-addresses: http://172.30.0.92:9100/xxl-job-admin - # 执行器通讯TOKEN:非空时启用 - access-token: xxl-job - # 执行器配置 - executor: - # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 - appname: xxl-job-executor - # 执行器端口号 执行器从9101开始往后写 - port: 9101 - # 执行器注册:默认IP:PORT - address: - # 执行器IP:默认自动获取IP - ip: - # 执行器运行日志文件存储磁盘路径 - logpath: ./logs/xxl-job - # 执行器日志文件保存天数:大于3生效 - logretentiondays: 30 +xxl.job: + # 执行器开关 + enabled: true + # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 + admin-addresses: http://172.30.0.92:9100/xxl-job-admin + # 执行器通讯TOKEN:非空时启用 + access-token: xxl-job + executor: + # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 + appname: xxl-job-executor + # 执行器端口号 执行器从9101开始往后写 + port: 9101 + # 执行器注册:默认IP:PORT + address: + # 执行器IP:默认自动获取IP + ip: + # 执行器运行日志文件存储磁盘路径 + logpath: ./logs/xxl-job + # 执行器日志文件保存天数:大于3生效 + logretentiondays: 30 --- # 数据源配置 spring: @@ -113,29 +102,27 @@ spring: filters: stat --- # druid 配置 -spring: - datasource: - druid: - webStatFilter: - enabled: true - statViewServlet: - enabled: true - # 设置白名单,不填则允许所有访问 - allow: - url-pattern: /druid/* - # 控制台管理用户名和密码 - login-username: ruoyi - login-password: 123456 - filter: - stat: - enabled: true - # 慢SQL记录 - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: true - wall: - config: - multi-statement-allow: true +spring.datasource.druid: + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) spring: @@ -158,8 +145,6 @@ redisson: threads: 16 # Netty线程池数量 nettyThreads: 32 - # 传输模式 - transportMode: "NIO" # 单节点配置 singleServerConfig: # 客户端名称 @@ -172,9 +157,5 @@ redisson: idleConnectionTimeout: 10000 # 命令等待超时,单位:毫秒 timeout: 3000 - # 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - retryAttempts: 3 - # 命令重试发送时间间隔,单位:毫秒 - retryInterval: 1500 # 发布和订阅连接池大小 subscriptionConnectionPoolSize: 50 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 7b5deb89..0932f6be 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -75,10 +75,6 @@ spring: restart: # 热部署开关 enabled: true - # 与vue整合部署使用 - thymeleaf: - # 将系统模板放置到最前面 否则会与 springboot-admin 页面冲突 - template-resolver-order: 1 mvc: pathmatch: # 适配 boot 2.6 路由与 springfox 兼容 @@ -107,16 +103,12 @@ sa-token: is-concurrent: true # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) is-share: false - # 是否尝试从请求体里读取token - is-read-body: false # 是否尝试从header里读取token is-read-head: true # 是否尝试从cookie里读取token is-read-cookie: false # token前缀 token-prefix: "Bearer" - # token风格 - token-style: uuid # jwt秘钥 jwt-secret-key: abcdefghijklmnopqrstuvwxyz # 是否输出操作日志 @@ -149,11 +141,6 @@ security: - /actuator - /actuator/** -# 重复提交 -repeat-submit: - # 全局间隔时间(毫秒) - interval: 5000 - # MyBatisPlus配置 # https://baomidou.com/config/ mybatis-plus: @@ -256,20 +243,10 @@ xss: thread-pool: # 是否开启线程池 enabled: false - # 核心线程池大小 - corePoolSize: 8 - # 最大可创建的线程数 - maxPoolSize: 16 # 队列最大长度 queueCapacity: 128 # 线程池维护线程所允许的空闲时间 keepAliveSeconds: 300 - # 线程池对拒绝任务(无线程可用)的处理策略 - # CALLER_RUNS_POLICY 调用方执行 - # DISCARD_OLDEST_POLICY 放弃最旧的 - # DISCARD_POLICY 丢弃 - # ABORT_POLICY 中止 - rejectedExecutionHandler: CALLER_RUNS_POLICY --- # redisson 缓存配置 redisson: @@ -297,8 +274,6 @@ lock4j: management: endpoints: web: - # Actuator 提供的 API 接口的根目录。默认为 /actuator - base-path: /actuator exposure: # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 # 生产环境不建议放开所有 根据项目需求放开即可 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index e19f912b..6664830f 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 @@ -69,11 +69,6 @@ easyexcel - - cglib - cglib - - org.yaml diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java index 082a5bee..942c2f97 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -14,6 +14,7 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; /** @@ -53,6 +54,7 @@ public class SysDictType extends BaseEntity { @ExcelProperty(value = "字典类型") @NotBlank(message = "字典类型不能为空") @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") + @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") private String dictType; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java new file mode 100644 index 00000000..c91a4b94 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java @@ -0,0 +1,39 @@ +package com.ruoyi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 登录类型 + * + * @author Lion Li + */ +@Getter +@AllArgsConstructor +public enum LoginType { + + /** + * 密码登录 + */ + PASSWORD("user.password.retry.limit.exceed", "user.password.retry.limit.count"), + + /** + * 短信登录 + */ + SMS("sms.code.retry.limit.exceed", "sms.code.retry.limit.count"), + + /** + * 小程序登录 + */ + XCX("", ""); + + /** + * 登录重试超出限制提示 + */ + final String retryLimitExceed; + + /** + * 登录重试限制计数提示 + */ + final String retryLimitCount; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java deleted file mode 100644 index 5529bb33..00000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ThreadPoolRejectedPolicy.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.common.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.concurrent.RejectedExecutionHandler; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 线程池 拒绝策略 泛型 - * - * @author Lion Li - */ -@Getter -@AllArgsConstructor -public enum ThreadPoolRejectedPolicy { - - CALLER_RUNS_POLICY("调用方执行", ThreadPoolExecutor.CallerRunsPolicy.class), - DISCARD_OLDEST_POLICY("放弃最旧的", ThreadPoolExecutor.DiscardOldestPolicy.class), - DISCARD_POLICY("丢弃", ThreadPoolExecutor.DiscardPolicy.class), - ABORT_POLICY("中止", ThreadPoolExecutor.AbortPolicy.class); - - private final String name; - private final Class clazz; - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java index 23ace00f..93906046 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java @@ -1,15 +1,20 @@ package com.ruoyi.common.utils; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.SimpleCache; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; -import cn.hutool.extra.cglib.CglibUtil; +import cn.hutool.core.util.StrUtil; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.springframework.cglib.beans.BeanCopier; +import org.springframework.cglib.beans.BeanMap; +import org.springframework.cglib.core.Converter; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * bean深拷贝工具(基于 cglib 性能优异) @@ -37,7 +42,8 @@ public class BeanCopyUtils { if (ObjectUtil.isNull(desc)) { return null; } - return CglibUtil.copy(source, desc); + final V target = ReflectUtil.newInstanceIfPossible(desc); + return copy(source, target); } /** @@ -54,7 +60,8 @@ public class BeanCopyUtils { if (ObjectUtil.isNull(desc)) { return null; } - CglibUtil.copy(source, desc); + BeanCopier beanCopier = BeanCopierCache.INSTANCE.get(source.getClass(), desc.getClass(), null); + beanCopier.copy(source, desc, null); return desc; } @@ -72,7 +79,11 @@ public class BeanCopyUtils { if (CollUtil.isEmpty(sourceList)) { return CollUtil.newArrayList(); } - return CglibUtil.copyList(sourceList, () -> ReflectUtil.newInstanceIfPossible(desc)); + return sourceList.stream().map(source -> { + V target = ReflectUtil.newInstanceIfPossible(desc); + copy(source, target); + return target; + }).collect(Collectors.toList()); } /** @@ -81,11 +92,12 @@ public class BeanCopyUtils { * @param bean 数据来源实体 * @return map对象 */ + @SuppressWarnings("unchecked") public static Map copyToMap(T bean) { if (ObjectUtil.isNull(bean)) { return null; } - return CglibUtil.toMap(bean); + return BeanMap.create(bean); } /** @@ -102,7 +114,8 @@ public class BeanCopyUtils { if (ObjectUtil.isNull(beanClass)) { return null; } - return CglibUtil.toBean(map, beanClass); + T bean = ReflectUtil.newInstanceIfPossible(beanClass); + return mapToBean(map, bean); } /** @@ -119,6 +132,54 @@ public class BeanCopyUtils { if (ObjectUtil.isNull(bean)) { return null; } - return CglibUtil.fillBean(map, bean); + BeanMap.create(bean).putAll(map); + return bean; } + + /** + * BeanCopier属性缓存
+ * 缓存用于防止多次反射造成的性能问题 + * + * @author Looly + * @since 5.4.1 + */ + public enum BeanCopierCache { + /** + * BeanCopier属性缓存单例 + */ + INSTANCE; + + private final SimpleCache cache = new SimpleCache<>(); + + /** + * 获得类与转换器生成的key在{@link BeanCopier}的Map中对应的元素 + * + * @param srcClass 源Bean的类 + * @param targetClass 目标Bean的类 + * @param converter 转换器 + * @return Map中对应的BeanCopier + */ + public BeanCopier get(Class srcClass, Class targetClass, Converter converter) { + final String key = genKey(srcClass, targetClass, converter); + return cache.get(key, () -> BeanCopier.create(srcClass, targetClass, converter != null)); + } + + /** + * 获得类与转换器生成的key + * + * @param srcClass 源Bean的类 + * @param targetClass 目标Bean的类 + * @param converter 转换器 + * @return 属性名和Map映射的key + */ + private String genKey(Class srcClass, Class targetClass, Converter converter) { + final StringBuilder key = StrUtil.builder() + .append(srcClass.getName()).append('#').append(targetClass.getName()); + if(null != converter){ + key.append('#').append(converter.getClass().getName()); + } + return key.toString(); + } + } + } diff --git a/ruoyi-demo/pom.xml b/ruoyi-demo/pom.xml index aeaca375..0e3fd21c 100644 --- a/ruoyi-demo/pom.xml +++ b/ruoyi-demo/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 diff --git a/ruoyi-extend/pom.xml b/ruoyi-extend/pom.xml index 95b96c6e..d8ab77d7 100644 --- a/ruoyi-extend/pom.xml +++ b/ruoyi-extend/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 ruoyi-extend diff --git a/ruoyi-extend/ruoyi-monitor-admin/pom.xml b/ruoyi-extend/ruoyi-monitor-admin/pom.xml index e811fd3b..8fed38aa 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/pom.xml +++ b/ruoyi-extend/ruoyi-monitor-admin/pom.xml @@ -5,7 +5,7 @@ ruoyi-extend com.ruoyi - 4.0.1 + 4.1.0 4.0.0 jar diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml index f59b63df..d61f79dc 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml @@ -4,7 +4,7 @@ ruoyi-extend com.ruoyi - 4.0.1 + 4.1.0 ruoyi-xxl-job-admin jar diff --git a/ruoyi-flowable/pom.xml b/ruoyi-flowable/pom.xml index 35d15769..4713c876 100644 --- a/ruoyi-flowable/pom.xml +++ b/ruoyi-flowable/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 83d2106c..c94fe2ff 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java index d0422e9d..aedc4431 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java @@ -12,7 +12,6 @@ import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.redis.RedisUtils; -import com.ruoyi.framework.config.properties.RepeatSubmitProperties; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; @@ -43,12 +42,10 @@ public class RepeatSubmitAspect { private static final ThreadLocal KEY_CACHE = new ThreadLocal<>(); - private final RepeatSubmitProperties repeatSubmitProperties; - @Before("@annotation(repeatSubmit)") public void doBefore(JoinPoint point, RepeatSubmit repeatSubmit) throws Throwable { // 如果注解不为0 则使用注解数值 - long interval = repeatSubmitProperties.getInterval(); + long interval = 0; if (repeatSubmit.interval() > 0) { interval = repeatSubmit.timeUnit().toMillis(repeatSubmit.interval()); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java index a8bec417..da18cfd1 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -53,8 +53,7 @@ public class RedisConfig extends CachingConfigurerSupport { Config config = new Config(); config.setThreads(redissonProperties.getThreads()) .setNettyThreads(redissonProperties.getNettyThreads()) - .setCodec(JsonJacksonCodec.INSTANCE) - .setTransportMode(redissonProperties.getTransportMode()); + .setCodec(JsonJacksonCodec.INSTANCE); RedissonProperties.SingleServerConfig singleServerConfig = redissonProperties.getSingleServerConfig(); if (ObjectUtil.isNotNull(singleServerConfig)) { @@ -65,8 +64,6 @@ public class RedisConfig extends CachingConfigurerSupport { .setDatabase(redisProperties.getDatabase()) .setPassword(StringUtils.isNotBlank(redisProperties.getPassword()) ? redisProperties.getPassword() : null) .setTimeout(singleServerConfig.getTimeout()) - .setRetryAttempts(singleServerConfig.getRetryAttempts()) - .setRetryInterval(singleServerConfig.getRetryInterval()) .setClientName(singleServerConfig.getClientName()) .setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout()) .setSubscriptionConnectionPoolSize(singleServerConfig.getSubscriptionConnectionPoolSize()) @@ -87,11 +84,8 @@ public class RedisConfig extends CachingConfigurerSupport { .setConnectTimeout(((Long) redisProperties.getTimeout().toMillis()).intValue()) .setPassword(StringUtils.isNotBlank(redisProperties.getPassword()) ? redisProperties.getPassword() : null) .setTimeout(clusterServersConfig.getTimeout()) - .setRetryAttempts(clusterServersConfig.getRetryAttempts()) - .setRetryInterval(clusterServersConfig.getRetryInterval()) .setClientName(clusterServersConfig.getClientName()) .setIdleConnectionTimeout(clusterServersConfig.getIdleConnectionTimeout()) - .setPingConnectionInterval(clusterServersConfig.getPingConnectionInterval()) .setSubscriptionConnectionPoolSize(clusterServersConfig.getSubscriptionConnectionPoolSize()) .setMasterConnectionMinimumIdleSize(clusterServersConfig.getMasterConnectionMinimumIdleSize()) .setMasterConnectionPoolSize(clusterServersConfig.getMasterConnectionPoolSize()) @@ -144,8 +138,6 @@ public class RedisConfig extends CachingConfigurerSupport { * threads: 16 * # Netty线程池数量 * nettyThreads: 32 - * # 传输模式 - * transportMode: "NIO" * # 集群配置 * clusterServersConfig: * # 客户端名称 @@ -160,14 +152,8 @@ public class RedisConfig extends CachingConfigurerSupport { * slaveConnectionPoolSize: 64 * # 连接空闲超时,单位:毫秒 * idleConnectionTimeout: 10000 - * # ping连接间隔 - * pingConnectionInterval: 1000 * # 命令等待超时,单位:毫秒 * timeout: 3000 - * # 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - * retryAttempts: 3 - * # 命令重试发送时间间隔,单位:毫秒 - * retryInterval: 1500 * # 发布和订阅连接池大小 * subscriptionConnectionPoolSize: 50 * # 读取模式 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java index f6e07fed..ebf236c8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java @@ -1,7 +1,6 @@ package com.ruoyi.framework.config; import com.ruoyi.common.utils.Threads; -import com.ruoyi.common.utils.reflect.ReflectUtils; import com.ruoyi.framework.config.properties.ThreadPoolProperties; import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -10,7 +9,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor; @@ -23,6 +21,11 @@ import java.util.concurrent.ThreadPoolExecutor; @Configuration public class ThreadPoolConfig { + /** + * 核心线程数 = cpu 核心数 + 1 + */ + private final int core = Runtime.getRuntime().availableProcessors() + 1; + @Autowired private ThreadPoolProperties threadPoolProperties; @@ -30,12 +33,11 @@ public class ThreadPoolConfig { @ConditionalOnProperty(prefix = "thread-pool", name = "enabled", havingValue = "true") public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(threadPoolProperties.getMaxPoolSize()); - executor.setCorePoolSize(threadPoolProperties.getCorePoolSize()); + executor.setMaxPoolSize(core); + executor.setCorePoolSize(core * 2); executor.setQueueCapacity(threadPoolProperties.getQueueCapacity()); executor.setKeepAliveSeconds(threadPoolProperties.getKeepAliveSeconds()); - RejectedExecutionHandler handler = ReflectUtils.newInstance(threadPoolProperties.getRejectedExecutionHandler().getClazz()); - executor.setRejectedExecutionHandler(handler); + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); return executor; } @@ -44,7 +46,7 @@ public class ThreadPoolConfig { */ @Bean(name = "scheduledExecutorService") protected ScheduledExecutorService scheduledExecutorService() { - return new ScheduledThreadPoolExecutor(threadPoolProperties.getCorePoolSize(), + return new ScheduledThreadPoolExecutor(core, new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), new ThreadPoolExecutor.CallerRunsPolicy()) { @Override diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java index eae9e3fc..cd320eb5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java @@ -4,7 +4,6 @@ import lombok.Data; import lombok.NoArgsConstructor; import org.redisson.config.ReadMode; import org.redisson.config.SubscriptionMode; -import org.redisson.config.TransportMode; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -30,11 +29,6 @@ public class RedissonProperties { */ private int nettyThreads; - /** - * 传输模式 - */ - private TransportMode transportMode; - /** * 单机服务配置 */ @@ -79,16 +73,6 @@ public class RedissonProperties { */ private int timeout; - /** - * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - */ - private int retryAttempts; - - /** - * 命令重试发送时间间隔,单位:毫秒 - */ - private int retryInterval; - /** * 发布和订阅连接池大小 */ @@ -130,26 +114,11 @@ public class RedissonProperties { */ private int idleConnectionTimeout; - /** - * ping超时 - */ - private int pingConnectionInterval; - /** * 命令等待超时,单位:毫秒 */ private int timeout; - /** - * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - */ - private int retryAttempts; - - /** - * 命令重试发送时间间隔,单位:毫秒 - */ - private int retryInterval; - /** * 发布和订阅连接池大小 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RepeatSubmitProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RepeatSubmitProperties.java deleted file mode 100644 index fa65b28c..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RepeatSubmitProperties.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ruoyi.framework.config.properties; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 重复提交 配置属性 - * - * @author Lion Li - */ -@Data -@Component -@ConfigurationProperties(prefix = "repeat-submit") -public class RepeatSubmitProperties { - - /** - * 间隔时间(毫秒) - */ - private int interval; - -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java index fbffc0f4..fe067332 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java @@ -1,6 +1,5 @@ package com.ruoyi.framework.config.properties; -import com.ruoyi.common.enums.ThreadPoolRejectedPolicy; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -20,16 +19,6 @@ public class ThreadPoolProperties { */ private boolean enabled; - /** - * 核心线程池大小 - */ - private int corePoolSize; - - /** - * 最大可创建的线程数 - */ - private int maxPoolSize; - /** * 队列最大长度 */ @@ -40,9 +29,4 @@ public class ThreadPoolProperties { */ private int keepAliveSeconds; - /** - * 线程池对拒绝任务(无线程可用)的处理策略 - */ - private ThreadPoolRejectedPolicy rejectedExecutionHandler; - } diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index b647587f..d744e10d 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index 96bb520c..ac0c2b2c 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -78,14 +78,24 @@ v-hasPermi="['${moduleName}:${businessName}:add']" >新增 + + 展开/折叠 + #foreach($column in $columns) @@ -293,6 +303,10 @@ export default { title: "", // 是否显示弹出层 open: false, + // 是否展开,默认全部展开 + isExpandAll: true, + // 重新渲染表格状态 + refreshTable: true, #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) @@ -423,6 +437,14 @@ export default { this.open = true; this.title = "添加${functionName}"; }, + /** 展开/折叠操作 */ + toggleExpandAll() { + this.refreshTable = false; + this.isExpandAll = !this.isExpandAll; + this.$nextTick(() => { + this.refreshTable = true; + }); + }, /** 修改按钮操作 */ handleUpdate(row) { this.loading = true; diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm index 629b931c..6776687d 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -76,14 +76,23 @@ v-hasPermi="['${moduleName}:${businessName}:add']" >新增 + + 展开/折叠 + #foreach($column in $columns) @@ -282,6 +291,8 @@ const buttonLoading = ref(false); const loading = ref(true); const showSearch = ref(true); const title = ref(""); +const isExpandAll = ref(true); +const refreshTable = ref(true); #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) @@ -404,6 +415,15 @@ async function handleAdd(row) { title.value = "添加${functionName}"; } +/** 展开/折叠操作 */ +function toggleExpandAll() { + refreshTable.value = false; + isExpandAll.value = !isExpandAll.value; + nextTick(() => { + refreshTable.value = true; + }); +} + /** 修改按钮操作 */ async function handleUpdate(row) { loading.value = true; diff --git a/ruoyi-job/pom.xml b/ruoyi-job/pom.xml index 8c50e68b..a4a5bb82 100644 --- a/ruoyi-job/pom.xml +++ b/ruoyi-job/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 jar diff --git a/ruoyi-oss/pom.xml b/ruoyi-oss/pom.xml index 1fdd2bfd..29b9a840 100644 --- a/ruoyi-oss/pom.xml +++ b/ruoyi-oss/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 @@ -42,6 +42,10 @@ org.slf4j slf4j-log4j12 + + org.bouncycastle + bcprov-jdk15on +
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java index 93f88fb3..f5be957f 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java @@ -79,6 +79,8 @@ public class MinioOssStrategy extends AbstractOssStrategy { @Override public UploadResult upload(InputStream inputStream, String path, String contentType) { try { + // 解决 inputStream.available() 再 socket 下传输延迟问题 导致获取数值不精确 + Thread.sleep(1000); minioClient.putObject(PutObjectArgs.builder() .bucket(properties.getBucketName()) .object(path) diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 9407f5e5..b92c3976 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -5,7 +5,7 @@ ruoyi-flowable-plus com.ruoyi - 4.0.1 + 4.1.0 4.0.0 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java index e62e2d31..80d874f2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java @@ -24,7 +24,7 @@ public interface ISysOssConfigService { /** * 查询单个 */ - SysOssConfigVo queryById(Integer ossConfigId); + SysOssConfigVo queryById(Long ossConfigId); /** * 查询列表 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java index 4630d1f9..01fa313b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java @@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.XcxLoginUser; import com.ruoyi.common.core.service.LogininforService; import com.ruoyi.common.enums.DeviceType; +import com.ruoyi.common.enums.LoginType; import com.ruoyi.common.enums.UserStatus; import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaExpireException; @@ -28,6 +29,7 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; /** * 登录校验方法 @@ -60,35 +62,8 @@ public class SysLoginService { if (captchaOnOff) { validateCaptcha(username, code, uuid, request); } - // 获取用户登录错误次数(可自定义限制策略 例如: key + username + ip) - Integer errorNumber = RedisUtils.getCacheObject(Constants.LOGIN_ERROR + username); - // 锁定时间内登录 则踢出 - if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) { - asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request); - throw new UserException("user.password.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME); - } - SysUser user = loadUserByUsername(username); - - if (!BCrypt.checkpw(password, user.getPassword())) { - // 是否第一次 - errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1; - // 达到规定错误次数 则锁定登录 - if (errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) { - RedisUtils.setCacheObject(Constants.LOGIN_ERROR + username, errorNumber, Constants.LOGIN_ERROR_LIMIT_TIME, TimeUnit.MINUTES); - asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request); - throw new UserException("user.password.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME); - } else { - // 未达到规定错误次数 则递增 - RedisUtils.setCacheObject(Constants.LOGIN_ERROR + username, errorNumber); - asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", errorNumber), request); - throw new UserException("user.password.retry.limit.count", errorNumber); - } - } - - // 登录成功 清空错误次数 - RedisUtils.deleteObject(Constants.LOGIN_ERROR + username); - + checkLogin(LoginType.PASSWORD, username, () -> !BCrypt.checkpw(password, user.getPassword())); // 此处可根据登录用户的数据不同 自行创建 loginUser LoginUser loginUser = buildLoginUser(user); // 生成token @@ -104,33 +79,7 @@ public class SysLoginService { SysUser user = loadUserByPhonenumber(phonenumber); HttpServletRequest request = ServletUtils.getRequest(); - // 获取用户登录错误次数(可自定义限制策略 例如: key + username + ip) - Integer errorNumber = RedisUtils.getCacheObject(Constants.LOGIN_ERROR + user.getUserName()); - // 锁定时间内登录 则踢出 - if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) { - asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request); - throw new UserException("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME); - } - - if (!validateSmsCode(phonenumber, smsCode)) { - // 是否第一次 - errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1; - // 达到规定错误次数 则锁定登录 - if (errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) { - RedisUtils.setCacheObject(Constants.LOGIN_ERROR + user.getUserName(), errorNumber, Constants.LOGIN_ERROR_LIMIT_TIME, TimeUnit.MINUTES); - asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request); - throw new UserException("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME); - } else { - // 未达到规定错误次数 则递增 - RedisUtils.setCacheObject(Constants.LOGIN_ERROR + user.getUserName(), errorNumber); - asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.count", errorNumber), request); - throw new UserException("sms.code.retry.limit.count", errorNumber); - } - } - - // 登录成功 清空错误次数 - RedisUtils.deleteObject(Constants.LOGIN_ERROR + user.getUserName()); - + checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode)); // 此处可根据登录用户的数据不同 自行创建 loginUser LoginUser loginUser = buildLoginUser(user); // 生成token @@ -276,4 +225,42 @@ public class SysLoginService { sysUser.setUpdateBy(username); userService.updateUserProfile(sysUser); } + + /** + * 登录校验 + */ + private void checkLogin(LoginType loginType, String username, Supplier supplier) { + HttpServletRequest request = ServletUtils.getRequest(); + String errorKey = Constants.LOGIN_ERROR + username; + Integer errorLimitTime = Constants.LOGIN_ERROR_LIMIT_TIME; + Integer setErrorNumber = Constants.LOGIN_ERROR_NUMBER; + String loginFail = Constants.LOGIN_FAIL; + + // 获取用户登录错误次数(可自定义限制策略 例如: key + username + ip) + Integer errorNumber = RedisUtils.getCacheObject(errorKey); + // 锁定时间内登录 则踢出 + if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(setErrorNumber)) { + asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), errorLimitTime), request); + throw new UserException(loginType.getRetryLimitExceed(), errorLimitTime); + } + + if (supplier.get()) { + // 是否第一次 + errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1; + // 达到规定错误次数 则锁定登录 + if (errorNumber.equals(setErrorNumber)) { + RedisUtils.setCacheObject(errorKey, errorNumber, errorLimitTime, TimeUnit.MINUTES); + asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), errorLimitTime), request); + throw new UserException(loginType.getRetryLimitExceed(), errorLimitTime); + } else { + // 未达到规定错误次数 则递增 + RedisUtils.setCacheObject(errorKey, errorNumber); + asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitCount(), errorNumber), request); + throw new UserException(loginType.getRetryLimitCount(), errorNumber); + } + } + + // 登录成功 清空错误次数 + RedisUtils.deleteObject(errorKey); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java index 86ba97d1..f78be1e8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java @@ -63,7 +63,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { } @Override - public SysOssConfigVo queryById(Integer ossConfigId) { + public SysOssConfigVo queryById(Long ossConfigId) { return baseMapper.selectVoById(ossConfigId); } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index d4fd23fc..0b388d13 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -32,6 +32,7 @@ + @@ -66,6 +67,7 @@ u.remark, d.dept_id, d.parent_id, + d.ancestors, d.dept_name, d.order_num, d.leader, diff --git a/ruoyi-ui/README.md b/ruoyi-ui/README.md index 9e43c974..048cbf88 100644 --- a/ruoyi-ui/README.md +++ b/ruoyi-ui/README.md @@ -11,7 +11,7 @@ cd ruoyi-ui npm install # 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 -npm install --registry=https://registry.npm.taobao.org +npm install --registry=https://registry.npmmirror.com # 启动服务 npm run dev diff --git a/ruoyi-ui/bin/package.bat b/ruoyi-ui/bin/package.bat index 82817497..9f6e5f4d 100644 --- a/ruoyi-ui/bin/package.bat +++ b/ruoyi-ui/bin/package.bat @@ -1,12 +1,12 @@ @echo off echo. -echo [Ϣ] װWeḅnode_modulesļ +echo [��Ϣ] ��װWeb���̣�����node_modules�ļ��� echo. %~d0 cd %~dp0 cd .. -npm install --registry=https://registry.npm.taobao.org +npm install --registry=https://registry.npmmirror.com -pause \ No newline at end of file +pause diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 4488b561..11d14721 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-flowable-plus", - "version": "4.0.1", + "version": "4.1.0", "description": "RuoYi-Flowable-Plus后台管理系统", "author": "KonBAI", "license": "MIT", @@ -41,13 +41,13 @@ "clipboard": "2.0.8", "core-js": "3.19.1", "echarts": "4.9.0", - "element-ui": "2.15.6", + "element-ui": "2.15.8", "file-saver": "2.0.5", "fuse.js": "6.4.3", "highlight.js": "^10.5.0", "js-beautify": "1.13.0", "js-cookie": "3.0.1", - "jsencrypt": "3.2.1", + "jsencrypt": "3.0.0-rc.1", "nprogress": "0.2.0", "quill": "1.3.7", "screenfull": "5.0.2", diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 5f1e2365..78baf48d 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -41,6 +41,7 @@ diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index 11573dd8..acd46701 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -44,6 +44,7 @@ diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue index cabb2582..0cc24dba 100644 --- a/ruoyi-ui/src/components/TopNav/index.vue +++ b/ruoyi-ui/src/components/TopNav/index.vue @@ -30,13 +30,14 @@