添加google-style 格式化maven插件,fix utf8文件编码问题

pull/444/head
Galudisu 2025-12-14 15:00:22 +08:00
parent f53b783049
commit a5fb62f1e5
300 changed files with 21281 additions and 25221 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 @@
1.8

12
.mvn/jvm.config Normal file
View File

@ -0,0 +1,12 @@
--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

3
.mvn/maven.config Normal file
View File

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

View File

@ -1,12 +1,12 @@
@echo off @echo off
echo. echo.
echo [信息] 清理工程target生成路径。 echo [信息] 清理工程target生成路径。
echo. echo.
%~d0 %~d0
cd %~dp0 cd %~dp0
cd .. cd ..
call mvn clean call mvn clean
pause pause

View File

@ -1,12 +1,12 @@
@echo off @echo off
echo. echo.
echo [信息] 打包Web工程生成war/jar包文件。 echo [信息] 打包Web工程生成war/jar包文件。
echo. echo.
%~d0 %~d0
cd %~dp0 cd %~dp0
cd .. cd ..
call mvn clean package -Dmaven.test.skip=true call mvn clean package -Dmaven.test.skip=true
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Auth工程。 echo [信息] 使用Jar命令运行Auth工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-auth/target cd ../ruoyi-auth/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-auth.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-auth.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Gateway工程。 echo [信息] 使用Jar命令运行Gateway工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-gateway/target cd ../ruoyi-gateway/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-gateway.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-gateway.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-File工程。 echo [信息] 使用Jar命令运行Modules-File工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-modules/ruoyi-file/target cd ../ruoyi-modules/ruoyi-file/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-file.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-file.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-Gen工程。 echo [信息] 使用Jar命令运行Modules-Gen工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-modules/ruoyi-gen/target cd ../ruoyi-modules/ruoyi-gen/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-gen.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-gen.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-Job工程。 echo [信息] 使用Jar命令运行Modules-Job工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-modules/ruoyi-job/target cd ../ruoyi-modules/ruoyi-job/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-job.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-job.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Modules-System工程。 echo [信息] 使用Jar命令运行Modules-System工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-modules/ruoyi-system/target cd ../ruoyi-modules/ruoyi-system/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-system.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-system.jar
cd bin cd bin
pause pause

View File

@ -1,14 +1,14 @@
@echo off @echo off
echo. echo.
echo [信息] 使用Jar命令运行Monitor工程。 echo [信息] 使用Jar命令运行Monitor工程。
echo. echo.
cd %~dp0 cd %~dp0
cd ../ruoyi-visual/ruoyi-monitor/target cd ../ruoyi-visual/ruoyi-monitor/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-visual-monitor.jar java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-visual-monitor.jar
cd bin cd bin
pause pause

View File

@ -69,7 +69,7 @@ services:
container_name: ruoyi-gateway container_name: ruoyi-gateway
build: build:
context: ./ruoyi/gateway context: ./ruoyi/gateway
dockerfile: dockerfile dockerfile: ruoyi/gateway/Dockerfile
ports: ports:
- "8080:8080" - "8080:8080"
depends_on: depends_on:
@ -80,7 +80,7 @@ services:
container_name: ruoyi-auth container_name: ruoyi-auth
build: build:
context: ./ruoyi/auth context: ./ruoyi/auth
dockerfile: dockerfile dockerfile: ruoyi/auth/Dockerfile
ports: ports:
- "9200:9200" - "9200:9200"
depends_on: depends_on:
@ -91,7 +91,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: ruoyi/modules/system/Dockerfile
ports: ports:
- "9201:9201" - "9201:9201"
depends_on: depends_on:
@ -104,7 +104,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: ruoyi/modules/gen/Dockerfile
ports: ports:
- "9202:9202" - "9202:9202"
depends_on: depends_on:
@ -115,7 +115,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: ruoyi/modules/job/Dockerfile
ports: ports:
- "9203:9203" - "9203:9203"
depends_on: depends_on:
@ -126,7 +126,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: ruoyi/modules/file/Dockerfile
ports: ports:
- "9300:9300" - "9300:9300"
volumes: volumes:
@ -135,6 +135,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: ruoyi/visual/monitor/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
# 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

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
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
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi/projects/ruoyi-ui RUN mkdir -p /home/ruoyi/projects/ruoyi-ui
# 指定路径 # 指定路径
WORKDIR /home/ruoyi/projects/ruoyi-ui WORKDIR /home/ruoyi/projects/ruoyi-ui
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径 # 复制html文件到路径
COPY ./html/dist /home/ruoyi/projects/ruoyi-ui COPY ./html/dist /home/ruoyi/projects/ruoyi-ui

View File

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

View File

@ -1,13 +1,13 @@
# 基础镜像 # 基础镜像
FROM redis FROM redis
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi/redis VOLUME /home/ruoyi/redis
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi/redis RUN mkdir -p /home/ruoyi/redis
# 指定路径 # 指定路径
WORKDIR /home/ruoyi/redis WORKDIR /home/ruoyi/redis
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/redis.conf /home/ruoyi/redis/redis.conf COPY ./conf/redis.conf /home/ruoyi/redis/redis.conf

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-auth.jar /home/ruoyi/ruoyi-auth.jar COPY ./jar/ruoyi-auth.jar /home/ruoyi/ruoyi-auth.jar
# 启动认证服务 # 启动认证服务
ENTRYPOINT ["java","-jar","ruoyi-auth.jar"] ENTRYPOINT ["java","-jar","ruoyi-auth.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar
# 启动网关服务 # 启动网关服务
ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"] ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-modules-file.jar /home/ruoyi/ruoyi-modules-file.jar COPY ./jar/ruoyi-modules-file.jar /home/ruoyi/ruoyi-modules-file.jar
# 启动文件服务 # 启动文件服务
ENTRYPOINT ["java","-jar","ruoyi-modules-file.jar"] ENTRYPOINT ["java","-jar","ruoyi-modules-file.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-modules-gen.jar /home/ruoyi/ruoyi-modules-gen.jar COPY ./jar/ruoyi-modules-gen.jar /home/ruoyi/ruoyi-modules-gen.jar
# 启动代码生成服务 # 启动代码生成服务
ENTRYPOINT ["java","-jar","ruoyi-modules-gen.jar"] ENTRYPOINT ["java","-jar","ruoyi-modules-gen.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-modules-job.jar /home/ruoyi/ruoyi-modules-job.jar COPY ./jar/ruoyi-modules-job.jar /home/ruoyi/ruoyi-modules-job.jar
# 启动定时任务服务 # 启动定时任务服务
ENTRYPOINT ["java","-jar","ruoyi-modules-job.jar"] ENTRYPOINT ["java","-jar","ruoyi-modules-job.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-modules-system.jar /home/ruoyi/ruoyi-modules-system.jar COPY ./jar/ruoyi-modules-system.jar /home/ruoyi/ruoyi-modules-system.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","ruoyi-modules-system.jar"] ENTRYPOINT ["java","-jar","ruoyi-modules-system.jar"]

View File

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

View File

@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER ruoyi LABEL org.opencontainers.image.authors="ruoyi"
# 挂载目录 # 挂载目录
VOLUME /home/ruoyi VOLUME /home/ruoyi
# 创建目录 # 创建目录
RUN mkdir -p /home/ruoyi RUN mkdir -p /home/ruoyi
# 指定路径 # 指定路径
WORKDIR /home/ruoyi WORKDIR /home/ruoyi
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/ruoyi-visual-monitor.jar /home/ruoyi/ruoyi-visual-monitor.jar COPY ./jar/ruoyi-visual-monitor.jar /home/ruoyi/ruoyi-visual-monitor.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","ruoyi-visual-monitor.jar"] ENTRYPOINT ["java","-jar","ruoyi-visual-monitor.jar"]

View File

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

677
pom.xml
View File

@ -2,330 +2,373 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.6</version> <version>3.6.6</version>
<name>ruoyi</name> <name>ruoyi</name>
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description> <description>若依微服务系统</description>
<properties> <properties>
<ruoyi.version>3.6.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>1.8</java.version>
<spring-boot.version>2.7.18</spring-boot.version> <spring-boot.version>2.7.18</spring-boot.version>
<spring-cloud.version>2021.0.9</spring-cloud.version> <spring-cloud.version>2021.0.9</spring-cloud.version>
<spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version>
<spring-boot-admin.version>2.7.16</spring-boot-admin.version> <spring-boot-admin.version>2.7.16</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.0.0</pagehelper.boot.version>
<druid.version>1.2.23</druid.version> <druid.version>1.2.23</druid.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version> <dynamic-ds.version>4.3.1</dynamic-ds.version>
<commons.io.version>2.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.57</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>1.6.9</springdoc.version>
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version> <transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
<!-- override dependency version --> <!-- 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.2.13</logback.version>
<spring-framework.version>5.3.39</spring-framework.version> <spring-framework.version>5.3.39</spring-framework.version>
</properties> <!-- plugin version -->
<git-code-format-maven-plugin.version>5.4</git-code-format-maven-plugin.version>
<!-- 依赖声明 --> </properties>
<dependencyManagement>
<dependencies>
<!-- 覆盖SpringFramework的依赖配置-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud 微服务 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud Alibaba 微服务 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 覆盖logback的依赖配置-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- 覆盖tomcat的依赖配置-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- FastDFS 分布式文件系统 -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${tobato.version}</version>
</dependency>
<!-- Springdoc webmvc 依赖配置 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- 代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- JSON 解析器和生成器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- JWT -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!-- 线程传递值 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version>
</dependency>
<!-- 核心模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 安全模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 数据脱敏 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 权限范围 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 多数据源 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 分布式事务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-seata</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 日志记录 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 缓存服务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 系统接口 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-auth</module>
<module>ruoyi-gateway</module>
<module>ruoyi-visual</module>
<module>ruoyi-modules</module>
<module>ruoyi-api</module>
<module>ruoyi-common</module>
</modules>
<packaging>pom</packaging>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies> <dependencies>
<!-- bootstrap 启动器 -->
<dependency> <!-- 覆盖SpringFramework的依赖配置-->
<groupId>org.springframework.cloud</groupId> <dependency>
<artifactId>spring-cloud-starter-bootstrap</artifactId> <groupId>org.springframework</groupId>
</dependency> <artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud 微服务 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud Alibaba 微服务 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 覆盖logback的依赖配置-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- 覆盖tomcat的依赖配置-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- FastDFS 分布式文件系统 -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${tobato.version}</version>
</dependency>
<!-- Springdoc webmvc 依赖配置 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- 代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- JSON 解析器和生成器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- JWT -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!-- 线程传递值 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version>
</dependency>
<!-- 核心模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 安全模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 数据脱敏 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 权限范围 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 多数据源 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 分布式事务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-seata</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 日志记录 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 缓存服务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 系统接口 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement>
<build> <modules>
<plugins> <module>ruoyi-auth</module>
<plugin> <module>ruoyi-gateway</module>
<groupId>org.apache.maven.plugins</groupId> <module>ruoyi-visual</module>
<artifactId>maven-compiler-plugin</artifactId> <module>ruoyi-modules</module>
<configuration> <module>ruoyi-api</module>
<source>${java.version}</source> <module>ruoyi-common</module>
<target>${java.version}</target> </modules>
<encoding>${project.build.sourceEncoding}</encoding> <packaging>pom</packaging>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories> <dependencies>
<repository> <!-- bootstrap 启动器 -->
<id>public</id> <dependency>
<name>aliyun nexus</name> <groupId>org.springframework.cloud</groupId>
<url>https://maven.aliyun.com/repository/public</url> <artifactId>spring-cloud-starter-bootstrap</artifactId>
<releases> </dependency>
<enabled>true</enabled> </dependencies>
</releases>
</repository>
</repositories>
<pluginRepositories> <build>
<pluginRepository> <plugins>
<id>public</id> <plugin>
<name>aliyun nexus</name> <groupId>org.apache.maven.plugins</groupId>
<url>https://maven.aliyun.com/repository/public</url> <artifactId>maven-compiler-plugin</artifactId>
<releases> <configuration>
<enabled>true</enabled> <source>${java.version}</source>
</releases> <target>${java.version}</target>
<snapshots> <encoding>${project.build.sourceEncoding}</encoding>
<enabled>false</enabled> </configuration>
</snapshots> </plugin>
</pluginRepository> <plugin>
</pluginRepositories> <groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</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>
</pluginManagement>
</build>
</project> <repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

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,34 +11,32 @@ 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 {
* /**
* @param file *
* @return *
*/ * @param file
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) * @return
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); */
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
/** /**
* *
* *
* @param fileUrl * @param fileUrl
* @return * @return
*/ */
@DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl); public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl);
} }

View File

@ -1,41 +1,48 @@
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 {
* /**
* @param sysOperLog *
* @param source *
* @return * @param sysOperLog
*/ * @param source
@PostMapping("/operlog") * @return
public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception; */
@PostMapping("/operlog")
public R<Boolean> saveLog(
@RequestBody SysOperLog sysOperLog,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source)
throws Exception;
/** /**
* 访 * 访
* *
* @param sysLogininfor 访 * @param sysLogininfor 访
* @param source * @param source
* @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,48 +13,48 @@ 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 {
* /**
* @param username *
* @param source *
* @return * @param username
*/ * @param source
@GetMapping("/user/info/{username}") * @return
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); */
@GetMapping("/user/info/{username}")
public R<LoginUser> getUserInfo(
@PathVariable("username") String username,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* *
* *
* @param sysUser * @param sysUser
* @param source * @param source
* @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
* *
* @param sysUser * @param sysUser
* @param source * @param source
* @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,5 +1,6 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
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.Email;
@ -8,196 +9,170 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.web.domain.BaseEntity;
/** /**
* 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 */
private Long deptId; private Long deptId;
/** 父部门ID */ /** 父部门ID */
private Long parentId; private Long parentId;
/** 祖级列表 */ /** 祖级列表 */
private String ancestors; private String ancestors;
/** 部门名称 */ /** 部门名称 */
private String deptName; private String deptName;
/** 显示顺序 */ /** 显示顺序 */
private Integer orderNum; private Integer orderNum;
/** 负责人 */ /** 负责人 */
private String leader; private String leader;
/** 联系电话 */ /** 联系电话 */
private String phone; private String phone;
/** 邮箱 */ /** 邮箱 */
private String email; private String email;
/** 部门状态:0正常,1停用 */ /** 部门状态:0正常,1停用 */
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 父部门名称 */ /** 父部门名称 */
private String parentName; private String parentName;
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId() /** 子部门 */
{ private List<SysDept> children = new ArrayList<SysDept>();
return deptId;
}
public void setDeptId(Long deptId) public Long getDeptId() {
{ return deptId;
this.deptId = deptId; }
}
public Long getParentId() public void setDeptId(Long deptId) {
{ this.deptId = deptId;
return parentId; }
}
public void setParentId(Long parentId) public Long getParentId() {
{ return parentId;
this.parentId = parentId; }
}
public String getAncestors() public void setParentId(Long parentId) {
{ this.parentId = parentId;
return ancestors; }
}
public void setAncestors(String ancestors) public String getAncestors() {
{ return ancestors;
this.ancestors = ancestors; }
}
@NotBlank(message = "部门名称不能为空") public void setAncestors(String ancestors) {
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") this.ancestors = ancestors;
public String getDeptName() }
{
return deptName;
}
public void setDeptName(String deptName) @NotBlank(message = "部门名称不能为空")
{ @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
this.deptName = deptName; public String getDeptName() {
} return deptName;
}
@NotNull(message = "显示顺序不能为空") public void setDeptName(String deptName) {
public Integer getOrderNum() this.deptName = deptName;
{ }
return orderNum;
}
public void setOrderNum(Integer orderNum) @NotNull(message = "显示顺序不能为空")
{ public Integer getOrderNum() {
this.orderNum = orderNum; return orderNum;
} }
public String getLeader() public void setOrderNum(Integer orderNum) {
{ this.orderNum = orderNum;
return leader; }
}
public void setLeader(String leader) public String getLeader() {
{ return leader;
this.leader = leader; }
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") public void setLeader(String leader) {
public String getPhone() this.leader = leader;
{ }
return phone;
}
public void setPhone(String phone) @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
{ public String getPhone() {
this.phone = phone; return phone;
} }
@Email(message = "邮箱格式不正确") public void setPhone(String phone) {
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") this.phone = phone;
public String getEmail() }
{
return email;
}
public void setEmail(String email) @Email(message = "邮箱格式不正确")
{ @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
this.email = email; public String getEmail() {
} return email;
}
public String getStatus() public void setEmail(String email) {
{ this.email = email;
return status; }
}
public void setStatus(String status) public String getStatus() {
{ return status;
this.status = status; }
}
public String getDelFlag() public void setStatus(String status) {
{ this.status = status;
return delFlag; }
}
public void setDelFlag(String delFlag) public String getDelFlag() {
{ return delFlag;
this.delFlag = delFlag; }
}
public String getParentName() public void setDelFlag(String delFlag) {
{ this.delFlag = delFlag;
return parentName; }
}
public void setParentName(String parentName) public String getParentName() {
{ return parentName;
this.parentName = parentName; }
}
public List<SysDept> getChildren() public void setParentName(String parentName) {
{ this.parentName = parentName;
return children; }
}
public void setChildren(List<SysDept> children) public List<SysDept> getChildren() {
{ return children;
this.children = children; }
}
@Override public void setChildren(List<SysDept> children) {
public String toString() { this.children = children;
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) }
.append("deptId", getDeptId())
.append("parentId", getParentId()) @Override
.append("ancestors", getAncestors()) public String toString() {
.append("deptName", getDeptName()) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("orderNum", getOrderNum()) .append("deptId", getDeptId())
.append("leader", getLeader()) .append("parentId", getParentId())
.append("phone", getPhone()) .append("ancestors", getAncestors())
.append("email", getEmail()) .append("deptName", getDeptName())
.append("status", getStatus()) .append("orderNum", getOrderNum())
.append("delFlag", getDelFlag()) .append("leader", getLeader())
.append("createBy", getCreateBy()) .append("phone", getPhone())
.append("createTime", getCreateTime()) .append("email", getEmail())
.append("updateBy", getUpdateBy()) .append("status", getStatus())
.append("updateTime", getUpdateTime()) .append("delFlag", getDelFlag())
.toString(); .append("createBy", getCreateBy())
} .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
} }

View File

@ -1,176 +1,156 @@
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 javax.validation.constraints.NotBlank;
import javax.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;
/** 字典编码 */ /** 字典编码 */
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC) @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
private Long dictCode; private Long dictCode;
/** 字典排序 */ /** 字典排序 */
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC) @Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
private Long dictSort; private Long dictSort;
/** 字典标签 */ /** 字典标签 */
@Excel(name = "字典标签") @Excel(name = "字典标签")
private String dictLabel; private String dictLabel;
/** 字典键值 */ /** 字典键值 */
@Excel(name = "字典键值") @Excel(name = "字典键值")
private String dictValue; private String dictValue;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 样式属性(其他样式扩展) */ /** 样式属性(其他样式扩展) */
private String cssClass; private String cssClass;
/** 表格字典样式 */ /** 表格字典样式 */
private String listClass; private String listClass;
/** 是否默认Y是 N否 */ /** 是否默认Y是 N否 */
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否") @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault; private String isDefault;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@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()) .append("dictValue", getDictValue())
.append("dictValue", getDictValue()) .append("dictType", getDictType())
.append("dictType", getDictType()) .append("cssClass", getCssClass())
.append("cssClass", getCssClass()) .append("listClass", getListClass())
.append("listClass", getListClass()) .append("isDefault", getIsDefault())
.append("isDefault", getIsDefault()) .append("status", getStatus())
.append("status", getStatus()) .append("createBy", getCreateBy())
.append("createBy", getCreateBy()) .append("createTime", getCreateTime())
.append("createTime", getCreateTime()) .append("updateBy", getUpdateBy())
.append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime())
.append("updateTime", getUpdateTime()) .append("remark", getRemark())
.append("remark", getRemark()) .toString();
.toString(); }
}
} }

View File

@ -1,96 +1,87 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity;
/** /**
* 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;
/** 字典主键 */ /** 字典主键 */
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC) @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId; private Long dictId;
/** 字典名称 */ /** 字典名称 */
@Excel(name = "字典名称") @Excel(name = "字典名称")
private String dictName; private String dictName;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型") @Excel(name = "字典类型")
private String dictType; private String dictType;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@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()) .append("status", getStatus())
.append("status", getStatus()) .append("createBy", getCreateBy())
.append("createBy", getCreateBy()) .append("createTime", getCreateTime())
.append("createTime", getCreateTime()) .append("updateBy", getUpdateBy())
.append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime())
.append("updateTime", getUpdateTime()) .append("remark", getRemark())
.append("remark", getRemark()) .toString();
.toString(); }
}
} }

View File

@ -5,46 +5,37 @@ 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,102 +1,89 @@
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 */
@Excel(name = "序号", cellType = ColumnType.NUMERIC) @Excel(name = "序号", cellType = ColumnType.NUMERIC)
private Long infoId; private Long infoId;
/** 用户账号 */ /** 用户账号 */
@Excel(name = "用户账号") @Excel(name = "用户账号")
private String userName; private String userName;
/** 状态 0成功 1失败 */ /** 状态 0成功 1失败 */
@Excel(name = "状态", readConverterExp = "0=成功,1=失败") @Excel(name = "状态", readConverterExp = "0=成功,1=失败")
private String status; private String status;
/** 地址 */ /** 地址 */
@Excel(name = "地址") @Excel(name = "地址")
private String ipaddr; private String ipaddr;
/** 描述 */ /** 描述 */
@Excel(name = "描述") @Excel(name = "描述")
private String msg; private String msg;
/** 访问时间 */ /** 访问时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@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,255 +1,220 @@
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;
/** 日志主键 */ /** 日志主键 */
@Excel(name = "操作序号", cellType = ColumnType.NUMERIC) @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
private Long operId; private Long operId;
/** 操作模块 */ /** 操作模块 */
@Excel(name = "操作模块") @Excel(name = "操作模块")
private String title; private String title;
/** 业务类型0其它 1新增 2修改 3删除 */ /** 业务类型0其它 1新增 2修改 3删除 */
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
private Integer businessType; private Integer businessType;
/** 业务类型数组 */ /** 业务类型数组 */
private Integer[] businessTypes; private Integer[] businessTypes;
/** 请求方法 */ /** 请求方法 */
@Excel(name = "请求方法") @Excel(name = "请求方法")
private String method; private String method;
/** 请求方式 */ /** 请求方式 */
@Excel(name = "请求方式") @Excel(name = "请求方式")
private String requestMethod; private String requestMethod;
/** 操作类别0其它 1后台用户 2手机端用户 */ /** 操作类别0其它 1后台用户 2手机端用户 */
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
private Integer operatorType; private Integer operatorType;
/** 操作人员 */ /** 操作人员 */
@Excel(name = "操作人员") @Excel(name = "操作人员")
private String operName; private String operName;
/** 部门名称 */ /** 部门名称 */
@Excel(name = "部门名称") @Excel(name = "部门名称")
private String deptName; private String deptName;
/** 请求url */ /** 请求url */
@Excel(name = "请求地址") @Excel(name = "请求地址")
private String operUrl; private String operUrl;
/** 操作地址 */ /** 操作地址 */
@Excel(name = "操作地址") @Excel(name = "操作地址")
private String operIp; private String operIp;
/** 请求参数 */ /** 请求参数 */
@Excel(name = "请求参数") @Excel(name = "请求参数")
private String operParam; private String operParam;
/** 返回参数 */ /** 返回参数 */
@Excel(name = "返回参数") @Excel(name = "返回参数")
private String jsonResult; private String jsonResult;
/** 操作状态0正常 1异常 */ /** 操作状态0正常 1异常 */
@Excel(name = "状态", readConverterExp = "0=正常,1=异常") @Excel(name = "状态", readConverterExp = "0=正常,1=异常")
private Integer status; private Integer status;
/** 错误消息 */ /** 错误消息 */
@Excel(name = "错误消息") @Excel(name = "错误消息")
private String errorMsg; private String errorMsg;
/** 操作时间 */ /** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operTime; private Date operTime;
/** 消耗时间 */ /** 消耗时间 */
@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,241 +1,208 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity;
import java.util.Set; import java.util.Set;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.web.domain.BaseEntity;
/** /**
* 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 */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC) @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId; private Long roleId;
/** 角色名称 */ /** 角色名称 */
@Excel(name = "角色名称") @Excel(name = "角色名称")
private String roleName; private String roleName;
/** 角色权限 */ /** 角色权限 */
@Excel(name = "角色权限") @Excel(name = "角色权限")
private String roleKey; private String roleKey;
/** 角色排序 */ /** 角色排序 */
@Excel(name = "角色排序") @Excel(name = "角色排序")
private Integer roleSort; private Integer roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */ /** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope; private String dataScope;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */ /** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */
private boolean menuCheckStrictly; private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */ /** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */
private boolean deptCheckStrictly; private boolean deptCheckStrictly;
/** 角色状态0正常 1停用 */ /** 角色状态0正常 1停用 */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */ /** 用户是否存在此角色标识 默认不存在 */
private boolean flag = false; private boolean flag = false;
/** 菜单组 */ /** 菜单组 */
private Long[] menuIds; private Long[] menuIds;
/** 部门组(数据权限) */ /** 部门组(数据权限) */
private Long[] deptIds; private Long[] deptIds;
/** 角色菜单权限 */ /** 角色菜单权限 */
private Set<String> permissions; private Set<String> permissions;
public SysRole() public SysRole() {}
{
} public SysRole(Long roleId) {
this.roleId = roleId;
}
public SysRole(Long roleId) public Long getRoleId() {
{ return roleId;
this.roleId = roleId; }
}
public Long getRoleId() public void setRoleId(Long roleId) {
{ this.roleId = roleId;
return roleId; }
}
public void setRoleId(Long roleId) public boolean isAdmin() {
{ return isAdmin(this.roleId);
this.roleId = roleId; }
}
public boolean isAdmin() public static boolean isAdmin(Long roleId) {
{ return roleId != null && 1L == roleId;
return isAdmin(this.roleId); }
}
public static boolean isAdmin(Long roleId) @NotBlank(message = "角色名称不能为空")
{ @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
return roleId != null && 1L == roleId; public String getRoleName() {
} return roleName;
}
@NotBlank(message = "角色名称不能为空") public void setRoleName(String roleName) {
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") this.roleName = roleName;
public String getRoleName() }
{
return roleName;
}
public void setRoleName(String roleName) @NotBlank(message = "权限字符不能为空")
{ @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
this.roleName = roleName; public String getRoleKey() {
} return roleKey;
}
@NotBlank(message = "权限字符不能为空") public void setRoleKey(String roleKey) {
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") this.roleKey = roleKey;
public String getRoleKey() }
{
return roleKey;
}
public void setRoleKey(String roleKey) @NotNull(message = "显示顺序不能为空")
{ public Integer getRoleSort() {
this.roleKey = roleKey; return roleSort;
} }
@NotNull(message = "显示顺序不能为空") public void setRoleSort(Integer roleSort) {
public Integer getRoleSort() this.roleSort = roleSort;
{ }
return roleSort;
}
public void setRoleSort(Integer roleSort) public String getDataScope() {
{ return dataScope;
this.roleSort = roleSort; }
}
public String getDataScope() public void setDataScope(String dataScope) {
{ this.dataScope = dataScope;
return dataScope; }
}
public void setDataScope(String dataScope) public boolean isMenuCheckStrictly() {
{ return menuCheckStrictly;
this.dataScope = dataScope; }
}
public boolean isMenuCheckStrictly() public void setMenuCheckStrictly(boolean menuCheckStrictly) {
{ this.menuCheckStrictly = menuCheckStrictly;
return menuCheckStrictly; }
}
public void setMenuCheckStrictly(boolean menuCheckStrictly) public boolean isDeptCheckStrictly() {
{ return deptCheckStrictly;
this.menuCheckStrictly = menuCheckStrictly; }
}
public boolean isDeptCheckStrictly() public void setDeptCheckStrictly(boolean deptCheckStrictly) {
{ this.deptCheckStrictly = deptCheckStrictly;
return deptCheckStrictly; }
}
public void setDeptCheckStrictly(boolean deptCheckStrictly) public String getStatus() {
{ return status;
this.deptCheckStrictly = deptCheckStrictly; }
}
public String getStatus() public void setStatus(String status) {
{ this.status = status;
return status; }
}
public void setStatus(String status) public String getDelFlag() {
{ return delFlag;
this.status = status; }
}
public String getDelFlag() public void setDelFlag(String delFlag) {
{ this.delFlag = delFlag;
return delFlag; }
}
public void setDelFlag(String delFlag) public boolean isFlag() {
{ return flag;
this.delFlag = delFlag; }
}
public boolean isFlag() public void setFlag(boolean flag) {
{ this.flag = flag;
return flag; }
}
public void setFlag(boolean flag) public Long[] getMenuIds() {
{ return menuIds;
this.flag = flag; }
}
public Long[] getMenuIds() public void setMenuIds(Long[] menuIds) {
{ this.menuIds = menuIds;
return menuIds; }
}
public void setMenuIds(Long[] menuIds) public Long[] getDeptIds() {
{ return deptIds;
this.menuIds = menuIds; }
}
public Long[] getDeptIds() public void setDeptIds(Long[] deptIds) {
{ this.deptIds = deptIds;
return deptIds; }
}
public void setDeptIds(Long[] deptIds) public Set<String> getPermissions() {
{ return permissions;
this.deptIds = deptIds; }
}
public Set<String> getPermissions() public void setPermissions(Set<String> permissions) {
{ this.permissions = permissions;
return permissions; }
}
public void setPermissions(Set<String> permissions) @Override
{ public String toString() {
this.permissions = permissions; return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
} .append("roleId", getRoleId())
.append("roleName", getRoleName())
@Override .append("roleKey", getRoleKey())
public String toString() { .append("roleSort", getRoleSort())
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("dataScope", getDataScope())
.append("roleId", getRoleId()) .append("menuCheckStrictly", isMenuCheckStrictly())
.append("roleName", getRoleName()) .append("deptCheckStrictly", isDeptCheckStrictly())
.append("roleKey", getRoleKey()) .append("status", getStatus())
.append("roleSort", getRoleSort()) .append("delFlag", getDelFlag())
.append("dataScope", getDataScope()) .append("createBy", getCreateBy())
.append("menuCheckStrictly", isMenuCheckStrictly()) .append("createTime", getCreateTime())
.append("deptCheckStrictly", isDeptCheckStrictly()) .append("updateBy", getUpdateBy())
.append("status", getStatus()) .append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag()) .append("remark", getRemark())
.append("createBy", getCreateBy()) .toString();
.append("createTime", getCreateTime()) }
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
} }

View File

@ -1,339 +1,294 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type;
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.xss.Xss;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
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.web.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss;
/** /**
* 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 */
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId; private Long userId;
/** 部门ID */ /** 部门ID */
@Excel(name = "部门编号", type = Type.IMPORT) @Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId; private Long deptId;
/** 用户账号 */ /** 用户账号 */
@Excel(name = "登录名称") @Excel(name = "登录名称")
private String userName; private String userName;
/** 用户昵称 */ /** 用户昵称 */
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** 用户邮箱 */ /** 用户邮箱 */
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; private String email;
/** 手机号码 */ /** 手机号码 */
@Excel(name = "手机号码", cellType = ColumnType.TEXT) @Excel(name = "手机号码", cellType = ColumnType.TEXT)
private String phonenumber; private String phonenumber;
/** 用户性别 */ /** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex; private String sex;
/** 用户头像 */ /** 用户头像 */
private String avatar; private String avatar;
/** 密码 */ /** 密码 */
private String password; private String password;
/** 账号状态0正常 1停用 */ /** 账号状态0正常 1停用 */
@Excel(name = "账号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "账号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 最后登录IP */ /** 最后登录IP */
@Excel(name = "最后登录IP", type = Type.EXPORT) @Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp; private String loginIp;
/** 最后登录时间 */ /** 最后登录时间 */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate; private Date loginDate;
/** 密码最后更新时间 */ /** 密码最后更新时间 */
private Date pwdUpdateDate; private Date pwdUpdateDate;
/** 部门对象 */ /** 部门对象 */
@Excels({ @Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
}) })
private SysDept dept; private SysDept dept;
/** 角色对象 */ /** 角色对象 */
private List<SysRole> roles; private List<SysRole> roles;
/** 角色组 */ /** 角色组 */
private Long[] roleIds; private Long[] roleIds;
/** 岗位组 */ /** 岗位组 */
private Long[] postIds; private Long[] postIds;
/** 角色ID */ /** 角色ID */
private Long roleId; private Long roleId;
public SysUser() public SysUser() {}
{
} public SysUser(Long userId) {
this.userId = userId;
}
public SysUser(Long userId) public Long getUserId() {
{ return userId;
this.userId = userId; }
}
public Long getUserId() public void setUserId(Long userId) {
{ this.userId = userId;
return userId; }
}
public void setUserId(Long userId) public boolean isAdmin() {
{ return isAdmin(this.userId);
this.userId = userId; }
}
public boolean isAdmin() public static boolean isAdmin(Long userId) {
{ return UserConstants.isAdmin(userId);
return isAdmin(this.userId); }
}
public static boolean isAdmin(Long userId) public Long getDeptId() {
{ return deptId;
return UserConstants.isAdmin(userId); }
}
public Long getDeptId() public void setDeptId(Long deptId) {
{ this.deptId = deptId;
return deptId; }
}
public void setDeptId(Long deptId) @Xss(message = "用户昵称不能包含脚本字符")
{ @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
this.deptId = deptId; public String getNickName() {
} return nickName;
}
@Xss(message = "用户昵称不能包含脚本字符") public void setNickName(String nickName) {
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") this.nickName = nickName;
public String getNickName() }
{
return nickName;
}
public void setNickName(String nickName) @Xss(message = "用户账号不能包含脚本字符")
{ @NotBlank(message = "用户账号不能为空")
this.nickName = nickName; @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
} public String getUserName() {
return userName;
}
@Xss(message = "用户账号不能包含脚本字符") public void setUserName(String userName) {
@NotBlank(message = "用户账号不能为空") this.userName = userName;
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") }
public String getUserName()
{
return userName;
}
public void setUserName(String userName) @Email(message = "邮箱格式不正确")
{ @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
this.userName = userName; public String getEmail() {
} return email;
}
@Email(message = "邮箱格式不正确") public void setEmail(String email) {
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") this.email = email;
public String getEmail() }
{
return email;
}
public void setEmail(String email) @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
{ public String getPhonenumber() {
this.email = email; return phonenumber;
} }
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") public void setPhonenumber(String phonenumber) {
public String getPhonenumber() this.phonenumber = phonenumber;
{ }
return phonenumber;
}
public void setPhonenumber(String phonenumber) public String getSex() {
{ return sex;
this.phonenumber = phonenumber; }
}
public String getSex() public void setSex(String sex) {
{ this.sex = sex;
return sex; }
}
public void setSex(String sex) public String getAvatar() {
{ return avatar;
this.sex = sex; }
}
public String getAvatar() public void setAvatar(String avatar) {
{ this.avatar = avatar;
return avatar; }
}
public void setAvatar(String avatar) public String getPassword() {
{ return password;
this.avatar = avatar; }
}
public String getPassword() public void setPassword(String password) {
{ this.password = password;
return password; }
}
public void setPassword(String password) public String getStatus() {
{ return status;
this.password = password; }
}
public String getStatus() public void setStatus(String status) {
{ this.status = status;
return status; }
}
public void setStatus(String status) public String getDelFlag() {
{ return delFlag;
this.status = status; }
}
public String getDelFlag() public void setDelFlag(String delFlag) {
{ this.delFlag = delFlag;
return delFlag; }
}
public void setDelFlag(String delFlag) public String getLoginIp() {
{ return loginIp;
this.delFlag = delFlag; }
}
public String getLoginIp() public void setLoginIp(String loginIp) {
{ this.loginIp = loginIp;
return loginIp; }
}
public void setLoginIp(String loginIp) public Date getLoginDate() {
{ return loginDate;
this.loginIp = loginIp; }
}
public Date getLoginDate() public void setLoginDate(Date loginDate) {
{ this.loginDate = loginDate;
return loginDate; }
}
public void setLoginDate(Date loginDate) public Date getPwdUpdateDate() {
{ return pwdUpdateDate;
this.loginDate = loginDate; }
}
public Date getPwdUpdateDate() public void setPwdUpdateDate(Date pwdUpdateDate) {
{ this.pwdUpdateDate = pwdUpdateDate;
return pwdUpdateDate; }
}
public void setPwdUpdateDate(Date pwdUpdateDate) public SysDept getDept() {
{ return dept;
this.pwdUpdateDate = pwdUpdateDate; }
}
public SysDept getDept() public void setDept(SysDept dept) {
{ this.dept = dept;
return dept; }
}
public void setDept(SysDept dept) public List<SysRole> getRoles() {
{ return roles;
this.dept = dept; }
}
public List<SysRole> getRoles() public void setRoles(List<SysRole> roles) {
{ this.roles = roles;
return roles; }
}
public void setRoles(List<SysRole> roles) public Long[] getRoleIds() {
{ return roleIds;
this.roles = roles; }
}
public Long[] getRoleIds() public void setRoleIds(Long[] roleIds) {
{ this.roleIds = roleIds;
return roleIds; }
}
public void setRoleIds(Long[] roleIds) public Long[] getPostIds() {
{ return postIds;
this.roleIds = roleIds; }
}
public Long[] getPostIds() public void setPostIds(Long[] postIds) {
{ this.postIds = postIds;
return postIds; }
}
public void setPostIds(Long[] postIds) public Long getRoleId() {
{ return roleId;
this.postIds = postIds; }
}
public Long getRoleId() public void setRoleId(Long roleId) {
{ this.roleId = roleId;
return roleId; }
}
public void setRoleId(Long roleId) @Override
{ public String toString() {
this.roleId = roleId; return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
} .append("userId", getUserId())
.append("deptId", getDeptId())
@Override .append("userName", getUserName())
public String toString() { .append("nickName", getNickName())
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("email", getEmail())
.append("userId", getUserId()) .append("phonenumber", getPhonenumber())
.append("deptId", getDeptId()) .append("sex", getSex())
.append("userName", getUserName()) .append("avatar", getAvatar())
.append("nickName", getNickName()) .append("password", getPassword())
.append("email", getEmail()) .append("status", getStatus())
.append("phonenumber", getPhonenumber()) .append("delFlag", getDelFlag())
.append("sex", getSex()) .append("loginIp", getLoginIp())
.append("avatar", getAvatar()) .append("loginDate", getLoginDate())
.append("password", getPassword()) .append("pwdUpdateDate", getPwdUpdateDate())
.append("status", getStatus()) .append("createBy", getCreateBy())
.append("delFlag", getDelFlag()) .append("createTime", getCreateTime())
.append("loginIp", getLoginIp()) .append("updateBy", getUpdateBy())
.append("loginDate", getLoginDate()) .append("updateTime", getUpdateTime())
.append("pwdUpdateDate", getPwdUpdateDate()) .append("remark", getRemark())
.append("createBy", getCreateBy()) .append("dept", getDept())
.append("createTime", getCreateTime()) .toString();
.append("updateBy", getUpdateBy()) }
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.toString();
}
} }

View File

@ -1,41 +1,36 @@
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;
/** /**
* *
* *
* @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
{ public R<SysFile> upload(MultipartFile file) {
@Override return R.fail("上传文件失败:" + throwable.getMessage());
public R<SysFile> upload(MultipartFile file) }
{
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,42 +1,36 @@
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;
/** /**
* *
* *
* @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
{ public R<Boolean> saveLog(SysOperLog sysOperLog, String source) {
@Override return R.fail("保存操作日志失败:" + throwable.getMessage());
public R<Boolean> saveLog(SysOperLog sysOperLog, String source) }
{
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,47 +1,41 @@
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;
/** /**
* *
* *
* @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
{ public R<LoginUser> getUserInfo(String username, String source) {
@Override return R.fail("获取用户失败:" + throwable.getMessage());
public R<LoginUser> getUserInfo(String username, String source) }
{
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,31 +1,30 @@
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;
/** /**
* *
* *
* @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);
{ System.out.println(
SpringApplication.run(RuoYiAuthApplication.class, args); "(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n"
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n"
" .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n"
" | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n"
" | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n"
" |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n"
" | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \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,63 +10,60 @@ 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 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;
/** /**
* token * token
* *
* @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 return R.ok(tokenService.createToken(userInfo));
return R.ok(tokenService.createToken(userInfo)); }
@DeleteMapping("logout")
public R<?> logout(HttpServletRequest request) {
String token = SecurityUtils.getToken(request);
if (StringUtils.isNotEmpty(token)) {
String username = JwtUtils.getUserName(token);
// 删除用户缓存记录
AuthUtil.logoutByToken(token);
// 记录用户退出日志
sysLoginService.logout(username);
} }
return R.ok();
}
@DeleteMapping("logout") @PostMapping("refresh")
public R<?> logout(HttpServletRequest request) public R<?> refresh(HttpServletRequest request) {
{ LoginUser loginUser = tokenService.getLoginUser(request);
String token = SecurityUtils.getToken(request); if (StringUtils.isNotNull(loginUser)) {
if (StringUtils.isNotEmpty(token)) // 刷新令牌有效期
{ tokenService.refreshToken(loginUser);
String username = JwtUtils.getUserName(token); return R.ok();
// 删除用户缓存记录
AuthUtil.logoutByToken(token);
// 记录用户退出日志
sysLoginService.logout(username);
}
return R.ok();
} }
return R.ok();
}
@PostMapping("refresh") @PostMapping("register")
public R<?> refresh(HttpServletRequest request) public R<?> register(@RequestBody RegisterBody registerBody) {
{ // 用户注册
LoginUser loginUser = tokenService.getLoginUser(request); sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
if (StringUtils.isNotNull(loginUser)) return R.ok();
{ }
// 刷新令牌有效期
tokenService.refreshToken(loginUser);
return R.ok();
}
return R.ok();
}
@PostMapping("register")
public R<?> register(@RequestBody RegisterBody registerBody)
{
// 用户注册
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
return R.ok();
}
} }

View File

@ -2,38 +2,29 @@ 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

@ -2,10 +2,7 @@ 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,139 +16,118 @@ 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;
/** /**
* *
* *
* @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)) {
{ recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
// 用户名或密码为空 错误 throw new ServiceException("用户/密码必须填写");
if (StringUtils.isAnyBlank(username, password)) }
{ // 密码如果不在指定范围内 错误
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写"); if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
throw new ServiceException("用户/密码必须填写"); || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
} recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
// 密码如果不在指定范围内 错误 throw new ServiceException("用户密码不在指定范围");
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH }
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) // 用户名不在指定范围内 错误
{ if (username.length() < UserConstants.USERNAME_MIN_LENGTH
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围"); || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
throw new ServiceException("用户密码不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
} throw new ServiceException("用户名不在指定范围");
// 用户名不在指定范围内 错误 }
if (username.length() < UserConstants.USERNAME_MIN_LENGTH // IP黑名单校验
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) String blackStr =
{ Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围"); if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
throw new ServiceException("用户名不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾访问IP已被列入系统黑名单");
} throw new ServiceException("很遗憾访问IP已被列入系统黑名单");
// IP黑名单校验 }
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); // 查询用户信息
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾访问IP已被列入系统黑名单");
throw new ServiceException("很遗憾访问IP已被列入系统黑名单");
}
// 查询用户信息
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();
SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
recordLoginInfo(user.getUserId());
return userInfo;
} }
/** LoginUser userInfo = userResult.getData();
* SysUser user = userResult.getData().getSysUser();
* if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
* @param userId ID recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
*/ throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
public void recordLoginInfo(Long userId) }
{ if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
SysUser sysUser = new SysUser(); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
sysUser.setUserId(userId); throw new ServiceException("对不起,您的账号:" + username + " 已停用");
// 更新用户登录IP }
sysUser.setLoginIp(IpUtils.getIpAddr()); passwordService.validate(user, password);
// 更新用户登录时间 recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
sysUser.setLoginDate(DateUtils.getNowDate()); recordLoginInfo(user.getUserId());
remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER); return userInfo;
}
/**
*
*
* @param userId ID
*/
public void recordLoginInfo(Long userId) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
// 更新用户登录IP
sysUser.setLoginIp(IpUtils.getIpAddr());
// 更新用户登录时间
sysUser.setLoginDate(DateUtils.getNowDate());
remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER);
}
public void logout(String loginName) {
recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
}
/** 注册 */
public void register(String username, String password) {
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) {
throw new ServiceException("用户/密码必须填写");
}
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
throw new ServiceException("账户长度必须在2到20个字符之间");
}
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
throw new ServiceException("密码长度必须在5到20个字符之间");
} }
public void logout(String loginName) // 注册用户信息
{ SysUser sysUser = new SysUser();
recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功"); sysUser.setUserName(username);
} sysUser.setNickName(username);
sysUser.setPwdUpdateDate(DateUtils.getNowDate());
/** sysUser.setPassword(SecurityUtils.encryptPassword(password));
* R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
*/
public void register(String username, String password) if (R.FAIL == registerResult.getCode()) {
{ throw new ServiceException(registerResult.getMsg());
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
throw new ServiceException("用户/密码必须填写");
}
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
throw new ServiceException("账户长度必须在2到20个字符之间");
}
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
throw new ServiceException("密码长度必须在5到20个字符之间");
}
// 注册用户信息
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPwdUpdateDate(DateUtils.getNowDate());
sysUser.setPassword(SecurityUtils.encryptPassword(password));
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
if (R.FAIL == registerResult.getCode())
{
throw new ServiceException(registerResult.getMsg());
}
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
} }
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
}
} }

View File

@ -1,85 +1,73 @@
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;
/** /**
* *
* *
* @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;
/** /**
* *
* *
* @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) {
String username = user.getUserName();
Integer retryCount = redisService.getCacheObject(getCacheKey(username));
if (retryCount == null) {
retryCount = 0;
} }
public void validate(SysUser user, String password) if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) {
{ String errMsg = String.format("密码输入错误%s次帐户锁定%s分钟", maxRetryCount, lockTime);
String username = user.getUserName(); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, errMsg);
throw new ServiceException(errMsg);
Integer retryCount = redisService.getCacheObject(getCacheKey(username));
if (retryCount == null)
{
retryCount = 0;
}
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
{
String errMsg = String.format("密码输入错误%s次帐户锁定%s分钟", maxRetryCount, lockTime);
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg);
throw new ServiceException(errMsg);
}
if (!matches(user, password))
{
retryCount = retryCount + 1;
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new ServiceException("用户不存在/密码错误");
}
else
{
clearLoginRecordCache(username);
}
} }
public boolean matches(SysUser user, String rawPassword) if (!matches(user, password)) {
{ retryCount = retryCount + 1;
return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); recordLogService.recordLogininfor(
username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new ServiceException("用户不存在/密码错误");
} else {
clearLoginRecordCache(username);
} }
}
public void clearLoginRecordCache(String loginName) public boolean matches(SysUser user, String rawPassword) {
{ return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
if (redisService.hasKey(getCacheKey(loginName))) }
{
redisService.deleteObject(getCacheKey(loginName)); public void clearLoginRecordCache(String loginName) {
} if (redisService.hasKey(getCacheKey(loginName))) {
redisService.deleteObject(getCacheKey(loginName));
} }
}
} }

View File

@ -1,48 +1,43 @@
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;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysRecordLogService public class SysRecordLogService {
{ @Autowired private RemoteLogService remoteLogService;
@Autowired
private RemoteLogService remoteLogService;
/** /**
* *
* *
* @param username * @param username
* @param status * @param status
* @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(
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) 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)) {
} logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
else if (Constants.LOGIN_FAIL.equals(status))
{
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
}
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
} }
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
}
} }

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,181 +8,124 @@ 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
* *
* @author ruoyi * @author ruoyi
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Excel public @interface Excel {
{ /** 导出时在excel中排序 */
/** public int sort() default Integer.MAX_VALUE;
* excel
*/
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),
private final int value; IMPORT(2);
private final int value;
Type(int value) Type(int value) {
{ this.value = value;
this.value = value;
}
public int value()
{
return this.value;
}
} }
public enum ColumnType public int value() {
{ return this.value;
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
private final int value;
ColumnType(int value)
{
this.value = value;
}
public int value()
{
return this.value;
}
} }
} }
public enum ColumnType {
NUMERIC(0),
STRING(1),
IMAGE(2),
TEXT(3);
private final int value;
ColumnType(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}
}

View File

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

View File

@ -2,58 +2,37 @@ 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

@ -2,144 +2,95 @@ package com.ruoyi.common.core.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class Constants public class Constants {
{ /** UTF-8 字符集 */
/** public static final String UTF8 = "UTF-8";
* 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

@ -2,116 +2,130 @@ 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";
/** 树表(增删改查) */ /** 树表(增删改查) */
public static final String TPL_TREE = "tree"; public static final String TPL_TREE = "tree";
/** 主子表(增删改查) */ /** 主子表(增删改查) */
public static final String TPL_SUB = "sub"; public static final String TPL_SUB = "sub";
/** 树编码字段 */ /** 树编码字段 */
public static final String TREE_CODE = "treeCode"; public static final String TREE_CODE = "treeCode";
/** 树父编码字段 */ /** 树父编码字段 */
public static final String TREE_PARENT_CODE = "treeParentCode"; public static final String TREE_PARENT_CODE = "treeParentCode";
/** 树名称字段 */ /** 树名称字段 */
public static final String TREE_NAME = "treeName"; public static final String TREE_NAME = "treeName";
/** 上级菜单ID字段 */ /** 上级菜单ID字段 */
public static final String PARENT_MENU_ID = "parentMenuId"; public static final String PARENT_MENU_ID = "parentMenuId";
/** 上级菜单名称字段 */ /** 上级菜单名称字段 */
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";
/** 文本域 */ /** 文本域 */
public static final String HTML_TEXTAREA = "textarea"; public static final String HTML_TEXTAREA = "textarea";
/** 下拉框 */ /** 下拉框 */
public static final String HTML_SELECT = "select"; public static final String HTML_SELECT = "select";
/** 单选框 */ /** 单选框 */
public static final String HTML_RADIO = "radio"; public static final String HTML_RADIO = "radio";
/** 复选框 */ /** 复选框 */
public static final String HTML_CHECKBOX = "checkbox"; public static final String HTML_CHECKBOX = "checkbox";
/** 日期控件 */ /** 日期控件 */
public static final String HTML_DATETIME = "datetime"; public static final String HTML_DATETIME = "datetime";
/** 图片上传控件 */ /** 图片上传控件 */
public static final String HTML_IMAGE_UPLOAD = "imageUpload"; public static final String HTML_IMAGE_UPLOAD = "imageUpload";
/** 文件上传控件 */ /** 文件上传控件 */
public static final String HTML_FILE_UPLOAD = "fileUpload"; public static final String HTML_FILE_UPLOAD = "fileUpload";
/** 富文本控件 */ /** 富文本控件 */
public static final String HTML_EDITOR = "editor"; public static final String HTML_EDITOR = "editor";
/** 字符串类型 */ /** 字符串类型 */
public static final String TYPE_STRING = "String"; public static final String TYPE_STRING = "String";
/** 整型 */ /** 整型 */
public static final String TYPE_INTEGER = "Integer"; public static final String TYPE_INTEGER = "Integer";
/** 长整型 */ /** 长整型 */
public static final String TYPE_LONG = "Long"; public static final String TYPE_LONG = "Long";
/** 浮点型 */ /** 浮点型 */
public static final String TYPE_DOUBLE = "Double"; public static final String TYPE_DOUBLE = "Double";
/** 高精度计算类型 */ /** 高精度计算类型 */
public static final String TYPE_BIGDECIMAL = "BigDecimal"; public static final String TYPE_BIGDECIMAL = "BigDecimal";
/** 时间类型 */ /** 时间类型 */
public static final String TYPE_DATE = "Date"; public static final String TYPE_DATE = "Date";
/** 模糊查询 */ /** 模糊查询 */
public static final String QUERY_LIKE = "LIKE"; public static final String QUERY_LIKE = "LIKE";
/** 相等查询 */ /** 相等查询 */
public static final String QUERY_EQ = "EQ"; public static final String QUERY_EQ = "EQ";
/** 需要 */ /** 需要 */
public static final String REQUIRE = "1"; public static final String REQUIRE = "1";
} }

View File

@ -2,93 +2,58 @@ 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

@ -2,49 +2,41 @@ 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 */
public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
/** 默认 */ /** 默认 */
public static final String MISFIRE_DEFAULT = "0"; public static final String MISFIRE_DEFAULT = "0";
/** 立即触发执行 */ /** 立即触发执行 */
public static final String MISFIRE_IGNORE_MISFIRES = "1"; public static final String MISFIRE_IGNORE_MISFIRES = "1";
/** 触发一次执行 */ /** 触发一次执行 */
public static final String MISFIRE_FIRE_AND_PROCEED = "2"; public static final String MISFIRE_FIRE_AND_PROCEED = "2";
/** 不触发立即执行 */ /** 不触发立即执行 */
public static final String MISFIRE_DO_NOTHING = "3"; public static final String MISFIRE_DO_NOTHING = "3";
public enum Status public enum Status {
{ /** 正常 */
/** NORMAL("0"),
* /** 暂停 */
*/ PAUSE("1");
NORMAL("0"),
/**
*
*/
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()
{
return value;
}
} }
public String getValue() {
return value;
}
}
} }

View File

@ -2,48 +2,31 @@ package com.ruoyi.common.core.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class SecurityConstants public class SecurityConstants {
{ /** 用户ID字段 */
/** public static final String DETAILS_USER_ID = "user_id";
* 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

@ -2,23 +2,16 @@ package com.ruoyi.common.core.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class ServiceNameConstants public class ServiceNameConstants {
{ /** 认证服务的serviceid */
/** public static final String AUTH_SERVICE = "ruoyi-auth";
* serviceid
*/
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

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

View File

@ -2,87 +2,80 @@ 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";
/** 正常状态 */ /** 正常状态 */
public static final String NORMAL = "0"; public static final String NORMAL = "0";
/** 异常状态 */ /** 异常状态 */
public static final String EXCEPTION = "1"; public static final String EXCEPTION = "1";
/** 用户封禁状态 */ /** 用户封禁状态 */
public static final String USER_DISABLE = "1"; public static final String USER_DISABLE = "1";
/** 角色正常状态 */ /** 角色正常状态 */
public static final String ROLE_NORMAL = "0"; public static final String ROLE_NORMAL = "0";
/** 角色封禁状态 */ /** 角色封禁状态 */
public static final String ROLE_DISABLE = "1"; public static final String ROLE_DISABLE = "1";
/** 部门正常状态 */ /** 部门正常状态 */
public static final String DEPT_NORMAL = "0"; public static final String DEPT_NORMAL = "0";
/** 部门停用状态 */ /** 部门停用状态 */
public static final String DEPT_DISABLE = "1"; public static final String DEPT_DISABLE = "1";
/** 字典正常状态 */ /** 字典正常状态 */
public static final String DICT_NORMAL = "0"; public static final String DICT_NORMAL = "0";
/** 是否为系统默认(是) */ /** 是否为系统默认(是) */
public static final String YES = "Y"; public static final String YES = "Y";
/** 是否菜单外链(是) */ /** 是否菜单外链(是) */
public static final String YES_FRAME = "0"; public static final String YES_FRAME = "0";
/** 是否菜单外链(否) */ /** 是否菜单外链(否) */
public static final String NO_FRAME = "1"; public static final String NO_FRAME = "1";
/** 菜单类型(目录) */ /** 菜单类型(目录) */
public static final String TYPE_DIR = "M"; public static final String TYPE_DIR = "M";
/** 菜单类型(菜单) */ /** 菜单类型(菜单) */
public static final String TYPE_MENU = "C"; public static final String TYPE_MENU = "C";
/** 菜单类型(按钮) */ /** 菜单类型(按钮) */
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_MAX_LENGTH = 20; /** 用户名长度限制 */
public static final int USERNAME_MIN_LENGTH = 2;
/** public static final int USERNAME_MAX_LENGTH = 20;
*
*/
public static final int PASSWORD_MIN_LENGTH = 5;
public static final int PASSWORD_MAX_LENGTH = 20; /** 密码长度限制 */
public static final int PASSWORD_MIN_LENGTH = 5;
public static boolean isAdmin(Long userId) public static final int PASSWORD_MAX_LENGTH = 20;
{
return userId != null && 1L == userId; public static boolean isAdmin(Long 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>();
{ THREAD_LOCAL.set(map);
map = new ConcurrentHashMap<String, Object>();
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,115 +1,97 @@
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;
/** 成功 */ /** 成功 */
public static final int SUCCESS = Constants.SUCCESS; public static final int SUCCESS = Constants.SUCCESS;
/** 失败 */ /** 失败 */
public static final int FAIL = Constants.FAIL; public static final int FAIL = Constants.FAIL;
private int code; private int code;
private String msg; private String msg;
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); apiResult.setMsg(msg);
apiResult.setMsg(msg); 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

@ -2,29 +2,27 @@ 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

@ -2,15 +2,13 @@ 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

@ -2,30 +2,26 @@ 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

@ -2,14 +2,11 @@ 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

@ -2,57 +2,45 @@ 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

@ -2,15 +2,13 @@ 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

@ -2,14 +2,11 @@ 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

@ -2,73 +2,57 @@ 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

@ -2,25 +2,21 @@ 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

@ -2,15 +2,13 @@ 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

@ -4,20 +4,17 @@ 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

@ -4,20 +4,17 @@ 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

@ -2,78 +2,60 @@ 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

@ -4,16 +4,13 @@ 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)
{
super("file", code, args, msg);
}
public FileException(String code, Object[] args, String msg) {
super("file", code, args, msg);
}
} }

View File

@ -2,15 +2,16 @@ 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");
}
} }

