Pre Merge pull request !444 from Barudisshu/master

pull/444/MERGE
Barudisshu 2025-12-14 12:17:10 +00:00 committed by Gitee
commit 7410bd4848
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
324 changed files with 21592 additions and 25412 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
charset = utf-8
max_line_length = 120
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

1
.java-version Normal file
View File

@ -0,0 +1 @@
25

13
.mvn/jvm.config Normal file
View File

@ -0,0 +1,13 @@
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
-Xmx1024m
-Xms1024m
-XX:+TieredCompilation
-Xshare:on
-Djava.net.preferIPv4Stack=true
-Djava.security.egd=file:/dev/./urandom
-Dfile.encoding=UTF-8

3
.mvn/maven.config Normal file
View File

@ -0,0 +1,3 @@
-Djava.version=25
-Drevision=1.0.0
-Dchangelist=-SNAPSHOT

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 清理工程target生成路径。 echo [信息] 清理工程target生成路径。
echo. echo.
%~d0 %~d0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 打包Web工程生成war/jar包文件。 echo [信息] 打包Web工程生成war/jar包文件。
echo. echo.
%~d0 %~d0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Auth工程。 echo [信息] 使用Jar命令运行Auth工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Gateway工程。 echo [信息] 使用Jar命令运行Gateway工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-File工程。 echo [信息] 使用Jar命令运行Modules-File工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-Gen工程。 echo [信息] 使用Jar命令运行Modules-Gen工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-Job工程。 echo [信息] 使用Jar命令运行Modules-Job工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-System工程。 echo [信息] 使用Jar命令运行Modules-System工程。
echo. echo.
cd %~dp0 cd %~dp0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Monitor工程。 echo [信息] 使用Jar命令运行Monitor工程。
echo. echo.
cd %~dp0 cd %~dp0

10
bin/clean.sh Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 清理工程target生成路径。"
echo ""
cd "$(dirname "$0")" || exit
cd ..
mvn clean

10
bin/package.sh Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 打包Web工程生成war/jar包文件。"
echo ""
cd "$(dirname "$0")" || exit
cd ..
mvn clean package -Dmaven.test.skip=true

12
bin/run-auth.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Auth工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-auth/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-auth.jar

12
bin/run-gateway.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Gateway工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-gateway/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-gateway.jar

12
bin/run-modules-file.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Modules-File工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-modules/ruoyi-file/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-modules-file.jar

12
bin/run-modules-gen.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Modules-Gen工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-modules/ruoyi-gen/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-modules-gen.jar

12
bin/run-modules-job.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Modules-Job工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-modules/ruoyi-job/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-modules-job.jar

12
bin/run-modules-system.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Modules-System工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-modules/ruoyi-system/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-modules-system.jar

12
bin/run-monitor.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo ""
echo "[信息] 使用Jar命令运行Monitor工程。"
echo ""
cd "$(dirname "$0")" || exit
cd ../ruoyi-visual/ruoyi-monitor/target || exit
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
java -Dfile.encoding=utf-8 "$JAVA_OPTS" -jar ruoyi-visual-monitor.jar

3
docker/copy.sh Normal file → Executable file
View File

