From 7d0f5e94efc4313422c8a21a4551b7796a1b1a62 Mon Sep 17 00:00:00 2001 From: phper08 Date: Mon, 3 May 2021 13:18:33 +0800 Subject: [PATCH 01/11] update ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java. --- .../java/com/ruoyi/common/utils/Arith.java | 228 +++++++++--------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java index 86683197..b6326c2b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java @@ -1,114 +1,114 @@ -package com.ruoyi.common.utils; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -/** - * 精确的浮点数运算 - * - * @author ruoyi - */ -public class Arith -{ - - /** 默认除法运算精度 */ - private static final int DEF_DIV_SCALE = 10; - - /** 这个类不能实例化 */ - private Arith() - { - } - - /** - * 提供精确的加法运算。 - * @param v1 被加数 - * @param v2 加数 - * @return 两个参数的和 - */ - public static double add(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.add(b2).doubleValue(); - } - - /** - * 提供精确的减法运算。 - * @param v1 被减数 - * @param v2 减数 - * @return 两个参数的差 - */ - public static double sub(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.subtract(b2).doubleValue(); - } - - /** - * 提供精确的乘法运算。 - * @param v1 被乘数 - * @param v2 乘数 - * @return 两个参数的积 - */ - public static double mul(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.multiply(b2).doubleValue(); - } - - /** - * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 - * 小数点以后10位,以后的数字四舍五入。 - * @param v1 被除数 - * @param v2 除数 - * @return 两个参数的商 - */ - public static double div(double v1, double v2) - { - return div(v1, v2, DEF_DIV_SCALE); - } - - /** - * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 - * 定精度,以后的数字四舍五入。 - * @param v1 被除数 - * @param v2 除数 - * @param scale 表示表示需要精确到小数点以后几位。 - * @return 两个参数的商 - */ - public static double div(double v1, double v2, int scale) - { - if (scale < 0) - { - throw new IllegalArgumentException( - "The scale must be a positive integer or zero"); - } - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - if (b1.compareTo(BigDecimal.ZERO) == 0) - { - return BigDecimal.ZERO.doubleValue(); - } - return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); - } - - /** - * 提供精确的小数位四舍五入处理。 - * @param v 需要四舍五入的数字 - * @param scale 小数点后保留几位 - * @return 四舍五入后的结果 - */ - public static double round(double v, int scale) - { - if (scale < 0) - { - throw new IllegalArgumentException( - "The scale must be a positive integer or zero"); - } - BigDecimal b = new BigDecimal(Double.toString(v)); - BigDecimal one = new BigDecimal("1"); - return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); - } -} +package com.ruoyi.common.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 精确的浮点数运算 + * + * @author ruoyi + */ +public class Arith +{ + + /** 默认除法运算精度 */ + private static final int DEF_DIV_SCALE = 10; + + /** 这个类不能实例化 */ + private Arith() + { + } + + /** + * 提供精确的加法运算。 + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 + * 小数点以后10位,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(double v1, double v2) + { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 + * 定精度,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @param scale 表示表示需要精确到小数点以后几位。 + * @return 两个参数的商 + */ + public static double div(double v1, double v2, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + if (b1.compareTo(BigDecimal.ZERO) == 0) + { + return BigDecimal.ZERO.doubleValue(); + } + return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * @param v 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(double v, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b = new BigDecimal(Double.toString(v)); + BigDecimal one = BigDecimal.ONE; + return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); + } +} From 3f1427eef9f367cef673edcad93d57e625ebba39 Mon Sep 17 00:00:00 2001 From: leizhuogogo <732124645@qq.com> Date: Thu, 6 May 2021 17:50:28 +0800 Subject: [PATCH 02/11] update ruoyi-ui/src/assets/styles/element-ui.scss. --- ruoyi-ui/src/assets/styles/element-ui.scss | 176 +++++++++++---------- 1 file changed, 92 insertions(+), 84 deletions(-) diff --git a/ruoyi-ui/src/assets/styles/element-ui.scss b/ruoyi-ui/src/assets/styles/element-ui.scss index 558eea48..363092a6 100644 --- a/ruoyi-ui/src/assets/styles/element-ui.scss +++ b/ruoyi-ui/src/assets/styles/element-ui.scss @@ -1,84 +1,92 @@ -// cover some element-ui styles - -.el-breadcrumb__inner, -.el-breadcrumb__inner a { - font-weight: 400 !important; -} - -.el-upload { - input[type="file"] { - display: none !important; - } -} - -.el-upload__input { - display: none; -} - -.cell { - .el-tag { - margin-right: 0px; - } -} - -.small-padding { - .cell { - padding-left: 5px; - padding-right: 5px; - } -} - -.fixed-width { - .el-button--mini { - padding: 7px 10px; - width: 60px; - } -} - -.status-col { - .cell { - padding: 0 10px; - text-align: center; - - .el-tag { - margin-right: 0px; - } - } -} - -// to fixed https://github.com/ElemeFE/element/issues/2461 -.el-dialog { - transform: none; - left: 0; - position: relative; - margin: 0 auto; -} - -// refine element ui upload -.upload-container { - .el-upload { - width: 100%; - - .el-upload-dragger { - width: 100%; - height: 200px; - } - } -} - -// dropdown -.el-dropdown-menu { - a { - display: block - } -} - -// fix date-picker ui bug in filter-item -.el-range-editor.el-input__inner { - display: inline-flex !important; -} - -// to fix el-date-picker css style -.el-range-separator { - box-sizing: content-box; -} +// cover some element-ui styles + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type="file"] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + +.cell { + .el-tag { + margin-right: 0px; + } +} + +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} + +.fixed-width { + .el-button--mini { + padding: 7px 10px; + width: 60px; + } +} + +.status-col { + .cell { + padding: 0 10px; + text-align: center; + + .el-tag { + margin-right: 0px; + } + } +} + +// to fixed https://github.com/ElemeFE/element/issues/2461 +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block + } +} + +// fix date-picker ui bug in filter-item +.el-range-editor.el-input__inner { + display: inline-flex !important; +} + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} + +.el-menu--collapse + > div + > .el-submenu + > .el-submenu__title + .el-submenu__icon-arrow { + display: none; +} \ No newline at end of file From 50034301ac37ad0d956fb99cec22d8c648add8a6 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 6 May 2021 20:40:25 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=BE=A4?= =?UTF-8?q?=E5=8F=B7=EF=BC=9A201396349?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- ruoyi-ui/src/views/index.vue | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 51a93691..96c1e9e0 100644 --- a/README.md +++ b/README.md @@ -82,4 +82,4 @@ ## 若依前后端分离交流群 -QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) 点击按钮入群。 \ No newline at end of file +QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。 \ No newline at end of file diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index f3cf00f4..b18cc6ce 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -120,8 +120,9 @@