View File

@ -2,15 +2,13 @@ package com.ruoyi.common.core.exception.file;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileSizeLimitExceededException extends FileException public class FileSizeLimitExceededException extends FileException {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException(long defaultMaxSize) public FileSizeLimitExceededException(long defaultMaxSize) {
{ super("upload.exceed.maxSize", new Object[] {defaultMaxSize}, "the filesize is too large");
super("upload.exceed.maxSize", new Object[] { defaultMaxSize }, "the filesize is too large"); }
}
} }

View File

@ -5,57 +5,48 @@ import java.io.PrintWriter;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileUploadException extends Exception public class FileUploadException extends Exception {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final Throwable cause; private final Throwable cause;
public FileUploadException() public FileUploadException() {
{ this(null, null);
this(null, null); }
public FileUploadException(final String msg) {
this(msg, null);
}
public FileUploadException(String msg, Throwable cause) {
super(msg);
this.cause = cause;
}
@Override
public void printStackTrace(PrintStream stream) {
super.printStackTrace(stream);
if (cause != null) {
stream.println("Caused by:");
cause.printStackTrace(stream);
} }
}
public FileUploadException(final String msg) @Override
{ public void printStackTrace(PrintWriter writer) {
this(msg, null); super.printStackTrace(writer);
if (cause != null) {
writer.println("Caused by:");
cause.printStackTrace(writer);
} }
}
public FileUploadException(String msg, Throwable cause) @Override
{ public Throwable getCause() {
super(msg); return cause;
this.cause = cause; }
}
@Override
public void printStackTrace(PrintStream stream)
{
super.printStackTrace(stream);
if (cause != null)
{
stream.println("Caused by:");
cause.printStackTrace(stream);
}
}
@Override
public void printStackTrace(PrintWriter writer)
{
super.printStackTrace(writer);
if (cause != null)
{
writer.println("Caused by:");
cause.printStackTrace(writer);
}
}
@Override
public Throwable getCause()
{
return cause;
}
} }

View File

@ -4,77 +4,75 @@ import java.util.Arrays;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class InvalidExtensionException extends FileUploadException public class InvalidExtensionException extends FileUploadException {
{ private static final long serialVersionUID = 1L;
private String[] allowedExtension;
private String extension;
private String filename;
public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
super(
"filename : ["
+ filename
+ "], extension : ["
+ extension
+ "], allowed extension : ["
+ Arrays.toString(allowedExtension)
+ "]");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;
}
public String[] getAllowedExtension() {
return allowedExtension;
}
public String getExtension() {
return extension;
}
public String getFilename() {
return filename;
}
public static class InvalidImageExtensionException extends InvalidExtensionException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String[] allowedExtension; public InvalidImageExtensionException(
private String extension; String[] allowedExtension, String extension, String filename) {
private String filename; super(allowedExtension, extension, filename);
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;
} }
}
public String[] getAllowedExtension() public static class InvalidFlashExtensionException extends InvalidExtensionException {
{ private static final long serialVersionUID = 1L;
return allowedExtension;
public InvalidFlashExtensionException(
String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
} }
}
public String getExtension() public static class InvalidMediaExtensionException extends InvalidExtensionException {
{ private static final long serialVersionUID = 1L;
return extension;
public InvalidMediaExtensionException(
String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
} }
}
public String getFilename() public static class InvalidVideoExtensionException extends InvalidExtensionException {
{ private static final long serialVersionUID = 1L;
return filename;
} public InvalidVideoExtensionException(
String[] allowedExtension, String extension, String filename) {
public static class InvalidImageExtensionException extends InvalidExtensionException super(allowedExtension, extension, filename);
{
private static final long serialVersionUID = 1L;
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidFlashExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidMediaExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidVideoExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
} }
}
} }

View File

@ -2,33 +2,33 @@ package com.ruoyi.common.core.exception.job;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class TaskException extends Exception public class TaskException extends Exception {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private Code code; private Code code;
public TaskException(String msg, Code code) public TaskException(String msg, Code code) {
{ this(msg, code, null);
this(msg, code, null); }
}
public TaskException(String msg, Code code, Exception nestedEx) public TaskException(String msg, Code code, Exception nestedEx) {
{ super(msg, nestedEx);
super(msg, nestedEx); this.code = code;
this.code = code; }
}
public Code getCode() public Code getCode() {
{ return code;
return code; }
}
public enum Code public enum Code {
{ TASK_EXISTS,
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE NO_TASK_EXISTS,
} TASK_ALREADY_STARTED,
} UNKNOWN,
CONFIG_ERROR,
TASK_NODE_NOT_AVAILABLE
}
}

View File

@ -2,15 +2,13 @@ package com.ruoyi.common.core.exception.user;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class CaptchaExpireException extends UserException public class CaptchaExpireException extends UserException {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public CaptchaExpireException() public CaptchaExpireException() {
{ super("user.jcaptcha.expire", null);
super("user.jcaptcha.expire", null); }
}
} }

View File

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

View File

@ -2,15 +2,13 @@ package com.ruoyi.common.core.exception.user;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class UserPasswordNotMatchException extends UserException public class UserPasswordNotMatchException extends UserException {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public UserPasswordNotMatchException() public UserPasswordNotMatchException() {
{ super("user.password.not.match", null);
super("user.password.not.match", null); }
}
} }

View File

@ -1,86 +1,82 @@
package com.ruoyi.common.core.text; package com.ruoyi.common.core.text;
import com.ruoyi.common.core.utils.StringUtils;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import com.ruoyi.common.core.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class CharsetKit public class CharsetKit {
{ /** ISO-8859-1 */
/** ISO-8859-1 */ public static final String ISO_8859_1 = "ISO-8859-1";
public static final String ISO_8859_1 = "ISO-8859-1";
/** UTF-8 */
public static final String UTF_8 = "UTF-8";
/** GBK */
public static final String GBK = "GBK";
/** ISO-8859-1 */ /** UTF-8 */
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); public static final String UTF_8 = "UTF-8";
/** UTF-8 */
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
/** GBK */
public static final Charset CHARSET_GBK = Charset.forName(GBK);
/** /** GBK */
* Charset public static final String GBK = "GBK";
*
* @param charset /** ISO-8859-1 */
* @return Charset public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
*/
public static Charset charset(String charset) /** UTF-8 */
{ public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
/** GBK */
public static final Charset CHARSET_GBK = Charset.forName(GBK);
/**
* Charset
*
* @param charset
* @return Charset
*/
public static Charset charset(String charset) {
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
}
/**
*
*
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
* @return
*/
public static String convert(String source, String srcCharset, String destCharset) {
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
}
/**
*
*
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
* @return
*/
public static String convert(String source, Charset srcCharset, Charset destCharset) {
if (null == srcCharset) {
srcCharset = StandardCharsets.ISO_8859_1;
} }
/** if (null == destCharset) {
* destCharset = StandardCharsets.UTF_8;
*
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
* @return
*/
public static String convert(String source, String srcCharset, String destCharset)
{
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
} }
/** if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) {
* return source;
*
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
* @return
*/
public static String convert(String source, Charset srcCharset, Charset destCharset)
{
if (null == srcCharset)
{
srcCharset = StandardCharsets.ISO_8859_1;
}
if (null == destCharset)
{
destCharset = StandardCharsets.UTF_8;
}
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
{
return source;
}
return new String(source.getBytes(srcCharset), destCharset);
} }
return new String(source.getBytes(srcCharset), destCharset);
}
/** /**
* @return * @return
*/ */
public static String systemCharset() public static String systemCharset() {
{ return Charset.defaultCharset().name();
return Charset.defaultCharset().name(); }
}
} }

View File