@ -10,7 +10,8 @@ usage() {
# copy sql # copy sql
echo "begin copy sql " echo "begin copy sql "
cp ../sql/ry_20250523.sql ./mysql/db cp ../sql/ry_20250523.sql ./mysql/db
cp ../sql/ry_config_20250224.sql ./mysql/db cp ../sql/ry_config*.sql ./mysql/db
cp ../sql/ry_seata*.sql ./mysql/db
# copy html # copy html
echo "begin copy html " echo "begin copy html "

9
docker/deploy.sh Normal file → Executable file
View File

@ -10,6 +10,7 @@ usage() {
port(){ port(){
firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=8080/tcp --permanent firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --add-port=8181/tcp --permanent
firewall-cmd --add-port=8848/tcp --permanent firewall-cmd --add-port=8848/tcp --permanent
firewall-cmd --add-port=9848/tcp --permanent firewall-cmd --add-port=9848/tcp --permanent
firewall-cmd --add-port=9849/tcp --permanent firewall-cmd --add-port=9849/tcp --permanent
@ -26,22 +27,22 @@ port(){
# 启动基础环境(必须) # 启动基础环境(必须)
base(){ base(){
docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos docker compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos
} }
# 启动程序模块(必须) # 启动程序模块(必须)
modules(){ modules(){
docker-compose up -d ruoyi-nginx ruoyi-gateway ruoyi-auth ruoyi-modules-system docker compose up -d ruoyi-nginx ruoyi-gateway ruoyi-auth ruoyi-modules-system
} }
# 关闭所有环境/模块 # 关闭所有环境/模块
stop(){ stop(){
docker-compose stop docker compose stop
} }
# 删除所有环境/模块 # 删除所有环境/模块
rm(){ rm(){
docker-compose rm docker compose rm
} }
# 根据输入参数,选择执行对应方法,不输入则执行使用说明 # 根据输入参数,选择执行对应方法,不输入则执行使用说明

View File

@ -1,4 +1,3 @@
version : '3.8'
services: services:
ruoyi-nacos: ruoyi-nacos:
container_name: ruoyi-nacos container_name: ruoyi-nacos
@ -7,10 +6,17 @@ services:
context: ./nacos context: ./nacos
environment: environment:
- MODE=standalone - MODE=standalone
- NACOS_AUTH_ENABLE=true
- NACOS_AUTH_TOKEN=U2VjcmV0S2V5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5
- NACOS_AUTH_ENABLE=true
- NACOS_AUTH_CACHE_ENABLE=true
- NACOS_AUTH_IDENTITY_KEY=serverIdentity
- NACOS_AUTH_IDENTITY_VALUE=security
volumes: volumes:
- ./nacos/logs/:/home/nacos/logs - ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties - ./nacos/conf/application.properties:/home/nacos/conf/application.properties
ports: ports:
- "8181:8080"
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"
- "9849:9849" - "9849:9849"
@ -69,7 +75,7 @@ services:
container_name: ruoyi-gateway container_name: ruoyi-gateway
build: build:
context: ./ruoyi/gateway context: ./ruoyi/gateway
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "8080:8080" - "8080:8080"
depends_on: depends_on:
@ -80,7 +86,7 @@ services:
container_name: ruoyi-auth container_name: ruoyi-auth
build: build:
context: ./ruoyi/auth context: ./ruoyi/auth
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9200:9200" - "9200:9200"
depends_on: depends_on:
@ -91,7 +97,7 @@ services:
container_name: ruoyi-modules-system container_name: ruoyi-modules-system
build: build:
context: ./ruoyi/modules/system context: ./ruoyi/modules/system
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9201:9201" - "9201:9201"
depends_on: depends_on:
@ -104,7 +110,7 @@ services:
container_name: ruoyi-modules-gen container_name: ruoyi-modules-gen
build: build:
context: ./ruoyi/modules/gen context: ./ruoyi/modules/gen
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9202:9202" - "9202:9202"
depends_on: depends_on:
@ -115,7 +121,7 @@ services:
container_name: ruoyi-modules-job container_name: ruoyi-modules-job
build: build:
context: ./ruoyi/modules/job context: ./ruoyi/modules/job
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9203:9203" - "9203:9203"
depends_on: depends_on:
@ -126,7 +132,7 @@ services:
container_name: ruoyi-modules-file container_name: ruoyi-modules-file
build: build:
context: ./ruoyi/modules/file context: ./ruoyi/modules/file
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9300:9300" - "9300:9300"
volumes: volumes:
@ -135,6 +141,6 @@ services:
container_name: ruoyi-visual-monitor container_name: ruoyi-visual-monitor
build: build:
context: ./ruoyi/visual/monitor context: ./ruoyi/visual/monitor
dockerfile: dockerfile dockerfile: Dockerfile
ports: ports:
- "9100:9100" - "9100:9100"

7
docker/mysql/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
# 基础镜像
FROM mysql:5.7
# author
LABEL org.opencontainers.image.authors="ruoyi"
# 执行sql脚本
COPY ./db/*.sql /docker-entrypoint-initdb.d/

View File

@ -1 +1 @@
存放sql目录下的所有脚本用于docker自动执行。 存放sql目录下的所有脚本用于docker自动执行。

View File

@ -1,7 +0,0 @@
# 基础镜像
FROM mysql:5.7
# author
MAINTAINER ruoyi
# 执行sql脚本
ADD ./db/*.sql /docker-entrypoint-initdb.d/

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM nacos/nacos-server FROM nacos/nacos-server:v3.1.1
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/application.properties /home/nacos/conf/application.properties COPY ./conf/application.properties /home/nacos/conf/application.properties

View File

@ -22,11 +22,12 @@ nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/
nacos.core.auth.system.type=nacos nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=false nacos.core.auth.enabled=false
nacos.core.auth.default.token.expire.seconds=18000 nacos.core.auth.plugin.nacos.token.expire.seconds=18000
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789 nacos.core.auth.plugin.nacos.token.secret.key=U2VjcmV0S2V5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5
nacos.core.auth.caching.enabled=true nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=false nacos.core.auth.enable.userAgentAuthWhite=false
nacos.core.auth.server.identity.key=serverIdentity nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security nacos.core.auth.server.identity.value=security
nacos.istio.mcp.server.enabled=false nacos.istio.mcp.server.enabled=false

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM nginx FROM nginx
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi/projects/ruoyi-ui VOLUME /home/ruoyi/projects/ruoyi-ui

View File

@ -1 +1 @@
存放前端ruoyi-ui构建好的静态文件用于nginx请求访问。 存放前端ruoyi-ui构建好的静态文件用于nginx请求访问。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM redis FROM redis
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi/redis VOLUME /home/ruoyi/redis

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放认证中心打包好的jar文件用于docker启动应用。 存放认证中心打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放网关模块打包好的jar文件用于docker启动应用。 存放网关模块打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放文件服务打包好的jar文件用于docker启动应用。 存放文件服务打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放代码生成打包好的jar文件用于docker启动应用。 存放代码生成打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放定时任务打包好的jar文件用于docker启动应用。 存放定时任务打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放系统模块打包好的jar文件用于docker启动应用。 存放系统模块打包好的jar文件用于docker启动应用。

View File

@ -1,7 +1,7 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM maven:3.9.11-eclipse-temurin-8-alpine
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi

View File

@ -1 +1 @@
存放监控中心打包好的jar文件用于docker启动应用。 存放监控中心打包好的jar文件用于docker启动应用。

86
pom.xml
View File

@ -16,28 +16,33 @@
<ruoyi.version>3.6.6</ruoyi.version> <ruoyi.version>3.6.6</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>1.8</java.version> <java.version>25</java.version>
<spring-boot.version>2.7.18</spring-boot.version>
<spring-cloud.version>2021.0.9</spring-cloud.version> <spring-boot.version>3.5.8</spring-boot.version>
<spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version> <spring-cloud.version>2025.0.0</spring-cloud.version>
<spring-boot-admin.version>2.7.16</spring-boot-admin.version> <spring-cloud-alibaba.version>2025.0.0.0</spring-cloud-alibaba.version>
<spring-boot-admin.version>3.5.6</spring-boot-admin.version>
<tobato.version>1.27.2</tobato.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.0.0</pagehelper.boot.version> <pagehelper.boot.version>2.1.1</pagehelper.boot.version>
<druid.version>1.2.23</druid.version> <druid.version>1.2.27</druid.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version> <dynamic-ds.version>4.3.1</dynamic-ds.version>
<commons.io.version>2.19.0</commons.io.version> <commons.io.version>2.19.0</commons.io.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<fastjson.version>2.0.57</fastjson.version> <fastjson.version>2.0.60</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>1.6.9</springdoc.version> <springdoc.version>3.0.0</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 --> <!-- override dependency version -->
<tomcat.version>9.0.112</tomcat.version> <tomcat.version>9.0.112</tomcat.version>
<logback.version>1.2.13</logback.version> <logback.version>1.5.22</logback.version>
<spring-framework.version>5.3.39</spring-framework.version> <spring-framework.version>6.2.15</spring-framework.version>
<!-- plugin version -->
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
<git-code-format-maven-plugin.version>5.4</git-code-format-maven-plugin.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -122,7 +127,7 @@
<!-- Springdoc webmvc 依赖配置 --> <!-- Springdoc webmvc 依赖配置 -->
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version> <version>${springdoc.version}</version>
</dependency> </dependency>
@ -276,13 +281,11 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> </plugin>
<source>${java.version}</source> <plugin>
<target>${java.version}</target> <groupId>com.cosium.code</groupId>
<encoding>${project.build.sourceEncoding}</encoding> <artifactId>git-code-format-maven-plugin</artifactId>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
@ -299,6 +302,53 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
<executions>
<execution>
<id>install-formatter-hook</id>
<goals>
<goal>install-hooks</goal>
</goals>
</execution>
<execution>
<id>git-code-format</id>
<phase>validate</phase>
<goals>
<goal>format-code</goal>
<goal>validate-code-format</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.cosium.code</groupId>
<artifactId>google-java-format</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<formatterOptions>
<googleJavaFormat.aosp>false</googleJavaFormat.aosp>
<googleJavaFormat.formatJavadoc>true</googleJavaFormat.formatJavadoc>
<googleJavaFormat.fixImportsOnly>false</googleJavaFormat.fixImportsOnly>
<googleJavaFormat.skipSortingImports>false</googleJavaFormat.skipSortingImports>
<googleJavaFormat.skipRemoveUnusedImports>false</googleJavaFormat.skipRemoveUnusedImports>
</formatterOptions>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>

View File

@ -1,5 +1,9 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
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.DeleteMapping;
@ -7,19 +11,17 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; 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.domain.R;
import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class) @FeignClient(
public interface RemoteFileService contextId = "remoteFileService",
{ value = ServiceNameConstants.FILE_SERVICE,
fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
/** /**
* *
* *

View File

@ -1,24 +1,26 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysLogininfor; import com.ruoyi.system.api.domain.SysLogininfor;
import com.ruoyi.system.api.domain.SysOperLog; import com.ruoyi.system.api.domain.SysOperLog;
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory; import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class) @FeignClient(
public interface RemoteLogService contextId = "remoteLogService",
{ value = ServiceNameConstants.SYSTEM_SERVICE,
fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {
/** /**
* *
* *
@ -27,7 +29,10 @@ public interface RemoteLogService
* @return * @return
*/ */
@PostMapping("/operlog") @PostMapping("/operlog")
public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception; public R<Boolean> saveLog(
@RequestBody SysOperLog sysOperLog,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source)
throws Exception;
/** /**
* 访 * 访
@ -37,5 +42,7 @@ public interface RemoteLogService
* @return * @return
*/ */
@PostMapping("/logininfor") @PostMapping("/logininfor")
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> saveLogininfor(
@RequestBody SysLogininfor sysLogininfor,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

View File

@ -1,5 +1,11 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -7,21 +13,17 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) @FeignClient(
public interface RemoteUserService contextId = "remoteUserService",
{ value = ServiceNameConstants.SYSTEM_SERVICE,
fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {
/** /**
* *
* *
@ -30,7 +32,9 @@ public interface RemoteUserService
* @return * @return
*/ */
@GetMapping("/user/info/{username}") @GetMapping("/user/info/{username}")
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<LoginUser> getUserInfo(
@PathVariable("username") String username,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* *
@ -40,7 +44,8 @@ public interface RemoteUserService
* @return * @return
*/ */
@PostMapping("/user/register") @PostMapping("/user/register")
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> registerUserInfo(
@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* IP * IP
@ -50,5 +55,6 @@ public interface RemoteUserService
* @return * @return
*/ */
@PutMapping("/user/recordlogin") @PutMapping("/user/recordlogin")
public R<Boolean> recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> recordUserLogin(
@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

View File

@ -1,22 +1,21 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
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;
/** /**
* sys_dept * sys_dept
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDept extends BaseEntity public class SysDept extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 部门ID */ /** 部门ID */
@ -55,135 +54,111 @@ public class SysDept extends BaseEntity
/** 子部门 */ /** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
public Long getParentId() public Long getParentId() {
{
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId) {
{
this.parentId = parentId; this.parentId = parentId;
} }
public String getAncestors() public String getAncestors() {
{
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors) {
{
this.ancestors = ancestors; this.ancestors = ancestors;
} }
@NotBlank(message = "部门名称不能为空") @NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName() public String getDeptName() {
{
return deptName; return deptName;
} }
public void setDeptName(String deptName) public void setDeptName(String deptName) {
{
this.deptName = deptName; this.deptName = deptName;
} }
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public Integer getOrderNum() public Integer getOrderNum() {
{
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum) {
{
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getLeader() public String getLeader() {
{
return leader; return leader;
} }
public void setLeader(String leader) public void setLeader(String leader) {
{
this.leader = leader; this.leader = leader;
} }
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone() public String getPhone() {
{
return phone; return phone;
} }
public void setPhone(String phone) public void setPhone(String phone) {
{
this.phone = phone; this.phone = phone;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getParentName() public String getParentName() {
{
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName) {
{
this.parentName = parentName; this.parentName = parentName;
} }
public List<SysDept> getChildren() public List<SysDept> getChildren() {
{
return children; return children;
} }
public void setChildren(List<SysDept> children) public void setChildren(List<SysDept> children) {
{
this.children = children; this.children = children;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("ancestors", getAncestors()) .append("ancestors", getAncestors())

View File

@ -1,21 +1,20 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* sys_dict_data * sys_dict_data
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDictData extends BaseEntity public class SysDictData extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典编码 */ /** 字典编码 */
@ -52,111 +51,92 @@ public class SysDictData extends BaseEntity
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictCode() public Long getDictCode() {
{
return dictCode; return dictCode;
} }
public void setDictCode(Long dictCode) public void setDictCode(Long dictCode) {
{
this.dictCode = dictCode; this.dictCode = dictCode;
} }
public Long getDictSort() public Long getDictSort() {
{
return dictSort; return dictSort;
} }
public void setDictSort(Long dictSort) public void setDictSort(Long dictSort) {
{
this.dictSort = dictSort; this.dictSort = dictSort;
} }
@NotBlank(message = "字典标签不能为空") @NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel() public String getDictLabel() {
{
return dictLabel; return dictLabel;
} }
public void setDictLabel(String dictLabel) public void setDictLabel(String dictLabel) {
{
this.dictLabel = dictLabel; this.dictLabel = dictLabel;
} }
@NotBlank(message = "字典键值不能为空") @NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue() public String getDictValue() {
{
return dictValue; return dictValue;
} }
public void setDictValue(String dictValue) public void setDictValue(String dictValue) {
{
this.dictValue = dictValue; this.dictValue = dictValue;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType() public String getDictType() {
{
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType) {
{
this.dictType = dictType; this.dictType = dictType;
} }
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass() public String getCssClass() {
{
return cssClass; return cssClass;
} }
public void setCssClass(String cssClass) public void setCssClass(String cssClass) {
{
this.cssClass = cssClass; this.cssClass = cssClass;
} }
public String getListClass() public String getListClass() {
{
return listClass; return listClass;
} }
public void setListClass(String listClass) public void setListClass(String listClass) {
{
this.listClass = listClass; this.listClass = listClass;
} }
public boolean getDefault() public boolean getDefault() {
{
return UserConstants.YES.equals(this.isDefault); return UserConstants.YES.equals(this.isDefault);
} }
public String getIsDefault() public String getIsDefault() {
{
return isDefault; return isDefault;
} }
public void setIsDefault(String isDefault) public void setIsDefault(String isDefault) {
{
this.isDefault = isDefault; this.isDefault = isDefault;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode()) .append("dictCode", getDictCode())
.append("dictSort", getDictSort()) .append("dictSort", getDictSort())
.append("dictLabel", getDictLabel()) .append("dictLabel", getDictLabel())

View File

@ -1,21 +1,20 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* sys_dict_type * sys_dict_type
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDictType extends BaseEntity public class SysDictType extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典主键 */ /** 字典主键 */
@ -34,54 +33,46 @@ public class SysDictType extends BaseEntity
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
public Long getDictId() public Long getDictId() {
{
return dictId; return dictId;
} }
public void setDictId(Long dictId) public void setDictId(Long dictId) {
{
this.dictId = dictId; this.dictId = dictId;
} }
@NotBlank(message = "字典名称不能为空") @NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName() public String getDictName() {
{
return dictName; return dictName;
} }
public void setDictName(String dictName) public void setDictName(String dictName) {
{
this.dictName = dictName; this.dictName = dictName;
} }
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType() public String getDictType() {
{
return dictType; return dictType;
} }
public void setDictType(String dictType) public void setDictType(String dictType) {
{
this.dictType = dictType; this.dictType = dictType;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId()) .append("dictId", getDictId())
.append("dictName", getDictName()) .append("dictName", getDictName())
.append("dictType", getDictType()) .append("dictType", getDictType())

View File

@ -8,41 +8,32 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysFile public class SysFile {
{ /** 文件名称 */
/**
*
*/
private String name; private String name;
/** /** 文件地址 */
*
*/
private String url; private String url;
public String getName() public String getName() {
{
return name; return name;
} }
public void setName(String name) public void setName(String name) {
{
this.name = name; this.name = name;
} }
public String getUrl() public String getUrl() {
{
return url; return url;
} }
public void setUrl(String url) public void setUrl(String url) {
{
this.url = url; this.url = url;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName()) .append("name", getName())
.append("url", getUrl()) .append("url", getUrl())
.toString(); .toString();

View File

@ -1,18 +1,17 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import java.util.Date;
/** /**
* 访 sys_logininfor * 访 sys_logininfor
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysLogininfor extends BaseEntity public class SysLogininfor extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@ -40,63 +39,51 @@ public class SysLogininfor extends BaseEntity
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date accessTime; private Date accessTime;
public Long getInfoId() public Long getInfoId() {
{
return infoId; return infoId;
} }
public void setInfoId(Long infoId) public void setInfoId(Long infoId) {
{
this.infoId = infoId; this.infoId = infoId;
} }
public String getUserName() public String getUserName() {
{
return userName; return userName;
} }
public void setUserName(String userName) public void setUserName(String userName) {
{
this.userName = userName; this.userName = userName;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getIpaddr() public String getIpaddr() {
{
return ipaddr; return ipaddr;
} }
public void setIpaddr(String ipaddr) public void setIpaddr(String ipaddr) {
{
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public String getMsg() public String getMsg() {
{
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg) {
{
this.msg = msg; this.msg = msg;
} }
public Date getAccessTime() public Date getAccessTime() {
{
return accessTime; return accessTime;
} }
public void setAccessTime(Date accessTime) public void setAccessTime(Date accessTime) {
{
this.accessTime = accessTime; this.accessTime = accessTime;
} }
} }

View File

@ -1,18 +1,17 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import java.util.Date;
/** /**
* oper_log * oper_log
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysOperLog extends BaseEntity public class SysOperLog extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 日志主键 */ /** 日志主键 */
@ -83,173 +82,139 @@ public class SysOperLog extends BaseEntity
@Excel(name = "消耗时间", suffix = "毫秒") @Excel(name = "消耗时间", suffix = "毫秒")
private Long costTime; private Long costTime;
public Long getOperId() public Long getOperId() {
{
return operId; return operId;
} }
public void setOperId(Long operId) public void setOperId(Long operId) {
{
this.operId = operId; this.operId = operId;
} }
public String getTitle() public String getTitle() {
{
return title; return title;
} }
public void setTitle(String title) public void setTitle(String title) {
{
this.title = title; this.title = title;
} }
public Integer getBusinessType() public Integer getBusinessType() {
{
return businessType; return businessType;
} }
public void setBusinessType(Integer businessType) public void setBusinessType(Integer businessType) {
{
this.businessType = businessType; this.businessType = businessType;
} }
public Integer[] getBusinessTypes() public Integer[] getBusinessTypes() {
{
return businessTypes; return businessTypes;
} }
public void setBusinessTypes(Integer[] businessTypes) public void setBusinessTypes(Integer[] businessTypes) {
{
this.businessTypes = businessTypes; this.businessTypes = businessTypes;
} }
public String getMethod() public String getMethod() {
{
return method; return method;
} }
public void setMethod(String method) public void setMethod(String method) {
{
this.method = method; this.method = method;
} }
public String getRequestMethod() public String getRequestMethod() {
{
return requestMethod; return requestMethod;
} }
public void setRequestMethod(String requestMethod) public void setRequestMethod(String requestMethod) {
{
this.requestMethod = requestMethod; this.requestMethod = requestMethod;
} }
public Integer getOperatorType() public Integer getOperatorType() {
{
return operatorType; return operatorType;
} }
public void setOperatorType(Integer operatorType) public void setOperatorType(Integer operatorType) {
{
this.operatorType = operatorType; this.operatorType = operatorType;
} }
public String getOperName() public String getOperName() {
{
return operName; return operName;
} }
public void setOperName(String operName) public void setOperName(String operName) {
{
this.operName = operName; this.operName = operName;
} }
public String getDeptName() public String getDeptName() {
{
return deptName; return deptName;
} }
public void setDeptName(String deptName) public void setDeptName(String deptName) {
{
this.deptName = deptName; this.deptName = deptName;
} }
public String getOperUrl() public String getOperUrl() {
{
return operUrl; return operUrl;
} }
public void setOperUrl(String operUrl) public void setOperUrl(String operUrl) {
{
this.operUrl = operUrl; this.operUrl = operUrl;
} }
public String getOperIp() public String getOperIp() {
{
return operIp; return operIp;
} }
public void setOperIp(String operIp) public void setOperIp(String operIp) {
{
this.operIp = operIp; this.operIp = operIp;
} }
public String getOperParam() public String getOperParam() {
{
return operParam; return operParam;
} }
public void setOperParam(String operParam) public void setOperParam(String operParam) {
{
this.operParam = operParam; this.operParam = operParam;
} }
public String getJsonResult() public String getJsonResult() {
{
return jsonResult; return jsonResult;
} }
public void setJsonResult(String jsonResult) public void setJsonResult(String jsonResult) {
{
this.jsonResult = jsonResult; this.jsonResult = jsonResult;
} }
public Integer getStatus() public Integer getStatus() {
{
return status; return status;
} }
public void setStatus(Integer status) public void setStatus(Integer status) {
{
this.status = status; this.status = status;
} }
public String getErrorMsg() public String getErrorMsg() {
{
return errorMsg; return errorMsg;
} }
public void setErrorMsg(String errorMsg) public void setErrorMsg(String errorMsg) {
{
this.errorMsg = errorMsg; this.errorMsg = errorMsg;
} }
public Date getOperTime() public Date getOperTime() {
{
return operTime; return operTime;
} }
public void setOperTime(Date operTime) public void setOperTime(Date operTime) {
{
this.operTime = operTime; this.operTime = operTime;
} }
public Long getCostTime() public Long getCostTime() {
{
return costTime; return costTime;
} }
public void setCostTime(Long costTime) public void setCostTime(Long costTime) {
{
this.costTime = costTime; this.costTime = costTime;
} }
} }

View File

@ -1,22 +1,21 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import java.util.Set;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.Set;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* sys_role * sys_role
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysRole extends BaseEntity public class SysRole extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 角色ID */ /** 角色ID */
@ -64,164 +63,132 @@ public class SysRole extends BaseEntity
/** 角色菜单权限 */ /** 角色菜单权限 */
private Set<String> permissions; private Set<String> permissions;
public SysRole() public SysRole() {}
{
} public SysRole(Long roleId) {
public SysRole(Long roleId)
{
this.roleId = roleId; this.roleId = roleId;
} }
public Long getRoleId() public Long getRoleId() {
{
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
public boolean isAdmin() public boolean isAdmin() {
{
return isAdmin(this.roleId); return isAdmin(this.roleId);
} }
public static boolean isAdmin(Long roleId) public static boolean isAdmin(Long roleId) {
{
return roleId != null && 1L == roleId; return roleId != null && 1L == roleId;
} }
@NotBlank(message = "角色名称不能为空") @NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName() public String getRoleName() {
{
return roleName; return roleName;
} }
public void setRoleName(String roleName) public void setRoleName(String roleName) {
{
this.roleName = roleName; this.roleName = roleName;
} }
@NotBlank(message = "权限字符不能为空") @NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey() public String getRoleKey() {
{
return roleKey; return roleKey;
} }
public void setRoleKey(String roleKey) public void setRoleKey(String roleKey) {
{
this.roleKey = roleKey; this.roleKey = roleKey;
} }
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public Integer getRoleSort() public Integer getRoleSort() {
{
return roleSort; return roleSort;
} }
public void setRoleSort(Integer roleSort) public void setRoleSort(Integer roleSort) {
{
this.roleSort = roleSort; this.roleSort = roleSort;
} }
public String getDataScope() public String getDataScope() {
{
return dataScope; return dataScope;
} }
public void setDataScope(String dataScope) public void setDataScope(String dataScope) {
{
this.dataScope = dataScope; this.dataScope = dataScope;
} }
public boolean isMenuCheckStrictly() public boolean isMenuCheckStrictly() {
{
return menuCheckStrictly; return menuCheckStrictly;
} }
public void setMenuCheckStrictly(boolean menuCheckStrictly) public void setMenuCheckStrictly(boolean menuCheckStrictly) {
{
this.menuCheckStrictly = menuCheckStrictly; this.menuCheckStrictly = menuCheckStrictly;
} }
public boolean isDeptCheckStrictly() public boolean isDeptCheckStrictly() {
{
return deptCheckStrictly; return deptCheckStrictly;
} }
public void setDeptCheckStrictly(boolean deptCheckStrictly) public void setDeptCheckStrictly(boolean deptCheckStrictly) {
{
this.deptCheckStrictly = deptCheckStrictly; this.deptCheckStrictly = deptCheckStrictly;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public boolean isFlag() public boolean isFlag() {
{
return flag; return flag;
} }
public void setFlag(boolean flag) public void setFlag(boolean flag) {
{
this.flag = flag; this.flag = flag;
} }
public Long[] getMenuIds() public Long[] getMenuIds() {
{
return menuIds; return menuIds;
} }
public void setMenuIds(Long[] menuIds) public void setMenuIds(Long[] menuIds) {
{
this.menuIds = menuIds; this.menuIds = menuIds;
} }
public Long[] getDeptIds() public Long[] getDeptIds() {
{
return deptIds; return deptIds;
} }
public void setDeptIds(Long[] deptIds) public void setDeptIds(Long[] deptIds) {
{
this.deptIds = deptIds; this.deptIds = deptIds;
} }
public Set<String> getPermissions() public Set<String> getPermissions() {
{
return permissions; return permissions;
} }
public void setPermissions(Set<String> permissions) public void setPermissions(Set<String> permissions) {
{
this.permissions = permissions; this.permissions = permissions;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId()) .append("roleId", getRoleId())
.append("roleName", getRoleName()) .append("roleName", getRoleName())
.append("roleKey", getRoleKey()) .append("roleKey", getRoleKey())

View File

@ -1,25 +1,24 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type; import com.ruoyi.common.core.annotation.Excel.Type;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.annotation.Excels; import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss; import com.ruoyi.common.core.xss.Xss;
import jakarta.validation.constraints.*;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* sys_user * sys_user
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysUser extends BaseEntity public class SysUser extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /** 用户ID */
@ -93,227 +92,183 @@ public class SysUser extends BaseEntity
/** 角色ID */ /** 角色ID */
private Long roleId; private Long roleId;
public SysUser() public SysUser() {}
{
} public SysUser(Long userId) {
public SysUser(Long userId)
{
this.userId = userId; this.userId = userId;
} }
public Long getUserId() public Long getUserId() {
{
return userId; return userId;
} }
public void setUserId(Long userId) public void setUserId(Long userId) {
{
this.userId = userId; this.userId = userId;
} }
public boolean isAdmin() public boolean isAdmin() {
{
return isAdmin(this.userId); return isAdmin(this.userId);
} }
public static boolean isAdmin(Long userId) public static boolean isAdmin(Long userId) {
{
return UserConstants.isAdmin(userId); return UserConstants.isAdmin(userId);
} }
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户昵称不能包含脚本字符") @Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName() {
{
return nickName; return nickName;
} }
public void setNickName(String nickName) public void setNickName(String nickName) {
{
this.nickName = nickName; this.nickName = nickName;
} }
@Xss(message = "用户账号不能包含脚本字符") @Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空") @NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() public String getUserName() {
{
return userName; return userName;
} }
public void setUserName(String userName) public void setUserName(String userName) {
{
this.userName = userName; this.userName = userName;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() public String getPhonenumber() {
{
return phonenumber; return phonenumber;
} }
public void setPhonenumber(String phonenumber) public void setPhonenumber(String phonenumber) {
{
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
} }
public String getSex() public String getSex() {
{
return sex; return sex;
} }
public void setSex(String sex) public void setSex(String sex) {
{
this.sex = sex; this.sex = sex;
} }
public String getAvatar() public String getAvatar() {
{
return avatar; return avatar;
} }
public void setAvatar(String avatar) public void setAvatar(String avatar) {
{
this.avatar = avatar; this.avatar = avatar;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getLoginIp() public String getLoginIp() {
{
return loginIp; return loginIp;
} }
public void setLoginIp(String loginIp) public void setLoginIp(String loginIp) {
{
this.loginIp = loginIp; this.loginIp = loginIp;
} }
public Date getLoginDate() public Date getLoginDate() {
{
return loginDate; return loginDate;
} }
public void setLoginDate(Date loginDate) public void setLoginDate(Date loginDate) {
{
this.loginDate = loginDate; this.loginDate = loginDate;
} }
public Date getPwdUpdateDate() public Date getPwdUpdateDate() {
{
return pwdUpdateDate; return pwdUpdateDate;
} }
public void setPwdUpdateDate(Date pwdUpdateDate) public void setPwdUpdateDate(Date pwdUpdateDate) {
{
this.pwdUpdateDate = pwdUpdateDate; this.pwdUpdateDate = pwdUpdateDate;
} }
public SysDept getDept() public SysDept getDept() {
{
return dept; return dept;
} }
public void setDept(SysDept dept) public void setDept(SysDept dept) {
{
this.dept = dept; this.dept = dept;
} }
public List<SysRole> getRoles() public List<SysRole> getRoles() {
{
return roles; return roles;
} }
public void setRoles(List<SysRole> roles) public void setRoles(List<SysRole> roles) {
{
this.roles = roles; this.roles = roles;
} }
public Long[] getRoleIds() public Long[] getRoleIds() {
{
return roleIds; return roleIds;
} }
public void setRoleIds(Long[] roleIds) public void setRoleIds(Long[] roleIds) {
{
this.roleIds = roleIds; this.roleIds = roleIds;
} }
public Long[] getPostIds() public Long[] getPostIds() {
{
return postIds; return postIds;
} }
public void setPostIds(Long[] postIds) public void setPostIds(Long[] postIds) {
{
this.postIds = postIds; this.postIds = postIds;
} }
public Long getRoleId() public Long getRoleId() {
{
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId()) .append("userId", getUserId())
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())

View File

@ -1,13 +1,13 @@
package com.ruoyi.system.api.factory; package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteFileService;
import com.ruoyi.system.api.domain.SysFile;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteFileService;
import com.ruoyi.system.api.domain.SysFile;
/** /**
* *
@ -15,25 +15,20 @@ import com.ruoyi.system.api.domain.SysFile;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileService> public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileService> {
{
private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class); private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class);
@Override @Override
public RemoteFileService create(Throwable throwable) public RemoteFileService create(Throwable throwable) {
{
log.error("文件服务调用失败:{}", throwable.getMessage()); log.error("文件服务调用失败:{}", throwable.getMessage());
return new RemoteFileService() return new RemoteFileService() {
{
@Override @Override
public R<SysFile> upload(MultipartFile file) public R<SysFile> upload(MultipartFile file) {
{
return R.fail("上传文件失败:" + throwable.getMessage()); return R.fail("上传文件失败:" + throwable.getMessage());
} }
@Override @Override
public R<Boolean> delete(String fileUrl) public R<Boolean> delete(String fileUrl) {
{
return R.fail("删除文件失败:" + throwable.getMessage()); return R.fail("删除文件失败:" + throwable.getMessage());
} }
}; };

View File

@ -1,13 +1,13 @@
package com.ruoyi.system.api.factory; package com.ruoyi.system.api.factory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteLogService; import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysLogininfor; import com.ruoyi.system.api.domain.SysLogininfor;
import com.ruoyi.system.api.domain.SysOperLog; import com.ruoyi.system.api.domain.SysOperLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/** /**
* *
@ -15,28 +15,22 @@ import com.ruoyi.system.api.domain.SysOperLog;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService> public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService> {
{
private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class); private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);
@Override @Override
public RemoteLogService create(Throwable throwable) public RemoteLogService create(Throwable throwable) {
{
log.error("日志服务调用失败:{}", throwable.getMessage()); log.error("日志服务调用失败:{}", throwable.getMessage());
return new RemoteLogService() return new RemoteLogService() {
{
@Override @Override
public R<Boolean> saveLog(SysOperLog sysOperLog, String source) public R<Boolean> saveLog(SysOperLog sysOperLog, String source) {
{
return R.fail("保存操作日志失败:" + throwable.getMessage()); return R.fail("保存操作日志失败:" + throwable.getMessage());
} }
@Override @Override
public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source) public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source) {
{
return R.fail("保存登录日志失败:" + throwable.getMessage()); return R.fail("保存登录日志失败:" + throwable.getMessage());
} }
}; };
} }
} }

View File

@ -1,13 +1,13 @@
package com.ruoyi.system.api.factory; package com.ruoyi.system.api.factory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteUserService; import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/** /**
* *
@ -15,31 +15,25 @@ import com.ruoyi.system.api.model.LoginUser;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> {
{
private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class); private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
@Override @Override
public RemoteUserService create(Throwable throwable) public RemoteUserService create(Throwable throwable) {
{
log.error("用户服务调用失败:{}", throwable.getMessage()); log.error("用户服务调用失败:{}", throwable.getMessage());
return new RemoteUserService() return new RemoteUserService() {
{
@Override @Override
public R<LoginUser> getUserInfo(String username, String source) public R<LoginUser> getUserInfo(String username, String source) {
{
return R.fail("获取用户失败:" + throwable.getMessage()); return R.fail("获取用户失败:" + throwable.getMessage());
} }
@Override @Override
public R<Boolean> registerUserInfo(SysUser sysUser, String source) public R<Boolean> registerUserInfo(SysUser sysUser, String source) {
{
return R.fail("注册用户失败:" + throwable.getMessage()); return R.fail("注册用户失败:" + throwable.getMessage());
} }
@Override @Override
public R<Boolean> recordUserLogin(SysUser sysUser, String source) public R<Boolean> recordUserLogin(SysUser sysUser, String source) {
{
return R.fail("记录用户登录信息失败:" + throwable.getMessage()); return R.fail("记录用户登录信息失败:" + throwable.getMessage());
} }
}; };

View File

@ -1,150 +1,113 @@
package com.ruoyi.system.api.model; package com.ruoyi.system.api.model;
import com.ruoyi.system.api.domain.SysUser;
import java.io.Serializable; import java.io.Serializable;
import java.util.Set; import java.util.Set;
import com.ruoyi.system.api.domain.SysUser;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginUser implements Serializable public class LoginUser implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 用户唯一标识 */
*
*/
private String token; private String token;
/** /** 用户名id */
* id
*/
private Long userid; private Long userid;
/** /** 用户名 */
*
*/
private String username; private String username;
/** /** 登录时间 */
*
*/
private Long loginTime; private Long loginTime;
/** /** 过期时间 */
*
*/
private Long expireTime; private Long expireTime;
/** /** 登录IP地址 */
* IP
*/
private String ipaddr; private String ipaddr;
/** /** 权限列表 */
*
*/
private Set<String> permissions; private Set<String> permissions;
/** /** 角色列表 */
*
*/
private Set<String> roles; private Set<String> roles;
/** /** 用户信息 */
*
*/
private SysUser sysUser; private SysUser sysUser;
public String getToken() public String getToken() {
{
return token; return token;
} }
public void setToken(String token) public void setToken(String token) {
{
this.token = token; this.token = token;
} }
public Long getUserid() public Long getUserid() {
{
return userid; return userid;
} }
public void setUserid(Long userid) public void setUserid(Long userid) {
{
this.userid = userid; this.userid = userid;
} }
public String getUsername() public String getUsername() {
{
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username) {
{
this.username = username; this.username = username;
} }
public Long getLoginTime() public Long getLoginTime() {
{
return loginTime; return loginTime;
} }
public void setLoginTime(Long loginTime) public void setLoginTime(Long loginTime) {
{
this.loginTime = loginTime; this.loginTime = loginTime;
} }
public Long getExpireTime() public Long getExpireTime() {
{
return expireTime; return expireTime;
} }
public void setExpireTime(Long expireTime) public void setExpireTime(Long expireTime) {
{
this.expireTime = expireTime; this.expireTime = expireTime;
} }
public String getIpaddr() public String getIpaddr() {
{
return ipaddr; return ipaddr;
} }
public void setIpaddr(String ipaddr) public void setIpaddr(String ipaddr) {
{
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public Set<String> getPermissions() public Set<String> getPermissions() {
{
return permissions; return permissions;
} }
public void setPermissions(Set<String> permissions) public void setPermissions(Set<String> permissions) {
{
this.permissions = permissions; this.permissions = permissions;
} }
public Set<String> getRoles() public Set<String> getRoles() {
{
return roles; return roles;
} }
public void setRoles(Set<String> roles) public void setRoles(Set<String> roles) {
{
this.roles = roles; this.roles = roles;
} }
public SysUser getSysUser() public SysUser getSysUser() {
{
return sysUser; return sysUser;
} }
public void setSysUser(SysUser sysUser) public void setSysUser(SysUser sysUser) {
{
this.sysUser = sysUser; this.sysUser = sysUser;
} }
} }

View File

@ -1,9 +1,9 @@
package com.ruoyi.auth; package com.ruoyi.auth;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
/** /**
* *
@ -11,21 +11,20 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients;
* @author ruoyi * @author ruoyi
*/ */
@EnableRyFeignClients @EnableRyFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class RuoYiAuthApplication public class RuoYiAuthApplication {
{ public static void main(String[] args) {
public static void main(String[] args)
{
SpringApplication.run(RuoYiAuthApplication.class, args); SpringApplication.run(RuoYiAuthApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println(
" .-------. ____ __ \n" + "(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n"
" | _ _ \\ \\ \\ / / \n" + + " .-------. ____ __ \n"
" | ( ' ) | \\ _. / ' \n" + + " | _ _ \\ \\ \\ / / \n"
" |(_ o _) / _( )_ .' \n" + + " | ( ' ) | \\ _. / ' \n"
" | (_,_).' __ ___(_ o _)' \n" + + " |(_ o _) / _( )_ .' \n"
" | |\\ \\ | || |(_,_)' \n" + + " | (_,_).' __ ___(_ o _)' \n"
" | | \\ `' /| `-' / \n" + + " | |\\ \\ | || |(_,_)' \n"
" | | \\ / \\ / \n" + + " | | \\ `' /| `-' / \n"
" ''-' `'-' `-..-' "); + " | | \\ / \\ / \n"
+ " ''-' `'-' `-..-' ");
} }
} }

View File

@ -1,11 +1,5 @@
package com.ruoyi.auth.controller; package com.ruoyi.auth.controller;
import javax.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.auth.form.LoginBody; import com.ruoyi.auth.form.LoginBody;
import com.ruoyi.auth.form.RegisterBody; import com.ruoyi.auth.form.RegisterBody;
import com.ruoyi.auth.service.SysLoginService; import com.ruoyi.auth.service.SysLoginService;
@ -16,6 +10,12 @@ import com.ruoyi.common.security.auth.AuthUtil;
import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import jakarta.servlet.http.HttpServletRequest;
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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/** /**
* token * token
@ -23,17 +23,13 @@ import com.ruoyi.system.api.model.LoginUser;
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class TokenController public class TokenController {
{ @Autowired private TokenService tokenService;
@Autowired
private TokenService tokenService;
@Autowired @Autowired private SysLoginService sysLoginService;
private SysLoginService sysLoginService;
@PostMapping("login") @PostMapping("login")
public R<?> login(@RequestBody LoginBody form) public R<?> login(@RequestBody LoginBody form) {
{
// 用户登录 // 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
// 获取登录token // 获取登录token
@ -41,11 +37,9 @@ public class TokenController
} }
@DeleteMapping("logout") @DeleteMapping("logout")
public R<?> logout(HttpServletRequest request) public R<?> logout(HttpServletRequest request) {
{
String token = SecurityUtils.getToken(request); String token = SecurityUtils.getToken(request);
if (StringUtils.isNotEmpty(token)) if (StringUtils.isNotEmpty(token)) {
{
String username = JwtUtils.getUserName(token); String username = JwtUtils.getUserName(token);
// 删除用户缓存记录 // 删除用户缓存记录
AuthUtil.logoutByToken(token); AuthUtil.logoutByToken(token);
@ -56,11 +50,9 @@ public class TokenController
} }
@PostMapping("refresh") @PostMapping("refresh")
public R<?> refresh(HttpServletRequest request) public R<?> refresh(HttpServletRequest request) {
{
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser)) if (StringUtils.isNotNull(loginUser)) {
{
// 刷新令牌有效期 // 刷新令牌有效期
tokenService.refreshToken(loginUser); tokenService.refreshToken(loginUser);
return R.ok(); return R.ok();
@ -69,8 +61,7 @@ public class TokenController
} }
@PostMapping("register") @PostMapping("register")
public R<?> register(@RequestBody RegisterBody registerBody) public R<?> register(@RequestBody RegisterBody registerBody) {
{
// 用户注册 // 用户注册
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword()); sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
return R.ok(); return R.ok();

View File

@ -5,35 +5,26 @@ package com.ruoyi.auth.form;
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginBody public class LoginBody {
{ /** 用户名 */
/**
*
*/
private String username; private String username;
/** /** 用户密码 */
*
*/
private String password; private String password;
public String getUsername() public String getUsername() {
{
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username) {
{
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
} }

View File

@ -5,7 +5,4 @@ package com.ruoyi.auth.form;
* *
* @author ruoyi * @author ruoyi
*/ */
public class RegisterBody extends LoginBody public class RegisterBody extends LoginBody {}
{
}

View File

@ -1,7 +1,5 @@
package com.ruoyi.auth.service; package com.ruoyi.auth.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
@ -18,6 +16,8 @@ import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteUserService; import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/** /**
* *
@ -25,69 +25,55 @@ import com.ruoyi.system.api.model.LoginUser;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysLoginService public class SysLoginService {
{ @Autowired private RemoteUserService remoteUserService;
@Autowired
private RemoteUserService remoteUserService;
@Autowired @Autowired private SysPasswordService passwordService;
private SysPasswordService passwordService;
@Autowired @Autowired private SysRecordLogService recordLogService;
private SysRecordLogService recordLogService;
@Autowired @Autowired private RedisService redisService;
private RedisService redisService;
/** /** 登录 */
* public LoginUser login(String username, String password) {
*/
public LoginUser login(String username, String password)
{
// 用户名或密码为空 错误 // 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) if (StringUtils.isAnyBlank(username, password)) {
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new ServiceException("用户/密码必须填写"); throw new ServiceException("用户/密码必须填写");
} }
// 密码如果不在指定范围内 错误 // 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
throw new ServiceException("用户密码不在指定范围"); throw new ServiceException("用户密码不在指定范围");
} }
// 用户名不在指定范围内 错误 // 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
throw new ServiceException("用户名不在指定范围"); throw new ServiceException("用户名不在指定范围");
} }
// IP黑名单校验 // IP黑名单校验
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); String blackStr =
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
{ if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾访问IP已被列入系统黑名单"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾访问IP已被列入系统黑名单");
throw new ServiceException("很遗憾访问IP已被列入系统黑名单"); throw new ServiceException("很遗憾访问IP已被列入系统黑名单");
} }
// 查询用户信息 // 查询用户信息
R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
if (R.FAIL == userResult.getCode()) if (R.FAIL == userResult.getCode()) {
{
throw new ServiceException(userResult.getMsg()); throw new ServiceException(userResult.getMsg());
} }
LoginUser userInfo = userResult.getData(); LoginUser userInfo = userResult.getData();
SysUser user = userResult.getData().getSysUser(); SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
} }
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用"); throw new ServiceException("对不起,您的账号:" + username + " 已停用");
} }
@ -102,8 +88,7 @@ public class SysLoginService
* *
* @param userId ID * @param userId ID
*/ */
public void recordLoginInfo(Long userId) public void recordLoginInfo(Long userId) {
{
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
sysUser.setUserId(userId); sysUser.setUserId(userId);
// 更新用户登录IP // 更新用户登录IP
@ -113,29 +98,22 @@ public class SysLoginService
remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER); remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER);
} }
public void logout(String loginName) public void logout(String loginName) {
{
recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功"); recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
} }
/** /** 注册 */
* public void register(String username, String password) {
*/
public void register(String username, String password)
{
// 用户名或密码为空 错误 // 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) if (StringUtils.isAnyBlank(username, password)) {
{
throw new ServiceException("用户/密码必须填写"); throw new ServiceException("用户/密码必须填写");
} }
if (username.length() < UserConstants.USERNAME_MIN_LENGTH if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
{
throw new ServiceException("账户长度必须在2到20个字符之间"); throw new ServiceException("账户长度必须在2到20个字符之间");
} }
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
{
throw new ServiceException("密码长度必须在5到20个字符之间"); throw new ServiceException("密码长度必须在5到20个字符之间");
} }
@ -147,8 +125,7 @@ public class SysLoginService
sysUser.setPassword(SecurityUtils.encryptPassword(password)); sysUser.setPassword(SecurityUtils.encryptPassword(password));
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
if (R.FAIL == registerResult.getCode()) if (R.FAIL == registerResult.getCode()) {
{
throw new ServiceException(registerResult.getMsg()); throw new ServiceException(registerResult.getMsg());
} }
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功"); recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");

View File

@ -1,14 +1,14 @@
package com.ruoyi.auth.service; package com.ruoyi.auth.service;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/** /**
* *
@ -16,17 +16,14 @@ import com.ruoyi.system.api.domain.SysUser;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysPasswordService public class SysPasswordService {
{ @Autowired private RedisService redisService;
@Autowired
private RedisService redisService;
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT; private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME; private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
@Autowired @Autowired private SysRecordLogService recordLogService;
private SysRecordLogService recordLogService;
/** /**
* *
@ -34,51 +31,42 @@ public class SysPasswordService
* @param username * @param username
* @return key * @return key
*/ */
private String getCacheKey(String username) private String getCacheKey(String username) {
{
return CacheConstants.PWD_ERR_CNT_KEY + username; return CacheConstants.PWD_ERR_CNT_KEY + username;
} }
public void validate(SysUser user, String password) public void validate(SysUser user, String password) {
{
String username = user.getUserName(); String username = user.getUserName();
Integer retryCount = redisService.getCacheObject(getCacheKey(username)); Integer retryCount = redisService.getCacheObject(getCacheKey(username));
if (retryCount == null) if (retryCount == null) {
{
retryCount = 0; retryCount = 0;
} }
if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) {
{
String errMsg = String.format("密码输入错误%s次帐户锁定%s分钟", maxRetryCount, lockTime); String errMsg = String.format("密码输入错误%s次帐户锁定%s分钟", maxRetryCount, lockTime);
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, errMsg);
throw new ServiceException(errMsg); throw new ServiceException(errMsg);
} }
if (!matches(user, password)) if (!matches(user, password)) {
{
retryCount = retryCount + 1; retryCount = retryCount + 1;
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount)); recordLogService.recordLogininfor(
username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new ServiceException("用户不存在/密码错误"); throw new ServiceException("用户不存在/密码错误");
} } else {
else
{
clearLoginRecordCache(username); clearLoginRecordCache(username);
} }
} }
public boolean matches(SysUser user, String rawPassword) public boolean matches(SysUser user, String rawPassword) {
{
return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
} }
public void clearLoginRecordCache(String loginName) public void clearLoginRecordCache(String loginName) {
{ if (redisService.hasKey(getCacheKey(loginName))) {
if (redisService.hasKey(getCacheKey(loginName)))
{
redisService.deleteObject(getCacheKey(loginName)); redisService.deleteObject(getCacheKey(loginName));
} }
} }

View File

@ -1,13 +1,13 @@
package com.ruoyi.auth.service; package com.ruoyi.auth.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.ip.IpUtils; import com.ruoyi.common.core.utils.ip.IpUtils;
import com.ruoyi.system.api.RemoteLogService; import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysLogininfor; import com.ruoyi.system.api.domain.SysLogininfor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/** /**
* *
@ -15,10 +15,8 @@ import com.ruoyi.system.api.domain.SysLogininfor;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysRecordLogService public class SysRecordLogService {
{ @Autowired private RemoteLogService remoteLogService;
@Autowired
private RemoteLogService remoteLogService;
/** /**
* *
@ -28,19 +26,16 @@ public class SysRecordLogService
* @param message * @param message
* @return * @return
*/ */
public void recordLogininfor(String username, String status, String message) public void recordLogininfor(String username, String status, String message) {
{
SysLogininfor logininfor = new SysLogininfor(); SysLogininfor logininfor = new SysLogininfor();
logininfor.setUserName(username); logininfor.setUserName(username);
logininfor.setIpaddr(IpUtils.getIpAddr()); logininfor.setIpaddr(IpUtils.getIpAddr());
logininfor.setMsg(message); logininfor.setMsg(message);
// 日志状态 // 日志状态
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) if (StringUtils.equalsAny(
{ status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) {
logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS); logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
} } else if (Constants.LOGIN_FAIL.equals(status)) {
else if (Constants.LOGIN_FAIL.equals(status))
{
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS); logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
} }
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER); remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);

View File

@ -14,10 +14,10 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8181
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8181
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -41,6 +41,11 @@
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<!-- Transmittable ThreadLocal --> <!-- Transmittable ThreadLocal -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
@ -77,12 +82,6 @@
<artifactId>jjwt</artifactId> <artifactId>jjwt</artifactId>
</dependency> </dependency>
<!-- Jaxb -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- Apache Lang3 --> <!-- Apache Lang3 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
@ -103,8 +102,8 @@
<!-- Java Servlet --> <!-- Java Servlet -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>jakarta.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>jakarta.servlet-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -1,5 +1,6 @@
package com.ruoyi.common.core.annotation; package com.ruoyi.common.core.annotation;
import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
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;
@ -7,7 +8,6 @@ import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
/** /**
* Excel * Excel
@ -16,171 +16,115 @@ import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Excel public @interface Excel {
{ /** 导出时在excel中排序 */
/**
* excel
*/
public int sort() default Integer.MAX_VALUE; public int sort() default Integer.MAX_VALUE;
/** /** 导出到Excel中的名字. */
* Excel.
*/
public String name() default ""; public String name() default "";
/** /** 日期格式, 如: yyyy-MM-dd */
* , : yyyy-MM-dd
*/
public String dateFormat() default ""; public String dateFormat() default "";
/** /** 读取内容转表达式 (如: 0=男,1=女,2=未知) */
* (: 0=,1=,2=)
*/
public String readConverterExp() default ""; public String readConverterExp() default "";
/** /** 分隔符,读取字符串组内容 */
*
*/
public String separator() default ","; public String separator() default ",";
/** /** BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) */
* BigDecimal :-1(BigDecimal)
*/
public int scale() default -1; public int scale() default -1;
/** /** BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN */
* BigDecimal :BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/** /** 导出时在excel中每个列的高度 */
* excel
*/
public double height() default 14; public double height() default 14;
/** /** 导出时在excel中每个列的宽度 */
* excel
*/
public double width() default 16; public double width() default 16;
/** /** 文字后缀,如% 90 变成90% */
* ,% 90 90%
*/
public String suffix() default ""; public String suffix() default "";
/** /** 当值为空时,字段的默认值 */
* ,
*/
public String defaultValue() default ""; public String defaultValue() default "";
/** /** 提示信息 */
*
*/
public String prompt() default ""; public String prompt() default "";
/** /** 是否允许内容换行 */
*
*/
public boolean wrapText() default false; public boolean wrapText() default false;
/** /** 设置只能选择不能输入的列内容. */
* .
*/
public String[] combo() default {}; public String[] combo() default {};
/** /** 是否需要纵向合并单元格,应对需求:含有list集合单元格) */
* ,:list)
*/
public boolean needMerge() default false; public boolean needMerge() default false;
/** /** 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. */
* ,:,.
*/
public boolean isExport() default true; public boolean isExport() default true;
/** /** 另一个类中的属性名称,支持多级获取,以小数点隔开 */
* ,,
*/
public String targetAttr() default ""; public String targetAttr() default "";
/** /** 是否自动统计数据,在最后追加一行统计数据总和 */
* ,
*/
public boolean isStatistics() default false; public boolean isStatistics() default false;
/** /** 导出类型0数字 1字符串 */
* 0 1
*/
public ColumnType cellType() default ColumnType.STRING; public ColumnType cellType() default ColumnType.STRING;
/** /** 导出列头背景颜色 */
*
*/
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
/** /** 导出列头字体颜色 */
*
*/
public IndexedColors headerColor() default IndexedColors.WHITE; public IndexedColors headerColor() default IndexedColors.WHITE;
/** /** 导出单元格背景颜色 */
*
*/
public IndexedColors backgroundColor() default IndexedColors.WHITE; public IndexedColors backgroundColor() default IndexedColors.WHITE;
/** /** 导出单元格字体颜色 */
*
*/
public IndexedColors color() default IndexedColors.BLACK; public IndexedColors color() default IndexedColors.BLACK;
/** /** 导出字段对齐方式 */
*
*/
public HorizontalAlignment align() default HorizontalAlignment.CENTER; public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/** /** 自定义数据处理器 */
*
*/
public Class<?> handler() default ExcelHandlerAdapter.class; public Class<?> handler() default ExcelHandlerAdapter.class;
/** /** 自定义数据处理器参数 */
*
*/
public String[] args() default {}; public String[] args() default {};
/** /** 字段类型0导出导入1仅导出2仅导入 */
* 012
*/
Type type() default Type.ALL; Type type() default Type.ALL;
public enum Type public enum Type {
{ ALL(0),
ALL(0), EXPORT(1), IMPORT(2); EXPORT(1),
IMPORT(2);
private final int value; private final int value;
Type(int value) Type(int value) {
{
this.value = value; this.value = value;
} }
public int value() public int value() {
{
return this.value; return this.value;
} }
} }
public enum ColumnType public enum ColumnType {
{ NUMERIC(0),
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3); STRING(1),
IMAGE(2),
TEXT(3);
private final int value; private final int value;
ColumnType(int value) ColumnType(int value) {
{
this.value = value; this.value = value;
} }
public int value() public int value() {
{
return this.value; return this.value;
} }
} }

View File

@ -12,7 +12,6 @@ import java.lang.annotation.Target;
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Excels public @interface Excels {
{
Excel[] value(); Excel[] value();
} }

View File

@ -5,55 +5,34 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class CacheConstants public class CacheConstants {
{ /** 缓存有效期默认720分钟 */
/** public static final long EXPIRATION = 720;
* 720
*/
public final static long EXPIRATION = 720;
/** /** 缓存刷新时间默认120分钟 */
* 120 public static final long REFRESH_TIME = 120;
*/
public final static long REFRESH_TIME = 120;
/** /** 密码最大错误次数 */
* public static final int PASSWORD_MAX_RETRY_COUNT = 5;
*/
public final static int PASSWORD_MAX_RETRY_COUNT = 5;
/** /** 密码锁定时间默认10分钟 */
* 10 public static final long PASSWORD_LOCK_TIME = 10;
*/
public final static long PASSWORD_LOCK_TIME = 10;
/** /** 权限缓存前缀 */
* public static final String LOGIN_TOKEN_KEY = "login_tokens:";
*/
public final static String LOGIN_TOKEN_KEY = "login_tokens:";
/** /** 验证码 redis key */
* redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/** /** 参数管理 cache key */
* cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:"; public static final String SYS_CONFIG_KEY = "sys_config:";
/** /** 字典管理 cache key */
* cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:"; public static final String SYS_DICT_KEY = "sys_dict:";
/** /** 登录账户密码错误次数 redis key */
* redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/** /** 登录IP黑名单 cache key */
* IP cache key
*/
public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList"; public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList";
} }

View File

@ -5,141 +5,92 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class Constants public class Constants {
{ /** UTF-8 字符集 */
/**
* UTF-8
*/
public static final String UTF8 = "UTF-8"; public static final String UTF8 = "UTF-8";
/** /** GBK 字符集 */
* GBK
*/
public static final String GBK = "GBK"; public static final String GBK = "GBK";
/** /** www主域 */
* www
*/
public static final String WWW = "www."; public static final String WWW = "www.";
/** /** RMI 远程方法调用 */
* RMI
*/
public static final String LOOKUP_RMI = "rmi:"; public static final String LOOKUP_RMI = "rmi:";
/** /** LDAP 远程方法调用 */
* LDAP
*/
public static final String LOOKUP_LDAP = "ldap:"; public static final String LOOKUP_LDAP = "ldap:";
/** /** LDAPS 远程方法调用 */
* LDAPS
*/
public static final String LOOKUP_LDAPS = "ldaps:"; public static final String LOOKUP_LDAPS = "ldaps:";
/** /** http请求 */
* http
*/
public static final String HTTP = "http://"; public static final String HTTP = "http://";
/** /** https请求 */
* https
*/
public static final String HTTPS = "https://"; public static final String HTTPS = "https://";
/** /** 成功标记 */
*
*/
public static final Integer SUCCESS = 200; public static final Integer SUCCESS = 200;
/** /** 失败标记 */
*
*/
public static final Integer FAIL = 500; public static final Integer FAIL = 500;
/** /** 登录成功状态 */
*
*/
public static final String LOGIN_SUCCESS_STATUS = "0"; public static final String LOGIN_SUCCESS_STATUS = "0";
/** /** 登录失败状态 */
*
*/
public static final String LOGIN_FAIL_STATUS = "1"; public static final String LOGIN_FAIL_STATUS = "1";
/** /** 登录成功 */
*
*/
public static final String LOGIN_SUCCESS = "Success"; public static final String LOGIN_SUCCESS = "Success";
/** /** 注销 */
*
*/
public static final String LOGOUT = "Logout"; public static final String LOGOUT = "Logout";
/** /** 注册 */
*
*/
public static final String REGISTER = "Register"; public static final String REGISTER = "Register";
/** /** 登录失败 */
*
*/
public static final String LOGIN_FAIL = "Error"; public static final String LOGIN_FAIL = "Error";
/** /** 所有权限标识 */
*
*/
public static final String ALL_PERMISSION = "*:*:*"; public static final String ALL_PERMISSION = "*:*:*";
/** /** 管理员角色权限标识 */
*
*/
public static final String SUPER_ADMIN = "admin"; public static final String SUPER_ADMIN = "admin";
/** /** 当前记录起始索引 */
*
*/
public static final String PAGE_NUM = "pageNum"; public static final String PAGE_NUM = "pageNum";
/** /** 每页显示记录数 */
*
*/
public static final String PAGE_SIZE = "pageSize"; public static final String PAGE_SIZE = "pageSize";
/** /** 排序列 */
*
*/
public static final String ORDER_BY_COLUMN = "orderByColumn"; public static final String ORDER_BY_COLUMN = "orderByColumn";
/** /** 排序的方向 "desc" 或者 "asc". */
* "desc" "asc".
*/
public static final String IS_ASC = "isAsc"; public static final String IS_ASC = "isAsc";
/** /** 验证码有效期(分钟) */
*
*/
public static final long CAPTCHA_EXPIRATION = 2; public static final long CAPTCHA_EXPIRATION = 2;
/** /** 资源映射路径 前缀 */
*
*/
public static final String RESOURCE_PREFIX = "/profile"; public static final String RESOURCE_PREFIX = "/profile";
/** /** 自动识别json对象白名单配置仅允许解析的包名范围越小越安全 */
* json public static final String[] JSON_WHITELIST_STR = {"com.ruoyi"};
*/
public static final String[] JSON_WHITELIST_STR = { "com.ruoyi" };
/** /** 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) */
* 访 public static final String[] JOB_WHITELIST_STR = {"com.ruoyi.job.task"};
*/
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.job.task" };
/** /** 定时任务违规的字符 */
* public static final String[] JOB_ERROR_STR = {
*/ "java.net.URL",
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", "javax.naming.InitialContext",
"org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" }; "org.yaml.snakeyaml",
"org.springframework",
"org.apache",
"com.ruoyi.common.core.utils.file"
};
} }

View File

@ -5,8 +5,7 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class GenConstants public class GenConstants {
{
/** 单表(增删改查) */ /** 单表(增删改查) */
public static final String TPL_CRUD = "crud"; public static final String TPL_CRUD = "crud";
@ -32,34 +31,49 @@ public class GenConstants
public static final String PARENT_MENU_NAME = "parentMenuName"; public static final String PARENT_MENU_NAME = "parentMenuName";
/** 数据库字符串类型 */ /** 数据库字符串类型 */
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
/** 数据库文本类型 */ /** 数据库文本类型 */
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
/** 数据库时间类型 */ /** 数据库时间类型 */
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
/** 数据库数字类型 */ /** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", public static final String[] COLUMNTYPE_NUMBER = {
"bit", "bigint", "float", "double", "decimal" }; "tinyint",
"smallint",
"mediumint",
"int",
"number",
"integer",
"bit",
"bigint",
"float",
"double",
"decimal"
};
/** 页面不需要编辑字段 */ /** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
/** 页面不需要显示的列表字段 */ /** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", public static final String[] COLUMNNAME_NOT_LIST = {
"update_time" }; "id", "create_by", "create_time", "del_flag", "update_by", "update_time"
};
/** 页面不需要查询字段 */ /** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", public static final String[] COLUMNNAME_NOT_QUERY = {
"update_time", "remark" }; "id", "create_by", "create_time", "del_flag", "update_by", "update_time", "remark"
};
/** Entity基类字段 */ /** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; public static final String[] BASE_ENTITY = {
"createBy", "createTime", "updateBy", "updateTime", "remark"
};
/** Tree基类字段 */ /** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" }; public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors"};
/** 文本框 */ /** 文本框 */
public static final String HTML_INPUT = "input"; public static final String HTML_INPUT = "input";

View File

@ -5,90 +5,55 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class HttpStatus public class HttpStatus {
{ /** 操作成功 */
/**
*
*/
public static final int SUCCESS = 200; public static final int SUCCESS = 200;
/** /** 对象创建成功 */
*
*/
public static final int CREATED = 201; public static final int CREATED = 201;
/** /** 请求已经被接受 */
*
*/
public static final int ACCEPTED = 202; public static final int ACCEPTED = 202;
/** /** 操作已经执行成功,但是没有返回数据 */
*
*/
public static final int NO_CONTENT = 204; public static final int NO_CONTENT = 204;
/** /** 资源已被移除 */
*
*/
public static final int MOVED_PERM = 301; public static final int MOVED_PERM = 301;
/** /** 重定向 */
*
*/
public static final int SEE_OTHER = 303; public static final int SEE_OTHER = 303;
/** /** 资源没有被修改 */
*
*/
public static final int NOT_MODIFIED = 304; public static final int NOT_MODIFIED = 304;
/** /** 参数列表错误(缺少,格式不匹配) */
*
*/
public static final int BAD_REQUEST = 400; public static final int BAD_REQUEST = 400;
/** /** 未授权 */
*
*/
public static final int UNAUTHORIZED = 401; public static final int UNAUTHORIZED = 401;
/** /** 访问受限,授权过期 */
* 访
*/
public static final int FORBIDDEN = 403; public static final int FORBIDDEN = 403;
/** /** 资源,服务未找到 */
*
*/
public static final int NOT_FOUND = 404; public static final int NOT_FOUND = 404;
/** /** 不允许的http方法 */
* http
*/
public static final int BAD_METHOD = 405; public static final int BAD_METHOD = 405;
/** /** 资源冲突,或者资源被锁 */
*
*/
public static final int CONFLICT = 409; public static final int CONFLICT = 409;
/** /** 不支持的数据,媒体类型 */
*
*/
public static final int UNSUPPORTED_TYPE = 415; public static final int UNSUPPORTED_TYPE = 415;
/** /** 系统内部错误 */
*
*/
public static final int ERROR = 500; public static final int ERROR = 500;
/** /** 接口未实现 */
*
*/
public static final int NOT_IMPLEMENTED = 501; public static final int NOT_IMPLEMENTED = 501;
/** /** 系统警告消息 */
*
*/
public static final int WARN = 601; public static final int WARN = 601;
} }

View File

@ -5,8 +5,7 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class ScheduleConstants public class ScheduleConstants {
{
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
/** 执行目标key */ /** 执行目标key */
@ -24,26 +23,19 @@ public class ScheduleConstants
/** 不触发立即执行 */ /** 不触发立即执行 */
public static final String MISFIRE_DO_NOTHING = "3"; public static final String MISFIRE_DO_NOTHING = "3";
public enum Status public enum Status {
{ /** 正常 */
/**
*
*/
NORMAL("0"), NORMAL("0"),
/** /** 暂停 */
*
*/
PAUSE("1"); PAUSE("1");
private String value; private String value;
private Status(String value) private Status(String value) {
{
this.value = value; this.value = value;
} }
public String getValue() public String getValue() {
{
return value; return value;
} }
} }

View File

@ -5,45 +5,28 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class SecurityConstants public class SecurityConstants {
{ /** 用户ID字段 */
/**
* ID
*/
public static final String DETAILS_USER_ID = "user_id"; public static final String DETAILS_USER_ID = "user_id";
/** /** 用户名字段 */
*
*/
public static final String DETAILS_USERNAME = "username"; public static final String DETAILS_USERNAME = "username";
/** /** 授权信息字段 */
*
*/
public static final String AUTHORIZATION_HEADER = "Authorization"; public static final String AUTHORIZATION_HEADER = "Authorization";
/** /** 请求来源 */
*
*/
public static final String FROM_SOURCE = "from-source"; public static final String FROM_SOURCE = "from-source";
/** /** 内部请求 */
*
*/
public static final String INNER = "inner"; public static final String INNER = "inner";
/** /** 用户标识 */
*
*/
public static final String USER_KEY = "user_key"; public static final String USER_KEY = "user_key";
/** /** 登录用户 */
*
*/
public static final String LOGIN_USER = "login_user"; public static final String LOGIN_USER = "login_user";
/** /** 角色权限 */
*
*/
public static final String ROLE_PERMISSION = "role_permission"; public static final String ROLE_PERMISSION = "role_permission";
} }

View File

@ -5,20 +5,13 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class ServiceNameConstants public class ServiceNameConstants {
{ /** 认证服务的serviceid */
/**
* serviceid
*/
public static final String AUTH_SERVICE = "ruoyi-auth"; public static final String AUTH_SERVICE = "ruoyi-auth";
/** /** 系统模块的serviceid */
* serviceid
*/
public static final String SYSTEM_SERVICE = "ruoyi-system"; public static final String SYSTEM_SERVICE = "ruoyi-system";
/** /** 文件服务的serviceid */
* serviceid
*/
public static final String FILE_SERVICE = "ruoyi-file"; public static final String FILE_SERVICE = "ruoyi-file";
} }

View File

@ -5,16 +5,10 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class TokenConstants public class TokenConstants {
{ /** 令牌前缀 */
/**
*
*/
public static final String PREFIX = "Bearer "; public static final String PREFIX = "Bearer ";
/** /** 令牌秘钥 */
* public static final String SECRET = "abcdefghijklmnopqrstuvwxyz";
*/
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
} }

View File

@ -5,11 +5,8 @@ package com.ruoyi.common.core.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class UserConstants public class UserConstants {
{ /** 平台内系统用户的唯一标志 */
/**
*
*/
public static final String SYS_USER = "SYS_USER"; public static final String SYS_USER = "SYS_USER";
/** 正常状态 */ /** 正常状态 */
@ -55,34 +52,30 @@ public class UserConstants
public static final String TYPE_BUTTON = "F"; public static final String TYPE_BUTTON = "F";
/** Layout组件标识 */ /** Layout组件标识 */
public final static String LAYOUT = "Layout"; public static final String LAYOUT = "Layout";
/** ParentView组件标识 */ /** ParentView组件标识 */
public final static String PARENT_VIEW = "ParentView"; public static final String PARENT_VIEW = "ParentView";
/** InnerLink组件标识 */ /** InnerLink组件标识 */
public final static String INNER_LINK = "InnerLink"; public static final String INNER_LINK = "InnerLink";
/** 校验是否唯一的返回标识 */ /** 校验是否唯一的返回标识 */
public final static boolean UNIQUE = true; public static final boolean UNIQUE = true;
public final static boolean NOT_UNIQUE = false;
/** public static final boolean NOT_UNIQUE = false;
*
*/ /** 用户名长度限制 */
public static final int USERNAME_MIN_LENGTH = 2; public static final int USERNAME_MIN_LENGTH = 2;
public static final int USERNAME_MAX_LENGTH = 20; public static final int USERNAME_MAX_LENGTH = 20;
/** /** 密码长度限制 */
*
*/
public static final int PASSWORD_MIN_LENGTH = 5; public static final int PASSWORD_MIN_LENGTH = 5;
public static final int PASSWORD_MAX_LENGTH = 20; public static final int PASSWORD_MAX_LENGTH = 20;
public static boolean isAdmin(Long userId) public static boolean isAdmin(Long userId) {
{
return userId != null && 1L == userId; return userId != null && 1L == userId;
} }
} }

View File

@ -1,98 +1,82 @@
package com.ruoyi.common.core.context; package com.ruoyi.common.core.context;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.alibaba.ttl.TransmittableThreadLocal; import com.alibaba.ttl.TransmittableThreadLocal;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* 线 idToken * 线 idToken HeaderInterceptor
* HeaderInterceptor
* *
* @author ruoyi * @author ruoyi
*/ */
public class SecurityContextHolder public class SecurityContextHolder {
{ private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL =
private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>(); new TransmittableThreadLocal<>();
public static void set(String key, Object value) public static void set(String key, Object value) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
map.put(key, value == null ? StringUtils.EMPTY : value); map.put(key, value == null ? StringUtils.EMPTY : value);
} }
public static String get(String key) public static String get(String key) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY)); return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY));
} }
public static <T> T get(String key, Class<T> clazz) public static <T> T get(String key, Class<T> clazz) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
return StringUtils.cast(map.getOrDefault(key, null)); return StringUtils.cast(map.getOrDefault(key, null));
} }
public static Map<String, Object> getLocalMap() public static Map<String, Object> getLocalMap() {
{
Map<String, Object> map = THREAD_LOCAL.get(); Map<String, Object> map = THREAD_LOCAL.get();
if (map == null) if (map == null) {
{
map = new ConcurrentHashMap<String, Object>(); map = new ConcurrentHashMap<String, Object>();
THREAD_LOCAL.set(map); THREAD_LOCAL.set(map);
} }
return map; return map;
} }
public static void setLocalMap(Map<String, Object> threadLocalMap) public static void setLocalMap(Map<String, Object> threadLocalMap) {
{
THREAD_LOCAL.set(threadLocalMap); THREAD_LOCAL.set(threadLocalMap);
} }
public static Long getUserId() public static Long getUserId() {
{
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
} }
public static void setUserId(String account) public static void setUserId(String account) {
{
set(SecurityConstants.DETAILS_USER_ID, account); set(SecurityConstants.DETAILS_USER_ID, account);
} }
public static String getUserName() public static String getUserName() {
{
return get(SecurityConstants.DETAILS_USERNAME); return get(SecurityConstants.DETAILS_USERNAME);
} }
public static void setUserName(String username) public static void setUserName(String username) {
{
set(SecurityConstants.DETAILS_USERNAME, username); set(SecurityConstants.DETAILS_USERNAME, username);
} }
public static String getUserKey() public static String getUserKey() {
{
return get(SecurityConstants.USER_KEY); return get(SecurityConstants.USER_KEY);
} }
public static void setUserKey(String userKey) public static void setUserKey(String userKey) {
{
set(SecurityConstants.USER_KEY, userKey); set(SecurityConstants.USER_KEY, userKey);
} }
public static String getPermission() public static String getPermission() {
{
return get(SecurityConstants.ROLE_PERMISSION); return get(SecurityConstants.ROLE_PERMISSION);
} }
public static void setPermission(String permissions) public static void setPermission(String permissions) {
{
set(SecurityConstants.ROLE_PERMISSION, permissions); set(SecurityConstants.ROLE_PERMISSION, permissions);
} }
public static void remove() public static void remove() {
{
THREAD_LOCAL.remove(); THREAD_LOCAL.remove();
} }
} }

View File

@ -1,15 +1,14 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable;
import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.Constants;
import java.io.Serializable;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class R<T> implements Serializable public class R<T> implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 成功 */ /** 成功 */
@ -24,48 +23,39 @@ public class R<T> implements Serializable
private T data; private T data;
public static <T> R<T> ok() public static <T> R<T> ok() {
{
return restResult(null, SUCCESS, null); return restResult(null, SUCCESS, null);
} }
public static <T> R<T> ok(T data) public static <T> R<T> ok(T data) {
{
return restResult(data, SUCCESS, null); return restResult(data, SUCCESS, null);
} }
public static <T> R<T> ok(T data, String msg) public static <T> R<T> ok(T data, String msg) {
{
return restResult(data, SUCCESS, msg); return restResult(data, SUCCESS, msg);
} }
public static <T> R<T> fail() public static <T> R<T> fail() {
{
return restResult(null, FAIL, null); return restResult(null, FAIL, null);
} }
public static <T> R<T> fail(String msg) public static <T> R<T> fail(String msg) {
{
return restResult(null, FAIL, msg); return restResult(null, FAIL, msg);
} }
public static <T> R<T> fail(T data) public static <T> R<T> fail(T data) {
{
return restResult(data, FAIL, null); return restResult(data, FAIL, null);
} }
public static <T> R<T> fail(T data, String msg) public static <T> R<T> fail(T data, String msg) {
{
return restResult(data, FAIL, msg); return restResult(data, FAIL, msg);
} }
public static <T> R<T> fail(int code, String msg) public static <T> R<T> fail(int code, String msg) {
{
return restResult(null, code, msg); return restResult(null, code, msg);
} }
private static <T> R<T> restResult(T data, int code, String msg) private static <T> R<T> restResult(T data, int code, String msg) {
{
R<T> apiResult = new R<>(); R<T> apiResult = new R<>();
apiResult.setCode(code); apiResult.setCode(code);
apiResult.setData(data); apiResult.setData(data);
@ -73,43 +63,35 @@ public class R<T> implements Serializable
return apiResult; return apiResult;
} }
public int getCode() public int getCode() {
{
return code; return code;
} }
public void setCode(int code) public void setCode(int code) {
{
this.code = code; this.code = code;
} }
public String getMsg() public String getMsg() {
{
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg) {
{
this.msg = msg; this.msg = msg;
} }
public T getData() public T getData() {
{
return data; return data;
} }
public void setData(T data) public void setData(T data) {
{
this.data = data; this.data = data;
} }
public static <T> Boolean isError(R<T> ret) public static <T> Boolean isError(R<T> ret) {
{
return !isSuccess(ret); return !isSuccess(ret);
} }
public static <T> Boolean isSuccess(R<T> ret) public static <T> Boolean isSuccess(R<T> ret) {
{
return R.SUCCESS == ret.getCode(); return R.SUCCESS == ret.getCode();
} }
} }