QQ群:满937441 满887144332 满180251782 满104180207 - 186866453满186866453 + + 201396349

From 14ea071306f0ec3b79687346fa05116522f7a6a2 Mon Sep 17 00:00:00 2001 From: libin <17610879900@163.com> Date: Sat, 8 May 2021 15:31:16 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=97=B6java.nio.file.FileAlreadyExistsExcep?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/file/FileUploadUtils.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index cb2f0239..daa9498c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -130,14 +130,10 @@ public class FileUploadUtils private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { File desc = new File(uploadDir + File.separator + fileName); - - if (!desc.getParentFile().exists()) - { - desc.getParentFile().mkdirs(); - } - if (!desc.exists()) - { - desc.createNewFile(); + if (!desc.exists()) { + if (!desc.getParentFile().exists()) { + desc.getParentFile().mkdirs(); + } } return desc; } From 961c60dd1a546969359b717c289f7cf21d083670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 10 May 2021 23:53:15 +0800 Subject: [PATCH 05/11] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0banner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/RuoYiApplication.java | 2 +- ruoyi-admin/src/main/resources/banner.txt | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 6be5918a..5b55927b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -17,6 +17,6 @@ public class RuoYiApplication { System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(RuoYiApplication.class, args); - System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙"); + System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙"); } } diff --git a/ruoyi-admin/src/main/resources/banner.txt b/ruoyi-admin/src/main/resources/banner.txt index fee1ce3b..f592dbe1 100644 --- a/ruoyi-admin/src/main/resources/banner.txt +++ b/ruoyi-admin/src/main/resources/banner.txt @@ -1,2 +1,8 @@ -Application Version: ${ruoyi.version} -Spring Boot Version: ${spring-boot.version} \ No newline at end of file +Application Version: ${ruoyi-vue-plus.version} +Spring Boot Version: ${spring-boot.version} +__________ _____.___.__ ____ ____ __________.__ +\______ \__ __ ____\__ | |__| \ \ / /_ __ ____ \______ \ | __ __ ______ + | _/ | \/ _ \/ | | | ______ \ Y / | \_/ __ \ ______ | ___/ | | | \/ ___/ + | | \ | ( <_> )____ | | /_____/ \ /| | /\ ___/ /_____/ | | | |_| | /\___ \ + |____|_ /____/ \____// ______|__| \___/ |____/ \___ > |____| |____/____//____ > + \/ \/ \/ \/ From dafdb43c848d5e1859ff22dd27d9d21c92bc169d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 11 May 2021 10:02:32 +0800 Subject: [PATCH 06/11] =?UTF-8?q?update=20=E9=85=8D=E7=BD=AE=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E5=88=B0=20yml=20=E6=96=87=E4=BB=B6=20=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/core/config/SwaggerConfig.java | 58 +++++++++++------- .../src/main/resources/application.yml | 26 ++++++++ .../framework/config/ApplicationConfig.java | 14 ++--- .../ruoyi/framework/config/FeignConfig.java | 2 +- .../framework/config/MybatisPlusConfig.java | 3 + .../framework/config/ThreadPoolConfig.java | 60 ++++++++++++------- 6 files changed, 112 insertions(+), 51 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 96570815..8a1b74be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -21,32 +21,54 @@ import java.util.List; /** * Swagger2的接口配置 - * - * @author ruoyi + * + * @author Lion Li */ @Configuration @EnableSwagger2WebMvc @EnableKnife4j -public class SwaggerConfig -{ - /** 系统基础配置 */ +public class SwaggerConfig { + /** + * 系统基础配置 + */ @Autowired private RuoYiConfig ruoyiConfig; - /** 是否开启swagger */ + /** + * 是否开启swagger + */ @Value("${swagger.enabled}") private boolean enabled; - /** 设置请求的统一前缀 */ + /** + * 设置请求的统一前缀 + */ @Value("${swagger.pathMapping}") private String pathMapping; + /** + * 标题 + */ + @Value("${swagger.title}") + private String title; + + /** + * 描述 + */ + @Value("${swagger.description}") + private String description; + + /** + * 版本 + */ + @Value("${swagger.version}") + private String version; + /** * 创建API */ @Bean - public Docket createRestApi() - { + public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) // 是否启用Swagger .enable(enabled) @@ -70,8 +92,7 @@ public class SwaggerConfig /** * 安全模式,这里指定token通过Authorization头请求头传递 */ - private List securitySchemes() - { + private List securitySchemes() { List apiKeyList = new ArrayList(); apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); return apiKeyList; @@ -80,8 +101,7 @@ public class SwaggerConfig /** * 安全上下文 */ - private List securityContexts() - { + private List securityContexts() { List securityContexts = new ArrayList<>(); securityContexts.add( SecurityContext.builder() @@ -94,8 +114,7 @@ public class SwaggerConfig /** * 默认的安全上引用 */ - private List defaultAuth() - { + private List defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; @@ -107,18 +126,17 @@ public class SwaggerConfig /** * 添加摘要信息 */ - private ApiInfo apiInfo() - { + private ApiInfo apiInfo() { // 用ApiInfoBuilder进行定制 return new ApiInfoBuilder() // 设置标题 - .title("标题:若依管理系统_接口文档") + .title(title) // 描述 - .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + .description(description) // 作者信息 .contact(new Contact(ruoyiConfig.getName(), null, null)) // 版本 - .version("版本号:" + ruoyiConfig.getVersion()) + .version(version) .build(); } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 44bc4377..85007285 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -119,6 +119,7 @@ token: # MyBatis配置 # https://baomidou.com/config/ mybatis-plus: + mapperPackage: com.ruoyi.**.mapper # 对应的 XML 文件位置 mapperLocations: classpath*:mapper/**/*Mapper.xml # 实体扫描,多个package用逗号或者分号分隔 @@ -217,6 +218,12 @@ swagger: enabled: true # 请求前缀 pathMapping: /dev-api + # 标题 + title: '标题:RuoYi-Vue-Plus后台管理系统_接口文档' + # 描述 + description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' + # 版本 + version: '版本号: ${ruoyi-vue-plus.version}' # 防止XSS攻击 xss: @@ -227,7 +234,26 @@ xss: # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* +threadPoolConfig: + # 是否开启线程池 + enabled: false + # 核心线程池大小 + corePoolSize: 8 + # 最大可创建的线程数 + maxPoolSize: 16 + # 队列最大长度 + queueCapacity: 128 + # 线程池维护线程所允许的空闲时间 + keepAliveSeconds: 300 + # 线程池对拒绝任务(无线程可用)的处理策略 + # CallerRunsPolicy 等待 + # DiscardOldestPolicy 放弃最旧的 + # DiscardPolicy 丢弃 + # AbortPolicy 中止 + rejectedExecutionHandler: CallerRunsPolicy + feign: + package: com.ruoyi.**.feign # 开启压缩 compression: request: diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java index 1d4dc1f7..183c3640 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java @@ -1,30 +1,26 @@ package com.ruoyi.framework.config; -import java.util.TimeZone; -import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; +import java.util.TimeZone; + /** * 程序注解配置 * - * @author ruoyi + * @author Lion Li */ @Configuration // 表示通过aop框架暴露该代理对象,AopContext能够访问 @EnableAspectJAutoProxy(exposeProxy = true) -// 指定要扫描的Mapper类的包的路径 -@MapperScan("com.ruoyi.**.mapper") -public class ApplicationConfig -{ +public class ApplicationConfig { /** * 时区配置 */ @Bean - public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() - { + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() { return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java index df095169..478a450f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit; * * @author Lion Li */ -@EnableFeignClients("com.ruoyi.**.feign") +@EnableFeignClients("${feign.package}") @Configuration @ConditionalOnClass(Feign.class) @AutoConfigureBefore(FeignAutoConfiguration.class) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java index 93a202ca..bce2150b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.ruoyi.framework.mybatisplus.CreateAndUpdateMetaObjectHandler; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -17,6 +18,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; */ @EnableTransactionManagement(proxyTargetClass = true) @Configuration +// 指定要扫描的Mapper类的包的路径 +@MapperScan("${mybatis-plus.mapperPackage}") public class MybatisPlusConfig { @Bean 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 0d67c224..30d5ef91 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,44 +1,65 @@ package com.ruoyi.framework.config; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; +import com.ruoyi.common.utils.Threads; import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import com.ruoyi.common.utils.Threads; + +import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; /** * 线程池配置 * - * @author ruoyi + * @author Lion Li **/ @Configuration -public class ThreadPoolConfig -{ +public class ThreadPoolConfig { + // 核心线程池大小 - private int corePoolSize = 50; + @Value("${threadPoolConfig.corePoolSize}") + private int corePoolSize; // 最大可创建的线程数 - private int maxPoolSize = 200; + @Value("${threadPoolConfig.maxPoolSize}") + private int maxPoolSize; // 队列最大长度 - private int queueCapacity = 1000; + @Value("${threadPoolConfig.queueCapacity}") + private int queueCapacity; // 线程池维护线程所允许的空闲时间 - private int keepAliveSeconds = 300; + @Value("${threadPoolConfig.keepAliveSeconds}") + private int keepAliveSeconds; + + // 线程池对拒绝任务(无线程可用)的处理策略 + @Value("${threadPoolConfig.rejectedExecutionHandler}") + private String rejectedExecutionHandler; @Bean(name = "threadPoolTaskExecutor") - public ThreadPoolTaskExecutor threadPoolTaskExecutor() - { + @ConditionalOnProperty(prefix = "threadPoolTaskExecutor", name = "enabled", havingValue = "true") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setMaxPoolSize(maxPoolSize); executor.setCorePoolSize(corePoolSize); executor.setQueueCapacity(queueCapacity); executor.setKeepAliveSeconds(keepAliveSeconds); - // 线程池对拒绝任务(无线程可用)的处理策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + RejectedExecutionHandler handler; + if (rejectedExecutionHandler.equals("CallerRunsPolicy")) { + handler = new ThreadPoolExecutor.CallerRunsPolicy(); + } else if (rejectedExecutionHandler.equals("DiscardOldestPolicy")) { + handler = new ThreadPoolExecutor.DiscardOldestPolicy(); + } else if (rejectedExecutionHandler.equals("DiscardPolicy")) { + handler = new ThreadPoolExecutor.DiscardPolicy(); + } else { + handler = new ThreadPoolExecutor.AbortPolicy(); + } + executor.setRejectedExecutionHandler(handler); return executor; } @@ -46,14 +67,11 @@ public class ThreadPoolConfig * 执行周期性或定时任务 */ @Bean(name = "scheduledExecutorService") - protected ScheduledExecutorService scheduledExecutorService() - { + protected ScheduledExecutorService scheduledExecutorService() { return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) - { + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { @Override - protected void afterExecute(Runnable r, Throwable t) - { + protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); Threads.printException(r, t); } From dd384e4a311fc9581aba15318bd6f9d20d0b3fba Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 11 May 2021 14:25:08 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/file/InvalidExtensionException.java | 10 ++++++++++ .../com/ruoyi/common/utils/file/FileUploadUtils.java | 12 ++++++++++-- .../com/ruoyi/common/utils/file/MimeTypeUtils.java | 4 ++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java index 81cd78b8..68195374 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java @@ -68,4 +68,14 @@ public class InvalidExtensionException extends FileUploadException super(allowedExtension, extension, filename); } } + + public static class InvalidVideoExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index daa9498c..94a5d43c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -130,8 +130,11 @@ public class FileUploadUtils private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { File desc = new File(uploadDir + File.separator + fileName); - if (!desc.exists()) { - if (!desc.getParentFile().exists()) { + + if (!desc.exists()) + { + if (!desc.getParentFile().exists()) + { desc.getParentFile().mkdirs(); } } @@ -182,6 +185,11 @@ public class FileUploadUtils throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName); } + else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) + { + throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, + fileName); + } else { throw new InvalidExtensionException(allowedExtension, extension, fileName); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java index d179a918..59358152 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java @@ -24,6 +24,8 @@ public class MimeTypeUtils public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", "asf", "rm", "rmvb" }; + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + public static final String[] DEFAULT_ALLOWED_EXTENSION = { // 图片 "bmp", "gif", "jpg", "jpeg", "png", @@ -31,6 +33,8 @@ public class MimeTypeUtils "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", // 压缩文件 "rar", "zip", "gz", "bz2", + // 视频格式 + "mp4", "avi", "rmvb", // pdf "pdf" }; From be5c19b764e85d19389935861c4c7794f0222494 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 11 May 2021 14:25:25 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=A0=91=E7=BA=A7=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AD=90=E8=8A=82=E7=82=B9=E4=BD=BF=E7=94=A8?= =?UTF-8?q?replaceFirst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 35f62769..aa69c475 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -241,7 +241,7 @@ public class SysDeptServiceImpl implements ISysDeptService List children = deptMapper.selectChildrenDeptById(deptId); for (SysDept child : children) { - child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); + child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); } if (children.size() > 0) { From 32f333a00e3222b75be61ecb6e9de3900cfa96c4 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 11 May 2021 14:25:39 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/web/controller/monitor/SysOperlogController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 19428561..75bf1268 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -48,6 +48,7 @@ public class SysOperlogController extends BaseController return util.exportExcel(list, "操作日志"); } + @Log(title = "操作日志", businessType = BusinessType.DELETE) @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @DeleteMapping("/{operIds}") public AjaxResult remove(@PathVariable Long[] operIds) From 99726be9acf116ad4537cb52a3c4460b8faa4631 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 11 May 2021 14:26:20 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=A1=A8=E6=9D=83=E9=99=90=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/generator/controller/GenController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 21b1cc53..516e5a10 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -101,7 +101,7 @@ public class GenController extends BaseController /** * 导入表结构(保存) */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @PreAuthorize("@ss.hasPermi('tool:gen:import')") @Log(title = "代码生成", businessType = BusinessType.IMPORT) @PostMapping("/importTable") public AjaxResult importTableSave(String tables) From 3b73bbe0acb269543ec580125fa73f18fd1a2726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 11 May 2021 17:36:52 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=20v1?= =?UTF-8?q?.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- ruoyi-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 43443e10..74ccf9d3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ RuoYi-Vue-Plus后台管理系统 - 1.0.0 + 1.0.1 UTF-8 UTF-8 1.8 diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index a3765b63..58ee98df 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "1.0.0", + "version": "1.0.1", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT",