mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 19:51:56 +08:00
Compare commits
83 Commits
springboot
...
924a7674fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
924a7674fa | ||
|
|
3915c77391 | ||
|
|
b80932ceb4 | ||
|
|
056cf94082 | ||
|
|
0dcd3e6183 | ||
|
|
07be5ceb26 | ||
|
|
cc59502d7c | ||
|
|
98738f23ad | ||
|
|
57fe1c663e | ||
|
|
7b6fdb3a89 | ||
|
|
7320bda521 | ||
|
|
646247503e | ||
|
|
8a55aaec91 | ||
|
|
79c885decb | ||
|
|
1a0f37a2dc | ||
|
|
02de344d8c | ||
|
|
189100f74e | ||
|
|
e29284e687 | ||
|
|
d4af286f41 | ||
|
|
60e2d55a23 | ||
|
|
bbd112d5a3 | ||
|
|
90922844ea | ||
|
|
3a9f56f04b | ||
|
|
a1ec1d57d4 | ||
|
|
060959a7c5 | ||
|
|
43e1d8d573 | ||
|
|
67cf51ba77 | ||
|
|
a256618d5d | ||
|
|
a6bcebb62b | ||
|
|
1cb262daa3 | ||
|
|
8c096cba8d | ||
|
|
088cec8adf | ||
|
|
85ff6a9910 | ||
|
|
cab5beaca7 | ||
|
|
fc8069a250 | ||
|
|
924e705dca | ||
|
|
049ba453d1 | ||
|
|
4aa261e8f7 | ||
|
|
914a6620f5 | ||
|
|
3dcee7057d | ||
|
|
0467631319 | ||
|
|
a11df90255 | ||
|
|
596e4fe756 | ||
|
|
37219e4ae6 | ||
|
|
adaa3e1db8 | ||
|
|
88ad5a2c19 | ||
|
|
b45dc2ec25 | ||
|
|
67b17da06f | ||
|
|
b25a280ebb | ||
|
|
cc026e75a3 | ||
|
|
7216b56a56 | ||
|
|
a326e880a1 | ||
|
|
92c6d21855 | ||
|
|
2335157f6e | ||
|
|
6c3b01c3c5 | ||
|
|
8faea60191 | ||
|
|
28a16d9878 | ||
|
|
dd3cf18e27 | ||
|
|
65d03dc014 | ||
|
|
7912fd81bd | ||
|
|
e2175e5b9d | ||
|
|
c0e119f8e0 | ||
|
|
fa77b2a08c | ||
|
|
a222c24796 | ||
|
|
08f4b877ce | ||
|
|
aa607d135c | ||
|
|
6d34cdb8a3 | ||
|
|
d47352253e | ||
|
|
61cbd470e1 | ||
|
|
b3ef4adfed | ||
|
|
856c471472 | ||
|
|
bec5600f16 | ||
|
|
5b485e7934 | ||
|
|
73a752d3ab | ||
|
|
1899a832b9 | ||
|
|
e6796c0954 | ||
|
|
4987289a98 | ||
|
|
18409922a5 | ||
|
|
3dca02b306 | ||
|
|
75f3275e15 | ||
|
|
b2e4a7046b | ||
|
|
60618c1da9 | ||
|
|
3b499b1344 |
@@ -1,11 +1,11 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
|
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.7</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.5</h1>
|
||||||
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
|
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.7-brightgreen.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.5-brightgreen.svg"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -126,4 +126,4 @@ com.ruoyi
|
|||||||
|
|
||||||
## 若依微服务交流群
|
## 若依微服务交流群
|
||||||
|
|
||||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Kuaw0Xdlw2Nlgn6s8h9elzuquHGxGObD&authKey=cSrQcWQ%2BzQZAFFrwxaR%2BbzcumX4WRduZnd1O6JO1dlclQMiu%2BKwxAy8t2JfNp67V&noverify=0&group_code=112869560) 点击按钮入群。
|
QQ群: [](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) 点击按钮入群。
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 清理工程target生成路径。
|
echo [信息] 清理工程target生成路径。
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
%~d0
|
%~d0
|
||||||
|
|||||||
45
docker/copy.ps1
Normal file
45
docker/copy.ps1
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
复制项目的文件到对应docker路径,便于一键生成镜像。
|
||||||
|
#>
|
||||||
|
|
||||||
|
# 复制SQL文件
|
||||||
|
Write-Host "begin copy sql"
|
||||||
|
Copy-Item -Path "../sql/ry_20250425.sql" -Destination "./mysql/db" -Force
|
||||||
|
Copy-Item -Path "../sql/ry_config_20250224.sql" -Destination "./mysql/db" -Force
|
||||||
|
|
||||||
|
# 复制HTML文件
|
||||||
|
Write-Host "begin copy html"
|
||||||
|
if (Test-Path "../ruoyi-ui/dist") {
|
||||||
|
Remove-Item -Path "./nginx/html/dist" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
New-Item -ItemType Directory -Path "./nginx/html/dist" -Force | Out-Null
|
||||||
|
Copy-Item -Path "../ruoyi-ui/dist/*" -Destination "./nginx/html/dist" -Recurse -Force
|
||||||
|
} else {
|
||||||
|
Write-Host "Warning: ../ruoyi-ui/dist directory not found"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 复制JAR文件
|
||||||
|
Write-Host "begin copy ruoyi-gateway"
|
||||||
|
Copy-Item -Path "../ruoyi-gateway/target/ruoyi-gateway.jar" -Destination "./ruoyi/gateway/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-auth"
|
||||||
|
Copy-Item -Path "../ruoyi-auth/target/ruoyi-auth.jar" -Destination "./ruoyi/auth/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-visual"
|
||||||
|
Copy-Item -Path "../ruoyi-visual/ruoyi-monitor/target/ruoyi-visual-monitor.jar" -Destination "./ruoyi/visual/monitor/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-modules-system"
|
||||||
|
Copy-Item -Path "../ruoyi-modules/ruoyi-system/target/ruoyi-modules-system.jar" -Destination "./ruoyi/modules/system/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-modules-file"
|
||||||
|
Copy-Item -Path "../ruoyi-modules/ruoyi-file/target/ruoyi-modules-file.jar" -Destination "./ruoyi/modules/file/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-modules-job"
|
||||||
|
Copy-Item -Path "../ruoyi-modules/ruoyi-job/target/ruoyi-modules-job.jar" -Destination "./ruoyi/modules/job/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "begin copy ruoyi-modules-gen"
|
||||||
|
Copy-Item -Path "../ruoyi-modules/ruoyi-gen/target/ruoyi-modules-gen.jar" -Destination "./ruoyi/modules/gen/jar" -Force
|
||||||
|
|
||||||
|
Write-Host "copy completed"
|
||||||
@@ -9,8 +9,8 @@ usage() {
|
|||||||
|
|
||||||
# copy sql
|
# copy sql
|
||||||
echo "begin copy sql "
|
echo "begin copy sql "
|
||||||
cp ../sql/ry_20250523.sql ./mysql/db
|
cp ../sql/ry_20240629.sql ./mysql/db
|
||||||
cp ../sql/ry_config_20250902.sql ./mysql/db
|
cp ../sql/ry_config_20250224.sql ./mysql/db
|
||||||
|
|
||||||
# copy html
|
# copy html
|
||||||
echo "begin copy html "
|
echo "begin copy html "
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ version : '3.8'
|
|||||||
services:
|
services:
|
||||||
ruoyi-nacos:
|
ruoyi-nacos:
|
||||||
container_name: ruoyi-nacos
|
container_name: ruoyi-nacos
|
||||||
image: nacos/nacos-server
|
|
||||||
build:
|
build:
|
||||||
context: ./nacos
|
context: ./nacos
|
||||||
environment:
|
environment:
|
||||||
@@ -18,7 +17,6 @@ services:
|
|||||||
- ruoyi-mysql
|
- ruoyi-mysql
|
||||||
ruoyi-mysql:
|
ruoyi-mysql:
|
||||||
container_name: ruoyi-mysql
|
container_name: ruoyi-mysql
|
||||||
image: mysql:5.7
|
|
||||||
build:
|
build:
|
||||||
context: ./mysql
|
context: ./mysql
|
||||||
ports:
|
ports:
|
||||||
@@ -40,7 +38,6 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
ruoyi-redis:
|
ruoyi-redis:
|
||||||
container_name: ruoyi-redis
|
container_name: ruoyi-redis
|
||||||
image: redis
|
|
||||||
build:
|
build:
|
||||||
context: ./redis
|
context: ./redis
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# 基础镜像
|
# 基础镜像
|
||||||
FROM mysql:5.7
|
FROM mysql:5.7
|
||||||
# author
|
# author
|
||||||
MAINTAINER ruoyi
|
MAINTAINER ruoyi
|
||||||
|
|
||||||
# 执行sql脚本
|
# 执行sql脚本
|
||||||
ADD ./db/*.sql /docker-entrypoint-initdb.d/
|
ADD ./db/*.sql /docker-entrypoint-initdb.d/
|
||||||
@@ -1 +1 @@
|
|||||||
存放sql目录下的所有脚本,用于docker自动执行。
|
存放sql目录下的所有脚本,用于docker自动执行。
|
||||||
1
docker/nginx/html/dist/readme.txt
vendored
1
docker/nginx/html/dist/readme.txt
vendored
@@ -1 +0,0 @@
|
|||||||
存放前端ruoyi-ui构建好的静态文件,用于nginx请求访问。
|
|
||||||
@@ -1 +1 @@
|
|||||||
存放认证中心打包好的jar文件,用于docker启动应用。
|
存放认证中心打包好的jar文件,用于docker启动应用。
|
||||||
@@ -1 +1 @@
|
|||||||
存放网关模块打包好的jar文件,用于docker启动应用。
|
存放网关模块打包好的jar文件,用于docker启动应用。
|
||||||
@@ -1 +1 @@
|
|||||||
存放监控中心打包好的jar文件,用于docker启动应用。
|
存放监控中心打包好的jar文件,用于docker启动应用。
|
||||||
95
pom.xml
95
pom.xml
@@ -6,40 +6,54 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>ruoyi</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依微服务系统</description>
|
<description>若依微服务系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi.version>3.6.7</ruoyi.version>
|
<ruoyi.version>3.6.5</ruoyi.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>17</java.version>
|
<java.version>1.8</java.version>
|
||||||
<spring-boot.version>3.3.5</spring-boot.version>
|
<spring-boot.version>2.7.18</spring-boot.version>
|
||||||
<spring-cloud.version>2023.0.3</spring-cloud.version>
|
<spring-cloud.version>2021.0.9</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2023.0.1.2</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version>
|
||||||
<spring-boot-admin.version>3.3.5</spring-boot-admin.version>
|
<spring-boot-admin.version>2.7.16</spring-boot-admin.version>
|
||||||
<mybatis-spring.version>3.0.3</mybatis-spring.version>
|
<tobato.version>1.27.2</tobato.version>
|
||||||
<kaptcha.version>2.3.3</kaptcha.version>
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
<pagehelper.boot.version>2.1.0</pagehelper.boot.version>
|
<pagehelper.boot.version>2.0.0</pagehelper.boot.version>
|
||||||
<druid.version>1.2.27</druid.version>
|
<druid.version>1.2.23</druid.version>
|
||||||
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
||||||
<commons.io.version>2.21.0</commons.io.version>
|
<commons.io.version>2.13.0</commons.io.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<fastjson.version>2.0.60</fastjson.version>
|
<fastjson.version>2.0.53</fastjson.version>
|
||||||
<jjwt.version>0.9.1</jjwt.version>
|
<jjwt.version>0.9.1</jjwt.version>
|
||||||
<minio.version>8.2.2</minio.version>
|
<minio.version>8.2.2</minio.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<springdoc.version>2.6.0</springdoc.version>
|
<springdoc.version>1.6.9</springdoc.version>
|
||||||
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
|
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
|
||||||
|
|
||||||
|
<!-- override dependency version -->
|
||||||
|
<tomcat.version>9.0.102</tomcat.version>
|
||||||
|
<logback.version>1.2.13</logback.version>
|
||||||
|
<spring-framework.version>5.3.39</spring-framework.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- 覆盖SpringFramework的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-framework-bom</artifactId>
|
||||||
|
<version>${spring-framework.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud 微服务 -->
|
<!-- SpringCloud 微服务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
@@ -67,10 +81,49 @@
|
|||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 覆盖logback的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 覆盖tomcat的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-core</artifactId>
|
||||||
|
<version>${tomcat.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-el</artifactId>
|
||||||
|
<version>${tomcat.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-websocket</artifactId>
|
||||||
|
<version>${tomcat.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FastDFS 分布式文件系统 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
<version>${tobato.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Springdoc webmvc 依赖配置 -->
|
<!-- Springdoc webmvc 依赖配置 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
<version>${springdoc.version}</version>
|
<version>${springdoc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -86,18 +139,6 @@
|
|||||||
<groupId>com.github.pagehelper</groupId>
|
<groupId>com.github.pagehelper</groupId>
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
<version>${pagehelper.boot.version}</version>
|
<version>${pagehelper.boot.version}</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>mybatis-spring</artifactId>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis-spring</artifactId>
|
|
||||||
<version>${mybatis-spring.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- io常用工具类 -->
|
<!-- io常用工具类 -->
|
||||||
@@ -238,9 +279,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.11.0</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<parameters>true</parameters>
|
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-api</artifactId>
|
<artifactId>ruoyi-api</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.ruoyi.system.api;
|
|||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
@@ -28,13 +26,4 @@ public interface RemoteFileService
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
|
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除文件
|
|
||||||
*
|
|
||||||
* @param fileUrl 文件地址
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
||||||
public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package com.ruoyi.system.api.domain;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.ruoyi.system.api.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.ruoyi.system.api.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.ruoyi.system.api.domain;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.ruoyi.system.api.domain;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
@@ -71,9 +71,6 @@ public class SysUser extends BaseEntity
|
|||||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
/** 密码最后更新时间 */
|
|
||||||
private Date pwdUpdateDate;
|
|
||||||
|
|
||||||
/** 部门对象 */
|
/** 部门对象 */
|
||||||
@Excels({
|
@Excels({
|
||||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||||
@@ -114,6 +111,11 @@ public class SysUser extends BaseEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAdmin()
|
public boolean isAdmin()
|
||||||
|
{
|
||||||
|
return isAdmin(this.userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAdmin(Long userId)
|
||||||
{
|
{
|
||||||
return UserConstants.isAdmin(userId);
|
return UserConstants.isAdmin(userId);
|
||||||
}
|
}
|
||||||
@@ -246,16 +248,6 @@ public class SysUser extends BaseEntity
|
|||||||
this.loginDate = loginDate;
|
this.loginDate = loginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getPwdUpdateDate()
|
|
||||||
{
|
|
||||||
return pwdUpdateDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwdUpdateDate(Date pwdUpdateDate)
|
|
||||||
{
|
|
||||||
this.pwdUpdateDate = pwdUpdateDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SysDept getDept()
|
public SysDept getDept()
|
||||||
{
|
{
|
||||||
return dept;
|
return dept;
|
||||||
@@ -322,7 +314,6 @@ public class SysUser extends BaseEntity
|
|||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("loginIp", getLoginIp())
|
.append("loginIp", getLoginIp())
|
||||||
.append("loginDate", getLoginDate())
|
.append("loginDate", getLoginDate())
|
||||||
.append("pwdUpdateDate", getPwdUpdateDate())
|
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
|
|||||||
{
|
{
|
||||||
return R.fail("上传文件失败:" + throwable.getMessage());
|
return R.fail("上传文件失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<Boolean> delete(String fileUrl)
|
|
||||||
{
|
|
||||||
return R.fail("删除文件失败:" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.auth.controller;
|
package com.ruoyi.auth.controller;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ public class SysLoginService
|
|||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
sysUser.setUserName(username);
|
sysUser.setUserName(username);
|
||||||
sysUser.setNickName(username);
|
sysUser.setNickName(username);
|
||||||
sysUser.setPwdUpdateDate(DateUtils.getNowDate());
|
|
||||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -53,24 +53,12 @@
|
|||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Mybatis Spring -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis-spring</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Hibernate Validator -->
|
<!-- Hibernate Validator -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Aop -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Jackson -->
|
<!-- Jackson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
@@ -93,7 +81,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Apache Lang3 -->
|
<!-- Apache Lang3 -->
|
||||||
@@ -116,8 +103,8 @@
|
|||||||
|
|
||||||
<!-- Java Servlet -->
|
<!-- Java Servlet -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ public @interface Excel
|
|||||||
/**
|
/**
|
||||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中每个列的高度
|
* 导出时在excel中每个列的高度
|
||||||
|
|||||||
@@ -87,16 +87,6 @@ public class Constants
|
|||||||
*/
|
*/
|
||||||
public static final String LOGIN_FAIL = "Error";
|
public static final String LOGIN_FAIL = "Error";
|
||||||
|
|
||||||
/**
|
|
||||||
* 所有权限标识
|
|
||||||
*/
|
|
||||||
public static final String ALL_PERMISSION = "*:*:*";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理员角色权限标识
|
|
||||||
*/
|
|
||||||
public static final String SUPER_ADMIN = "admin";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前记录起始索引
|
* 当前记录起始索引
|
||||||
*/
|
*/
|
||||||
@@ -130,7 +120,7 @@ public class Constants
|
|||||||
/**
|
/**
|
||||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||||
*/
|
*/
|
||||||
public static final String[] JSON_WHITELIST_STR = { "com.ruoyi" };
|
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ruoyi.common.core.exception.file;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传无效扩展名异常类
|
* 文件上传 误异常类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -136,14 +136,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||||||
return new Date(time);
|
return new Date(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算相差天数
|
|
||||||
*/
|
|
||||||
public static int differentDaysByMillisecond(Date date1, Date date2)
|
|
||||||
{
|
|
||||||
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算时间差
|
* 计算时间差
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import java.util.Collections;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import jakarta.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.springframework.core.io.buffer.DataBuffer;
|
import org.springframework.core.io.buffer.DataBuffer;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.ruoyi.common.core.utils.bean;
|
package com.ruoyi.common.core.utils.bean;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import jakarta.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import jakarta.validation.ConstraintViolationException;
|
import javax.validation.ConstraintViolationException;
|
||||||
import jakarta.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bean对象属性验证
|
* bean对象属性验证
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import java.io.OutputStream;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|
||||||
@@ -114,20 +114,20 @@ public class FileUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验文件路径合法性(安全性与扩展名)
|
* 检查文件是否可下载
|
||||||
*
|
*
|
||||||
* @param fileUrl 待校验的文件地址
|
* @param resource 需要下载的文件
|
||||||
* @return true 正常 false 非法
|
* @return true 正常 false 非法
|
||||||
*/
|
*/
|
||||||
public static boolean validateFilePath(String fileUrl)
|
public static boolean checkAllowDownload(String resource)
|
||||||
{
|
{
|
||||||
// 禁止目录上跳级别
|
// 禁止目录上跳级别
|
||||||
if (StringUtils.contains(fileUrl, ".."))
|
if (StringUtils.contains(resource, ".."))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 判断是否在允许下载的文件规则内
|
// 判断是否在允许下载的文件规则内
|
||||||
return ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(fileUrl));
|
return ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.ruoyi.common.core.utils.ip;
|
|||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.ruoyi.common.core.utils.ServletUtils;
|
import com.ruoyi.common.core.utils.ServletUtils;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.RegExUtils;
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||||
@@ -73,8 +73,6 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
|
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
|
||||||
|
|
||||||
public static final String SEPARATOR = ",";
|
|
||||||
|
|
||||||
public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
|
public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
|
||||||
|
|
||||||
public static final String[] FORMULA_STR = { "=", "-", "+", "@" };
|
public static final String[] FORMULA_STR = { "=", "-", "+", "@" };
|
||||||
@@ -147,18 +145,23 @@ public class ExcelUtil<T>
|
|||||||
/**
|
/**
|
||||||
* 对象的子列表方法
|
* 对象的子列表方法
|
||||||
*/
|
*/
|
||||||
private Map<String, Method> subMethods;
|
private Method subMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对象的子列表属性
|
* 对象的子列表属性
|
||||||
*/
|
*/
|
||||||
private Map<String, List<Field>> subFieldsMap;
|
private List<Field> subFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计列表
|
* 统计列表
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数字格式
|
||||||
|
*/
|
||||||
|
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实体对象
|
* 实体对象
|
||||||
*/
|
*/
|
||||||
@@ -225,10 +228,7 @@ public class ExcelUtil<T>
|
|||||||
int titleLastCol = this.fields.size() - 1;
|
int titleLastCol = this.fields.size() - 1;
|
||||||
if (isSubList())
|
if (isSubList())
|
||||||
{
|
{
|
||||||
for (List<Field> currentSubFields : subFieldsMap.values())
|
titleLastCol = titleLastCol + subFields.size() - 1;
|
||||||
{
|
|
||||||
titleLastCol = titleLastCol + currentSubFields.size() - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
||||||
titleRow.setHeightInPoints(30);
|
titleRow.setHeightInPoints(30);
|
||||||
@@ -248,17 +248,16 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
Row subRow = sheet.createRow(rownum);
|
Row subRow = sheet.createRow(rownum);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
int subFieldSize = subFields != null ? subFields.size() : 0;
|
||||||
for (Object[] objects : fields)
|
for (Object[] objects : fields)
|
||||||
{
|
{
|
||||||
Field field = (Field) objects[0];
|
Field field = (Field) objects[0];
|
||||||
Excel attr = (Excel) objects[1];
|
Excel attr = (Excel) objects[1];
|
||||||
CellStyle cellStyle = styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()));
|
|
||||||
if (Collection.class.isAssignableFrom(field.getType()))
|
if (Collection.class.isAssignableFrom(field.getType()))
|
||||||
{
|
{
|
||||||
Cell cell = subRow.createCell(column);
|
Cell cell = subRow.createCell(column);
|
||||||
cell.setCellValue(attr.name());
|
cell.setCellValue(attr.name());
|
||||||
cell.setCellStyle(cellStyle);
|
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
|
||||||
int subFieldSize = subFieldsMap != null ? subFieldsMap.get(field.getName()).size() : 0;
|
|
||||||
if (subFieldSize > 1)
|
if (subFieldSize > 1)
|
||||||
{
|
{
|
||||||
CellRangeAddress cellAddress = new CellRangeAddress(rownum, rownum, column, column + subFieldSize - 1);
|
CellRangeAddress cellAddress = new CellRangeAddress(rownum, rownum, column, column + subFieldSize - 1);
|
||||||
@@ -270,7 +269,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
Cell cell = subRow.createCell(column++);
|
Cell cell = subRow.createCell(column++);
|
||||||
cell.setCellValue(attr.name());
|
cell.setCellValue(attr.name());
|
||||||
cell.setCellStyle(cellStyle);
|
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rownum++;
|
rownum++;
|
||||||
@@ -342,11 +341,7 @@ public class ExcelUtil<T>
|
|||||||
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
||||||
// 获取表头
|
// 获取表头
|
||||||
Row heard = sheet.getRow(titleNum);
|
Row heard = sheet.getRow(titleNum);
|
||||||
if (heard == null)
|
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
||||||
{
|
|
||||||
throw new UtilException("文件标题行为空,请检查Excel文件格式");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < heard.getLastCellNum(); i++)
|
|
||||||
{
|
{
|
||||||
Cell cell = heard.getCell(i);
|
Cell cell = heard.getCell(i);
|
||||||
if (StringUtils.isNotNull(cell))
|
if (StringUtils.isNotNull(cell))
|
||||||
@@ -354,6 +349,10 @@ public class ExcelUtil<T>
|
|||||||
String value = this.getCellValue(heard, i).toString();
|
String value = this.getCellValue(heard, i).toString();
|
||||||
cellMap.put(value, i);
|
cellMap.put(value, i);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellMap.put(null, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 有数据时才处理 得到类的所有field.
|
// 有数据时才处理 得到类的所有field.
|
||||||
List<Object[]> fields = this.getFields();
|
List<Object[]> fields = this.getFields();
|
||||||
@@ -382,7 +381,7 @@ public class ExcelUtil<T>
|
|||||||
Object val = this.getCellValue(row, entry.getKey());
|
Object val = this.getCellValue(row, entry.getKey());
|
||||||
|
|
||||||
// 如果不存在实例则新建.
|
// 如果不存在实例则新建.
|
||||||
entity = (entity == null ? clazz.getDeclaredConstructor().newInstance() : entity);
|
entity = (entity == null ? clazz.newInstance() : entity);
|
||||||
// 从map中得到对应列的field.
|
// 从map中得到对应列的field.
|
||||||
Field field = (Field) entry.getValue()[0];
|
Field field = (Field) entry.getValue()[0];
|
||||||
Excel attr = (Excel) entry.getValue()[1];
|
Excel attr = (Excel) entry.getValue()[1];
|
||||||
@@ -566,8 +565,7 @@ public class ExcelUtil<T>
|
|||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
if (Collection.class.isAssignableFrom(field.getType()))
|
if (Collection.class.isAssignableFrom(field.getType()))
|
||||||
{
|
{
|
||||||
List<Field> currentSubFields = subFieldsMap.get(field.getName());
|
for (Field subField : subFields)
|
||||||
for (Field subField : currentSubFields)
|
|
||||||
{
|
{
|
||||||
Excel subExcel = subField.getAnnotation(Excel.class);
|
Excel subExcel = subField.getAnnotation(Excel.class);
|
||||||
this.createHeadCell(subExcel, row, column++);
|
this.createHeadCell(subExcel, row, column++);
|
||||||
@@ -580,7 +578,7 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
if (Type.EXPORT.equals(type))
|
if (Type.EXPORT.equals(type))
|
||||||
{
|
{
|
||||||
fillExcelData(index);
|
fillExcelData(index, row);
|
||||||
addStatisticsRow();
|
addStatisticsRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -590,9 +588,10 @@ public class ExcelUtil<T>
|
|||||||
* 填充excel数据
|
* 填充excel数据
|
||||||
*
|
*
|
||||||
* @param index 序号
|
* @param index 序号
|
||||||
|
* @param row 单元格行
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void fillExcelData(int index)
|
public void fillExcelData(int index, Row row)
|
||||||
{
|
{
|
||||||
int startNo = index * sheetSize;
|
int startNo = index * sheetSize;
|
||||||
int endNo = Math.min(startNo + sheetSize, list.size());
|
int endNo = Math.min(startNo + sheetSize, list.size());
|
||||||
@@ -600,7 +599,7 @@ public class ExcelUtil<T>
|
|||||||
|
|
||||||
for (int i = startNo; i < endNo; i++)
|
for (int i = startNo; i < endNo; i++)
|
||||||
{
|
{
|
||||||
Row row = sheet.createRow(currentRowNum);
|
row = sheet.createRow(currentRowNum);
|
||||||
T vo = (T) list.get(i);
|
T vo = (T) list.get(i);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
int maxSubListSize = getCurrentMaxSubListSize(vo);
|
int maxSubListSize = getCurrentMaxSubListSize(vo);
|
||||||
@@ -613,7 +612,6 @@ public class ExcelUtil<T>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Collection<?> subList = (Collection<?>) getTargetValue(vo, field, excel);
|
Collection<?> subList = (Collection<?>) getTargetValue(vo, field, excel);
|
||||||
List<Field> currentSubFields = subFieldsMap.get(field.getName());
|
|
||||||
if (subList != null && !subList.isEmpty())
|
if (subList != null && !subList.isEmpty())
|
||||||
{
|
{
|
||||||
int subIndex = 0;
|
int subIndex = 0;
|
||||||
@@ -626,15 +624,15 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
int subColumn = column;
|
int subColumn = column;
|
||||||
for (Field subField : currentSubFields)
|
for (Field subField : subFields)
|
||||||
{
|
{
|
||||||
Excel subExcel = subField.getAnnotation(Excel.class);
|
Excel subExcel = subField.getAnnotation(Excel.class);
|
||||||
addCell(subExcel, subRow, (T) subVo, subField, subColumn++);
|
addCell(subExcel, subRow, (T) subVo, subField, subColumn++);
|
||||||
}
|
}
|
||||||
subIndex++;
|
subIndex++;
|
||||||
}
|
}
|
||||||
|
column += subFields.size();
|
||||||
}
|
}
|
||||||
column += currentSubFields.size();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -726,7 +724,6 @@ public class ExcelUtil<T>
|
|||||||
style = wb.createCellStyle();
|
style = wb.createCellStyle();
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
style.setDataFormat(dataFormat.getFormat("######0.00"));
|
|
||||||
Font totalFont = wb.createFont();
|
Font totalFont = wb.createFont();
|
||||||
totalFont.setFontName("Arial");
|
totalFont.setFontName("Arial");
|
||||||
totalFont.setFontHeightInPoints((short) 10);
|
totalFont.setFontHeightInPoints((short) 10);
|
||||||
@@ -975,8 +972,7 @@ public class ExcelUtil<T>
|
|||||||
/**
|
/**
|
||||||
* 添加单元格
|
* 添加单元格
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
|
||||||
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
|
|
||||||
{
|
{
|
||||||
Cell cell = null;
|
Cell cell = null;
|
||||||
try
|
try
|
||||||
@@ -988,7 +984,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
// 创建cell
|
// 创建cell
|
||||||
cell = row.createCell(column);
|
cell = row.createCell(column);
|
||||||
if (isSubListValue(vo) && getListCellValue(vo) > 1 && attr.needMerge())
|
if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
|
||||||
{
|
{
|
||||||
if (subMergedLastRowNum >= subMergedFirstRowNum)
|
if (subMergedLastRowNum >= subMergedFirstRowNum)
|
||||||
{
|
{
|
||||||
@@ -1004,7 +1000,7 @@ public class ExcelUtil<T>
|
|||||||
String separator = attr.separator();
|
String separator = attr.separator();
|
||||||
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
|
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
|
||||||
{
|
{
|
||||||
cell.setCellStyle(createCellStyle(cell.getCellStyle(), dateFormat));
|
cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat));
|
||||||
cell.setCellValue(parseDateToStr(dateFormat, value));
|
cell.setCellValue(parseDateToStr(dateFormat, value));
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
|
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
|
||||||
@@ -1034,21 +1030,6 @@ public class ExcelUtil<T>
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用自定义格式,同时避免样式污染
|
|
||||||
*
|
|
||||||
* @param cellStyle 从此样式复制
|
|
||||||
* @param format 格式匹配的字符串
|
|
||||||
* @return 格式化后CellStyle对象
|
|
||||||
*/
|
|
||||||
private CellStyle createCellStyle(CellStyle cellStyle, String format)
|
|
||||||
{
|
|
||||||
CellStyle style = wb.createCellStyle();
|
|
||||||
style.cloneStyleFrom(cellStyle);
|
|
||||||
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format));
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置 POI XSSFSheet 单元格提示或选择框
|
* 设置 POI XSSFSheet 单元格提示或选择框
|
||||||
*
|
*
|
||||||
@@ -1100,36 +1081,18 @@ public class ExcelUtil<T>
|
|||||||
public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol)
|
public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol)
|
||||||
{
|
{
|
||||||
String hideSheetName = "combo_" + firstCol + "_" + endCol;
|
String hideSheetName = "combo_" + firstCol + "_" + endCol;
|
||||||
Sheet hideSheet = null;
|
Sheet hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
|
||||||
String hideSheetDataName = hideSheetName + "_data";
|
for (int i = 0; i < textlist.length; i++)
|
||||||
Name name = wb.getName(hideSheetDataName);
|
|
||||||
if (name != null)
|
|
||||||
{
|
{
|
||||||
// 名称已存在,尝试从名称的引用中找到sheet名称
|
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
|
||||||
String refersToFormula = name.getRefersToFormula();
|
|
||||||
if (StringUtils.isNotEmpty(refersToFormula) && refersToFormula.contains("!"))
|
|
||||||
{
|
|
||||||
String sheetNameFromFormula = refersToFormula.substring(0, refersToFormula.indexOf("!"));
|
|
||||||
hideSheet = wb.getSheet(sheetNameFromFormula);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// 创建名称,可被其他单元格引用
|
||||||
if (hideSheet == null)
|
Name name = wb.createName();
|
||||||
{
|
name.setNameName(hideSheetName + "_data");
|
||||||
hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
|
name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length);
|
||||||
for (int i = 0; i < textlist.length; i++)
|
|
||||||
{
|
|
||||||
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
|
|
||||||
}
|
|
||||||
// 创建名称,可被其他单元格引用
|
|
||||||
name = wb.createName();
|
|
||||||
name.setNameName(hideSheetDataName);
|
|
||||||
name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
DataValidationHelper helper = sheet.getDataValidationHelper();
|
DataValidationHelper helper = sheet.getDataValidationHelper();
|
||||||
// 加载下拉列表内容
|
// 加载下拉列表内容
|
||||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetDataName);
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetName + "_data");
|
||||||
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
|
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
|
||||||
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
||||||
// 数据有效性对象
|
// 数据有效性对象
|
||||||
@@ -1167,7 +1130,7 @@ public class ExcelUtil<T>
|
|||||||
public static String convertByExp(String propertyValue, String converterExp, String separator)
|
public static String convertByExp(String propertyValue, String converterExp, String separator)
|
||||||
{
|
{
|
||||||
StringBuilder propertyString = new StringBuilder();
|
StringBuilder propertyString = new StringBuilder();
|
||||||
String[] convertSource = converterExp.split(SEPARATOR);
|
String[] convertSource = converterExp.split(",");
|
||||||
for (String item : convertSource)
|
for (String item : convertSource)
|
||||||
{
|
{
|
||||||
String[] itemArray = item.split("=");
|
String[] itemArray = item.split("=");
|
||||||
@@ -1204,7 +1167,7 @@ public class ExcelUtil<T>
|
|||||||
public static String reverseByExp(String propertyValue, String converterExp, String separator)
|
public static String reverseByExp(String propertyValue, String converterExp, String separator)
|
||||||
{
|
{
|
||||||
StringBuilder propertyString = new StringBuilder();
|
StringBuilder propertyString = new StringBuilder();
|
||||||
String[] convertSource = converterExp.split(SEPARATOR);
|
String[] convertSource = converterExp.split(",");
|
||||||
for (String item : convertSource)
|
for (String item : convertSource)
|
||||||
{
|
{
|
||||||
String[] itemArray = item.split("=");
|
String[] itemArray = item.split("=");
|
||||||
@@ -1241,7 +1204,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object instance = excel.handler().getDeclaredConstructor().newInstance();
|
Object instance = excel.handler().newInstance();
|
||||||
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class });
|
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class });
|
||||||
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
|
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
|
||||||
}
|
}
|
||||||
@@ -1292,7 +1255,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
cell = row.createCell(key);
|
cell = row.createCell(key);
|
||||||
cell.setCellStyle(styles.get("total"));
|
cell.setCellStyle(styles.get("total"));
|
||||||
cell.setCellValue(statistics.get(key));
|
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
|
||||||
}
|
}
|
||||||
statistics.clear();
|
statistics.clear();
|
||||||
}
|
}
|
||||||
@@ -1367,8 +1330,6 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
List<Object[]> fields = new ArrayList<Object[]>();
|
List<Object[]> fields = new ArrayList<Object[]>();
|
||||||
List<Field> tempFields = new ArrayList<>();
|
List<Field> tempFields = new ArrayList<>();
|
||||||
subFieldsMap = new HashMap<>();
|
|
||||||
subMethods = new HashMap<>();
|
|
||||||
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
||||||
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||||
if (StringUtils.isNotEmpty(includeFields))
|
if (StringUtils.isNotEmpty(includeFields))
|
||||||
@@ -1416,11 +1377,10 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
if (Collection.class.isAssignableFrom(field.getType()))
|
if (Collection.class.isAssignableFrom(field.getType()))
|
||||||
{
|
{
|
||||||
String fieldName = field.getName();
|
subMethod = getSubMethod(field.getName(), clazz);
|
||||||
subMethods.put(fieldName, getSubMethod(fieldName, clazz));
|
|
||||||
ParameterizedType pt = (ParameterizedType) field.getGenericType();
|
ParameterizedType pt = (ParameterizedType) field.getGenericType();
|
||||||
Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0];
|
Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0];
|
||||||
subFieldsMap.put(fieldName, FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class));
|
this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1489,8 +1449,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
this.sheet = wb.createSheet();
|
this.sheet = wb.createSheet();
|
||||||
this.createTitle();
|
this.createTitle();
|
||||||
int actualIndex = wb.getSheetIndex(this.sheet);
|
wb.setSheetName(index, sheetName + index);
|
||||||
wb.setSheetName(actualIndex, sheetName + index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,7 +1574,7 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
public boolean isSubList()
|
public boolean isSubList()
|
||||||
{
|
{
|
||||||
return !StringUtils.isEmpty(subFieldsMap);
|
return StringUtils.isNotNull(subFields) && subFields.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1623,32 +1582,24 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
public boolean isSubListValue(T vo)
|
public boolean isSubListValue(T vo)
|
||||||
{
|
{
|
||||||
return !StringUtils.isEmpty(subFieldsMap) && getListCellValue(vo) > 0;
|
return StringUtils.isNotNull(subFields) && subFields.size() > 0 && StringUtils.isNotNull(getListCellValue(vo)) && getListCellValue(vo).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取集合的值
|
* 获取集合的值
|
||||||
*/
|
*/
|
||||||
public int getListCellValue(Object obj)
|
public Collection<?> getListCellValue(Object obj)
|
||||||
{
|
{
|
||||||
Collection<?> value;
|
Object value;
|
||||||
int max = 0;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (String s : subMethods.keySet())
|
value = subMethod.invoke(obj, new Object[] {});
|
||||||
{
|
|
||||||
value = (Collection<?>) subMethods.get(s).invoke(obj);
|
|
||||||
if (value.size() > max)
|
|
||||||
{
|
|
||||||
max = value.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return 0;
|
return new ArrayList<Object>();
|
||||||
}
|
}
|
||||||
return max;
|
return (Collection<?>) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -310,8 +310,7 @@ public class ReflectUtils
|
|||||||
/**
|
/**
|
||||||
* 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
* 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
public static void makeAccessible(Method method)
|
||||||
public static void makeAccessible(Method method)
|
|
||||||
{
|
{
|
||||||
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
|
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
|
||||||
&& !method.isAccessible())
|
&& !method.isAccessible())
|
||||||
@@ -323,8 +322,7 @@ public class ReflectUtils
|
|||||||
/**
|
/**
|
||||||
* 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
* 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
public static void makeAccessible(Field field)
|
||||||
public static void makeAccessible(Field field)
|
|
||||||
{
|
{
|
||||||
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|
||||||
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible())
|
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible())
|
||||||
|
|||||||
@@ -7,12 +7,17 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.common.core.constant.HttpStatus;
|
import com.ruoyi.common.core.constant.HttpStatus;
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
import com.ruoyi.common.core.utils.PageUtils;
|
import com.ruoyi.common.core.utils.PageUtils;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.PageDomain;
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.web.page.TableSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
@@ -48,6 +53,19 @@ public class BaseController
|
|||||||
PageUtils.startPage();
|
PageUtils.startPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求排序数据
|
||||||
|
*/
|
||||||
|
protected void startOrderBy()
|
||||||
|
{
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
||||||
|
{
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.orderBy(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理分页的线程变量
|
* 清理分页的线程变量
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.common.core.xss;
|
package com.ruoyi.common.core.xss;
|
||||||
|
|
||||||
import jakarta.validation.Constraint;
|
import javax.validation.Constraint;
|
||||||
import jakarta.validation.Payload;
|
import javax.validation.Payload;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.ruoyi.common.core.xss;
|
|||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import jakarta.validation.ConstraintValidator;
|
import javax.validation.ConstraintValidator;
|
||||||
import jakarta.validation.ConstraintValidatorContext;
|
import javax.validation.ConstraintValidatorContext;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class DataScopeAspect
|
|||||||
List<String> conditions = new ArrayList<String>();
|
List<String> conditions = new ArrayList<String>();
|
||||||
List<String> scopeCustomIds = new ArrayList<String>();
|
List<String> scopeCustomIds = new ArrayList<String>();
|
||||||
user.getRoles().forEach(role -> {
|
user.getRoles().forEach(role -> {
|
||||||
if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && (StringUtils.isEmpty(permission) || StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))))
|
if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
|
||||||
{
|
{
|
||||||
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
|
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ public class DataScopeAspect
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(permission) && !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
|
if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -20,14 +20,14 @@
|
|||||||
<!-- Druid -->
|
<!-- Druid -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<version>${druid.version}</version>
|
<version>${druid.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Dynamic DataSource -->
|
<!-- Dynamic DataSource -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
<version>${dynamic-ds.version}</version>
|
<version>${dynamic-ds.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.ruoyi.common.log.aspect;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
@@ -48,9 +48,6 @@ public class LogAspect
|
|||||||
/** 计算操作消耗时间 */
|
/** 计算操作消耗时间 */
|
||||||
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
|
||||||
|
|
||||||
/** 参数最大长度限制 */
|
|
||||||
private static final int PARAM_MAX_LENGTH = 2000;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AsyncLogService asyncLogService;
|
private AsyncLogService asyncLogService;
|
||||||
|
|
||||||
@@ -169,16 +166,16 @@ public class LogAspect
|
|||||||
*/
|
*/
|
||||||
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception
|
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception
|
||||||
{
|
{
|
||||||
String requestMethod = operLog.getRequestMethod();
|
|
||||||
Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
|
Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
|
||||||
|
String requestMethod = operLog.getRequestMethod();
|
||||||
if (StringUtils.isEmpty(paramsMap) && StringUtils.equalsAny(requestMethod, HttpMethod.PUT.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name()))
|
if (StringUtils.isEmpty(paramsMap) && StringUtils.equalsAny(requestMethod, HttpMethod.PUT.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name()))
|
||||||
{
|
{
|
||||||
String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
|
String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
|
||||||
operLog.setOperParam(params);
|
operLog.setOperParam(StringUtils.substring(params, 0, 2000));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, PARAM_MAX_LENGTH));
|
operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, 2000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +184,7 @@ public class LogAspect
|
|||||||
*/
|
*/
|
||||||
private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames)
|
private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames)
|
||||||
{
|
{
|
||||||
StringBuilder params = new StringBuilder();
|
String params = "";
|
||||||
if (paramsArray != null && paramsArray.length > 0)
|
if (paramsArray != null && paramsArray.length > 0)
|
||||||
{
|
{
|
||||||
for (Object o : paramsArray)
|
for (Object o : paramsArray)
|
||||||
@@ -197,20 +194,15 @@ public class LogAspect
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
||||||
params.append(jsonObj).append(" ");
|
params += jsonObj.toString() + " ";
|
||||||
if (params.length() >= PARAM_MAX_LENGTH)
|
|
||||||
{
|
|
||||||
return StringUtils.substring(params.toString(), 0, PARAM_MAX_LENGTH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("请求参数拼装异常 msg:{}, 参数:{}", e.getMessage(), paramsArray, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return params.toString();
|
return params.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class RedisConfig extends CachingConfigurerSupport
|
public class RedisConfig extends CachingConfigurerSupport
|
||||||
{
|
{
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.common.security.feign;
|
package com.ruoyi.common.security.feign;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.utils.ServletUtils;
|
import com.ruoyi.common.core.utils.ServletUtils;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.common.security.handler;
|
package com.ruoyi.common.security.handler;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.common.security.interceptor;
|
package com.ruoyi.common.security.interceptor;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ruoyi.common.security.service;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.ruoyi.common.security.utils;
|
package com.ruoyi.common.security.utils;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.constant.TokenConstants;
|
import com.ruoyi.common.core.constant.TokenConstants;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.context.SecurityContextHolder;
|
import com.ruoyi.common.core.context.SecurityContextHolder;
|
||||||
import com.ruoyi.common.core.utils.ServletUtils;
|
import com.ruoyi.common.core.utils.ServletUtils;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.system.api.model.LoginUser;
|
import com.ruoyi.system.api.model.LoginUser;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限获取工具类
|
* 权限获取工具类
|
||||||
@@ -80,16 +79,6 @@ public class SecurityUtils
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为管理员
|
|
||||||
*
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public static boolean isAdmin()
|
|
||||||
{
|
|
||||||
return isAdmin(getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为管理员
|
* 是否为管理员
|
||||||
*
|
*
|
||||||
@@ -98,7 +87,7 @@ public class SecurityUtils
|
|||||||
*/
|
*/
|
||||||
public static boolean isAdmin(Long userId)
|
public static boolean isAdmin(Long userId)
|
||||||
{
|
{
|
||||||
return UserConstants.isAdmin(userId);
|
return userId != null && 1L == userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<!-- SpringDoc webmvc -->
|
<!-- SpringDoc webmvc -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.ruoyi.common.swagger.config;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springdoc.core.configuration.SpringDocConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
@@ -21,7 +19,6 @@ import io.swagger.v3.oas.models.servers.Server;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@AutoConfiguration(before = SpringDocConfiguration.class)
|
|
||||||
@EnableConfigurationProperties(SpringDocProperties.class)
|
@EnableConfigurationProperties(SpringDocProperties.class)
|
||||||
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
|
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
|
||||||
public class SpringDocAutoConfiguration
|
public class SpringDocAutoConfiguration
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<!-- Springdoc -->
|
<!-- Springdoc -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
<artifactId>springdoc-openapi-webflux-ui</artifactId>
|
||||||
<version>${springdoc.version}</version>
|
<version>${springdoc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.ruoyi.gateway.config;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.springdoc.core.properties.AbstractSwaggerUiConfigProperties;
|
import org.springdoc.core.AbstractSwaggerUiConfigProperties;
|
||||||
import org.springdoc.core.properties.SwaggerUiConfigProperties;
|
import org.springdoc.core.SwaggerUiConfigProperties;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private String resolveBodyFromRequest(ServerHttpRequest serverHttpRequest)
|
private String resolveBodyFromRequest(ServerHttpRequest serverHttpRequest)
|
||||||
{
|
{
|
||||||
// 获取请求体
|
// 获取请求体
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ruoyi.gateway.service.impl;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import jakarta.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -46,6 +46,12 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FastDFS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Minio -->
|
<!-- Minio -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.ruoyi.file.config;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import jakarta.servlet.DispatcherType;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import com.ruoyi.file.filter.RefererFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter配置
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class FilterConfig
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 资源映射路径 前缀
|
|
||||||
*/
|
|
||||||
@Value("${file.prefix}")
|
|
||||||
public String localFilePrefix;
|
|
||||||
|
|
||||||
@Value("${referer.allowed-domains}")
|
|
||||||
private String allowedDomains;
|
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnProperty(value = "referer.enabled", havingValue = "true")
|
|
||||||
public FilterRegistrationBean refererFilterRegistration()
|
|
||||||
{
|
|
||||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
|
||||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
|
||||||
registration.setFilter(new RefererFilter());
|
|
||||||
registration.addUrlPatterns(localFilePrefix + "/*");
|
|
||||||
registration.setName("refererFilter");
|
|
||||||
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
|
|
||||||
Map<String, String> initParameters = new HashMap<String, String>();
|
|
||||||
initParameters.put("allowedDomains", allowedDomains);
|
|
||||||
registration.setInitParameters(initParameters);
|
|
||||||
return registration;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,12 +3,10 @@ package com.ruoyi.file.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.core.utils.file.FileUtils;
|
import com.ruoyi.common.core.utils.file.FileUtils;
|
||||||
import com.ruoyi.file.service.ISysFileService;
|
import com.ruoyi.file.service.ISysFileService;
|
||||||
import com.ruoyi.system.api.domain.SysFile;
|
import com.ruoyi.system.api.domain.SysFile;
|
||||||
@@ -47,26 +45,4 @@ public class SysFileController
|
|||||||
return R.fail(e.getMessage());
|
return R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 文件删除请求
|
|
||||||
*/
|
|
||||||
@DeleteMapping("delete")
|
|
||||||
public R<Boolean> delete(String fileUrl)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!FileUtils.validateFilePath(fileUrl))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许删除。 ", fileUrl));
|
|
||||||
}
|
|
||||||
sysFileService.deleteFile(fileUrl);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("删除文件失败", e);
|
|
||||||
return R.fail(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.ruoyi.file.filter;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import jakarta.servlet.Filter;
|
|
||||||
import jakarta.servlet.FilterChain;
|
|
||||||
import jakarta.servlet.FilterConfig;
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.ServletRequest;
|
|
||||||
import jakarta.servlet.ServletResponse;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 防盗链过滤器
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class RefererFilter implements Filter
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 允许的域名列表
|
|
||||||
*/
|
|
||||||
public List<String> allowedDomains;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(FilterConfig filterConfig) throws ServletException
|
|
||||||
{
|
|
||||||
String domains = filterConfig.getInitParameter("allowedDomains");
|
|
||||||
this.allowedDomains = Arrays.asList(domains.split(","));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
|
||||||
throws IOException, ServletException
|
|
||||||
{
|
|
||||||
HttpServletRequest req = (HttpServletRequest) request;
|
|
||||||
HttpServletResponse resp = (HttpServletResponse) response;
|
|
||||||
|
|
||||||
String referer = req.getHeader("Referer");
|
|
||||||
|
|
||||||
// 如果Referer为空,拒绝访问
|
|
||||||
if (referer == null || referer.isEmpty())
|
|
||||||
{
|
|
||||||
resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Access denied: Referer header is required");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查Referer是否在允许的域名列表中
|
|
||||||
boolean allowed = false;
|
|
||||||
for (String domain : allowedDomains)
|
|
||||||
{
|
|
||||||
if (referer.contains(domain))
|
|
||||||
{
|
|
||||||
allowed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据检查结果决定是否放行
|
|
||||||
if (allowed)
|
|
||||||
{
|
|
||||||
chain.doFilter(request, response);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Access denied: Referer '" + referer + "' is not allowed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void destroy()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.ruoyi.file.service;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import com.alibaba.nacos.common.utils.IoUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
||||||
|
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
||||||
|
import com.ruoyi.common.core.utils.file.FileTypeUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FastDFS 文件存储
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FastDfsSysFileServiceImpl implements ISysFileService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 域名或本机访问地址
|
||||||
|
*/
|
||||||
|
@Value("${fdfs.domain}")
|
||||||
|
public String domain;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FastFileStorageClient storageClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FastDfs文件上传接口
|
||||||
|
*
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @return 访问地址
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String uploadFile(MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
inputStream = file.getInputStream();
|
||||||
|
StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), FileTypeUtils.getExtension(file), null);
|
||||||
|
return domain + "/" + storePath.getFullPath();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("FastDfs Failed to upload file", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IoUtils.closeQuietly(inputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,12 +17,4 @@ public interface ISysFileService
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String uploadFile(MultipartFile file) throws Exception;
|
public String uploadFile(MultipartFile file) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件删除接口
|
|
||||||
*
|
|
||||||
* @param fileUrl 文件访问URL
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void deleteFile(String fileUrl) throws Exception;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.core.utils.file.FileUtils;
|
|
||||||
import com.ruoyi.file.utils.FileUploadUtils;
|
import com.ruoyi.file.utils.FileUploadUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,17 +47,4 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|||||||
String url = domain + localFilePrefix + name;
|
String url = domain + localFilePrefix + name;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 本地文件删除接口
|
|
||||||
*
|
|
||||||
* @param fileUrl 文件访问URL
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void deleteFile(String fileUrl) throws Exception
|
|
||||||
{
|
|
||||||
String localFile = StringUtils.substringAfter(fileUrl, localFilePrefix);
|
|
||||||
FileUtils.deleteFile(localFilePath + localFile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.alibaba.nacos.common.utils.IoUtils;
|
import com.alibaba.nacos.common.utils.IoUtils;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.file.config.MinioConfig;
|
import com.ruoyi.file.config.MinioConfig;
|
||||||
import com.ruoyi.file.utils.FileUploadUtils;
|
import com.ruoyi.file.utils.FileUploadUtils;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectArgs;
|
import io.minio.PutObjectArgs;
|
||||||
import io.minio.RemoveObjectArgs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minio 文件存储
|
* Minio 文件存储
|
||||||
@@ -59,24 +57,4 @@ public class MinioSysFileServiceImpl implements ISysFileService
|
|||||||
IoUtils.closeQuietly(inputStream);
|
IoUtils.closeQuietly(inputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Minio文件删除接口
|
|
||||||
*
|
|
||||||
* @param fileUrl 文件访问URL
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void deleteFile(String fileUrl) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String minioFile = StringUtils.substringAfter(fileUrl, minioConfig.getBucketName());
|
|
||||||
client.removeObject(RemoveObjectArgs.builder().bucket(minioConfig.getBucketName()).object(minioFile).build());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException("Minio Failed to delete file", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.gen.domain;
|
package com.ruoyi.gen.domain;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import com.ruoyi.common.core.constant.GenConstants;
|
import com.ruoyi.common.core.constant.GenConstants;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.gen.domain;
|
package com.ruoyi.gen.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package ${packageName}.controller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ function getList() {
|
|||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
if (null != daterange${AttrName}.value && '' != daterange${AttrName}.value) {
|
if (null != daterange${AttrName} && '' != daterange${AttrName}) {
|
||||||
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
|
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
|
||||||
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
|
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ function getList() {
|
|||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
if (null != daterange${AttrName}.value && '' != daterange${AttrName}.value) {
|
if (null != daterange${AttrName} && '' != daterange${AttrName}) {
|
||||||
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
|
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
|
||||||
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
|
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.job.controller;
|
package com.ruoyi.job.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.job.controller;
|
package com.ruoyi.job.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.job.domain;
|
package com.ruoyi.job.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.job.service;
|
package com.ruoyi.job.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import org.quartz.JobDataMap;
|
import org.quartz.JobDataMap;
|
||||||
import org.quartz.JobKey;
|
import org.quartz.JobKey;
|
||||||
import org.quartz.Scheduler;
|
import org.quartz.Scheduler;
|
||||||
|
|||||||
@@ -131,11 +131,11 @@ public class ScheduleUtils
|
|||||||
int count = StringUtils.countMatches(packageName, ".");
|
int count = StringUtils.countMatches(packageName, ".");
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
{
|
{
|
||||||
return StringUtils.startsWithAny(invokeTarget, Constants.JOB_WHITELIST_STR);
|
return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR);
|
||||||
}
|
}
|
||||||
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]);
|
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]);
|
||||||
String beanPackageName = obj.getClass().getPackage().getName();
|
String beanPackageName = obj.getClass().getPackage().getName();
|
||||||
return StringUtils.startsWithAny(beanPackageName, Constants.JOB_WHITELIST_STR)
|
return StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_WHITELIST_STR)
|
||||||
&& !StringUtils.startsWithAny(beanPackageName, Constants.JOB_ERROR_STR);
|
&& !StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_ERROR_STR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.ruoyi.system.controller;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|||||||
@@ -97,10 +97,6 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
else if (!menuService.checkRouteConfigUnique(menu))
|
|
||||||
{
|
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
|
|
||||||
}
|
|
||||||
menu.setCreateBy(SecurityUtils.getUsername());
|
menu.setCreateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
}
|
}
|
||||||
@@ -125,10 +121,6 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
}
|
}
|
||||||
else if (!menuService.checkRouteConfigUnique(menu))
|
|
||||||
{
|
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
|
|
||||||
}
|
|
||||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.file.FileTypeUtils;
|
import com.ruoyi.common.core.utils.file.FileTypeUtils;
|
||||||
import com.ruoyi.common.core.utils.file.MimeTypeUtils;
|
import com.ruoyi.common.core.utils.file.MimeTypeUtils;
|
||||||
@@ -100,7 +99,7 @@ public class SysProfileController extends BaseController
|
|||||||
String oldPassword = params.get("oldPassword");
|
String oldPassword = params.get("oldPassword");
|
||||||
String newPassword = params.get("newPassword");
|
String newPassword = params.get("newPassword");
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
Long userId = loginUser.getUserid();
|
String userName = loginUser.getUsername();
|
||||||
String password = loginUser.getSysUser().getPassword();
|
String password = loginUser.getSysUser().getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||||
{
|
{
|
||||||
@@ -111,10 +110,9 @@ public class SysProfileController extends BaseController
|
|||||||
return error("新密码不能与旧密码相同");
|
return error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
newPassword = SecurityUtils.encryptPassword(newPassword);
|
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||||
if (userService.resetUserPwd(userId, newPassword) > 0)
|
if (userService.resetUserPwd(userName, newPassword) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户密码&密码最后更新时间
|
// 更新缓存用户密码
|
||||||
loginUser.getSysUser().setPwdUpdateDate(DateUtils.getNowDate());
|
|
||||||
loginUser.getSysUser().setPassword(newPassword);
|
loginUser.getSysUser().setPassword(newPassword);
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return success();
|
return success();
|
||||||
@@ -143,13 +141,8 @@ public class SysProfileController extends BaseController
|
|||||||
return error("文件服务异常,请联系管理员");
|
return error("文件服务异常,请联系管理员");
|
||||||
}
|
}
|
||||||
String url = fileResult.getData().getUrl();
|
String url = fileResult.getData().getUrl();
|
||||||
if (userService.updateUserAvatar(loginUser.getUserid(), url))
|
if (userService.updateUserAvatar(loginUser.getUsername(), url))
|
||||||
{
|
{
|
||||||
String oldAvatarUrl = loginUser.getSysUser().getAvatar();
|
|
||||||
if (StringUtils.isNotEmpty(oldAvatarUrl))
|
|
||||||
{
|
|
||||||
remoteFileService.delete(oldAvatarUrl);
|
|
||||||
}
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("imgUrl", url);
|
ajax.put("imgUrl", url);
|
||||||
// 更新缓存用户头像
|
// 更新缓存用户头像
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -19,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
@@ -163,7 +160,7 @@ public class SysUserController extends BaseController
|
|||||||
@PutMapping("/recordlogin")
|
@PutMapping("/recordlogin")
|
||||||
public R<Boolean> recordlogin(@RequestBody SysUser sysUser)
|
public R<Boolean> recordlogin(@RequestBody SysUser sysUser)
|
||||||
{
|
{
|
||||||
return R.ok(userService.updateLoginInfo(sysUser));
|
return R.ok(userService.updateUserProfile(sysUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,35 +186,9 @@ public class SysUserController extends BaseController
|
|||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
|
||||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查初始密码是否提醒修改
|
|
||||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
|
||||||
{
|
|
||||||
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
|
||||||
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查密码是否过期
|
|
||||||
public boolean passwordIsExpiration(Date pwdUpdateDate)
|
|
||||||
{
|
|
||||||
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
|
||||||
if (passwordValidateDays != null && passwordValidateDays > 0)
|
|
||||||
{
|
|
||||||
if (StringUtils.isNull(pwdUpdateDate))
|
|
||||||
{
|
|
||||||
// 如果从未修改过初始密码,直接提醒过期
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Date nowDate = DateUtils.getNowDate();
|
|
||||||
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户编号获取详细信息
|
* 根据用户编号获取详细信息
|
||||||
*/
|
*/
|
||||||
@@ -235,7 +206,7 @@ public class SysUserController extends BaseController
|
|||||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<SysRole> roles = roleService.selectRoleAll();
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostAll());
|
ajax.put("posts", postService.selectPostAll());
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
@@ -350,7 +321,7 @@ public class SysUserController extends BaseController
|
|||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package com.ruoyi.system.domain;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|||||||
@@ -122,13 +122,4 @@ public interface SysMenuMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据路由路径或名称查询菜单信息(用于唯一性校验)
|
|
||||||
*
|
|
||||||
* @param path 路由地址
|
|
||||||
* @param routeName 路由名称
|
|
||||||
* @return 匹配的菜单列表
|
|
||||||
*/
|
|
||||||
public List<SysMenu> selectMenusByPathOrRouteName(@Param("path") String path, @Param("routeName") String routeName);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,37 +70,20 @@ public interface SysUserMapper
|
|||||||
/**
|
/**
|
||||||
* 修改用户头像
|
* 修改用户头像
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userName 用户名
|
||||||
* @param avatar 头像地址
|
* @param avatar 头像地址
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateUserAvatar(@Param("userId") Long userId, @Param("avatar") String avatar);
|
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改用户状态
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param status 状态
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateUserStatus(@Param("userId") Long userId, @Param("status") String status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新用户登录信息(IP和登录时间)
|
|
||||||
*
|
|
||||||
* @param user 用户信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateLoginInfo(SysUser user);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置用户密码
|
* 重置用户密码
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userName 用户名
|
||||||
* @param password 密码
|
* @param password 密码
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int resetUserPwd(@Param("userId") Long userId, @Param("password") String password);
|
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID删除用户
|
* 通过用户ID删除用户
|
||||||
|
|||||||
@@ -141,12 +141,4 @@ public interface ISysMenuService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean checkMenuNameUnique(SysMenu menu);
|
public boolean checkMenuNameUnique(SysMenu menu);
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验路由组合是否唯一
|
|
||||||
*
|
|
||||||
* @param menu 菜单信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public boolean checkRouteConfigUnique(SysMenu menu);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user