View File

@ -5,26 +5,24 @@ package com.ruoyi.common.core.enums;
* *
* @author ruoyi * @author ruoyi
*/ */
public enum UserStatus public enum UserStatus {
{ OK("0", "正常"),
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); DISABLE("1", "停用"),
DELETED("2", "删除");
private final String code; private final String code;
private final String info; private final String info;
UserStatus(String code, String info) UserStatus(String code, String info) {
{
this.code = code; this.code = code;
this.info = info; this.info = info;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public String getInfo() public String getInfo() {
{
return info; return info;
} }
} }

View File

@ -5,12 +5,10 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class CaptchaException extends RuntimeException public class CaptchaException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public CaptchaException(String msg) public CaptchaException(String msg) {
{
super(msg); super(msg);
} }
} }

View File

@ -5,27 +5,23 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class CheckedException extends RuntimeException public class CheckedException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public CheckedException(String message) public CheckedException(String message) {
{
super(message); super(message);
} }
public CheckedException(Throwable cause) public CheckedException(Throwable cause) {
{
super(cause); super(cause);
} }
public CheckedException(String message, Throwable cause) public CheckedException(String message, Throwable cause) {
{
super(message, cause); super(message, cause);
} }
public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) public CheckedException(
{ String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace); super(message, cause, enableSuppression, writableStackTrace);
} }
} }