@ -4,89 +4,73 @@ import com.ruoyi.common.core.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class StrFormatter public class StrFormatter {
{ public static final String EMPTY_JSON = "{}";
public static final String EMPTY_JSON = "{}"; public static final char C_BACKSLASH = '\\';
public static final char C_BACKSLASH = '\\'; public static final char C_DELIM_START = '{';
public static final char C_DELIM_START = '{'; public static final char C_DELIM_END = '}';
public static final char C_DELIM_END = '}';
/** /**
* <br> * <br>
* {} <br> * {} <br>
* {} 使 \\ { {} \ 使 \\\\ <br> * {} 使 \\ { {} \ 使 \\\\ <br>
* <br> * <br>
* 使format("this is {} for {}", "a", "b") -> this is a for b<br> * 使format("this is {} for {}", "a", "b") -> this is a for b<br>
* {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> * {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> * \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
* *
* @param strPattern * @param strPattern
* @param argArray * @param argArray
* @return * @return
*/ */
public static String format(final String strPattern, final Object... argArray) public static String format(final String strPattern, final Object... argArray) {
{ if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) return strPattern;
{
return strPattern;
}
final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;
int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++)
{
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1)
{
if (handledPosition == 0)
{
return strPattern;
}
else
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
}
else
{
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
{
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
{
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
else
{
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1;
}
}
else
{
// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
}
// 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
} }
final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;
int delimIndex; // 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1) {
if (handledPosition == 0) {
return strPattern;
} else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
} else {
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
} else {
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1;
}
} else {
// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
}
// 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
}
} }

View File

@ -16,176 +16,139 @@ import org.apache.commons.lang3.time.DateFormatUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
{ public static String YYYY = "yyyy";
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM"; public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd"; public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = { private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"
};
/** /**
* Date * Date
* *
* @return Date() * @return Date()
*/ */
public static Date getNowDate() public static Date getNowDate() {
{ return new Date();
return new Date(); }
/**
* , yyyy-MM-dd
*
* @return String
*/
public static String getDate() {
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts) {
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
throw new RuntimeException(e);
} }
}
/** /** 日期路径 即年/月/日 如2018/08/08 */
* , yyyy-MM-dd public static final String datePath() {
* Date now = new Date();
* @return String return DateFormatUtils.format(now, "yyyy/MM/dd");
*/ }
public static String getDate()
{
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime() /** 日期路径 即年/月/日 如20180808 */
{ public static final String dateTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS); Date now = new Date();
} return DateFormatUtils.format(now, "yyyyMMdd");
}
public static final String dateTimeNow() /** 日期型字符串转化为日期 格式 */
{ public static Date parseDate(Object str) {
return dateTimeNow(YYYYMMDDHHMMSS); if (str == null) {
return null;
} }
try {
return parseDate(str.toString(), parsePatterns);
} catch (ParseException e) {
return null;
}
}
public static final String dateTimeNow(final String format) /** 获取服务器启动时间 */
{ public static Date getServerStartDate() {
return parseDateToStr(format, new Date()); long time = ManagementFactory.getRuntimeMXBean().getStartTime();
} return new Date(time);
}
public static final String dateTime(final Date date) /** 计算相差天数 */
{ public static int differentDaysByMillisecond(Date date1, Date date2) {
return parseDateToStr(YYYY_MM_DD, date); return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
} }
public static final String parseDateToStr(final String format, final Date date) /**
{ *
return new SimpleDateFormat(format).format(date); *
} * @param endDate
* @param startTime
* @return //
*/
public static String timeDistance(Date endDate, Date startTime) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - startTime.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟";
}
public static final Date dateTime(final String format, final String ts) /** 增加 LocalDateTime ==> Date */
{ public static Date toDate(LocalDateTime temporalAccessor) {
try ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
{ return Date.from(zdt.toInstant());
return new SimpleDateFormat(format).parse(ts); }
}
catch (ParseException e)
{
throw new RuntimeException(e);
}
}
/** /** 增加 LocalDate ==> Date */
* // 2018/08/08 public static Date toDate(LocalDate temporalAccessor) {
*/ LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
public static final String datePath() ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
{ return Date.from(zdt.toInstant());
Date now = new Date(); }
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* // 20180808
*/
public static final String dateTime()
{
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
*
*/
public static Date parseDate(Object str)
{
if (str == null)
{
return null;
}
try
{
return parseDate(str.toString(), parsePatterns);
}
catch (ParseException e)
{
return null;
}
}
/**
*
*/
public static Date getServerStartDate()
{
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
*
*/
public static int differentDaysByMillisecond(Date date1, Date date2)
{
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
/**
*
*
* @param endDate
* @param startTime
* @return //
*/
public static String timeDistance(Date endDate, Date startTime)
{
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - startTime.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟";
}
/**
* LocalDateTime ==> Date
*/
public static Date toDate(LocalDateTime temporalAccessor)
{
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
/**
* LocalDate ==> Date
*/
public static Date toDate(LocalDate temporalAccessor)
{
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
} }

View File

@ -9,31 +9,24 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class ExceptionUtil public class ExceptionUtil {
{ /** 获取exception的详细错误信息。 */
/** public static String getExceptionMessage(Throwable e) {
* exception StringWriter sw = new StringWriter();
*/ e.printStackTrace(new PrintWriter(sw, true));
public static String getExceptionMessage(Throwable e) return sw.toString();
{ }
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
return sw.toString();
}
public static String getRootErrorMessage(Exception e) public static String getRootErrorMessage(Exception e) {
{ Throwable root = ExceptionUtils.getRootCause(e);
Throwable root = ExceptionUtils.getRootCause(e); root = (root == null ? e : root);
root = (root == null ? e : root); if (root == null) {
if (root == null) return "";
{
return "";
}
String msg = root.getMessage();
if (msg == null)
{
return "null";
}
return StringUtils.defaultString(msg);
} }
String msg = root.getMessage();
if (msg == null) {
return "null";
}
return StringUtils.defaultString(msg);
}
} }

View File

@ -1,123 +1,114 @@
package com.ruoyi.common.core.utils; package com.ruoyi.common.core.utils;
import java.util.Map;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.TokenConstants; import com.ruoyi.common.core.constant.TokenConstants;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Map;
/** /**
* Jwt * Jwt
* *
* @author ruoyi * @author ruoyi
*/ */
public class JwtUtils public class JwtUtils {
{ public static String secret = TokenConstants.SECRET;
public static String secret = TokenConstants.SECRET;
/** /**
* *
* *
* @param claims * @param claims
* @return * @return
*/ */
public static String createToken(Map<String, Object> claims) public static String createToken(Map<String, Object> claims) {
{ String token =
String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact(); Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
return token; return token;
} }
/** /**
* *
* *
* @param token * @param token
* @return * @return
*/ */
public static Claims parseToken(String token) public static Claims parseToken(String token) {
{ return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); }
}
/** /**
* *
* *
* @param token * @param token
* @return ID * @return ID
*/ */
public static String getUserKey(String token) public static String getUserKey(String token) {
{ Claims claims = parseToken(token);
Claims claims = parseToken(token); return getValue(claims, SecurityConstants.USER_KEY);
return getValue(claims, SecurityConstants.USER_KEY); }
}
/** /**
* *
* *
* @param claims * @param claims
* @return ID * @return ID
*/ */
public static String getUserKey(Claims claims) public static String getUserKey(Claims claims) {
{ return getValue(claims, SecurityConstants.USER_KEY);
return getValue(claims, SecurityConstants.USER_KEY); }
}
/** /**
* ID * ID
* *
* @param token * @param token
* @return ID * @return ID
*/ */
public static String getUserId(String token) public static String getUserId(String token) {
{ Claims claims = parseToken(token);
Claims claims = parseToken(token); return getValue(claims, SecurityConstants.DETAILS_USER_ID);
return getValue(claims, SecurityConstants.DETAILS_USER_ID); }
}
/** /**
* ID * ID
* *
* @param claims * @param claims
* @return ID * @return ID
*/ */
public static String getUserId(Claims claims) public static String getUserId(Claims claims) {
{ return getValue(claims, SecurityConstants.DETAILS_USER_ID);
return getValue(claims, SecurityConstants.DETAILS_USER_ID); }
}
/** /**
* *
* *
* @param token * @param token
* @return * @return
*/ */
public static String getUserName(String token) public static String getUserName(String token) {
{ Claims claims = parseToken(token);
Claims claims = parseToken(token); return getValue(claims, SecurityConstants.DETAILS_USERNAME);
return getValue(claims, SecurityConstants.DETAILS_USERNAME); }
}
/** /**
* *
* *
* @param claims * @param claims
* @return * @return
*/ */
public static String getUserName(Claims claims) public static String getUserName(Claims claims) {
{ return getValue(claims, SecurityConstants.DETAILS_USERNAME);
return getValue(claims, SecurityConstants.DETAILS_USERNAME); }
}
/** /**
* *
* *
* @param claims * @param claims
* @param key * @param key
* @return * @return
*/ */
public static String getValue(Claims claims, String key) public static String getValue(Claims claims, String key) {
{ return Convert.toStr(claims.get(key), "");
return Convert.toStr(claims.get(key), ""); }
}
} }

View File

@ -7,29 +7,22 @@ import com.ruoyi.common.core.web.page.TableSupport;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class PageUtils extends PageHelper public class PageUtils extends PageHelper {
{ /** 设置请求分页数据 */
/** public static void startPage() {
* PageDomain pageDomain = TableSupport.buildPageRequest();
*/ Integer pageNum = pageDomain.getPageNum();
public static void startPage() Integer pageSize = pageDomain.getPageSize();
{ String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageDomain pageDomain = TableSupport.buildPageRequest(); Boolean reasonable = pageDomain.getReasonable();
Integer pageNum = pageDomain.getPageNum(); PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
Integer pageSize = pageDomain.getPageSize(); }
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
Boolean reasonable = pageDomain.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
/** /** 清理分页的线程变量 */
* 线 public static void clearPage() {
*/ PageHelper.clearPage();
public static void clearPage() }
{
PageHelper.clearPage();
}
} }

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