View File

@ -5,11 +5,8 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class DemoModeException extends RuntimeException public class DemoModeException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public DemoModeException() public DemoModeException() {}
{
}
} }

View File

@ -5,53 +5,41 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class GlobalException extends RuntimeException public class GlobalException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 错误提示 */
*
*/
private String message; private String message;
/** /**
* *
* *
* {@link CommonResult#getDetailMessage()} * <p> {@link CommonResult#getDetailMessage()}
*/ */
private String detailMessage; private String detailMessage;
/** /** 空构造方法,避免反序列化问题 */
* public GlobalException() {}
*/
public GlobalException()
{
}
public GlobalException(String message) public GlobalException(String message) {
{
this.message = message; this.message = message;
} }
public String getDetailMessage() public String getDetailMessage() {
{
return detailMessage; return detailMessage;
} }
public GlobalException setDetailMessage(String detailMessage) public GlobalException setDetailMessage(String detailMessage) {
{
this.detailMessage = detailMessage; this.detailMessage = detailMessage;
return this; return this;
} }
@Override @Override
public String getMessage() public String getMessage() {
{
return message; return message;
} }
public GlobalException setMessage(String message) public GlobalException setMessage(String message) {
{
this.message = message; this.message = message;
return this; return this;
} }

View File

@ -5,12 +5,10 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class InnerAuthException extends RuntimeException public class InnerAuthException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public InnerAuthException(String message) public InnerAuthException(String message) {
{
super(message); super(message);
} }
} }

View File

@ -5,11 +5,8 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class PreAuthorizeException extends RuntimeException public class PreAuthorizeException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public PreAuthorizeException() public PreAuthorizeException() {}
{
}
} }

View File

@ -5,69 +5,53 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public final class ServiceException extends RuntimeException public final class ServiceException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 错误码 */
*
*/
private Integer code; private Integer code;
/** /** 错误提示 */
*
*/
private String message; private String message;
/** /**
* *
* *
* {@link CommonResult#getDetailMessage()} * <p> {@link CommonResult#getDetailMessage()}
*/ */
private String detailMessage; private String detailMessage;
/** /** 空构造方法,避免反序列化问题 */
* public ServiceException() {}
*/
public ServiceException()
{
}
public ServiceException(String message) public ServiceException(String message) {
{
this.message = message; this.message = message;
} }
public ServiceException(String message, Integer code) public ServiceException(String message, Integer code) {
{
this.message = message; this.message = message;
this.code = code; this.code = code;
} }
public String getDetailMessage() public String getDetailMessage() {
{
return detailMessage; return detailMessage;
} }
@Override @Override
public String getMessage() public String getMessage() {
{
return message; return message;
} }
public Integer getCode() public Integer getCode() {
{
return code; return code;
} }
public ServiceException setMessage(String message) public ServiceException setMessage(String message) {
{
this.message = message; this.message = message;
return this; return this;
} }
public ServiceException setDetailMessage(String detailMessage) public ServiceException setDetailMessage(String detailMessage) {
{
this.detailMessage = detailMessage; this.detailMessage = detailMessage;
return this; return this;
} }

View File

@ -5,22 +5,18 @@ package com.ruoyi.common.core.exception;
* *
* @author ruoyi * @author ruoyi
*/ */
public class UtilException extends RuntimeException public class UtilException extends RuntimeException {
{
private static final long serialVersionUID = 8247610319171014183L; private static final long serialVersionUID = 8247610319171014183L;
public UtilException(Throwable e) public UtilException(Throwable e) {
{
super(e.getMessage(), e); super(e.getMessage(), e);
} }
public UtilException(String message) public UtilException(String message) {
{
super(message); super(message);
} }
public UtilException(String message, Throwable throwable) public UtilException(String message, Throwable throwable) {
{
super(message, throwable); super(message, throwable);
} }
} }

View File

@ -5,12 +5,10 @@ package com.ruoyi.common.core.exception.auth;
* *
* @author ruoyi * @author ruoyi
*/ */
public class NotLoginException extends RuntimeException public class NotLoginException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public NotLoginException(String message) public NotLoginException(String message) {
{
super(message); super(message);
} }
} }

View File

@ -7,17 +7,14 @@ import org.apache.commons.lang3.StringUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class NotPermissionException extends RuntimeException public class NotPermissionException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public NotPermissionException(String permission) public NotPermissionException(String permission) {
{
super(permission); super(permission);
} }
public NotPermissionException(String[] permissions) public NotPermissionException(String[] permissions) {
{
super(StringUtils.join(permissions, ",")); super(StringUtils.join(permissions, ","));
} }
} }

View File

@ -7,17 +7,14 @@ import org.apache.commons.lang3.StringUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class NotRoleException extends RuntimeException public class NotRoleException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public NotRoleException(String role) public NotRoleException(String role) {
{
super(role); super(role);
} }
public NotRoleException(String[] roles) public NotRoleException(String[] roles) {
{
super(StringUtils.join(roles, ",")); super(StringUtils.join(roles, ","));
} }
} }

View File

@ -5,75 +5,57 @@ package com.ruoyi.common.core.exception.base;
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseException extends RuntimeException public class BaseException extends RuntimeException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 所属模块 */
*
*/
private String module; private String module;
/** /** 错误码 */
*
*/
private String code; private String code;
/** /** 错误码对应的参数 */
*
*/
private Object[] args; private Object[] args;
/** /** 错误消息 */
*
*/
private String defaultMessage; private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage) public BaseException(String module, String code, Object[] args, String defaultMessage) {
{
this.module = module; this.module = module;
this.code = code; this.code = code;
this.args = args; this.args = args;
this.defaultMessage = defaultMessage; this.defaultMessage = defaultMessage;
} }
public BaseException(String module, String code, Object[] args) public BaseException(String module, String code, Object[] args) {
{
this(module, code, args, null); this(module, code, args, null);
} }
public BaseException(String module, String defaultMessage) public BaseException(String module, String defaultMessage) {
{
this(module, null, null, defaultMessage); this(module, null, null, defaultMessage);
} }
public BaseException(String code, Object[] args) public BaseException(String code, Object[] args) {
{
this(null, code, args, null); this(null, code, args, null);
} }
public BaseException(String defaultMessage) public BaseException(String defaultMessage) {
{
this(null, null, null, defaultMessage); this(null, null, null, defaultMessage);
} }
public String getModule() public String getModule() {
{
return module; return module;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public Object[] getArgs() public Object[] getArgs() {
{
return args; return args;
} }
public String getDefaultMessage() public String getDefaultMessage() {
{
return defaultMessage; return defaultMessage;
} }
} }

View File

@ -7,13 +7,10 @@ import com.ruoyi.common.core.exception.base.BaseException;
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileException extends BaseException public class FileException extends BaseException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args, String msg) public FileException(String code, Object[] args, String msg) {
{
super("file", code, args, msg); super("file", code, args, msg);
} }
} }

View File

@ -5,12 +5,13 @@ package com.ruoyi.common.core.exception.file;
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileNameLengthLimitExceededException extends FileException public class FileNameLengthLimitExceededException extends FileException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException(int defaultFileNameLength) public FileNameLengthLimitExceededException(int defaultFileNameLength) {
{ super(
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }, "the filename is too long"); "upload.filename.exceed.length",
new Object[] {defaultFileNameLength},
"the filename is too long");
} }
} }

Some files were not shown because too many files have changed in this diff Show More