修改框架

main
lj7788 2025-08-25 10:49:01 +08:00
parent f82e20f68e
commit c2eb35681e
538 changed files with 37850 additions and 36488 deletions

View File

@ -0,0 +1 @@
custom: http://doc.ruoyi.vip/ruoyi-vue/other/donate.html

View File

@ -1,44 +1,47 @@
###################################################################### ######################################################################
# Build Tools # Build Tools
.gradle .gradle
/build/ /build/
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
target/ target/
!.mvn/wrapper/maven-wrapper.jar !.mvn/wrapper/maven-wrapper.jar
###################################################################### ######################################################################
# IDE # IDE
### STS ### ### STS ###
.apt_generated .apt_generated
.classpath .classpath
.factorypath .factorypath
.project .project
.settings .settings
.springBeans .springBeans
### IntelliJ IDEA ### ### IntelliJ IDEA ###
.idea .idea
*.iws *.iws
*.iml *.iml
*.ipr *.ipr
### NetBeans ### ### JRebel ###
nbproject/private/ rebel.xml
build/*
nbbuild/ ### NetBeans ###
dist/ nbproject/private/
nbdist/ build/*
.nb-gradle/ nbbuild/
dist/
###################################################################### nbdist/
# Others .nb-gradle/
*.log
*.xml.versionsBackup ######################################################################
*.swp # Others
*.log
!*/build/*.java *.xml.versionsBackup
!*/build/*.html *.swp
!*/build/*.xml
!*/build/*.java
!*/build/*.html
!*/build/*.xml

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,85 +0,0 @@
## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 特别鸣谢:[element](https://github.com/ElemeFE/element)[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://github.com/elunez/eladmin-web)。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。

View File

@ -1 +0,0 @@
mvn clean

View File

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

View File

@ -1 +0,0 @@
mvn clean package -Dmaven.test.skip=true

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 +0,0 @@
java -Dfile.encoding=utf-8 -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -jar ruoyi-admin/target/examapi.jar

View File

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

View File

@ -1,7 +0,0 @@
package com.hig.onlineexam.mapper;
import com.hig.onlineexam.domain.dto.ExamTitleData;
public interface ExamTitleDataMapper {
public ExamTitleData selectCurrentExam(String userCode);
}

View File

@ -1,7 +0,0 @@
package com.hig.onlineexam.service;
import com.hig.onlineexam.domain.dto.ExamTitleData;
public interface IExamTitleDataService {
public ExamTitleData selectCurrentExam(String userCode);
}

View File

@ -1,125 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.6</version>
</parent>
<artifactId>hig-common</artifactId>
<name>hig-common</name>
<description>应用框架公用部分</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.30</lombok.version>
<gson.version>2.10.1</gson.version>
<jasypt.version>3.0.5</jasypt.version>
<httpclient.version>4.5.14</httpclient.version>
<httpmime.version>4.5.14</httpmime.version>
<httpcore.version>4.4.16</httpcore.version>
<commons-codec.version>1.15</commons-codec.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.15.1</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 发war包的时侯排除tomcat -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${jasypt.version}</version>
</dependency>
<!-- 添加Scheduled坐标 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- Sprng tx 坐标 这个是控制事务的-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpmime.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,163 +0,0 @@
package com.hig.component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
public class GsonUtil {
/**
*
*/
private static final String DATEFORMAT_default = "yyyy-MM-dd HH:mm:ss";
/**
* 使gson
*
* @param json
* @param typeToken
* @return
*/
public static <T> T fromJsonDefault(String json, TypeToken<T> typeToken) {
Gson gson = new Gson();
return gson.fromJson(json, typeToken.getType());
}
/**
* jsonlistmap
*
* @param json
* @param typeToken
* @return
*/
public static <T> T fromJson(String json, TypeToken<T> typeToken) {
Gson gson = new GsonBuilder()
/**
* map
*/
.registerTypeAdapter(new TypeToken<Map<String, Object>>() {
}.getType(), new MapTypeAdapter()).create();
return gson.fromJson(json, typeToken.getType());
}
/**
* jsonbean
*
* @param json
* @param cls
* @return
*/
public static <T> T fromJson(String json, Class<T> cls) {
Gson gson = new GsonBuilder().setDateFormat(DATEFORMAT_default)
.create();
return gson.fromJson(json, cls);
}
/**
* json
*
* @param obj
* @param format
* @return
*/
public static String toJson(Object obj, boolean format) {
GsonBuilder gsonBuilder = new GsonBuilder();
/**
*
*/
gsonBuilder.setDateFormat(DATEFORMAT_default);
/**
*
*/
if (format) {
gsonBuilder.setPrettyPrinting();
}
Gson gson = gsonBuilder.create();
return gson.toJson(obj);
}
public static class MapTypeAdapter extends TypeAdapter<Object> {
@Override
public Object read(JsonReader in) throws IOException {
JsonToken token = in.peek();
switch (token) {
case BEGIN_ARRAY:
List<Object> list = new ArrayList<Object>();
in.beginArray();
while (in.hasNext()) {
list.add(read(in));
}
in.endArray();
return list;
case BEGIN_OBJECT:
Map<String, Object> map = new LinkedTreeMap<String, Object>();
in.beginObject();
while (in.hasNext()) {
map.put(in.nextName(), read(in));
}
in.endObject();
return map;
case STRING:
return in.nextString();
case NUMBER:
/**
*
*/
double dbNum = in.nextDouble();
// 数字超过long的最大值返回浮点类型
if (dbNum > Long.MAX_VALUE) {
return dbNum;
}
// 判断数字是否为整数值
long lngNum = (long) dbNum;
if (dbNum == lngNum) {
return lngNum;
} else {
return dbNum;
}
case BOOLEAN:
return in.nextBoolean();
case NULL:
in.nextNull();
return null;
default:
throw new IllegalStateException();
}
}
@Override
public void write(JsonWriter out, Object value) throws IOException {
// 序列化无需实现
}
}
}

View File

@ -1,177 +0,0 @@
package com.hig.component;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.hig.dto.ResultPackage;
@Component
public class HttpAPIService {
private static final Gson gson = new Gson();
@Autowired
private CloseableHttpClient httpClient;
@Autowired
private RequestConfig config;
/**
* get200body200null
*
* @param url
* @return
* @throws Exception
*/
// get方法
public String doGet(String url) throws Exception {
Map<String, Object> map = new HashMap<>();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000)
.setConnectionRequestTimeout(30000)
.setSocketTimeout(30000)
.setRedirectsEnabled(true)
.build();
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(requestConfig);
String result = null;
try {
HttpResponse httpResponse = httpClient.execute(httpGet);
if (httpResponse.getStatusLine().getStatusCode() == 200) {
result = EntityUtils.toString(httpResponse.getEntity());
} else if (httpResponse.getStatusLine().getStatusCode() == 404) {
throw new Exception("404错误请求的资源不存在");
} else if (httpResponse.getStatusLine().getStatusCode() == 500) {
throw new Exception("500错误,服务器内部错误");
} else
throw new Exception("Http请求出错,返回Http状态码:" + httpResponse.getStatusLine().getStatusCode());
} catch (Exception e) {
throw new Exception("处理httpGet操作出错,\r\n出错信息:" + e.getMessage());
}
return result;
}
// get方法
public Map<String, Object> doGetReturnMap(String url) throws Exception {
Map<String, Object> map = new HashMap<>();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000)
.setConnectionRequestTimeout(30000)
.setSocketTimeout(30000)
.setRedirectsEnabled(true)
.build();
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(requestConfig);
try {
HttpResponse httpResponse = httpClient.execute(httpGet);
// 这个地方调用的时侯有可能会出错,要做出错处理
if (httpResponse.getStatusLine().getStatusCode() == 200) {
String jsonResult = EntityUtils.toString(httpResponse.getEntity());
map = GsonUtil.fromJson(jsonResult,
new TypeToken<Map<String, Object>>() {
});
} else if (httpResponse.getStatusLine().getStatusCode() == 404) {
throw new Exception("404错误请求的资源不存在");
} else if (httpResponse.getStatusLine().getStatusCode() == 500) {
throw new Exception("500错误,服务器内部错误");
} else
throw new Exception("Http请求出错,返回Http状态码:" + httpResponse.getStatusLine().getStatusCode());
} catch (Exception e) {
throw new Exception("处理httpGet操作出错,\r\n出错信息:" + e.getMessage());
}
return map;
}
// post方式
public Map<String, Object> doPost(String url, Map<String, Object> map) throws Exception {
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000)
.setConnectionRequestTimeout(30000)
.setSocketTimeout(30000)
.setRedirectsEnabled(true)
.build();
HttpPost httpPost = new HttpPost(url);
httpPost.setConfig(requestConfig);
httpPost.addHeader("Content-Type", "application/json; chartset=UTF-8");
if (map != null && map.size() > 0) {
StringEntity stringEntity;
try {
String data = new String(JSON.toJSONString(map).getBytes("utf-8"), "iso-8859-1");
stringEntity = new StringEntity(data);
httpPost.setEntity(stringEntity);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
throw new Exception("转换字符集出错,\r\n出错信息:" + e.getMessage());
}
}
Map<String, Object> resultmap = new HashMap<>();
try {
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
if (httpResponse.getStatusLine().getStatusCode() == 200) {
String jsonResult = EntityUtils.toString(httpResponse.getEntity());
resultmap = GsonUtil.fromJson(jsonResult,
new TypeToken<Map<String, Object>>() {
});
} else if (httpResponse.getStatusLine().getStatusCode() == 404) {
throw new Exception("404错误请求的资源不存在");
} else if (httpResponse.getStatusLine().getStatusCode() == 500) {
throw new Exception("500错误,服务器内部错误");
} else
throw new Exception("Http请求出错,返回Http状态码:" + httpResponse.getStatusLine().getStatusCode());
} catch (Exception ex) {
throw new Exception("处理httpPost操作出错,\r\n出错信息:" + ex.getMessage());
}
return resultmap;
}
/**
* post
*
* @param url
* @return
* @throws Exception
*/
public Map<String, Object> doPost(String url) throws Exception {
return this.doPost(url, null);
}
}

View File

@ -1,42 +0,0 @@
package com.hig.component;
import org.apache.http.conn.HttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class IdleConnectionEvictor extends Thread {
@Autowired
private HttpClientConnectionManager connMgr;
private volatile boolean shutdown;
public IdleConnectionEvictor() {
super();
super.start();
}
@Override
public void run() {
try {
while (!shutdown) {
synchronized (this) {
wait(30000);
// 关闭失效的连接
connMgr.closeExpiredConnections();
}
}
} catch (InterruptedException ex) {
// 结束
}
}
//关闭清理无效连接的线程
public void shutdown() {
shutdown = true;
synchronized (this) {
notifyAll();
}
}
}

View File

@ -1,20 +0,0 @@
package com.hig.component;
public class StringUtil {
public static String getFileName(String text) throws Exception {
int start = text.indexOf("\"");
int end = text.lastIndexOf("\"");
String result = null;
if (end > start) {
result = text.substring(start + 1,end);
}
else {
throw new Exception("不是有效的Http头");
}
return result;
}
}

View File

@ -1,99 +0,0 @@
package com.hig.config;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class HttpClient {
@Value("${http.maxTotal}")
private Integer maxTotal;
@Value("${http.defaultMaxPerRoute}")
private Integer defaultMaxPerRoute;
@Value("${http.connectTimeout}")
private Integer connectTimeout;
@Value("${http.connectionRequestTimeout}")
private Integer connectionRequestTimeout;
@Value("${http.socketTimeout}")
private Integer socketTimeout;
@Value("${http.staleConnectionCheckEnabled}")
private boolean staleConnectionCheckEnabled;
/**
*
* @return
*/
@Bean(name = "httpClientConnectionManager")
public PoolingHttpClientConnectionManager getHttpClientConnectionManager(){
PoolingHttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager();
//最大连接数
httpClientConnectionManager.setMaxTotal(maxTotal);
//并发数
httpClientConnectionManager.setDefaultMaxPerRoute(defaultMaxPerRoute);
return httpClientConnectionManager;
}
/**
*
*
* @param httpClientConnectionManager
* @return
*/
@Bean(name = "httpClientBuilder")
public HttpClientBuilder getHttpClientBuilder(@Qualifier("httpClientConnectionManager")PoolingHttpClientConnectionManager httpClientConnectionManager){
//HttpClientBuilder中的构造方法被protected修饰所以这里不能直接使用new来实例化一个HttpClientBuilder可以使用HttpClientBuilder提供的静态方法create()来获取HttpClientBuilder对象
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
httpClientBuilder.setConnectionManager(httpClientConnectionManager);
return httpClientBuilder;
}
/**
* httpClient
* @param httpClientBuilder
* @return
*/
@Bean
public CloseableHttpClient getCloseableHttpClient(@Qualifier("httpClientBuilder") HttpClientBuilder httpClientBuilder){
return httpClientBuilder.build();
}
/**
* BuilderRequestConfig
* RequestConfigcustomBuilder
* builder
* proxycookieSpec
* @return
*/
@Bean(name = "builder")
public RequestConfig.Builder getBuilder(){
RequestConfig.Builder builder = RequestConfig.custom();
return builder.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectionRequestTimeout)
.setSocketTimeout(socketTimeout)
.setStaleConnectionCheckEnabled(staleConnectionCheckEnabled);
}
/**
* 使builderRequestConfig
* @param builder
* @return
*/
@Bean
public RequestConfig getRequestConfig(@Qualifier("builder") RequestConfig.Builder builder){
return builder.build();
}
}

View File

@ -1,41 +0,0 @@
package com.hig.dto;
import java.util.Map;
import lombok.Data;
@Data
public class ResultPackage {
private int errcode;
private String errmsg;
private Object data;
public ResultPackage( ) {
}
public ResultPackage(int errcode, String errmsg, Object data) {
super();
this.errcode = errcode;
this.errmsg = errmsg;
this.data = data;
}
public ResultPackage (Map<String, Object> objmap)
{
String errcode = objmap.get("errcode").toString();
if (errcode.indexOf(".") > 0)
errcode = errcode.substring(0, errcode.indexOf("."));
this.errcode = Integer.parseInt(errcode);
this.errmsg = objmap.get("errmsg").toString();
this.data = objmap.get("data");
}
public ResultPackage Right(Object data)
{
return new ResultPackage(0,"",data);
}
}

View File

@ -1,37 +0,0 @@
package com.hig.httpclient;
public class HttpResult {
// 响应码
private Integer code;
// 响应体
private String body;
public HttpResult() {
super();
}
public HttpResult(Integer code, String body) {
super();
this.code = code;
this.body = body;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}

View File

@ -1,19 +0,0 @@
package com.hig.utils;
import java.util.Base64;
public class Base64Coder {
public static String Encode(byte[] bytes)
{
return Base64.getEncoder().encodeToString(bytes);
}
public static byte[] Decode(String basestr) throws Exception
{
try {
return Base64.getDecoder().decode(basestr);
} catch (IllegalArgumentException e) {
throw new Exception(e.getMessage());
}
}
}

View File

@ -1,61 +0,0 @@
package com.hig.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtils {
public static String toString(Date date)
{
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateformat.format(date);
}
public static String toMonthDayString(Date date)
{
SimpleDateFormat dateformat = new SimpleDateFormat("MMdd");
return dateformat.format(date);
}
public static String toYearString(Date date)
{
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy");
return dateformat.format(date);
}
public static String toDateString()
{
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMdd");
return dateformat.format(new Date());
}
public static String toShortDateString(Date date)
{
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
return dateformat.format(date);
}
public static String toMonthDayString()
{
SimpleDateFormat dateformat = new SimpleDateFormat("MMdd");
return dateformat.format(new Date());
}
public static String toYearString()
{
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy");
return dateformat.format(new Date());
}
}

View File

@ -1,34 +0,0 @@
package com.hig.utils;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig;
public class EncryUtils {
private static String password = "Z1cZbNeiq75+w==3Y1p2ioY";
public static String EncryText(String text) {
StandardPBEStringEncryptor encryptOr = new StandardPBEStringEncryptor();
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
config.setAlgorithm("PBEWithMD5AndDES");
config.setPassword(password);
// 应用配置
encryptOr.setConfig(config);
return encryptOr.encrypt(text);
}
public static String DecryText(String entext) {
if (entext == null || entext.equals("")) return null;
StandardPBEStringEncryptor encryptOr = new StandardPBEStringEncryptor();
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
config.setAlgorithm("PBEWithMD5AndDES");
config.setPassword(password);
// 应用配置
encryptOr.setConfig(config);
return encryptOr.decrypt(entext);
}
}

View File

@ -1,28 +0,0 @@
package com.hig.utils;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
/**
* @author Binary Wang(https://github.com/binarywang)
*/
public class JsonUtils {
private static final ObjectMapper JSON = new ObjectMapper();
static {
JSON.setSerializationInclusion(Include.NON_NULL);
JSON.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE);
}
public static String toJson(Object obj) {
try {
return JSON.writeValueAsString(obj);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -1,104 +0,0 @@
package com.hig.utils;
import java.util.Random;
public class NameBuilder {
private static String xings = "赵 钱 孙 李 周 吴 郑 王 冯 陈 褚 卫 " + "蒋 沈 韩 杨 朱 秦 尤 许 何 吕 施 张 " + "孔 曹 严 华 金 魏 陶 姜 戚 谢 邹 喻 "
+ "柏 水 窦 章 云 苏 潘 葛 奚 范 彭 郎 " + "万俟 司马 上官 欧阳 夏侯 诸葛 闻人 东方 赫连 皇甫 尉迟 公羊";
private static String mings = "碧凡、夏菡、曼香、若烟、半梦、雅绿、冰蓝、灵槐、平安、书翠、翠风、香巧、代云、" + "友巧、听寒、梦柏、醉易、访旋、亦玉、凌萱、访卉、怀亦、笑蓝、春翠、靖柏、书雪、"
+ "乐枫、念薇、靖雁、寻春、恨山、从寒、忆香、觅波、静曼、凡旋、新波、代真、新蕾、" + "雁玉、冷卉、紫山、千琴、恨天、傲芙、盼山、怀蝶、冰兰、问旋、从南、白易、问筠、"
+ "如霜、半芹、寒雁、怜云、寻文、谷雪、乐萱、涵菡、海莲、傲蕾、青槐、冬儿、易梦、" + "惜雪、宛海、之柔、夏青";
private static Random r = new Random();
/**
* 使xings
* @param xing
* @param length
* @return
*/
public static String build(String xing, int length) {
// 定义姓名
String xingming = xing;
//创建随机对象
Random r = new Random();
while (xingming.length() < length) {
// 从名字符串中随机取出一个字符的编号
int index = r.nextInt(mings.length());
// 从名字字符串中取一个字
String s = mings.substring(index, index + 1);
// 如果s是顿号就重新再取一次使用常量比变量这是推荐的方式
if ("、".equals(s)) {
continue;
} else {
//将名 加到 姓名中取
xingming += s;
}
}
return xingming;
}
/**
* 使xingsxings
* @param length
* @return
*/
public static String build(int length) {
// 判断姓名的长度必须大于 2
if (length < 2) {
System.out.println("姓名不能少于2个字符");
return null;
}
/**
*
* xings
*/
// 先随机选姓氏
Random r = new Random();
String[] xingArr = xings.split(" ");
int index = r.nextInt(xingArr.length);
String xing = xingArr[index];
// 有了姓氏再调用上面的选名字的方法就OK了
return build(xing, length);
}
/**
* 2~3
* @return
*/
public static String build() {
int length = r.nextInt(2) + 2;
return build(length);
}
public static void main(String[] args) {
System.out.println("\r\n指定姓氏造100个3个字的名字");
for (int i = 0; i < 100; i++) {
System.out.print(build("廖", 3) + "");
if ((i + 1) % 10 == 0) {
System.out.println();
}
}
System.out.println("\r\n不指定姓氏造100个3个字的名字");
for (int i = 0; i < 100; i++) {
System.out.print(build(3) + "");
if ((i + 1) % 10 == 0) {
System.out.println();
}
}
System.out.println("\r\n随机造100个名2~3个字的字");
for (int i = 0; i < 100; i++) {
System.out.print(build() + "\t");
if ((i + 1) % 10 == 0) {
System.out.println();
}
}
}
}

View File

@ -1,32 +0,0 @@
package com.hig.utils;
import java.util.HashMap;
import java.util.Map;
import com.hig.dto.ResultPackage;
public class PackageWork {
public static Map<String, Object> ToMap(int errcode,String errmsg,Object data)
{
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("errcode", errcode);
resultMap.put("errmsg", errmsg);
resultMap.put("data", data);
return resultMap;
}
public static Map<String, Object> Right(Object data)
{
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("errcode", 0);
resultMap.put("errmsg", "");
resultMap.put("data", data);
return resultMap;
}
}

View File

@ -1,62 +0,0 @@
package com.hig.utils;
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class RandomNameUtils {
//百家姓
private static final String[] Surname= {"赵","钱","孙","李","周","吴","郑","王","冯","陈","褚","卫","蒋","沈","韩","杨","朱","秦","尤","许",
"何","吕","施","张","孔","曹","严","华","金","魏","陶","姜","戚","谢","邹","喻","柏","水","窦","章","云","苏","潘","葛","奚","范","彭","郎",
"鲁","韦","昌","马","苗","凤","花","方","俞","任","袁","柳","酆","鲍","史","唐","费","廉","岑","薛","雷","贺","倪","汤","滕","殷",
"罗","毕","郝","邬","安","常","乐","于","时","傅","皮","卞","齐","康","伍","余","元","卜","顾","孟","平","黄","和",
"穆","萧","尹","姚","邵","湛","汪","祁","毛","禹","狄","米","贝","明","臧","计","伏","成","戴","谈","宋","茅","庞","熊","纪","舒",
"屈","项","祝","董","梁","杜","阮","蓝","闵","席","季","麻","强","贾","路","娄","危","江","童","颜","郭","梅","盛","林","刁","钟",
"徐","邱","骆","高","夏","蔡","田","樊","胡","凌","霍","虞","万","支","柯","昝","管","卢","莫","经","房","裘","缪","干","解","应",
"宗","丁","宣","贲","邓","郁","单","杭","洪","包","诸","左","石","崔","吉","钮","龚","程","嵇","邢","滑","裴","陆","荣","翁","荀",
"羊","于","惠","甄","曲","家","封","芮","羿","储","靳","汲","邴","糜","松","井","段","富","巫","乌","焦","巴","弓","牧","隗","山",
"谷","车","侯","宓","蓬","全","郗","班","仰","秋","仲","伊","宫","宁","仇","栾","暴","甘","钭","厉","戎","祖","武","符","刘","景",
"詹","束","龙","叶","幸","司","韶","郜","黎","蓟","溥","印","宿","白","怀","蒲","邰","从","鄂","索","咸","籍","赖","卓","蔺","屠",
"蒙","池","乔","阴","郁","胥","能","苍","双","闻","莘","党","翟","谭","贡","劳","逄","姬","申","扶","堵","冉","宰","郦","雍","却",
"璩","桑","桂","濮","牛","寿","通","边","扈","燕","冀","浦","尚","农","温","别","庄","晏","柴","瞿","阎","充","慕","连","茹","习",
"宦","艾","鱼","容","向","古","易","慎","戈","廖","庾","终","暨","居","衡","步","都","耿","满","弘","匡","国","文","寇","广","禄",
"阙","东","欧","殳","沃","利","蔚","越","夔","隆","师","巩","厍","聂","晁","勾","敖","融","冷","訾","辛","阚","那","简","饶","空",
"曾","毋","沙","乜","养","鞠","须","丰","巢","关","蒯","相","查","后","荆","红","游","郏","竺","权","逯","盖","益","桓","公","仉",
"督","岳","帅","缑","亢","况","郈","有","琴","归","海","晋","楚","闫","法","汝","鄢","涂","钦","商","牟","佘","佴","伯","赏","墨",
"哈","谯","篁","年","爱","阳","佟","言","福","南","火","铁","迟","漆","官","冼","真","展","繁","檀","祭","密","敬","揭","舜","楼",
"疏","冒","浑","挚","胶","随","高","皋","原","种","练","弥","仓","眭","蹇","覃","阿","门","恽","来","綦","召","仪","风","介","巨",
"木","京","狐","郇","虎","枚","抗","达","杞","苌","折","麦","庆","过","竹","端","鲜","皇","亓","老","是","秘","畅","邝","还","宾",
"闾","辜","纵","侴","万俟","司马","上官","欧阳","夏侯","诸葛","闻人","东方","赫连","皇甫","羊舌","尉迟","公羊","澹台","公冶","宗正",
"濮阳","淳于","单于","太叔","申屠","公孙","仲孙","轩辕","令狐","钟离","宇文","长孙","慕容","鲜于","闾丘","司徒","司空","兀官","司寇",
"南门","呼延","子车","颛孙","端木","巫马","公西","漆雕","车正","壤驷","公良","拓跋","夹谷","宰父","谷梁","段干","百里","东郭","微生",
"梁丘","左丘","东门","西门","南宫","第五","公仪","公乘","太史","仲长","叔孙","屈突","尔朱","东乡","相里","胡母","司城","张廖","雍门",
"毋丘","贺兰","綦毋","屋庐","独孤","南郭","北宫","王孙"};
public static String getChineseName() {
String str = null;
String name = null;
int highPos, lowPos;
Random random = new Random();
//区码0xA0打头从第16区开始即0xB0=11*16=176,16~55一级汉字56~87二级汉字
highPos = (176 + Math.abs(random.nextInt(72)));
random=new Random();
//位码0xA0打头范围第1~94列
lowPos = 161 + Math.abs(random.nextInt(94));
byte[] bArr = new byte[2];
bArr[0] = (new Integer(highPos)).byteValue();
bArr[1] = (new Integer(lowPos)).byteValue();
try {
//区位码组合成汉字
str = new String(bArr, "GB2312");
int index=random.nextInt(Surname.length-1);
//获得一个随机的姓氏
name = Surname[index] +str;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return name;
}
}

View File

@ -1,17 +0,0 @@
package com.hig.utils;
import java.util.Random;
public class RandomUtils {
// 随机生成16位字符串
public static String get16Str() {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 16; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
}

View File

@ -1,5 +0,0 @@
package com.hig.utils;
public class ResultUtils {
}

View File

@ -1,90 +0,0 @@
package com.hig.utils;
import java.net.InetAddress;
public class UUIDGenerator {
/**
* 32UUID
*
* @return
*/
public static String generate() {
return new StringBuilder(32).append(format(getIP())).append(
format(getJVM())).append(format(getHiTime())).append(
format(getLoTime())).append(format(getCount())).toString();
}
private static final int IP;
static {
int ipadd;
try {
ipadd = toInt(InetAddress.getLocalHost().getAddress());
} catch (Exception e) {
ipadd = 0;
}
IP = ipadd;
}
private static short counter = (short) 0;
private static final int JVM = (int) (System.currentTimeMillis() >>> 8);
private final static String format(int intval) {
String formatted = Integer.toHexString(intval);
StringBuilder buf = new StringBuilder("00000000");
buf.replace(8 - formatted.length(), 8, formatted);
return buf.toString();
}
private final static String format(short shortval) {
String formatted = Integer.toHexString(shortval);
StringBuilder buf = new StringBuilder("0000");
buf.replace(4 - formatted.length(), 4, formatted);
return buf.toString();
}
private final static int getJVM() {
return JVM;
}
private final static short getCount() {
synchronized (UUIDGenerator.class) {
if (counter < 0) {
counter = 0;
}
return counter++;
}
}
/**
* Unique in a local network
*/
private final static int getIP() {
return IP;
}
/**
* Unique down to millisecond
*/
private final static short getHiTime() {
return (short) (System.currentTimeMillis() >>> 32);
}
private final static int getLoTime() {
return (int) System.currentTimeMillis();
}
private final static int toInt(byte[] bytes) {
int result = 0;
for (int i = 0; i < 4; i++) {
result = (result << 8) - Byte.MIN_VALUE + (int) bytes[i];
}
return result;
}
}

View File

@ -1,3 +0,0 @@
{
"lockfileVersion": 1
}

View File

@ -1,312 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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.8.6</version> <version>3.8.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.8.6</ruoyi.version> <ruoyi.version>3.8.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>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.16</druid.version> <druid.version>1.2.16</druid.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version> <swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.2</kaptcha.version> <kaptcha.version>2.3.3</kaptcha.version>
<mybatis-spring-boot.version>2.3.2</mybatis-spring-boot.version> <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
<!-- <oracle.version>12.2.0.1.0</oracle.version> --> <fastjson.version>2.0.34</fastjson.version>
<pagehelper.boot.version>1.4.7</pagehelper.boot.version> <oshi.version>6.4.3</oshi.version>
<fastjson.version>1.2.83</fastjson.version> <commons.io.version>2.11.0</commons.io.version>
<oshi.version>6.4.6</oshi.version> <commons.collections.version>3.2.2</commons.collections.version>
<jna.version>5.13.0</jna.version> <poi.version>4.1.2</poi.version>
<commons.io.version>2.15.1</commons.io.version> <velocity.version>2.3</velocity.version>
<commons.fileupload.version>1.5</commons.fileupload.version> <jwt.version>0.9.1</jwt.version>
<commons.collections.version>3.2.2</commons.collections.version> </properties>
<poi.version>5.2.4</poi.version>
<velocity.version>2.3</velocity.version> <!-- 依赖声明 -->
<jwt.version>0.9.1</jwt.version> <dependencyManagement>
<mysql.version>8.0.33</mysql.version> <dependencies>
<weixin.version>4.5.0</weixin.version>
<qrgen.version>3.0.1</qrgen.version> <!-- SpringBoot的依赖配置-->
</properties> <dependency>
<groupId>org.springframework.boot</groupId>
<!-- 依赖声明 --> <artifactId>spring-boot-dependencies</artifactId>
<dependencyManagement> <version>2.5.15</version>
<dependencies> <type>pom</type>
<scope>import</scope>
<!-- SpringBoot的依赖配置--> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <!-- 阿里数据库连接池 -->
<artifactId>spring-boot-dependencies</artifactId> <dependency>
<version>2.5.15</version> <groupId>com.alibaba</groupId>
<type>pom</type> <artifactId>druid-spring-boot-starter</artifactId>
<scope>import</scope> <version>${druid.version}</version>
</dependency> </dependency>
<!-- 阿里数据库连接池 --> <!-- 解析客户端操作系统、浏览器等 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>eu.bitwalker</groupId>
<artifactId>druid-spring-boot-starter</artifactId> <artifactId>UserAgentUtils</artifactId>
<version>${druid.version}</version> <version>${bitwalker.version}</version>
</dependency> </dependency>
<!-- 解析客户端操作系统、浏览器等 --> <!-- pagehelper 分页插件 -->
<dependency> <dependency>
<groupId>eu.bitwalker</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>UserAgentUtils</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${bitwalker.version}</version> <version>${pagehelper.boot.version}</version>
</dependency> </dependency>
<!-- SpringBoot集成mybatis框架 --> <!-- 获取系统信息 -->
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>com.github.oshi</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>oshi-core</artifactId>
<version>${mybatis-spring-boot.version}</version> <version>${oshi.version}</version>
</dependency> </dependency>
<!--oracle驱动--> <!-- Swagger3依赖 -->
<!-- <dependency> <dependency>
<groupId>com.oracle</groupId> <groupId>io.springfox</groupId>
<artifactId>ojdbc8</artifactId> <artifactId>springfox-boot-starter</artifactId>
<version>${oracle.version}</version> <version>${swagger.version}</version>
</dependency> --> <exclusions>
<exclusion>
<!-- pagehelper 分页插件 --> <groupId>io.swagger</groupId>
<dependency> <artifactId>swagger-models</artifactId>
<groupId>com.github.pagehelper</groupId> </exclusion>
<artifactId>pagehelper-spring-boot-starter</artifactId> </exclusions>
<version>${pagehelper.boot.version}</version> </dependency>
</dependency>
<!-- io常用工具类 -->
<!-- 获取系统信息 --> <dependency>
<dependency> <groupId>commons-io</groupId>
<groupId>com.github.oshi</groupId> <artifactId>commons-io</artifactId>
<artifactId>oshi-core</artifactId> <version>${commons.io.version}</version>
<version>${oshi.version}</version> </dependency>
</dependency>
<!-- excel工具 -->
<dependency> <dependency>
<groupId>net.java.dev.jna</groupId> <groupId>org.apache.poi</groupId>
<artifactId>jna</artifactId> <artifactId>poi-ooxml</artifactId>
<version>${jna.version}</version> <version>${poi.version}</version>
</dependency> </dependency>
<dependency> <!-- velocity代码生成使用模板 -->
<groupId>net.java.dev.jna</groupId> <dependency>
<artifactId>jna-platform</artifactId> <groupId>org.apache.velocity</groupId>
<version>${jna.version}</version> <artifactId>velocity-engine-core</artifactId>
</dependency> <version>${velocity.version}</version>
</dependency>
<!-- Swagger3依赖 -->
<dependency> <!-- collections工具类 -->
<groupId>io.springfox</groupId> <dependency>
<artifactId>springfox-boot-starter</artifactId> <groupId>commons-collections</groupId>
<version>${swagger.version}</version> <artifactId>commons-collections</artifactId>
<exclusions> <version>${commons.collections.version}</version>
<exclusion> </dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <!-- 阿里JSON解析器 -->
</exclusion> <dependency>
</exclusions> <groupId>com.alibaba.fastjson2</groupId>
</dependency> <artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
<!-- io常用工具类 --> </dependency>
<dependency>
<groupId>commons-io</groupId> <!-- Validation -->
<artifactId>commons-io</artifactId> <dependency>
<version>${commons.io.version}</version> <groupId>org.springframework.boot</groupId>
</dependency> <artifactId>spring-boot-starter-validation</artifactId>
<version>2.5.15</version>
<!-- 文件上传工具类 --> </dependency>
<dependency>
<groupId>commons-fileupload</groupId> <!-- MySQL 连接器 -->
<artifactId>commons-fileupload</artifactId> <dependency>
<version>${commons.fileupload.version}</version> <groupId>com.mysql</groupId>
</dependency> <artifactId>mysql-connector-j</artifactId>
<version>8.0.33</version>
<!-- excel工具 --> </dependency>
<dependency>
<groupId>org.apache.poi</groupId> <!-- Token生成与解析-->
<artifactId>poi-ooxml</artifactId> <dependency>
<version>${poi.version}</version> <groupId>io.jsonwebtoken</groupId>
</dependency> <artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
<!-- velocity代码生成使用模板 --> </dependency>
<dependency>
<groupId>org.apache.velocity</groupId> <!-- 验证码 -->
<artifactId>velocity-engine-core</artifactId> <dependency>
<version>${velocity.version}</version> <groupId>pro.fessional</groupId>
</dependency> <artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
<!-- collections工具类 --> </dependency>
<dependency>
<groupId>commons-collections</groupId> <!-- 定时任务-->
<artifactId>commons-collections</artifactId> <dependency>
<version>${commons.collections.version}</version> <groupId>com.ruoyi</groupId>
</dependency> <artifactId>ruoyi-quartz</artifactId>
<version>${ruoyi.version}</version>
<!-- 阿里JSON解析器 --> </dependency>
<dependency>
<groupId>com.alibaba</groupId> <!-- 代码生成-->
<artifactId>fastjson</artifactId> <dependency>
<version>${fastjson.version}</version> <groupId>com.ruoyi</groupId>
</dependency> <artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version>
<!-- MySQL驱动 --> </dependency>
<dependency>
<groupId>com.mysql</groupId> <!-- 核心模块-->
<artifactId>mysql-connector-j</artifactId> <dependency>
<version>${mysql.version}</version> <groupId>com.ruoyi</groupId>
</dependency> <artifactId>ruoyi-framework</artifactId>
<version>${ruoyi.version}</version>
<!-- Token生成与解析--> </dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId> <!-- 系统模块-->
<artifactId>jjwt</artifactId> <dependency>
<version>${jwt.version}</version> <groupId>com.ruoyi</groupId>
</dependency> <artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version>
<!-- 验证码 --> </dependency>
<dependency>
<groupId>com.github.penggle</groupId> <!-- 通用工具-->
<artifactId>kaptcha</artifactId> <dependency>
<version>${kaptcha.version}</version> <groupId>com.ruoyi</groupId>
</dependency> <artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version>
<!-- 微信开发SDK --> </dependency>
<dependency>
<groupId>com.github.binarywang</groupId> <dependency>
<artifactId>weixin-java-mp</artifactId> <groupId>com.ruoyi</groupId>
<version>${weixin.version}</version> <artifactId>yanzhu-exam</artifactId>
</dependency> <version>${ruoyi.version}</version>
</dependency>
<!-- 二维码生成工具 --> </dependencies>
<dependency> </dependencyManagement>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId> <modules>
<version>3.5.3</version> <module>ruoyi-admin</module>
</dependency> <module>ruoyi-framework</module>
<module>ruoyi-system</module>
<!-- 定时任务--> <module>ruoyi-quartz</module>
<dependency> <module>ruoyi-generator</module>
<groupId>com.ruoyi</groupId> <module>ruoyi-common</module>
<artifactId>ruoyi-quartz</artifactId> <module>yanzhu-exam</module>
<version>${ruoyi.version}</version> </modules>
</dependency> <packaging>pom</packaging>
<!-- 代码生成--> <build>
<dependency> <plugins>
<groupId>com.ruoyi</groupId> <plugin>
<artifactId>ruoyi-generator</artifactId> <groupId>org.apache.maven.plugins</groupId>
<version>${ruoyi.version}</version> <artifactId>maven-compiler-plugin</artifactId>
</dependency> <version>3.1</version>
<configuration>
<!-- 核心模块--> <source>${java.version}</source>
<dependency> <target>${java.version}</target>
<groupId>com.ruoyi</groupId> <encoding>${project.build.sourceEncoding}</encoding>
<artifactId>ruoyi-framework</artifactId> </configuration>
<version>${ruoyi.version}</version> </plugin>
</dependency> </plugins>
</build>
<!-- 系统模块-->
<dependency> <repositories>
<groupId>com.ruoyi</groupId> <repository>
<artifactId>ruoyi-system</artifactId> <id>public</id>
<version>${ruoyi.version}</version> <name>aliyun nexus</name>
</dependency> <url>https://maven.aliyun.com/repository/public</url>
<releases>
<!-- 通用工具--> <enabled>true</enabled>
<dependency> </releases>
<groupId>com.ruoyi</groupId> </repository>
<artifactId>ruoyi-common</artifactId> </repositories>
<version>${ruoyi.version}</version>
</dependency> <pluginRepositories>
<pluginRepository>
<!-- 扩展应用--> <id>public</id>
<!-- <dependency> <name>aliyun nexus</name>
<groupId>com.ruoyi</groupId> <url>https://maven.aliyun.com/repository/public</url>
<artifactId>ruoyi-application</artifactId> <releases>
<version>${ruoyi.version}</version> <enabled>true</enabled>
</dependency> --> </releases>
<dependency> <snapshots>
<groupId>com.ruoyi</groupId> <enabled>false</enabled>
<artifactId>hig-application</artifactId> </snapshots>
<version>${ruoyi.version}</version> </pluginRepository>
</dependency> </pluginRepositories>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>hig-common</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-admin</module>
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<!-- <module>ruoyi-application</module> -->
<module>hig-application</module>
<module>hig-common</module>
</modules>
<packaging>pom</packaging>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<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> </project>

View File

@ -1,108 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<version>3.8.6</version> <version>3.8.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>ruoyi-admin</artifactId> <artifactId>examapi</artifactId>
<description> <description>
web服务入口 web服务入口
</description> </description>
<dependencies> <dependencies>
<!-- spring-boot-devtools --> <!-- spring-boot-devtools -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 --> <optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency> </dependency>
<!-- swagger3--> <!-- swagger3-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId> <artifactId>springfox-boot-starter</artifactId>
</dependency> </dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 --> <!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>
<version>1.6.2</version> <version>1.6.2</version>
</dependency> </dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-j</artifactId>
</dependency> </dependency>
<!--oracle驱动--> <!-- 核心模块-->
<!-- <dependency>--> <dependency>
<!-- <groupId>com.oracle</groupId>--> <groupId>com.ruoyi</groupId>
<!-- <artifactId>ojdbc8</artifactId>--> <artifactId>ruoyi-framework</artifactId>
<!-- <version>12.2.0.1.0</version>--> </dependency>
<!-- </dependency> -->
<!-- 核心模块--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-quartz</artifactId>
</dependency> </dependency>
<!-- 定时任务--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<!-- 代码生成--> <!-- 扩展应用-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>yanzhu-exam</artifactId>
</dependency> </dependency>
</dependencies>
<!-- 扩展应用-->
<dependency> <build>
<groupId>com.ruoyi</groupId> <plugins>
<artifactId>hig-application</artifactId> <plugin>
</dependency> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</dependencies> <version>2.1.1.RELEASE</version>
<configuration>
<build> <fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
<plugins> </configuration>
<plugin> <executions>
<groupId>org.springframework.boot</groupId> <execution>
<artifactId>spring-boot-maven-plugin</artifactId> <goals>
<version>2.5.15</version> <goal>repackage</goal>
<configuration> </goals>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 --> </execution>
</configuration> </executions>
<executions> </plugin>
<execution> <plugin>
<goals> <groupId>org.apache.maven.plugins</groupId>
<goal>repackage</goal> <artifactId>maven-war-plugin</artifactId>
</goals> <version>3.1.0</version>
</execution> <configuration>
</executions> <failOnMissingWebXml>false</failOnMissingWebXml>
</plugin> <warName>${project.artifactId}</warName>
<plugin> </configuration>
<groupId>org.apache.maven.plugins</groupId> </plugin>
<artifactId>maven-war-plugin</artifactId> </plugins>
<version>3.4.0</version> <finalName>${project.artifactId}</finalName>
<configuration> </build>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>examapi</warName>
</configuration>
</plugin>
</plugins>
<finalName>examapi</finalName>
</build>
</project> </project>

View File

@ -1,32 +1,33 @@
package com.ruoyi; package com.ruoyi;
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 org.springframework.context.annotation.ComponentScan; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* /**
* *
* @author ruoyi *
*/ * @author ruoyi
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) */
@ComponentScan(basePackages = {"com.ruoyi","com.hig"}) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication @ComponentScan(basePackages = {"com.ruoyi", "com.yanzhu.exam"})
{ public class RuoYiApplication
public static void main(String[] args) {
{ public static void main(String[] args)
// System.setProperty("spring.devtools.restart.enabled", "false"); {
SpringApplication.run(RuoYiApplication.class, args); // System.setProperty("spring.devtools.restart.enabled", "false");
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + SpringApplication.run(RuoYiApplication.class, args);
" .-------. ____ __ \n" + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" | _ _ \\ \\ \\ / / \n" + " .-------. ____ __ \n" +
" | ( ' ) | \\ _. / ' \n" + " | _ _ \\ \\ \\ / / \n" +
" |(_ o _) / _( )_ .' \n" + " | ( ' ) | \\ _. / ' \n" +
" | (_,_).' __ ___(_ o _)' \n" + " |(_ o _) / _( )_ .' \n" +
" | |\\ \\ | || |(_,_)' \n" + " | (_,_).' __ ___(_ o _)' \n" +
" | | \\ `' /| `-' / \n" + " | |\\ \\ | || |(_,_)' \n" +
" | | \\ / \\ / \n" + " | | \\ `' /| `-' / \n" +
" ''-' `'-' `-..-' "); " | | \\ / \\ / \n" +
} " ''-' `'-' `-..-' ");
} }
}

View File

@ -1,18 +1,18 @@
package com.ruoyi; package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/** /**
* web * web
* *
* @author ruoyi * @author ruoyi
*/ */
public class RuoYiServletInitializer extends SpringBootServletInitializer public class RuoYiServletInitializer extends SpringBootServletInitializer
{ {
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{ {
return application.sources(RuoYiApplication.class); return application.sources(RuoYiApplication.class);
} }
} }

View File

@ -1,96 +1,94 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.util.FastByteArrayOutputStream; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController; import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.Producer; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
/**
* /**
* *
* @author ruoyi *
*/ * @author ruoyi
@RestController */
public class CaptchaController @RestController
{ public class CaptchaController
@Resource(name = "captchaProducer") {
private Producer captchaProducer; @Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath; @Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache; @Autowired
private RedisCache redisCache;
// 验证码类型
@Value("${ruoyi.captchaType}") @Autowired
private String captchaType; private ISysConfigService configService;
/**
@Autowired *
private ISysConfigService configService; */
/** @GetMapping("/captchaImage")
* public AjaxResult getCode(HttpServletResponse response) throws IOException
*/ {
@GetMapping("/captchaImage") AjaxResult ajax = AjaxResult.success();
public AjaxResult getCode(HttpServletResponse response) throws IOException boolean captchaEnabled = configService.selectCaptchaEnabled();
{ ajax.put("captchaEnabled", captchaEnabled);
AjaxResult ajax = AjaxResult.success(); if (!captchaEnabled)
boolean captchaOnOff = configService.selectCaptchaOnOff(); {
ajax.put("captchaOnOff", captchaOnOff); return ajax;
if (!captchaOnOff) }
{
return ajax; // 保存验证码信息
} String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
// 保存验证码信息
String uuid = IdUtils.simpleUuid(); String capStr = null, code = null;
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; BufferedImage image = null;
String capStr = null, code = null; // 生成验证码
BufferedImage image = null; String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType))
// 生成验证码 {
if ("math".equals(captchaType)) String capText = captchaProducerMath.createText();
{ capStr = capText.substring(0, capText.lastIndexOf("@"));
String capText = captchaProducerMath.createText(); code = capText.substring(capText.lastIndexOf("@") + 1);
capStr = capText.substring(0, capText.lastIndexOf("@")); image = captchaProducerMath.createImage(capStr);
code = capText.substring(capText.lastIndexOf("@") + 1); }
image = captchaProducerMath.createImage(capStr); else if ("char".equals(captchaType))
} {
else if ("char".equals(captchaType)) capStr = code = captchaProducer.createText();
{ image = captchaProducer.createImage(capStr);
capStr = code = captchaProducer.createText(); }
image = captchaProducer.createImage(capStr);
} redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); FastByteArrayOutputStream os = new FastByteArrayOutputStream();
// 转换流信息写出 try
FastByteArrayOutputStream os = new FastByteArrayOutputStream(); {
try ImageIO.write(image, "jpg", os);
{ }
ImageIO.write(image, "jpg", os); catch (IOException e)
} {
catch (IOException e) return AjaxResult.error(e.getMessage());
{ }
return AjaxResult.error(e.getMessage());
} ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
ajax.put("uuid", uuid); return ajax;
ajax.put("img", Base64.encode(os.toByteArray())); }
return ajax; }
}
}

View File

@ -1,118 +1,163 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import javax.servlet.http.HttpServletRequest; import java.util.ArrayList;
import javax.servlet.http.HttpServletResponse; import java.util.List;
import org.slf4j.Logger; import javax.servlet.http.HttpServletRequest;
import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.slf4j.Logger;
import org.springframework.http.MediaType; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.PostMapping;
import com.ruoyi.common.config.RuoYiConfig; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.constant.Constants; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.config.ServerConfig; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
/** import com.ruoyi.common.utils.file.FileUtils;
* import com.ruoyi.framework.config.ServerConfig;
*
* @author ruoyi /**
*/ *
@RestController *
public class CommonController * @author ruoyi
{ */
private static final Logger log = LoggerFactory.getLogger(CommonController.class); @RestController
@RequestMapping("/common")
@Autowired public class CommonController
private ServerConfig serverConfig; {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
/**
* @Autowired
* private ServerConfig serverConfig;
* @param fileName
* @param delete private static final String FILE_DELIMETER = ",";
*/
@GetMapping("common/download") /**
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) *
{ *
try * @param fileName
{ * @param delete
if (!FileUtils.checkAllowDownload(fileName)) */
{ @GetMapping("/download")
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
} {
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); try
String filePath = RuoYiConfig.getDownloadPath() + fileName; {
if (!FileUtils.checkAllowDownload(fileName))
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); {
FileUtils.setAttachmentResponseHeader(response, realFileName); throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
FileUtils.writeBytes(filePath, response.getOutputStream()); }
if (delete) String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
{ String filePath = RuoYiConfig.getDownloadPath() + fileName;
FileUtils.deleteFile(filePath);
} response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
} FileUtils.setAttachmentResponseHeader(response, realFileName);
catch (Exception e) FileUtils.writeBytes(filePath, response.getOutputStream());
{ if (delete)
log.error("下载文件失败", e); {
} FileUtils.deleteFile(filePath);
} }
}
/** catch (Exception e)
* {
*/ log.error("下载文件失败", e);
@PostMapping("/common/upload") }
public AjaxResult uploadFile(MultipartFile file) throws Exception }
{
try /**
{ *
// 上传文件路径 */
String filePath = RuoYiConfig.getUploadPath(); @PostMapping("/upload")
// 上传并返回新文件名称 public AjaxResult uploadFile(MultipartFile file) throws Exception
String fileName = FileUploadUtils.upload(filePath, file); {
String url = serverConfig.getUrl() + fileName; try
AjaxResult ajax = AjaxResult.success(); {
ajax.put("fileName", fileName); // 上传文件路径
ajax.put("url", url); String filePath = RuoYiConfig.getUploadPath();
return ajax; // 上传并返回新文件名称
} String fileName = FileUploadUtils.upload(filePath, file);
catch (Exception e) String url = serverConfig.getUrl() + fileName;
{ AjaxResult ajax = AjaxResult.success();
return AjaxResult.error(e.getMessage()); ajax.put("url", url);
} ajax.put("fileName", fileName);
} ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
/** return ajax;
* }
*/ catch (Exception e)
@GetMapping("/common/download/resource") {
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) return AjaxResult.error(e.getMessage());
throws Exception }
{ }
try
{ /**
if (!FileUtils.checkAllowDownload(resource)) *
{ */
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); @PostMapping("/uploads")
} public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
// 本地资源路径 {
String localPath = RuoYiConfig.getProfile(); try
// 数据库资源地址 {
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); // 上传文件路径
// 下载名称 String filePath = RuoYiConfig.getUploadPath();
String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); List<String> urls = new ArrayList<String>();
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); List<String> fileNames = new ArrayList<String>();
FileUtils.setAttachmentResponseHeader(response, downloadName); List<String> newFileNames = new ArrayList<String>();
FileUtils.writeBytes(downloadPath, response.getOutputStream()); List<String> originalFilenames = new ArrayList<String>();
} for (MultipartFile file : files)
catch (Exception e) {
{ // 上传并返回新文件名称
log.error("下载文件失败", e); String fileName = FileUploadUtils.upload(filePath, file);
} String url = serverConfig.getUrl() + fileName;
} urls.add(url);
} fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}

View File

@ -1,53 +1,120 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.Collection;
import java.util.List; import java.util.HashMap;
import java.util.Map; import java.util.List;
import java.util.Properties; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import java.util.Properties;
import org.springframework.data.redis.core.RedisCallback; import java.util.Set;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.data.redis.core.RedisCallback;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.DeleteMapping;
import com.ruoyi.common.core.domain.AjaxResult; import org.springframework.web.bind.annotation.GetMapping;
import com.ruoyi.common.utils.StringUtils; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/** import org.springframework.web.bind.annotation.RestController;
* import com.ruoyi.common.constant.CacheConstants;
* import com.ruoyi.common.core.domain.AjaxResult;
* @author ruoyi import com.ruoyi.common.utils.StringUtils;
*/ import com.ruoyi.system.domain.SysCache;
@RestController
@RequestMapping("/monitor/cache") /**
public class CacheController *
{ *
@Autowired * @author ruoyi
private RedisTemplate<String, String> redisTemplate; */
@RestController
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @RequestMapping("/monitor/cache")
@GetMapping() public class CacheController
public AjaxResult getInfo() throws Exception {
{ @Autowired
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); private RedisTemplate<String, String> redisTemplate;
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); private final static List<SysCache> caches = new ArrayList<SysCache>();
{
Map<String, Object> result = new HashMap<>(3); caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
result.put("info", info); caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
result.put("dbSize", dbSize); caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
List<Map<String, String>> pieList = new ArrayList<>(); caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
commandStats.stringPropertyNames().forEach(key -> { caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
Map<String, String> data = new HashMap<>(2); caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
String property = commandStats.getProperty(key); }
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
pieList.add(data); @GetMapping()
}); public AjaxResult getInfo() throws Exception
result.put("commandStats", pieList); {
return AjaxResult.success(result); Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
} Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
} Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public AjaxResult cache()
{
return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(cacheKeys);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
}

View File

@ -1,27 +1,27 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server; import com.ruoyi.framework.web.domain.Server;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/server") @RequestMapping("/monitor/server")
public class ServerController public class ServerController
{ {
@PreAuthorize("@ss.hasPermi('monitor:server:list')") @PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping() @GetMapping()
public AjaxResult getInfo() throws Exception public AjaxResult getInfo() throws Exception
{ {
Server server = new Server(); Server server = new Server();
server.copyTo(); server.copyTo();
return AjaxResult.success(server); return AjaxResult.success(server);
} }
} }

View File

@ -1,67 +1,82 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.PostMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISysLogininforService; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPasswordService;
/** import com.ruoyi.system.domain.SysLogininfor;
* 访 import com.ruoyi.system.service.ISysLogininforService;
*
* @author ruoyi /**
*/ * 访
@RestController *
@RequestMapping("/monitor/logininfor") * @author ruoyi
public class SysLogininforController extends BaseController */
{ @RestController
@Autowired @RequestMapping("/monitor/logininfor")
private ISysLogininforService logininforService; public class SysLogininforController extends BaseController
{
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @Autowired
@GetMapping("/list") private ISysLogininforService logininforService;
public TableDataInfo list(SysLogininfor logininfor)
{ @Autowired
startPage(); private SysPasswordService passwordService;
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list); @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
} @GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
@Log(title = "登录日志", businessType = BusinessType.EXPORT) {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") startPage();
@GetMapping("/export") List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
public AjaxResult export(SysLogininfor logininfor) return getDataTable(list);
{ }
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); @Log(title = "登录日志", businessType = BusinessType.EXPORT)
return util.exportExcel(list, "登录日志"); @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
} @PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") {
@Log(title = "登录日志", businessType = BusinessType.DELETE) List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
@DeleteMapping("/{infoIds}") ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
public AjaxResult remove(@PathVariable Long[] infoIds) util.exportExcel(response, list, "登录日志");
{ }
return toAjax(logininforService.deleteLogininforByIds(infoIds));
} @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @DeleteMapping("/{infoIds}")
@Log(title = "登录日志", businessType = BusinessType.CLEAN) public AjaxResult remove(@PathVariable Long[] infoIds)
@DeleteMapping("/clean") {
public AjaxResult clean() return toAjax(logininforService.deleteLogininforByIds(infoIds));
{ }
logininforService.cleanLogininfor();
return AjaxResult.success(); @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
} @Log(title = "登录日志", businessType = BusinessType.CLEAN)
} @DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
passwordService.clearLoginRecordCache(userName);
return success();
}
}

View File

@ -1,67 +1,69 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.PostMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISysOperLogService; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
/** import com.ruoyi.system.service.ISysOperLogService;
*
* /**
* @author ruoyi *
*/ *
@RestController * @author ruoyi
@RequestMapping("/monitor/operlog") */
public class SysOperlogController extends BaseController @RestController
{ @RequestMapping("/monitor/operlog")
@Autowired public class SysOperlogController extends BaseController
private ISysOperLogService operLogService; {
@Autowired
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')") private ISysOperLogService operLogService;
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog) @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
{ @GetMapping("/list")
startPage(); public TableDataInfo list(SysOperLog operLog)
List<SysOperLog> list = operLogService.selectOperLogList(operLog); {
return getDataTable(list); startPage();
} List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
@Log(title = "操作日志", businessType = BusinessType.EXPORT) }
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@GetMapping("/export") @Log(title = "操作日志", businessType = BusinessType.EXPORT)
public AjaxResult export(SysOperLog operLog) @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
{ @PostMapping("/export")
List<SysOperLog> list = operLogService.selectOperLogList(operLog); public void export(HttpServletResponse response, SysOperLog operLog)
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); {
return util.exportExcel(list, "操作日志"); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
} ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
@Log(title = "操作日志", businessType = BusinessType.DELETE) }
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}") @Log(title = "操作日志", businessType = BusinessType.DELETE)
public AjaxResult remove(@PathVariable Long[] operIds) @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
{ @DeleteMapping("/{operIds}")
return toAjax(operLogService.deleteOperLogByIds(operIds)); public AjaxResult remove(@PathVariable Long[] operIds)
} {
return toAjax(operLogService.deleteOperLogByIds(operIds));
@Log(title = "操作日志", businessType = BusinessType.CLEAN) }
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean") @Log(title = "操作日志", businessType = BusinessType.CLEAN)
public AjaxResult clean() @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
{ @DeleteMapping("/clean")
operLogService.cleanOperLog(); public AjaxResult clean()
return AjaxResult.success(); {
} operLogService.cleanOperLog();
} return success();
}
}

View File

@ -1,92 +1,83 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService; import com.ruoyi.system.service.ISysUserOnlineService;
/** /**
* 线 * 线
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/monitor/online") @RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController public class SysUserOnlineController extends BaseController
{ {
@Autowired @Autowired
private ISysUserOnlineService userOnlineService; private ISysUserOnlineService userOnlineService;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')") @PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName) public TableDataInfo list(String ipaddr, String userName)
{ {
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*"); Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) for (String key : keys)
{ {
LoginUser user = redisCache.getCacheObject(key); LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{ {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
{ }
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); else if (StringUtils.isNotEmpty(ipaddr))
} {
} userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
else if (StringUtils.isNotEmpty(ipaddr)) }
{ else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
{ userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); }
} else
} {
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
{ }
if (StringUtils.equals(userName, user.getUsername())) }
{ Collections.reverse(userOnlineList);
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); userOnlineList.removeAll(Collections.singleton(null));
} return getDataTable(userOnlineList);
} }
else
{ /**
userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); * 退
} */
} @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
Collections.reverse(userOnlineList); @Log(title = "在线用户", businessType = BusinessType.FORCE)
userOnlineList.removeAll(Collections.singleton(null)); @DeleteMapping("/{tokenId}")
return getDataTable(userOnlineList); public AjaxResult forceLogout(@PathVariable String tokenId)
} {
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
/** return success();
* 退 }
*/ }
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}

View File

@ -1,140 +1,133 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService; /**
*
/** *
* * @author ruoyi
* */
* @author ruoyi @RestController
*/ @RequestMapping("/system/config")
@RestController public class SysConfigController extends BaseController
@RequestMapping("/system/config") {
public class SysConfigController extends BaseController @Autowired
{ private ISysConfigService configService;
@Autowired
private ISysConfigService configService; /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:config:list')")
*/ @GetMapping("/list")
@PreAuthorize("@ss.hasPermi('system:config:list')") public TableDataInfo list(SysConfig config)
@GetMapping("/list") {
public TableDataInfo list(SysConfig config) startPage();
{ List<SysConfig> list = configService.selectConfigList(config);
startPage(); return getDataTable(list);
List<SysConfig> list = configService.selectConfigList(config); }
return getDataTable(list);
} @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @PostMapping("/export")
@PreAuthorize("@ss.hasPermi('system:config:export')") public void export(HttpServletResponse response, SysConfig config)
@GetMapping("/export") {
public AjaxResult export(SysConfig config) List<SysConfig> list = configService.selectConfigList(config);
{ ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
List<SysConfig> list = configService.selectConfigList(config); util.exportExcel(response, list, "参数数据");
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); }
return util.exportExcel(list, "参数数据");
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:config:query')")
*/ @GetMapping(value = "/{configId}")
@PreAuthorize("@ss.hasPermi('system:config:query')") public AjaxResult getInfo(@PathVariable Long configId)
@GetMapping(value = "/{configId}") {
public AjaxResult getInfo(@PathVariable Long configId) return success(configService.selectConfigById(configId));
{ }
return AjaxResult.success(configService.selectConfigById(configId));
} /**
*
/** */
* @GetMapping(value = "/configKey/{configKey}")
*/ public AjaxResult getConfigKey(@PathVariable String configKey)
@GetMapping(value = "/configKey/{configKey}") {
public AjaxResult getConfigKey(@PathVariable String configKey) return success(configService.selectConfigByKey(configKey));
{ }
return AjaxResult.success(configService.selectConfigByKey(configKey));
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:config:add')")
*/ @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('system:config:add')") @PostMapping
@Log(title = "参数管理", businessType = BusinessType.INSERT) public AjaxResult add(@Validated @RequestBody SysConfig config)
@PostMapping {
@RepeatSubmit if (!configService.checkConfigKeyUnique(config))
public AjaxResult add(@Validated @RequestBody SysConfig config) {
{ return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) }
{ config.setCreateBy(getUsername());
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return toAjax(configService.insertConfig(config));
} }
config.setCreateBy(SecurityUtils.getUsername());
return toAjax(configService.insertConfig(config)); /**
} *
*/
/** @PreAuthorize("@ss.hasPermi('system:config:edit')")
* @Log(title = "参数管理", businessType = BusinessType.UPDATE)
*/ @PutMapping
@PreAuthorize("@ss.hasPermi('system:config:edit')") public AjaxResult edit(@Validated @RequestBody SysConfig config)
@Log(title = "参数管理", businessType = BusinessType.UPDATE) {
@PostMapping("/update") if (!configService.checkConfigKeyUnique(config))
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysConfig config) return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
{ }
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) config.setUpdateBy(getUsername());
{ return toAjax(configService.updateConfig(config));
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); }
}
config.setUpdateBy(SecurityUtils.getUsername()); /**
return toAjax(configService.updateConfig(config)); *
} */
@PreAuthorize("@ss.hasPermi('system:config:remove')")
/** @Log(title = "参数管理", businessType = BusinessType.DELETE)
* @DeleteMapping("/{configIds}")
*/ public AjaxResult remove(@PathVariable Long[] configIds)
@PreAuthorize("@ss.hasPermi('system:config:remove')") {
@Log(title = "参数管理", businessType = BusinessType.DELETE) configService.deleteConfigByIds(configIds);
@GetMapping("/batch/{configIds}") return success();
// @DeleteMapping("/{configIds}") }
public AjaxResult remove(@PathVariable Long[] configIds)
{ /**
// System.out.println("configIds:" + configIds.toString()); *
configService.deleteConfigByIds(configIds); */
return success(); @PreAuthorize("@ss.hasPermi('system:config:remove')")
} @Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
/** public AjaxResult refreshCache()
* {
*/ configService.resetConfigCache();
@PreAuthorize("@ss.hasPermi('system:config:remove')") return success();
@Log(title = "参数管理", businessType = BusinessType.CLEAN) }
@GetMapping("/refreshCache") }
// @DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return AjaxResult.success();
}
}

View File

@ -1,174 +1,142 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.Iterator; import java.util.List;
import java.util.List; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated;
import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.DeleteMapping; 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; import org.springframework.web.bind.annotation.PostMapping;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; /**
import com.ruoyi.system.service.ISysDeptService; *
*
import me.chanjar.weixin.common.error.WxErrorException; * @author ruoyi
import me.chanjar.weixin.cp.api.WxCpService; */
import me.chanjar.weixin.cp.bean.WxCpDepart; @RestController
@RequestMapping("/system/dept")
/** public class SysDeptController extends BaseController
* {
* @Autowired
* @author ruoyi private ISysDeptService deptService;
*/
@RestController /**
@RequestMapping("/system/dept") *
public class SysDeptController extends BaseController */
{ @PreAuthorize("@ss.hasPermi('system:dept:list')")
@Autowired @GetMapping("/list")
private ISysDeptService deptService; public AjaxResult list(SysDept dept)
{
/*@Autowired List<SysDept> depts = deptService.selectDeptList(dept);
private WxDepartmentService wxDeptService;*/ return success(depts);
/** }
*
*/ /**
@PreAuthorize("@ss.hasPermi('system:dept:list')") *
@GetMapping("/list") */
public AjaxResult list(SysDept dept) @PreAuthorize("@ss.hasPermi('system:dept:list')")
{ @GetMapping("/list/exclude/{deptId}")
List<SysDept> depts = deptService.selectDeptList(dept); public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
return AjaxResult.success(depts); {
} List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
/** return success(depts);
* }
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')") /**
@GetMapping("/list/exclude/{deptId}") *
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) */
{ @PreAuthorize("@ss.hasPermi('system:dept:query')")
List<SysDept> depts = deptService.selectDeptList(new SysDept()); @GetMapping(value = "/{deptId}")
Iterator<SysDept> it = depts.iterator(); public AjaxResult getInfo(@PathVariable Long deptId)
while (it.hasNext()) {
{ deptService.checkDeptDataScope(deptId);
SysDept d = (SysDept) it.next(); return success(deptService.selectDeptById(deptId));
if (d.getDeptId().intValue() == deptId }
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{ /**
it.remove(); *
} */
} @PreAuthorize("@ss.hasPermi('system:dept:add')")
return AjaxResult.success(depts); @Log(title = "部门管理", businessType = BusinessType.INSERT)
} @PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
/** {
* if (!deptService.checkDeptNameUnique(dept))
*/ {
@PreAuthorize("@ss.hasPermi('system:dept:query')") return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
@GetMapping(value = "/{deptId}") }
public AjaxResult getInfo(@PathVariable Long deptId) dept.setCreateBy(getUsername());
{ return toAjax(deptService.insertDept(dept));
return AjaxResult.success(deptService.selectDeptById(deptId)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:dept:edit')")
@GetMapping("/treeselect") @Log(title = "部门管理", businessType = BusinessType.UPDATE)
public AjaxResult treeselect(SysDept dept) @PutMapping
{ public AjaxResult edit(@Validated @RequestBody SysDept dept)
List<SysDept> depts = deptService.selectDeptList(dept); {
return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); Long deptId = dept.getDeptId();
} deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
/** {
* return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
*/ }
@GetMapping(value = "/roleDeptTreeselect/{roleId}") else if (dept.getParentId().equals(deptId))
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
{ return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
List<SysDept> depts = deptService.selectDeptList(new SysDept()); }
AjaxResult ajax = AjaxResult.success(); else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); {
ajax.put("depts", deptService.buildDeptTreeSelect(depts)); return error("该部门包含未停用的子部门!");
return ajax; }
} dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
/** }
*
*/ /**
@PreAuthorize("@ss.hasPermi('system:dept:add')") *
@Log(title = "部门管理", businessType = BusinessType.INSERT) */
@PostMapping @GetMapping("/treeselect")
public AjaxResult add(@Validated @RequestBody SysDept dept) public AjaxResult treeselect(SysDept dept)
{ {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) List<SysDept> depts = deptService.selectDeptList(dept);
{ return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); }
}
dept.setCreateBy(SecurityUtils.getUsername()); /**
return toAjax(deptService.insertDept(dept)); *
} */
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
/** @Log(title = "部门管理", businessType = BusinessType.DELETE)
* @DeleteMapping("/{deptId}")
*/ public AjaxResult remove(@PathVariable Long deptId)
@PreAuthorize("@ss.hasPermi('system:dept:edit')") {
@Log(title = "部门管理", businessType = BusinessType.UPDATE) if (deptService.hasChildByDeptId(deptId))
@PostMapping("/update") {
// @PutMapping return warn("存在下级部门,不允许删除");
public AjaxResult edit(@Validated @RequestBody SysDept dept) }
{ if (deptService.checkDeptExistUser(deptId))
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
{ return warn("部门存在用户,不允许删除");
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); }
} deptService.checkDeptDataScope(deptId);
else if (dept.getParentId().equals(dept.getDeptId())) return toAjax(deptService.deleteDeptById(deptId));
{ }
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); }
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@GetMapping("/delete/{deptId}")
// @DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@ -1,123 +1,121 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysDictTypeService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/dict/data") @RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController public class SysDictDataController extends BaseController
{ {
@Autowired @Autowired
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@Autowired @Autowired
private ISysDictTypeService dictTypeService; private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysDictData dictData) public TableDataInfo list(SysDictData dictData)
{ {
startPage(); startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysDictData dictData) public void export(HttpServletResponse response, SysDictData dictData)
{ {
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据"); util.exportExcel(response, list, "字典数据");
} }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}") @GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode) public AjaxResult getInfo(@PathVariable Long dictCode)
{ {
return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); return success(dictDataService.selectDictDataById(dictCode));
} }
/** /**
* *
*/ */
@GetMapping(value = "/type/{dictType}") @GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) public AjaxResult dictType(@PathVariable String dictType)
{ {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) if (StringUtils.isNull(data))
{ {
data = new ArrayList<SysDictData>(); data = new ArrayList<SysDictData>();
} }
return AjaxResult.success(data); return success(data);
} }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT) @Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) public AjaxResult add(@Validated @RequestBody SysDictData dict)
{ {
dict.setCreateBy(SecurityUtils.getUsername()); dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE) @Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PutMapping
// @PutMapping public AjaxResult edit(@Validated @RequestBody SysDictData dict)
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
{ dict.setUpdateBy(getUsername());
dict.setUpdateBy(SecurityUtils.getUsername()); return toAjax(dictDataService.updateDictData(dict));
return toAjax(dictDataService.updateDictData(dict)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.DELETE)
@Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}")
@GetMapping("/batch/{dictCodes}") public AjaxResult remove(@PathVariable Long[] dictCodes)
// @DeleteMapping("/{dictCodes}") {
public AjaxResult remove(@PathVariable Long[] dictCodes) dictDataService.deleteDictDataByIds(dictCodes);
{ return success();
dictDataService.deleteDictDataByIds(dictCodes); }
return success(); }
}
}

View File

@ -1,135 +1,131 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.system.service.ISysDictTypeService;
/**
/** *
* *
* * @author ruoyi
* @author ruoyi */
*/ @RestController
@RestController @RequestMapping("/system/dict/type")
@RequestMapping("/system/dict/type") public class SysDictTypeController extends BaseController
public class SysDictTypeController extends BaseController {
{ @Autowired
@Autowired private ISysDictTypeService dictTypeService;
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list")
@GetMapping("/list") public TableDataInfo list(SysDictType dictType)
public TableDataInfo list(SysDictType dictType) {
{ startPage();
startPage(); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); return getDataTable(list);
return getDataTable(list); }
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')")
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PostMapping("/export")
@GetMapping("/export") public void export(HttpServletResponse response, SysDictType dictType)
public AjaxResult export(SysDictType dictType) {
{ List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); util.exportExcel(response, list, "字典类型");
return util.exportExcel(list, "字典类型"); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:dict:query')")
@PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictId}")
@GetMapping(value = "/{dictId}") public AjaxResult getInfo(@PathVariable Long dictId)
public AjaxResult getInfo(@PathVariable Long dictId) {
{ return success(dictTypeService.selectDictTypeById(dictId));
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:dict:add')")
@PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "字典类型", businessType = BusinessType.INSERT)
@Log(title = "字典类型", businessType = BusinessType.INSERT) @PostMapping
@PostMapping public AjaxResult add(@Validated @RequestBody SysDictType dict)
public AjaxResult add(@Validated @RequestBody SysDictType dict) {
{ if (!dictTypeService.checkDictTypeUnique(dict))
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
{ return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); }
} dict.setCreateBy(getUsername());
dict.setCreateBy(SecurityUtils.getUsername()); return toAjax(dictTypeService.insertDictType(dict));
return toAjax(dictTypeService.insertDictType(dict)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "字典类型", businessType = BusinessType.UPDATE)
@Log(title = "字典类型", businessType = BusinessType.UPDATE) @PutMapping
@PostMapping("/update") public AjaxResult edit(@Validated @RequestBody SysDictType dict)
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysDictType dict) if (!dictTypeService.checkDictTypeUnique(dict))
{ {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
{ }
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); dict.setUpdateBy(getUsername());
} return toAjax(dictTypeService.updateDictType(dict));
dict.setUpdateBy(SecurityUtils.getUsername()); }
return toAjax(dictTypeService.updateDictType(dict));
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:dict:remove')")
*/ @Log(title = "字典类型", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @DeleteMapping("/{dictIds}")
@Log(title = "字典类型", businessType = BusinessType.DELETE) public AjaxResult remove(@PathVariable Long[] dictIds)
@GetMapping("/batch/{dictIds}") {
// @DeleteMapping("/{dictIds}") dictTypeService.deleteDictTypeByIds(dictIds);
public AjaxResult remove(@PathVariable Long[] dictIds) return success();
{ }
dictTypeService.deleteDictTypeByIds(dictIds);
return success(); /**
} *
*/
/** @PreAuthorize("@ss.hasPermi('system:dict:remove')")
* @Log(title = "字典类型", businessType = BusinessType.CLEAN)
*/ @DeleteMapping("/refreshCache")
@PreAuthorize("@ss.hasPermi('system:dict:remove')") public AjaxResult refreshCache()
@Log(title = "字典类型", businessType = BusinessType.CLEAN) {
@GetMapping("/refreshCache") dictTypeService.resetDictCache();
// @DeleteMapping("/refreshCache") return success();
public AjaxResult refreshCache() }
{
dictTypeService.resetDictCache(); /**
return AjaxResult.success(); *
} */
@GetMapping("/optionselect")
/** public AjaxResult optionselect()
* {
*/ List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
@GetMapping("/optionselect") return success(dictTypes);
public AjaxResult optionselect() }
{ }
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}

View File

@ -1,29 +1,29 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
public class SysIndexController public class SysIndexController
{ {
/** 系统基础配置 */ /** 系统基础配置 */
@Autowired @Autowired
private RuoYiConfig ruoyiConfig; private RuoYiConfig ruoyiConfig;
/** /**
* 访 * 访
*/ */
@RequestMapping("/") @RequestMapping("/")
public String index() public String index()
{ {
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
} }
} }

View File

@ -1,182 +1,99 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Base64; import java.util.Base64;
import java.util.Date; import java.util.List;
import java.util.List; import java.util.Set;
import java.util.Set; import org.springframework.beans.factory.annotation.Autowired;
import org.slf4j.Logger; import org.springframework.web.bind.annotation.GetMapping;
import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping; import com.ruoyi.common.constant.Constants;
import org.springframework.web.bind.annotation.RequestBody; import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.RequestParam; import com.ruoyi.common.core.domain.entity.SysMenu;
import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.enums.UserStatus; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.common.core.domain.entity.WechatLoginStatus;
import com.ruoyi.common.core.domain.model.LoginBody; /**
import com.ruoyi.common.core.domain.model.LoginUser; *
import com.ruoyi.common.utils.ServletUtils; *
import com.ruoyi.framework.web.service.SysLoginService; * @author ruoyi
import com.ruoyi.framework.web.service.SysPermissionService; */
import com.ruoyi.framework.web.service.TokenService; @RestController
import com.ruoyi.framework.web.service.WechatService; public class SysLoginController
import com.ruoyi.system.mapper.WechatLoginStatusMapper; {
import com.ruoyi.system.service.ISysMenuService; @Autowired
import com.ruoyi.system.service.ISysUserService; private SysLoginService loginService;
/** @Autowired
* private ISysMenuService menuService;
*
* @author ruoyi @Autowired
*/ private SysPermissionService permissionService;
@RestController
public class SysLoginController /**
{ *
private static final Logger log = LoggerFactory.getLogger(SysLoginController.class); *
@Autowired * @param loginBody
private SysLoginService loginService; * @return
*/
@Autowired @PostMapping("/login")
private ISysMenuService menuService; public AjaxResult login(@RequestBody LoginBody loginBody)
{
@Autowired // System.out.println("loginBody:" + loginBody.toString());
private SysPermissionService permissionService; String username = null;
String password = null;
@Autowired try {
private TokenService tokenService; username = new String(Base64.getDecoder().decode(loginBody.getUsername()), "UTF-8");
password = new String(Base64.getDecoder().decode(loginBody.getPassword()), "UTF-8");
@Autowired } catch (UnsupportedEncodingException e) {
private WechatService wechatService; // TODO Auto-generated catch block
return AjaxResult.error("解密字符串出错:" + e.getMessage());
@Autowired }
private WechatLoginStatusMapper wechatLoginStatusMapper;
AjaxResult ajax = AjaxResult.success();
@Autowired // 生成令牌
private ISysUserService userService; String token = loginService.login(username, password, loginBody.getCode(),
loginBody.getUuid());
/** ajax.put(Constants.TOKEN, token);
* return ajax;
* }
* @param loginBody
* @return /**
*/ *
@PostMapping("/login") *
public AjaxResult login(@RequestBody LoginBody loginBody) * @return
{ */
// System.out.println("loginBody:" + loginBody.toString()); @GetMapping("getInfo")
String username = null; public AjaxResult getInfo()
String password = null; {
try { SysUser user = SecurityUtils.getLoginUser().getUser();
username = new String(Base64.getDecoder().decode(loginBody.getUsername()), "UTF-8"); // 角色集合
password = new String(Base64.getDecoder().decode(loginBody.getPassword()), "UTF-8"); Set<String> roles = permissionService.getRolePermission(user);
} catch (UnsupportedEncodingException e) { // 权限集合
// TODO Auto-generated catch block Set<String> permissions = permissionService.getMenuPermission(user);
return AjaxResult.error("解密字符串出错:" + e.getMessage()); AjaxResult ajax = AjaxResult.success();
} ajax.put("user", user);
ajax.put("roles", roles);
AjaxResult ajax = AjaxResult.success(); ajax.put("permissions", permissions);
// 生成令牌 return ajax;
String token = loginService.login(username, password, loginBody.getCode(), }
loginBody.getUuid());
ajax.put(Constants.TOKEN, token); /**
return ajax; *
} *
* @return
/** */
* @GetMapping("getRouters")
* public AjaxResult getRouters()
* @return {
*/ Long userId = SecurityUtils.getUserId();
@GetMapping("getInfo") List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
public AjaxResult getInfo() return AjaxResult.success(menuService.buildMenus(menus));
{ }
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); }
SysUser user = loginUser.getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
log.debug("ajax:{}", ajax.toString());
return ajax;
}
/**
*
*
* @return
*/
@GetMapping("getRouters")
public AjaxResult getRouters()
{
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// 用户信息
SysUser user = loginUser.getUser();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
return AjaxResult.success(menuService.buildMenus(menus));
}
/**
*
*
* @param loginId ID
* @return
*/
@PostMapping("/wechat/login")
public AjaxResult wechatLogin(@RequestParam String loginId)
{
try {
// 查询登录状态
WechatLoginStatus loginStatus = wechatLoginStatusMapper.selectWechatLoginStatusById(loginId);
if (loginStatus == null) {
return AjaxResult.error("登录状态不存在");
}
// 检查状态是否为已确认
if (!"2".equals(loginStatus.getStatus())) {
return AjaxResult.error("登录状态不正确");
}
// 根据openid查询用户
SysUser user = userService.selectUserByWechatOpenid(loginStatus.getOpenid());
if (user == null) {
return AjaxResult.error("未找到绑定的用户");
}
// 检查用户状态
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
return AjaxResult.error("用户已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
return AjaxResult.error("用户已被禁用");
}
// 创建登录用户对象
LoginUser loginUser = new LoginUser(user, permissionService.getMenuPermission(user));
// 生成令牌
String token = tokenService.createToken(loginUser);
// 更新登录状态为已使用
loginStatus.setStatus("4"); // 已使用
loginStatus.setUpdateTime(new Date());
wechatLoginStatusMapper.updateWechatLoginStatus(loginStatus);
AjaxResult ajax = AjaxResult.success();
ajax.put(Constants.TOKEN, token);
return ajax;
} catch (Exception e) {
log.error("微信登录失败", e);
return AjaxResult.error("微信登录失败: " + e.getMessage());
}
}
}

View File

@ -1,156 +1,142 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
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;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; /**
import com.ruoyi.framework.web.service.TokenService; *
import com.ruoyi.system.service.ISysMenuService; *
* @author ruoyi
/** */
* @RestController
* @RequestMapping("/system/menu")
* @author ruoyi public class SysMenuController extends BaseController
*/ {
@RestController @Autowired
@RequestMapping("/system/menu") private ISysMenuService menuService;
public class SysMenuController extends BaseController
{ /**
@Autowired *
private ISysMenuService menuService; */
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@Autowired @GetMapping("/list")
private TokenService tokenService; public AjaxResult list(SysMenu menu)
{
/** List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
* return success(menus);
*/ }
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list") /**
public AjaxResult list(SysMenu menu) *
{ */
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); @PreAuthorize("@ss.hasPermi('system:menu:query')")
Long userId = loginUser.getUser().getUserId(); @GetMapping(value = "/{menuId}")
List<SysMenu> menus = menuService.selectMenuList(menu, userId); public AjaxResult getInfo(@PathVariable Long menuId)
return AjaxResult.success(menus); {
} return success(menuService.selectMenuById(menuId));
}
/**
* /**
*/ *
@PreAuthorize("@ss.hasPermi('system:menu:query')") */
@GetMapping(value = "/{menuId}") @GetMapping("/treeselect")
public AjaxResult getInfo(@PathVariable Long menuId) public AjaxResult treeselect(SysMenu menu)
{ {
return AjaxResult.success(menuService.selectMenuById(menuId)); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
} return success(menuService.buildMenuTreeSelect(menus));
}
/**
* /**
*/ *
@GetMapping("/treeselect") */
public AjaxResult treeselect(SysMenu menu) @GetMapping(value = "/roleMenuTreeselect/{roleId}")
{ public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); {
Long userId = loginUser.getUser().getUserId(); List<SysMenu> menus = menuService.selectMenuList(getUserId());
List<SysMenu> menus = menuService.selectMenuList(menu, userId); AjaxResult ajax = AjaxResult.success();
return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
} ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
/** }
*
*/ /**
@GetMapping(value = "/roleMenuTreeselect/{roleId}") *
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) */
{ @PreAuthorize("@ss.hasPermi('system:menu:add')")
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); @Log(title = "菜单管理", businessType = BusinessType.INSERT)
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId()); @PostMapping
AjaxResult ajax = AjaxResult.success(); public AjaxResult add(@Validated @RequestBody SysMenu menu)
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); {
ajax.put("menus", menuService.buildMenuTreeSelect(menus)); if (!menuService.checkMenuNameUnique(menu))
return ajax; {
} return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
/** else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
* {
*/ return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
@PreAuthorize("@ss.hasPermi('system:menu:add')") }
@Log(title = "菜单管理", businessType = BusinessType.INSERT) menu.setCreateBy(getUsername());
@PostMapping return toAjax(menuService.insertMenu(menu));
public AjaxResult add(@Validated @RequestBody SysMenu menu) }
{
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) /**
{ *
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); */
} @PreAuthorize("@ss.hasPermi('system:menu:edit')")
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
{ @PutMapping
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); public AjaxResult edit(@Validated @RequestBody SysMenu menu)
} {
menu.setCreateBy(SecurityUtils.getUsername()); if (!menuService.checkMenuNameUnique(menu))
return toAjax(menuService.insertMenu(menu)); {
} return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
/** else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
* {
*/ return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
@PreAuthorize("@ss.hasPermi('system:menu:edit')") }
@Log(title = "菜单管理", businessType = BusinessType.UPDATE) else if (menu.getMenuId().equals(menu.getParentId()))
@PostMapping("/update") {
// @PutMapping return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
public AjaxResult edit(@Validated @RequestBody SysMenu menu) }
{ menu.setUpdateBy(getUsername());
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) return toAjax(menuService.updateMenu(menu));
{ }
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} /**
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) *
{ */
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); @PreAuthorize("@ss.hasPermi('system:menu:remove')")
} @Log(title = "菜单管理", businessType = BusinessType.DELETE)
else if (menu.getMenuId().equals(menu.getParentId())) @DeleteMapping("/{menuId}")
{ public AjaxResult remove(@PathVariable("menuId") Long menuId)
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); {
} if (menuService.hasChildByMenuId(menuId))
menu.setUpdateBy(SecurityUtils.getUsername()); {
return toAjax(menuService.updateMenu(menu)); return warn("存在子菜单,不允许删除");
} }
if (menuService.checkMenuExistRole(menuId))
/** {
* return warn("菜单已分配,不允许删除");
*/ }
@PreAuthorize("@ss.hasPermi('system:menu:remove')") return toAjax(menuService.deleteMenuById(menuId));
@Log(title = "菜单管理", businessType = BusinessType.DELETE) }
@GetMapping("/delete/{menuId}")
// @DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.hasChildByMenuId(menuId))
{
return AjaxResult.error("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId))
{
return AjaxResult.error("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
} }

View File

@ -1,94 +1,91 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
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;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService;
import com.ruoyi.system.service.ISysNoticeService;
/**
/** *
* *
* * @author ruoyi
* @author ruoyi */
*/ @RestController
@RestController @RequestMapping("/system/notice")
@RequestMapping("/system/notice") public class SysNoticeController extends BaseController
public class SysNoticeController extends BaseController {
{ @Autowired
@Autowired private ISysNoticeService noticeService;
private ISysNoticeService noticeService;
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:notice:list')")
@PreAuthorize("@ss.hasPermi('system:notice:list')") @GetMapping("/list")
@GetMapping("/list") public TableDataInfo list(SysNotice notice)
public TableDataInfo list(SysNotice notice) {
{ startPage();
startPage(); List<SysNotice> list = noticeService.selectNoticeList(notice);
List<SysNotice> list = noticeService.selectNoticeList(notice); return getDataTable(list);
return getDataTable(list); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:notice:query')")
@PreAuthorize("@ss.hasPermi('system:notice:query')") @GetMapping(value = "/{noticeId}")
@GetMapping(value = "/{noticeId}") public AjaxResult getInfo(@PathVariable Long noticeId)
public AjaxResult getInfo(@PathVariable Long noticeId) {
{ return success(noticeService.selectNoticeById(noticeId));
return AjaxResult.success(noticeService.selectNoticeById(noticeId)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:notice:add')")
@PreAuthorize("@ss.hasPermi('system:notice:add')") @Log(title = "通知公告", businessType = BusinessType.INSERT)
@Log(title = "通知公告", businessType = BusinessType.INSERT) @PostMapping
@PostMapping public AjaxResult add(@Validated @RequestBody SysNotice notice)
public AjaxResult add(@Validated @RequestBody SysNotice notice) {
{ notice.setCreateBy(getUsername());
notice.setCreateBy(SecurityUtils.getUsername()); return toAjax(noticeService.insertNotice(notice));
return toAjax(noticeService.insertNotice(notice)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:notice:edit')")
@PreAuthorize("@ss.hasPermi('system:notice:edit')") @Log(title = "通知公告", businessType = BusinessType.UPDATE)
@Log(title = "通知公告", businessType = BusinessType.UPDATE) @PutMapping
@PostMapping("/update") public AjaxResult edit(@Validated @RequestBody SysNotice notice)
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysNotice notice) notice.setUpdateBy(getUsername());
{ return toAjax(noticeService.updateNotice(notice));
notice.setUpdateBy(SecurityUtils.getUsername()); }
return toAjax(noticeService.updateNotice(notice));
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:notice:remove')")
*/ @Log(title = "通知公告", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('system:notice:remove')") @DeleteMapping("/{noticeIds}")
@Log(title = "通知公告", businessType = BusinessType.DELETE) public AjaxResult remove(@PathVariable Long[] noticeIds)
@GetMapping("/batch/{noticeIds}") {
// @DeleteMapping("/{noticeIds}") return toAjax(noticeService.deleteNoticeByIds(noticeIds));
public AjaxResult remove(@PathVariable Long[] noticeIds) }
{ }
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -1,132 +1,129 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Log; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysPostService;
/**
/** *
* *
* * @author ruoyi
* @author ruoyi */
*/ @RestController
@RestController @RequestMapping("/system/post")
@RequestMapping("/system/post") public class SysPostController extends BaseController
public class SysPostController extends BaseController {
{ @Autowired
@Autowired private ISysPostService postService;
private ISysPostService postService;
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:post:list')")
@PreAuthorize("@ss.hasPermi('system:post:list')") @GetMapping("/list")
@GetMapping("/list") public TableDataInfo list(SysPost post)
public TableDataInfo list(SysPost post) {
{ startPage();
startPage(); List<SysPost> list = postService.selectPostList(post);
List<SysPost> list = postService.selectPostList(post); return getDataTable(list);
return getDataTable(list); }
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:post:export')")
@PreAuthorize("@ss.hasPermi('system:post:export')") @PostMapping("/export")
@GetMapping("/export") public void export(HttpServletResponse response, SysPost post)
public AjaxResult export(SysPost post) {
{ List<SysPost> list = postService.selectPostList(post);
List<SysPost> list = postService.selectPostList(post); ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); util.exportExcel(response, list, "岗位数据");
return util.exportExcel(list, "岗位数据"); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:post:query')")
@PreAuthorize("@ss.hasPermi('system:post:query')") @GetMapping(value = "/{postId}")
@GetMapping(value = "/{postId}") public AjaxResult getInfo(@PathVariable Long postId)
public AjaxResult getInfo(@PathVariable Long postId) {
{ return success(postService.selectPostById(postId));
return AjaxResult.success(postService.selectPostById(postId)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:post:add')")
@PreAuthorize("@ss.hasPermi('system:post:add')") @Log(title = "岗位管理", businessType = BusinessType.INSERT)
@Log(title = "岗位管理", businessType = BusinessType.INSERT) @PostMapping
@PostMapping public AjaxResult add(@Validated @RequestBody SysPost post)
public AjaxResult add(@Validated @RequestBody SysPost post) {
{ if (!postService.checkPostNameUnique(post))
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
{ return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); }
} else if (!postService.checkPostCodeUnique(post))
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
{ return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); }
} post.setCreateBy(getUsername());
post.setCreateBy(SecurityUtils.getUsername()); return toAjax(postService.insertPost(post));
return toAjax(postService.insertPost(post)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:post:edit')")
@PreAuthorize("@ss.hasPermi('system:post:edit')") @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@Log(title = "岗位管理", businessType = BusinessType.UPDATE) @PutMapping
@PostMapping("/update") public AjaxResult edit(@Validated @RequestBody SysPost post)
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysPost post) if (!postService.checkPostNameUnique(post))
{ {
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
{ }
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); else if (!postService.checkPostCodeUnique(post))
} {
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
{ }
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); post.setUpdateBy(getUsername());
} return toAjax(postService.updatePost(post));
post.setUpdateBy(SecurityUtils.getUsername()); }
return toAjax(postService.updatePost(post));
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:post:remove')")
*/ @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('system:post:remove')") @DeleteMapping("/{postIds}")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) public AjaxResult remove(@PathVariable Long[] postIds)
@GetMapping("/remove/{postIds}") {
// @DeleteMapping("/{postIds}") return toAjax(postService.deletePostByIds(postIds));
public AjaxResult remove(@PathVariable Long[] postIds) }
{
return toAjax(postService.deletePostByIds(postIds)); /**
} *
*/
/** @GetMapping("/optionselect")
* public AjaxResult optionselect()
*/ {
@GetMapping("/optionselect") List<SysPost> posts = postService.selectPostAll();
public AjaxResult optionselect() return success(posts);
{ }
List<SysPost> posts = postService.selectPostAll(); }
return AjaxResult.success(posts);
}
}

View File

@ -1,141 +1,141 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.io.IOException; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService; /**
*
/** *
* * @author ruoyi
* */
* @author ruoyi @RestController
*/ @RequestMapping("/system/user/profile")
@RestController public class SysProfileController extends BaseController
@RequestMapping("/system/user/profile") {
public class SysProfileController extends BaseController @Autowired
{ private ISysUserService userService;
@Autowired
private ISysUserService userService; @Autowired
private TokenService tokenService;
@Autowired
private TokenService tokenService; /**
*
/** */
* @GetMapping
*/ public AjaxResult profile()
@GetMapping {
public AjaxResult profile() LoginUser loginUser = getLoginUser();
{ SysUser user = loginUser.getUser();
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); AjaxResult ajax = AjaxResult.success(user);
SysUser user = loginUser.getUser(); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
AjaxResult ajax = AjaxResult.success(user); ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); return ajax;
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); }
return ajax;
} /**
*
/** */
* @Log(title = "个人信息", businessType = BusinessType.UPDATE)
*/ @PutMapping
@Log(title = "个人信息", businessType = BusinessType.UPDATE) public AjaxResult updateProfile(@RequestBody SysUser user)
@PostMapping("/update") {
// @PutMapping LoginUser loginUser = getLoginUser();
public AjaxResult updateProfile(@RequestBody SysUser user) SysUser sysUser = loginUser.getUser();
{ user.setUserName(sysUser.getUserName());
if (StringUtils.isNotEmpty(user.getPhonenumber()) if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
{ return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); }
} if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
if (StringUtils.isNotEmpty(user.getEmail()) {
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
{ }
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); user.setUserId(sysUser.getUserId());
} user.setPassword(null);
if (userService.updateUserProfile(user) > 0) user.setAvatar(null);
{ user.setDeptId(null);
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); if (userService.updateUserProfile(user) > 0)
// 更新缓存用户信息 {
loginUser.getUser().setNickName(user.getNickName()); // 更新缓存用户信息
loginUser.getUser().setPhonenumber(user.getPhonenumber()); sysUser.setNickName(user.getNickName());
loginUser.getUser().setEmail(user.getEmail()); sysUser.setPhonenumber(user.getPhonenumber());
loginUser.getUser().setSex(user.getSex()); sysUser.setEmail(user.getEmail());
tokenService.setLoginUser(loginUser); sysUser.setSex(user.getSex());
return AjaxResult.success(); tokenService.setLoginUser(loginUser);
} return success();
return AjaxResult.error("修改个人信息异常,请联系管理员"); }
} return error("修改个人信息异常,请联系管理员");
}
/**
* /**
*/ *
@Log(title = "个人信息", businessType = BusinessType.UPDATE) */
@PostMapping("/updatePwd") @Log(title = "个人信息", businessType = BusinessType.UPDATE)
// @PutMapping("/updatePwd") @PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) public AjaxResult updatePwd(String oldPassword, String newPassword)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername(); String userName = loginUser.getUsername();
String password = loginUser.getPassword(); String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) if (!SecurityUtils.matchesPassword(oldPassword, password))
{ {
return AjaxResult.error("修改密码失败,旧密码错误"); return error("修改密码失败,旧密码错误");
} }
if (SecurityUtils.matchesPassword(newPassword, password)) if (SecurityUtils.matchesPassword(newPassword, password))
{ {
return AjaxResult.error("新密码不能与旧密码相同"); return error("新密码不能与旧密码相同");
} }
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
{ {
// 更新缓存用户密码 // 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return AjaxResult.success(); return success();
} }
return AjaxResult.error("修改密码异常,请联系管理员"); return error("修改密码异常,请联系管理员");
} }
/** /**
* *
*/ */
@Log(title = "用户头像", businessType = BusinessType.UPDATE) @Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar") @PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
{ {
if (!file.isEmpty()) if (!file.isEmpty())
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar); ajax.put("imgUrl", avatar);
// 更新缓存用户头像 // 更新缓存用户头像
loginUser.getUser().setAvatar(avatar); loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return ajax; return ajax;
} }
} }
return AjaxResult.error("上传图片异常,请联系管理员"); return error("上传图片异常,请联系管理员");
} }
} }

View File

@ -0,0 +1,38 @@
package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user)
{
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!");
}
String msg = registerService.register(user);
return StringUtils.isEmpty(msg) ? success() : error(msg);
}
}

View File

@ -1,253 +1,262 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Map; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated;
import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.DeleteMapping; 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; import org.springframework.web.bind.annotation.PostMapping;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; /**
*
/** *
* * @author ruoyi
* */
* @author ruoyi @RestController
*/ @RequestMapping("/system/role")
@RestController public class SysRoleController extends BaseController
@RequestMapping("/system/role") {
public class SysRoleController extends BaseController @Autowired
{ private ISysRoleService roleService;
@Autowired
private ISysRoleService roleService; @Autowired
private TokenService tokenService;
@Autowired
private TokenService tokenService; @Autowired
private SysPermissionService permissionService;
@Autowired
private SysPermissionService permissionService; @Autowired
private ISysUserService userService;
@Autowired
private ISysUserService userService; @Autowired
private ISysDeptService deptService;
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list") @PreAuthorize("@ss.hasPermi('system:role:list')")
public TableDataInfo list(SysRole role) @GetMapping("/list")
{ public TableDataInfo list(SysRole role)
Map<String, Object> map = role.getParams(); {
System.out.println("map:" + map.toString()); startPage();
List<SysRole> list = roleService.selectRoleList(role);
startPage(); return getDataTable(list);
List<SysRole> list = roleService.selectRoleList(role); }
return getDataTable(list);
} @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @PostMapping("/export")
@PreAuthorize("@ss.hasPermi('system:role:export')") public void export(HttpServletResponse response, SysRole role)
@GetMapping("/export") {
public AjaxResult export(SysRole role) List<SysRole> list = roleService.selectRoleList(role);
{ ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
List<SysRole> list = roleService.selectRoleList(role); util.exportExcel(response, list, "角色数据");
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); }
return util.exportExcel(list, "角色数据");
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:role:query')")
*/ @GetMapping(value = "/{roleId}")
@PreAuthorize("@ss.hasPermi('system:role:query')") public AjaxResult getInfo(@PathVariable Long roleId)
@GetMapping(value = "/{roleId}") {
public AjaxResult getInfo(@PathVariable Long roleId) roleService.checkRoleDataScope(roleId);
{ return success(roleService.selectRoleById(roleId));
return AjaxResult.success(roleService.selectRoleById(roleId)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:role:add')")
@PreAuthorize("@ss.hasPermi('system:role:add')") @Log(title = "角色管理", businessType = BusinessType.INSERT)
@Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping
@PostMapping public AjaxResult add(@Validated @RequestBody SysRole role)
public AjaxResult add(@Validated @RequestBody SysRole role) {
{ if (!roleService.checkRoleNameUnique(role))
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
{ return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); }
} else if (!roleService.checkRoleKeyUnique(role))
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
{ return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); }
} role.setCreateBy(getUsername());
role.setCreateBy(SecurityUtils.getUsername()); return toAjax(roleService.insertRole(role));
return toAjax(roleService.insertRole(role));
}
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:role:edit')")
@PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping
@PostMapping("/update") public AjaxResult edit(@Validated @RequestBody SysRole role)
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysRole role) roleService.checkRoleAllowed(role);
{ roleService.checkRoleDataScope(role.getRoleId());
roleService.checkRoleAllowed(role); if (!roleService.checkRoleNameUnique(role))
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
{ return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); }
} else if (!roleService.checkRoleKeyUnique(role))
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
{ return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); }
} role.setUpdateBy(getUsername());
role.setUpdateBy(SecurityUtils.getUsername());
if (roleService.updateRole(role) > 0)
if (roleService.updateRole(role) > 0) {
{ // 更新缓存用户权限
// 更新缓存用户权限 LoginUser loginUser = getLoginUser();
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
{ loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); tokenService.setLoginUser(loginUser);
tokenService.setLoginUser(loginUser); }
} return success();
return AjaxResult.success(); }
} return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:role:edit')")
@PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping("/dataScope")
@PostMapping("/dataScope") public AjaxResult dataScope(@RequestBody SysRole role)
// @PutMapping("/dataScope") {
public AjaxResult dataScope(@RequestBody SysRole role) roleService.checkRoleAllowed(role);
{ roleService.checkRoleDataScope(role.getRoleId());
roleService.checkRoleAllowed(role); return toAjax(roleService.authDataScope(role));
return toAjax(roleService.authDataScope(role)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:role:edit')")
@PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus")
@PostMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody SysRole role)
// @PutMapping("/changeStatus") {
public AjaxResult changeStatus(@RequestBody SysRole role) roleService.checkRoleAllowed(role);
{ roleService.checkRoleDataScope(role.getRoleId());
roleService.checkRoleAllowed(role); role.setUpdateBy(getUsername());
role.setUpdateBy(SecurityUtils.getUsername()); return toAjax(roleService.updateRoleStatus(role));
return toAjax(roleService.updateRoleStatus(role)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:role:remove')")
@PreAuthorize("@ss.hasPermi('system:role:remove')") @Log(title = "角色管理", businessType = BusinessType.DELETE)
@Log(title = "角色管理", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}")
@GetMapping(value = "/batch/{roleIds}") public AjaxResult remove(@PathVariable Long[] roleIds)
// @DeleteMapping("/{roleIds}") {
public AjaxResult remove(@PathVariable Long[] roleIds) return toAjax(roleService.deleteRoleByIds(roleIds));
{ }
return toAjax(roleService.deleteRoleByIds(roleIds));
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:role:query')")
*/ @GetMapping("/optionselect")
@PreAuthorize("@ss.hasPermi('system:role:query')") public AjaxResult optionselect()
@GetMapping("/optionselect") {
public AjaxResult optionselect() return success(roleService.selectRoleAll());
{ }
return AjaxResult.success(roleService.selectRoleAll());
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:role:list')")
*/ @GetMapping("/authUser/allocatedList")
@PreAuthorize("@ss.hasPermi('system:role:list')") public TableDataInfo allocatedList(SysUser user)
@GetMapping("/authUser/allocatedList") {
public TableDataInfo allocatedList(SysUser user) startPage();
{ List<SysUser> list = userService.selectAllocatedList(user);
startPage(); return getDataTable(list);
List<SysUser> list = userService.selectAllocatedList(user); }
return getDataTable(list);
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:role:list')")
*/ @GetMapping("/authUser/unallocatedList")
@PreAuthorize("@ss.hasPermi('system:role:list')") public TableDataInfo unallocatedList(SysUser user)
@GetMapping("/authUser/unallocatedList") {
public TableDataInfo unallocatedList(SysUser user) startPage();
{ List<SysUser> list = userService.selectUnallocatedList(user);
startPage(); return getDataTable(list);
List<SysUser> list = userService.selectUnallocatedList(user); }
return getDataTable(list);
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:role:edit')")
*/ @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PutMapping("/authUser/cancel")
@Log(title = "角色管理", businessType = BusinessType.GRANT) public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
@PostMapping("/authUser/cancel") {
// @PutMapping("/authUser/cancel") return toAjax(roleService.deleteAuthUser(userRole));
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) }
{
return toAjax(roleService.deleteAuthUser(userRole)); /**
} *
*/
/** @PreAuthorize("@ss.hasPermi('system:role:edit')")
* @Log(title = "角色管理", businessType = BusinessType.GRANT)
*/ @PutMapping("/authUser/cancelAll")
@PreAuthorize("@ss.hasPermi('system:role:edit')") public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
@Log(title = "角色管理", businessType = BusinessType.GRANT) {
@PostMapping("/authUser/cancelAll") return toAjax(roleService.deleteAuthUsers(roleId, userIds));
// @PutMapping("/authUser/cancelAll") }
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{ /**
return toAjax(roleService.deleteAuthUsers(roleId, userIds)); *
} */
@PreAuthorize("@ss.hasPermi('system:role:edit')")
/** @Log(title = "角色管理", businessType = BusinessType.GRANT)
* @PutMapping("/authUser/selectAll")
*/ public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
@PreAuthorize("@ss.hasPermi('system:role:edit')") {
@Log(title = "角色管理", businessType = BusinessType.GRANT) roleService.checkRoleDataScope(roleId);
@PostMapping("/authUser/selectAll") return toAjax(roleService.insertAuthUsers(roleId, userIds));
// @PutMapping("/authUser/selectAll") }
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{ /**
return toAjax(roleService.insertAuthUsers(roleId, userIds)); *
} */
} @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
{
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
return ajax;
}
}

View File

@ -1,263 +1,251 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.hig.utils.UUIDGenerator; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService; /**
import com.ruoyi.system.service.ISysUserService; *
*
/** * @author ruoyi
* */
* @RestController
* @author ruoyi @RequestMapping("/system/user")
*/ public class SysUserController extends BaseController
@RestController {
@RequestMapping("/system/user") @Autowired
public class SysUserController extends BaseController private ISysUserService userService;
{
@Autowired
@Autowired private ISysRoleService roleService;
private ISysUserService userService;
@Autowired
@Autowired private ISysDeptService deptService;
private ISysRoleService roleService;
@Autowired
@Autowired private ISysPostService postService;
private ISysPostService postService;
/**
@Autowired *
private TokenService tokenService; */
@PreAuthorize("@ss.hasPermi('system:user:list')")
/*@Value("${system.orgid}") @GetMapping("/list")
private String orgId;*/ public TableDataInfo list(SysUser user)
{
/** startPage();
* List<SysUser> list = userService.selectUserList(user);
*/ return getDataTable(list);
// @PreAuthorize("@ss.hasPermi('system:user:list')") }
@GetMapping("/list")
public TableDataInfo list(SysUser user) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
{ @PreAuthorize("@ss.hasPermi('system:user:export')")
// System.out.println("SysUser:" + user.toString()); @PostMapping("/export")
// 进行单位选择判断 public void export(HttpServletResponse response, SysUser user)
/*if (user.getDeptId() != null) { {
System.out.println("选过单位"); List<SysUser> list = userService.selectUserList(user);
if (user.getDeptId().toString().equals(orgId)) { ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
user.setDeptId(null); util.exportExcel(response, list, "用户数据");
} else { }
int count = sysDepartmentLevelMapper.selectCount(user.getDeptId());
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
if (count > 0) { @PreAuthorize("@ss.hasPermi('system:user:import')")
user.setCountyCode(user.getDeptId()); @PostMapping("/importData")
user.setDeptId(null); public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
} {
} ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
}*/ List<SysUser> userList = util.importExcel(file.getInputStream());
// System.out.println("SysUser:" + user.toString()); String operName = getUsername();
startPage(); String message = userService.importUser(userList, updateSupport, operName);
List<SysUser> list = userService.selectUserList(user); return success(message);
return getDataTable(list); }
}
@PostMapping("/importTemplate")
@Log(title = "用户管理", businessType = BusinessType.EXPORT) public void importTemplate(HttpServletResponse response)
@PreAuthorize("@ss.hasPermi('system:user:export')") {
@GetMapping("/export") ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
public AjaxResult export(SysUser user) util.importTemplateExcel(response, "用户数据");
{ }
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); /**
return util.exportExcel(list, "用户数据"); *
} */
@PreAuthorize("@ss.hasPermi('system:user:query')")
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @GetMapping(value = { "/", "/{userId}" })
@PreAuthorize("@ss.hasPermi('system:user:import')") public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
@PostMapping("/importData") {
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception userService.checkUserDataScope(userId);
{ AjaxResult ajax = AjaxResult.success();
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); List<SysRole> roles = roleService.selectRoleAll();
List<SysUser> userList = util.importExcel(file.getInputStream()); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); ajax.put("posts", postService.selectPostAll());
String operName = loginUser.getUsername(); if (StringUtils.isNotNull(userId))
String message = userService.importUser(userList, updateSupport, operName); {
return AjaxResult.success(message); SysUser sysUser = userService.selectUserById(userId);
} ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
@GetMapping("/importTemplate") ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
public AjaxResult importTemplate() }
{ return ajax;
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); }
return util.importTemplateExcel("用户数据");
} /**
*
/** */
* @PreAuthorize("@ss.hasPermi('system:user:add')")
*/ @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('system:user:query')") @PostMapping
@GetMapping(value = { "/", "/{userId}" }) public AjaxResult add(@Validated @RequestBody SysUser user)
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
{ if (!userService.checkUserNameUnique(user))
AjaxResult ajax = AjaxResult.success(); {
List<SysRole> roles = roleService.selectRoleAll(); return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
// System.out.println("roles:" + roles); }
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
// System.out.println("ajax:" + ajax); {
ajax.put("posts", postService.selectPostAll()); return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
if (StringUtils.isNotNull(userId)) }
{ else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); {
ajax.put("postIds", postService.selectPostListByUserId(userId)); return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); }
} user.setCreateBy(getUsername());
return ajax; user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
} return toAjax(userService.insertUser(user));
}
/**
* /**
*/ *
@PreAuthorize("@ss.hasPermi('system:user:add')") */
@Log(title = "用户管理", businessType = BusinessType.INSERT) @PreAuthorize("@ss.hasPermi('system:user:edit')")
@PostMapping @Log(title = "用户管理", businessType = BusinessType.UPDATE)
public AjaxResult add(@Validated @RequestBody SysUser user) @PutMapping
{ public AjaxResult edit(@Validated @RequestBody SysUser user)
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
{ userService.checkUserAllowed(user);
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); userService.checkUserDataScope(user.getUserId());
} if (!userService.checkUserNameUnique(user))
else if (StringUtils.isNotEmpty(user.getPhonenumber()) {
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
{ }
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
} {
else if (StringUtils.isNotEmpty(user.getEmail()) return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) }
{ else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); {
} return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
user.setCreateBy(SecurityUtils.getUsername()); }
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setUpdateBy(getUsername());
user.setUserCode(UUIDGenerator.generate()); return toAjax(userService.updateUser(user));
return toAjax(userService.insertUser(user)); }
}
/**
/** *
* */
*/ @PreAuthorize("@ss.hasPermi('system:user:remove')")
@PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.DELETE)
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @DeleteMapping("/{userIds}")
@PostMapping("/update") public AjaxResult remove(@PathVariable Long[] userIds)
// @PutMapping {
public AjaxResult edit(@Validated @RequestBody SysUser user) if (ArrayUtils.contains(userIds, getUserId()))
{ {
userService.checkUserAllowed(user); return error("当前用户不能删除");
if (StringUtils.isNotEmpty(user.getPhonenumber()) }
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) return toAjax(userService.deleteUserByIds(userIds));
{ }
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} /**
else if (StringUtils.isNotEmpty(user.getEmail()) *
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) */
{ @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); @Log(title = "用户管理", businessType = BusinessType.UPDATE)
} @PutMapping("/resetPwd")
user.setUpdateBy(SecurityUtils.getUsername()); public AjaxResult resetPwd(@RequestBody SysUser user)
return toAjax(userService.updateUser(user)); {
} userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
/** user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
* user.setUpdateBy(getUsername());
*/ return toAjax(userService.resetPwd(user));
@PreAuthorize("@ss.hasPermi('system:user:remove')") }
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@GetMapping("/batch/{userIds}") /**
// @DeleteMapping("/{userIds}") *
public AjaxResult remove(@PathVariable Long[] userIds) */
{ @PreAuthorize("@ss.hasPermi('system:user:edit')")
return toAjax(userService.deleteUserByIds(userIds)); @Log(title = "用户管理", businessType = BusinessType.UPDATE)
} @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user)
/** {
* userService.checkUserAllowed(user);
*/ userService.checkUserDataScope(user.getUserId());
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") user.setUpdateBy(getUsername());
@Log(title = "用户管理", businessType = BusinessType.UPDATE) return toAjax(userService.updateUserStatus(user));
@PostMapping("/resetPwd") }
// @PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) /**
{ *
userService.checkUserAllowed(user); */
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); @PreAuthorize("@ss.hasPermi('system:user:query')")
user.setUpdateBy(SecurityUtils.getUsername()); @GetMapping("/authRole/{userId}")
return toAjax(userService.resetPwd(user)); public AjaxResult authRole(@PathVariable("userId") Long userId)
} {
AjaxResult ajax = AjaxResult.success();
/** SysUser user = userService.selectUserById(userId);
* List<SysRole> roles = roleService.selectRolesByUserId(userId);
*/ ajax.put("user", user);
@PreAuthorize("@ss.hasPermi('system:user:edit')") ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
@Log(title = "用户管理", businessType = BusinessType.UPDATE) return ajax;
@PostMapping("/changeStatus") }
// @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) /**
{ *
userService.checkUserAllowed(user); */
user.setUpdateBy(SecurityUtils.getUsername()); @PreAuthorize("@ss.hasPermi('system:user:edit')")
return toAjax(userService.updateUserStatus(user)); @Log(title = "用户管理", businessType = BusinessType.GRANT)
} @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
/** {
* userService.checkUserDataScope(userId);
*/ userService.insertUserAuth(userId, roleIds);
@PreAuthorize("@ss.hasPermi('system:user:query')") return success();
@GetMapping("/authRole/{userId}") }
public AjaxResult authRole(@PathVariable("userId") Long userId)
{ /**
AjaxResult ajax = AjaxResult.success(); *
SysUser user = userService.selectUserById(userId); */
List<SysRole> roles = roleService.selectRolesByUserId(userId); @PreAuthorize("@ss.hasPermi('system:user:list')")
ajax.put("user", user); @GetMapping("/deptTree")
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); public AjaxResult deptTree(SysDept dept)
return ajax; {
} return success(deptService.selectDeptTreeList(dept));
}
/** }
*
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PostMapping("/authRole")
// @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.insertUserAuth(userId, roleIds);
return success();
}
}

View File

@ -1,69 +0,0 @@
package com.ruoyi.web.controller.system;
import java.io.IOException;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.google.zxing.WriterException;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.service.WechatService;
import me.chanjar.weixin.common.error.WxErrorException;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/wechat")
public class WechatLoginController extends BaseController
{
@Autowired
private WechatService wechatService;
/**
*
*/
@GetMapping("/qrcode")
public AjaxResult generateQrCode()
{
try
{
Map<String, Object> result = wechatService.generateLoginQrCode();
return AjaxResult.success(result);
}
catch (WxErrorException | IOException | WriterException e)
{
return AjaxResult.error("生成二维码失败: " + e.getMessage());
}
}
/**
*
*/
@GetMapping("/status")
public AjaxResult checkLoginStatus(@RequestParam String loginId)
{
Map<String, Object> result = wechatService.checkLoginStatus(loginId);
return AjaxResult.success(result);
}
/**
*
*/
@GetMapping("/callback")
public AjaxResult wechatCallback(
@RequestParam(required = false) String code,
@RequestParam(required = false) String state)
{
return wechatService.handleWechatCallback(code, state);
}
}

View File

@ -1,24 +0,0 @@
package com.ruoyi.web.controller.tool;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* swagger
*
* @author ruoyi
*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
@GetMapping()
public String index()
{
return redirect("/swagger-ui.html");
}
}

View File

@ -1,181 +1,183 @@
package com.ruoyi.web.controller.tool; package com.ruoyi.web.controller.tool;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
* swagger * swagger
* *
* @author ruoyi * @author ruoyi
*/ */
@Api("用户信息管理") @Api("用户信息管理")
@RestController @RestController
@RequestMapping("/test/user") @RequestMapping("/test/user")
public class TestController extends BaseController public class TestController extends BaseController
{ {
private final static Map<Integer, UserEntity> USERS = new LinkedHashMap<Integer, UserEntity>(); private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{ {
USERS.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
USERS.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
} }
@ApiOperation("获取用户列表") @ApiOperation("获取用户列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult userList() public R<List<UserEntity>> userList()
{ {
List<UserEntity> userList = new ArrayList<UserEntity>(USERS.values()); List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList); return R.ok(userList);
} }
@ApiOperation("获取用户详细") @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}") @GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId) public R<UserEntity> getUser(@PathVariable Integer userId)
{ {
if (!USERS.isEmpty() && USERS.containsKey(userId)) if (!users.isEmpty() && users.containsKey(userId))
{ {
return AjaxResult.success(USERS.get(userId)); return R.ok(users.get(userId));
} }
else else
{ {
return error("用户不存在"); return R.fail("用户不存在");
} }
} }
@ApiOperation("新增用户") @ApiOperation("新增用户")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"), @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"), @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String") @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
}) })
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(UserEntity user) public R<String> save(UserEntity user)
{ {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{ {
return error("用户ID不能为空"); return R.fail("用户ID不能为空");
} }
return AjaxResult.success(USERS.put(user.getUserId(), user)); users.put(user.getUserId(), user);
} return R.ok();
}
@ApiOperation("更新用户")
@PutMapping("/update") @ApiOperation("更新用户")
public AjaxResult update(@RequestBody UserEntity user) @PutMapping("/update")
{ public R<String> update(@RequestBody UserEntity user)
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
{ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
return error("用户ID不能为空"); {
} return R.fail("用户ID不能为空");
if (USERS.isEmpty() || !USERS.containsKey(user.getUserId())) }
{ if (users.isEmpty() || !users.containsKey(user.getUserId()))
return error("用户不存在"); {
} return R.fail("用户不存在");
USERS.remove(user.getUserId()); }
return AjaxResult.success(USERS.put(user.getUserId(), user)); users.remove(user.getUserId());
} users.put(user.getUserId(), user);
return R.ok();
@ApiOperation("删除用户信息") }
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@DeleteMapping("/{userId}") @ApiOperation("删除用户信息")
public AjaxResult delete(@PathVariable Integer userId) @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
{ @DeleteMapping("/{userId}")
if (!USERS.isEmpty() && USERS.containsKey(userId)) public R<String> delete(@PathVariable Integer userId)
{ {
USERS.remove(userId); if (!users.isEmpty() && users.containsKey(userId))
return success(); {
} users.remove(userId);
else return R.ok();
{ }
return error("用户不存在"); else
} {
} return R.fail("用户不存在");
} }
}
@ApiModel(value = "UserEntity", description = "用户实体") }
class UserEntity
{ @ApiModel(value = "UserEntity", description = "用户实体")
@ApiModelProperty("用户ID") class UserEntity
private Integer userId; {
@ApiModelProperty("用户ID")
@ApiModelProperty("用户名称") private Integer userId;
private String username;
@ApiModelProperty("用户名称")
@ApiModelProperty("用户密码") private String username;
private String password;
@ApiModelProperty("用户密码")
@ApiModelProperty("用户手机") private String password;
private String mobile;
@ApiModelProperty("用户手机")
public UserEntity() private String mobile;
{
public UserEntity()
} {
public UserEntity(Integer userId, String username, String password, String mobile) }
{
this.userId = userId; public UserEntity(Integer userId, String username, String password, String mobile)
this.username = username; {
this.password = password; this.userId = userId;
this.mobile = mobile; this.username = username;
} this.password = password;
this.mobile = mobile;
public Integer getUserId() }
{
return userId; public Integer getUserId()
} {
return userId;
public void setUserId(Integer userId) }
{
this.userId = userId; public void setUserId(Integer userId)
} {
this.userId = userId;
public String getUsername() }
{
return username; public String getUsername()
} {
return username;
public void setUsername(String username) }
{
this.username = username; public void setUsername(String username)
} {
this.username = username;
public String getPassword() }
{
return password; public String getPassword()
} {
return password;
public void setPassword(String password) }
{
this.password = password; public void setPassword(String password)
} {
this.password = password;
public String getMobile() }
{
return mobile; public String getMobile()
} {
return mobile;
public void setMobile(String mobile) }
{
this.mobile = mobile; public void setMobile(String mobile)
} {
} this.mobile = mobile;
}
}

View File

@ -1,125 +1,125 @@
package com.ruoyi.web.core.config; package com.ruoyi.web.core.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey; import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference; import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme; import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
/** /**
* Swagger2 * Swagger2
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
public class SwaggerConfig public class SwaggerConfig
{ {
/** 系统基础配置 */ /** 系统基础配置 */
@Autowired @Autowired
private RuoYiConfig ruoyiConfig; private RuoYiConfig ruoyiConfig;
/** 是否开启swagger */ /** 是否开启swagger */
@Value("${swagger.enabled}") @Value("${swagger.enabled}")
private boolean enabled; private boolean enabled;
/** 设置请求的统一前缀 */ /** 设置请求的统一前缀 */
@Value("${swagger.pathMapping}") @Value("${swagger.pathMapping}")
private String pathMapping; private String pathMapping;
/** /**
* API * API
*/ */
@Bean @Bean
public Docket createRestApi() public Docket createRestApi()
{ {
return new Docket(DocumentationType.OAS_30) return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger // 是否启用Swagger
.enable(enabled) .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo()) .apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示 // 设置哪些接口暴露给Swagger展示
.select() .select()
// 扫描所有有注解的api用这种方式更灵活 // 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解 // 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any()) // 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build() .build()
/* 设置安全模式swagger可以设置访问token */ /* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes()) .securitySchemes(securitySchemes())
.securityContexts(securityContexts()) .securityContexts(securityContexts())
.pathMapping(pathMapping); .pathMapping(pathMapping);
} }
/** /**
* tokenAuthorization * tokenAuthorization
*/ */
private List<SecurityScheme> securitySchemes() private List<SecurityScheme> securitySchemes()
{ {
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>(); List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList; return apiKeyList;
} }
/** /**
* *
*/ */
private List<SecurityContext> securityContexts() private List<SecurityContext> securityContexts()
{ {
List<SecurityContext> securityContexts = new ArrayList<>(); List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add( securityContexts.add(
SecurityContext.builder() SecurityContext.builder()
.securityReferences(defaultAuth()) .securityReferences(defaultAuth())
.operationSelector(o -> o.requestMappingPattern().matches("/.*")) .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
.build()); .build());
return securityContexts; return securityContexts;
} }
/** /**
* *
*/ */
private List<SecurityReference> defaultAuth() private List<SecurityReference> defaultAuth()
{ {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope; authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>(); List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences; return securityReferences;
} }
/** /**
* *
*/ */
private ApiInfo apiInfo() private ApiInfo apiInfo()
{ {
// 用ApiInfoBuilder进行定制 // 用ApiInfoBuilder进行定制
return new ApiInfoBuilder() return new ApiInfoBuilder()
// 设置标题 // 设置标题
.title("标题若依管理系统_接口文档") .title("标题若依管理系统_接口文档")
// 描述 // 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息 // 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null)) .contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本 // 版本
.version("版本号:" + ruoyiConfig.getVersion()) .version("版本号:" + ruoyiConfig.getVersion())
.build(); .build();
} }
} }

View File

@ -1,65 +1,63 @@
# 数据源配置 # 数据源配置
spring: spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
#driver-class-name: oracle.jdbc.OracleDriver druid:
druid: # 主库数据源
# 主库数据源 master:
master: #url: jdbc:mysql://62.234.3.186:3306/yanzhu_exam?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
#url: jdbc:mysql://62.234.3.186:3306/yanzhu_exam?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8 url: jdbc:mysql://127.0.0.1:3306/yanzhu_exam?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:3306/yanzhu_exam?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8 username: root
username: root #password: Sxyanzhu@cf123
#password: Sxyanzhu@cf123 password: haha123321
password: haha123321 # 从库数据源
slave:
#url: jdbc:oracle:thin:@127.0.0.1:1521/xchwdb # 从数据源开关/默认关闭
#username: exam_user enabled: false
#password: exam_user url:
username:
# 从库数据源 password:
slave: # 初始连接数
# 从数据源开关/默认关闭 initialSize: 5
enabled: false # 最小连接池数量
url: minIdle: 10
username: # 最大连接池数量
password: maxActive: 20
# 初始连接数 # 配置获取连接等待超时的时间
initialSize: 5 maxWait: 60000
# 最小连接池数量 # 配置连接超时时间
minIdle: 10 connectTimeout: 30000
# 最大连接池数量 # 配置网络超时时间
maxActive: 20 socketTimeout: 60000
# 配置获取连接等待超时的时间 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
maxWait: 60000 timeBetweenEvictionRunsMillis: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒
timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置一个连接在池中最大生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000 maxEvictableIdleTimeMillis: 900000
# 配置一个连接在池中最大生存的时间,单位是毫秒 # 配置检测连接是否有效
maxEvictableIdleTimeMillis: 900000 validationQuery: SELECT 1 FROM DUAL
# 配置检测连接是否有效 testWhileIdle: true
validationQuery: SELECT 1 testOnBorrow: false
testWhileIdle: true testOnReturn: false
testOnBorrow: false webStatFilter:
testOnReturn: false enabled: true
webStatFilter: statViewServlet:
enabled: true enabled: true
statViewServlet: # 设置白名单,不填则允许所有访问
enabled: true allow:
# 设置白名单,不填则允许所有访问 url-pattern: /druid/*
allow: # 控制台管理用户名和密码
url-pattern: /druid/* login-username: ruoyi
# 控制台管理用户名和密码 login-password: 123456
login-username: ruoyi filter:
login-password: 123456 stat:
filter: enabled: true
stat: # 慢SQL记录
enabled: true log-slow-sql: true
# 慢SQL记录 slow-sql-millis: 1000
log-slow-sql: true merge-sql: true
slow-sql-millis: 1000 wall:
merge-sql: true config:
wall:
config:
multi-statement-allow: true multi-statement-allow: true

View File

@ -1,164 +1,158 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: Yanzhu name: Yanzhu
# 版本 # 版本
version: 3.6.0 version: 3.8.6
# 版权年份 # 版权年份
copyrightYear: 2025 copyrightYear: 2023
# 实例演示开关 # 实例演示开关
demoEnabled: false demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /Users/mac/data/uploadPath/exam profile: /Users/mac/data/uploadPath/exam
# profile: D:/image/upload # 获取ip地址开关
# 获取ip地址开关 addressEnabled: false
addressEnabled: false # 验证码类型 math 数字计算 char 字符验证
# 验证码类型 math 数组计算 char 字符验证 captchaType: math
captchaType: math
# 开发环境配置
# 开发环境配置 server:
server: # 服务器的HTTP端口默认为8080
# 服务器的HTTP端口默认为8080 port: 8040
port: 8040 servlet:
servlet: # 应用的访问路径
# 应用的访问路径 context-path: /examapi
context-path: /examapi tomcat:
tomcat: # tomcat的URI编码
# tomcat的URI编码 uri-encoding: UTF-8
uri-encoding: UTF-8 # 连接数满后的排队数默认为100
# tomcat最大线程数默认为200 accept-count: 1000
max-threads: 800 threads:
# Tomcat启动初始化的线程数默认值25 # tomcat最大线程数默认为200
min-spare-threads: 30 max: 800
# Tomcat启动初始化的线程数默认值10
# Spring配置 min-spare: 100
spring:
# 资源信息 # 日志配置
messages: logging:
# 国际化资源文件路径 level:
basename: i18n/messages com.ruoyi: debug
profiles: org.springframework: warn
active: druid
# 文件上传 # 用户配置
servlet: user:
multipart: password:
# 单个文件大小 # 密码最大错误次数
max-file-size: 30MB maxRetryCount: 5
# 设置总上传的文件大小 # 密码锁定时间默认10分钟
max-request-size: 120MB lockTime: 10
# 服务模块
devtools: # Spring配置
restart: spring:
# 热部署开关 # 资源信息
enabled: true messages:
# redis 配置 # 国际化资源文件路径
redis: basename: i18n/messages
database: 0 # Redis数据库索引默认为0 profiles:
# host: localhost # Redis服务器地址 active: druid
host: 127.0.0.1 # 文件上传
port: 6379 # Redis服务器连接端口 servlet:
password: 123456 # Redis服务器连接密码默认为空 multipart:
timeout: 20000 # 连接超时时间(毫秒) # 单个文件大小
jedis: max-file-size: 10MB
pool: # 设置总上传的文件大小
max-active: -1 # 连接池最大连接数(使用负值表示没有限制) max-request-size: 20MB
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) # 服务模块
max-idle: 100 # 连接池中的最大空闲连接 devtools:
min-idle: 10 # 连接池中的最小空闲连接 restart:
# 热部署开关
enabled: true
# 内容管理相关 # redis 配置
cms: redis:
swipper: # 地址
photo-path: /photo/swipper host: localhost
# 内容管理相关 # 端口默认为6379
news: port: 6379
photo-path: /photo/news # 数据库索引
exam: database: 0
photo-path: /photo/exam # 密码
# 文件管理相关 password: 123456
fms: # 连接超时时间
photo-path: /photo/fms timeout: 10s
# 文件管理相关 lettuce:
files: pool:
photo-path: /photo/files # 连接池中的最小空闲连接
# 流程附件相关 min-idle: 0
workflow: # 连接池中的最大空闲连接
file-path: /photo/ueditor max-idle: 8
# 连接池的最大数据库连接数
# 微信配置 max-active: 8
wechat: # #连接池最大阻塞等待时间(使用负值表示没有限制)
# 微信公众号AppId max-wait: -1ms
app-id: your_wechat_appid
# 微信公众号AppSecret # token配置
app-secret: your_wechat_app_secret token:
# 授权回调地址 # 令牌自定义标识
redirect-uri: http://your-domain.com/examapi/wechat/callback header: Authorization
# 二维码场景值前缀 # 令牌密钥
qr-scene-prefix: LOGIN_ secret: abcdefghijklmnopqrstuvwxyz
# 二维码有效期(秒) # 令牌有效期默认30分钟
qr-expire-time: 600 expireTime: 30
# 登录状态检查间隔(毫秒)
status-check-interval: 2000 # MyBatis配置
# 考试系统 mybatis:
exam: # 搜索指定包别名
photo-path: /photo/exam typeAliasesPackage: com.ruoyi.**.domain,com.yanzhu.exam.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
http: # 加载全局的配置文件
maxTotal: 300 configLocation: classpath:mybatis/mybatis-config.xml
defaultMaxPerRoute: 100
connectTimeout: 30000 # PageHelper分页插件
connectionRequestTimeout: 30000 pagehelper:
socketTimeout: 30000 helperDialect: mysql
staleConnectionCheckEnabled: true supportMethodsArguments: true
params: count=countSql
# 日志配置
logging: # Swagger配置
level: swagger:
root: info # 是否开启swagger
com.ruoyi: debug enabled: true
com.hig: debug # 请求前缀
org.springframework: warn pathMapping: /news-api
# 防止XSS攻击
xss:
# token配置 # 过滤开关
token: enabled: true
# 令牌自定义标识 # 排除链接(多个用逗号分隔)
header: Authorization excludes: /system/notice
# 令牌密钥 # 匹配链接
secret: abcdefghijklmnopqrstuvwxyz urlPatterns: /system/*,/monitor/*,/tool/*
# 令牌有效期默认30分钟
expireTime: 30 http:
maxTotal: 300
# MyBatis配置 defaultMaxPerRoute: 100
mybatis: connectTimeout: 30000
# 搜索指定包别名 connectionRequestTimeout: 30000
typeAliasesPackage: com.ruoyi.**.domain,com.hig.**.domain socketTimeout: 30000
# 配置mapper的扫描找到所有的mapper.xml映射文件 staleConnectionCheckEnabled: true
mapperLocations: classpath*:mapper/**/*Mapper.xml # 内容管理相关
# 加载全局的配置文件 cms:
configLocation: classpath:mybatis/mybatis-config.xml swipper:
photo-path: /photo/swipper
# PageHelper分页插件 # 内容管理相关
pagehelper: news:
helperDialect: mysql photo-path: /photo/news
supportMethodsArguments: true exam:
params: count=countSql photo-path: /photo/exam
# 文件管理相关
# Swagger配置 fms:
swagger: photo-path: /photo/fms
# 是否开启swagger # 文件管理相关
enabled: true files:
# 请求前缀 photo-path: /photo/files
pathMapping: /news-api # 流程附件相关
workflow:
# 防止XSS攻击 file-path: /photo/ueditor
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -0,0 +1,24 @@
Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////

View File

@ -1,77 +0,0 @@
{
"basePath": "/u01/upload",
"imageActionName": "uploadimage",
"imageFieldName": "upfile",
"imageMaxSize": 2048000,
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"imageCompressEnable": true,
"imageCompressBorder": 1600,
"imageInsertAlign": "none",
"imageUrlPrefix": "http://127.0.0.1:8080/examapi",
"imagePathFormat": "/photo/ueditor/{yyyy}{mm}{dd}/{time}{rand:6}",
"scrawlActionName": "uploadscrawl",
"scrawlFieldName": "upfile",
"scrawlPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"scrawlMaxSize": 2048000,
"scrawlUrlPrefix": "",
"scrawlInsertAlign": "none",
"snapscreenActionName": "uploadimage",
"snapscreenPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"snapscreenUrlPrefix": "",
"snapscreenInsertAlign": "none",
"catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
"catcherActionName": "catchimage",
"catcherFieldName": "source",
"catcherPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"catcherUrlPrefix": "",
"catcherMaxSize": 2048000,
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"videoActionName": "uploadvideo",
"videoFieldName": "upfile",
"videoPathFormat": "/photo/ueditor/{yyyy}{mm}{dd}/{time}{rand:6}",
"videoUrlPrefix": "http://127.0.0.1:8080/examapi",
"videoMaxSize": 102400000,
"videoAllowFiles": [
".mp4", ".ogg", ".webm"],
"fileActionName": "uploadfile",
"fileFieldName": "upfile",
"filePathFormat": "/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}",
"fileUrlPrefix": "",
"fileMaxSize": 51200000,
"fileAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
],
"imageManagerActionName": "listimage",
"imageManagerListPath": "/ueditor/jsp/upload/image/",
"imageManagerListSize": 20,
"imageManagerUrlPrefix": "",
"imageManagerInsertAlign": "none",
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"fileManagerActionName": "listfile",
"fileManagerListPath": "/ueditor/jsp/upload/file/",
"fileManagerUrlPrefix": "",
"fileManagerListSize": 20,
"fileManagerAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
]
}

View File

@ -1,36 +1,38 @@
#错误消息 #错误消息
not.null=* 必须填写 not.null=* 必须填写
user.jcaptcha.error=验证码错误 user.jcaptcha.error=验证码错误
user.jcaptcha.expire=验证码已失效 user.jcaptcha.expire=验证码已失效
user.not.exists=用户不存在/密码错误 user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误 user.password.not.match=用户不存在/密码错误
user.password.retry.limit.count=密码输入错误{0}次 user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟 user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
user.password.delete=对不起,您的账号已被删除 user.password.delete=对不起,您的账号已被删除
user.blocked=用户已封禁,请联系管理员 user.blocked=用户已封禁,请联系管理员
role.blocked=角色已封禁,请联系管理员 role.blocked=角色已封禁,请联系管理员
user.logout.success=退出成功 login.blocked=很遗憾访问IP已被列入系统黑名单
user.logout.success=退出成功
length.not.valid=长度必须在{min}到{max}个字符之间
length.not.valid=长度必须在{min}到{max}个字符之间
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符 user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误 user.email.not.valid=邮箱格式错误
user.login.success=登录成功 user.mobile.phone.number.not.valid=手机号格式错误
user.notfound=请重新登录 user.login.success=登录成功
user.forcelogout=管理员强制退出,请重新登录 user.register.success=注册成功
user.unknown.error=未知错误,请重新登录 user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录
##文件上传消息 user.unknown.error=未知错误,请重新登录
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符 ##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
##权限 upload.filename.exceed.length=上传的文件名最长{0}个字符
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] ##权限
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

View File

@ -1,94 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/Users/code/logs" /> <property name="log.path" value="./logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 --> <!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统日志输出 --> <!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file> <file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>INFO</level> <level>INFO</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file> <file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>ERROR</level> <level>ERROR</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<!-- 用户访问日志输出 --> <!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file> <file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily --> <!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统模块日志级别控制 --> <!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="debug" /> <logger name="com.ruoyi" level="info" />
<logger name="com.hig" level="debug" /> <!-- Spring日志级别控制 -->
<!-- Spring日志级别控制 --> <logger name="org.springframework" level="warn" />
<logger name="org.springframework" level="warn" />
<root level="info">
<root level="info"> <appender-ref ref="console" />
<appender-ref ref="console" /> </root>
</root>
<!--系统操作日志-->
<!--系统操作日志--> <root level="info">
<root level="info"> <appender-ref ref="file_info" />
<appender-ref ref="file_info" /> <appender-ref ref="file_error" />
<appender-ref ref="file_error" /> </root>
</root>
<!--系统用户操作日志-->
<!--系统用户操作日志--> <logger name="sys-user" level="info">
<logger name="sys-user" level="info"> <appender-ref ref="sys-user"/>
<appender-ref ref="sys-user"/> </logger>
</logger>
</configuration> </configuration>

View File

@ -1,15 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration <!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd"> "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration> <configuration>
<!-- 全局参数 -->
<settings> <settings>
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 --> <!-- 使全局的映射器启用或禁用缓存 -->
<!-- <setting name="useGeneratedKeys" value="true" /> --> <!-- 允许 JDBC 支持自动生成主键 --> <setting name="cacheEnabled" value="true" />
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 --> <!-- 允许JDBC 支持自动生成主键 -->
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 --> <setting name="useGeneratedKeys" value="true" />
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 --> <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
</settings> <setting name="defaultExecutorType" value="SIMPLE" />
<!-- 指定 MyBatis 所用日志的具体实现 -->
</configuration> <setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
</settings>
</configuration>

View File

@ -1,131 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<version>3.8.6</version> <version>3.8.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<description> <description>
common通用工具 common通用工具
</description> </description>
<dependencies> <dependencies>
<!-- Spring框架基本的核心工具 --> <!-- Spring框架基本的核心工具 -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<!-- SpringWeb模块 --> <!-- SpringWeb模块 -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<!-- spring security 安全认证 --> <!-- spring security 安全认证 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<!-- pagehelper 分页插件 --> <!-- pagehelper 分页插件 -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency> </dependency>
<!-- 自定义验证注解 --> <!-- 自定义验证注解 -->
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>validation-api</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
</dependency> </dependency>
<!--常用工具类 --> <!--常用工具类 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- JSON工具类 --> <!-- JSON工具类 -->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
</dependency> </dependency>
<!-- 阿里JSON解析器 --> <!-- 动态数据源 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.baomidou</groupId>
<artifactId>fastjson</artifactId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency> <version>3.5.2</version>
</dependency>
<!-- io常用工具类 -->
<dependency> <!-- 阿里JSON解析器 -->
<groupId>commons-io</groupId> <dependency>
<artifactId>commons-io</artifactId> <groupId>com.alibaba.fastjson2</groupId>
</dependency> <artifactId>fastjson2</artifactId>
</dependency>
<!-- 文件上传工具类 -->
<dependency> <!-- io常用工具类 -->
<groupId>commons-fileupload</groupId> <dependency>
<artifactId>commons-fileupload</artifactId> <groupId>commons-io</groupId>
</dependency> <artifactId>commons-io</artifactId>
</dependency>
<!-- excel工具 -->
<dependency> <!-- excel工具 -->
<groupId>org.apache.poi</groupId> <dependency>
<artifactId>poi-ooxml</artifactId> <groupId>org.apache.poi</groupId>
</dependency> <artifactId>poi-ooxml</artifactId>
</dependency>
<!-- yml解析器 -->
<dependency> <!-- yml解析器 -->
<groupId>org.yaml</groupId> <dependency>
<artifactId>snakeyaml</artifactId> <groupId>org.yaml</groupId>
</dependency> <artifactId>snakeyaml</artifactId>
</dependency>
<!--Token生成与解析-->
<dependency> <!-- Token生成与解析-->
<groupId>io.jsonwebtoken</groupId> <dependency>
<artifactId>jjwt</artifactId> <groupId>io.jsonwebtoken</groupId>
</dependency> <artifactId>jjwt</artifactId>
</dependency>
<!-- redis 缓存操作 -->
<dependency> <!-- Jaxb -->
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-starter-data-redis</artifactId> <groupId>javax.xml.bind</groupId>
</dependency> <artifactId>jaxb-api</artifactId>
</dependency>
<!-- pool 对象池 -->
<dependency> <!-- redis 缓存操作 -->
<groupId>org.apache.commons</groupId> <dependency>
<artifactId>commons-pool2</artifactId> <groupId>org.springframework.boot</groupId>
</dependency> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 解析客户端操作系统、浏览器等 -->
<dependency> <!-- pool 对象池 -->
<groupId>eu.bitwalker</groupId> <dependency>
<artifactId>UserAgentUtils</artifactId> <groupId>org.apache.commons</groupId>
</dependency> <artifactId>commons-pool2</artifactId>
</dependency>
<!-- servlet包 -->
<dependency> <!-- 解析客户端操作系统、浏览器等 -->
<groupId>javax.servlet</groupId> <dependency>
<artifactId>javax.servlet-api</artifactId> <groupId>eu.bitwalker</groupId>
</dependency> <artifactId>UserAgentUtils</artifactId>
</dependency>
<!-- JAXB API for DatatypeConverter used by jjwt -->
<dependency> <!-- servlet包 -->
<groupId>javax.xml.bind</groupId> <dependency>
<artifactId>jaxb-api</artifactId> <groupId>javax.servlet</groupId>
<version>2.3.1</version> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -0,0 +1,19 @@
package com.ruoyi.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 访
*
* @author ruoyi
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Anonymous
{
}

View File

@ -1,28 +1,33 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
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;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface DataScope public @interface DataScope
{ {
/** /**
* *
*/ */
public String deptAlias() default ""; public String deptAlias() default "";
/** /**
* *
*/ */
public String userAlias() default ""; public String userAlias() default "";
}
/**
* @ss
*/
public String permission() default "";
}

View File

@ -1,28 +1,28 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
/** /**
* *
* *
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@Inherited @Inherited
public @interface DataSource public @interface DataSource
{ {
/** /**
* *
*/ */
public DataSourceType value() default DataSourceType.MASTER; public DataSourceType value() default DataSourceType.MASTER;
} }

View File

@ -1,211 +1,188 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
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;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
/** import org.apache.poi.ss.usermodel.HorizontalAlignment;
* Excel import org.apache.poi.ss.usermodel.IndexedColors;
* import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
* @author ruoyi
*/ /**
@Retention(RetentionPolicy.RUNTIME) * Excel
@Target(ElementType.FIELD) *
public @interface Excel * @author ruoyi
{ */
/** @Retention(RetentionPolicy.RUNTIME)
* excel @Target(ElementType.FIELD)
*/ public @interface Excel
public int sort() default Integer.MAX_VALUE; {
/**
/** * excel
* Excel. */
*/ public int sort() default Integer.MAX_VALUE;
public String name() default "";
/**
/** * Excel.
* , : yyyy-MM-dd */
*/ public String name() default "";
public String dateFormat() default "";
/**
/** * , : yyyy-MM-dd
* type (: sys_user_sex) */
*/ public String dateFormat() default "";
public String dictType() default "";
/**
/** * type (: sys_user_sex)
* (: 0=,1=,2=) */
*/ public String dictType() default "";
public String readConverterExp() default "";
/**
/** * (: 0=,1=,2=)
* */
*/ public String readConverterExp() default "";
public String separator() default ",";
/**
/** *
* BigDecimal :-1(BigDecimal) */
*/ public String separator() default ",";
public int scale() default -1;
/**
/** * BigDecimal :-1(BigDecimal)
* BigDecimal :BigDecimal.ROUND_HALF_EVEN */
*/ public int scale() default -1;
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
/** * BigDecimal :RoundingMode.HALF_EVEN
* 0 1 */
*/ public RoundingMode roundingMode() default RoundingMode.HALF_EVEN;
public ColumnType cellType() default ColumnType.STRING;
/**
/** * 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 String[] combo() default {};
public String[] combo() default {};
/**
/** * ,:list)
* ,:,. */
*/ 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;
/**
/** * ,
* 0123 */
*/ public boolean isStatistics() default false;
Align align() default Align.AUTO;
/**
/** * 0 1 2
* 012 */
*/ public ColumnType cellType() default ColumnType.STRING;
public enum Align
{ /**
/** *
* */
*/ public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
AUTO(0),
/** /**
* *
*/ */
LEFT(1), public IndexedColors headerColor() default IndexedColors.WHITE;
/**
* /**
*/ *
CENTER(2), */
/** public IndexedColors backgroundColor() default IndexedColors.WHITE;
*
*/ /**
right(3); *
private final int value; */
public IndexedColors color() default IndexedColors.BLACK;
Align(int value)
{ /**
this.value = value; *
} */
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
public int value()
{ /**
return this.value; *
} */
} public Class<?> handler() default ExcelHandlerAdapter.class;
/** /**
* 012 *
*/ */
Type type() default Type.ALL; public String[] args() default {};
/** /**
* 012 * 012
*/ */
public enum Type Type type() default Type.ALL;
{
/** public enum Type
* {
*/ ALL(0), EXPORT(1), IMPORT(2);
ALL(0), private final int value;
/**
* Type(int value)
*/ {
EXPORT(1), this.value = value;
/** }
*
*/ public int value()
IMPORT(2); {
private final int value; return this.value;
}
Type(int value) }
{
this.value = value; public enum ColumnType
} {
NUMERIC(0), STRING(1), IMAGE(2);
public int value() private final int value;
{
return this.value; ColumnType(int value)
} {
} this.value = value;
}
/**
* 012 public int value()
*/ {
public enum ColumnType return this.value;
{ }
/** }
*
*/
NUMERIC(0),
/**
*
*/
STRING(1),
/**
*
*/
IMAGE(2);
private final int value;
ColumnType(int value)
{
this.value = value;
}
public int value()
{
return this.value;
}
}
} }

View File

@ -1,18 +1,18 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
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;
import java.lang.annotation.Target; 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(); public Excel[] value();
} }

View File

@ -1,41 +1,51 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
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;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType; import com.ruoyi.common.enums.OperatorType;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
* *
*/ */
@Target({ ElementType.PARAMETER, ElementType.METHOD }) @Target({ ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface Log public @interface Log
{ {
/** /**
* *
*/ */
public String title() default ""; public String title() default "";
/** /**
* *
*/ */
public BusinessType businessType() default BusinessType.OTHER; public BusinessType businessType() default BusinessType.OTHER;
/** /**
* *
*/ */
public OperatorType operatorType() default OperatorType.MANAGE; public OperatorType operatorType() default OperatorType.MANAGE;
/** /**
* *
*/ */
public boolean isSaveRequestData() default true; public boolean isSaveRequestData() default true;
}
/**
*
*/
public boolean isSaveResponseData() default true;
/**
*
*/
public String[] excludeParamNames() default {};
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.enums.LimitType;
/**
*
*
* @author ruoyi
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter
{
/**
* key
*/
public String key() default CacheConstants.RATE_LIMIT_KEY;
/**
* ,
*/
public int time() default 60;
/**
*
*/
public int count() default 100;
/**
*
*/
public LimitType limitType() default LimitType.DEFAULT;
}

View File

@ -1,23 +1,31 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
* *
*/ */
@Inherited @Inherited
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface RepeatSubmit public @interface RepeatSubmit
{ {
/**
} * (ms)
*/
public int interval() default 5000;
/**
*
*/
public String message() default "不允许重复提交,请稍候再试";
}

View File

@ -1,116 +1,135 @@
package com.ruoyi.common.config; package com.ruoyi.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
@ConfigurationProperties(prefix = "ruoyi") @ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig public class RuoYiConfig
{ {
/** 项目名称 */ /** 项目名称 */
private String name; private String name;
/** 版本 */ /** 版本 */
private String version; private String version;
/** 版权年份 */ /** 版权年份 */
private String copyrightYear; private String copyrightYear;
/** 实例演示开关 */ /** 实例演示开关 */
private boolean demoEnabled; private boolean demoEnabled;
/** 上传路径 */ /** 上传路径 */
private static String profile; private static String profile;
/** 获取地址开关 */ /** 获取地址开关 */
private static boolean addressEnabled; private static boolean addressEnabled;
public String getName() /** 验证码类型 */
{ private static String captchaType;
return name;
} public String getName()
{
public void setName(String name) return name;
{ }
this.name = name;
} public void setName(String name)
{
public String getVersion() this.name = name;
{ }
return version;
} public String getVersion()
{
public void setVersion(String version) return version;
{ }
this.version = version;
} public void setVersion(String version)
{
public String getCopyrightYear() this.version = version;
{ }
return copyrightYear;
} public String getCopyrightYear()
{
public void setCopyrightYear(String copyrightYear) return copyrightYear;
{ }
this.copyrightYear = copyrightYear;
} public void setCopyrightYear(String copyrightYear)
{
public boolean isDemoEnabled() this.copyrightYear = copyrightYear;
{ }
return demoEnabled;
} public boolean isDemoEnabled()
{
public void setDemoEnabled(boolean demoEnabled) return demoEnabled;
{ }
this.demoEnabled = demoEnabled;
} public void setDemoEnabled(boolean demoEnabled)
{
public static String getProfile() this.demoEnabled = demoEnabled;
{ }
return profile;
} public static String getProfile()
{
public void setProfile(String profile) return profile;
{ }
RuoYiConfig.profile = profile;
} public void setProfile(String profile)
{
public static boolean isAddressEnabled() RuoYiConfig.profile = profile;
{ }
return addressEnabled;
} public static boolean isAddressEnabled()
{
public void setAddressEnabled(boolean addressEnabled) return addressEnabled;
{ }
RuoYiConfig.addressEnabled = addressEnabled;
} public void setAddressEnabled(boolean addressEnabled)
{
/** RuoYiConfig.addressEnabled = addressEnabled;
* }
*/
public static String getAvatarPath() public static String getCaptchaType() {
{ return captchaType;
return getProfile() + "/avatar"; }
}
public void setCaptchaType(String captchaType) {
/** RuoYiConfig.captchaType = captchaType;
* }
*/
public static String getDownloadPath() /**
{ *
return getProfile() + "/download/"; */
} public static String getImportPath()
{
/** return getProfile() + "/import";
* }
*/
public static String getUploadPath() /**
{ *
return getProfile() + "/upload"; */
} public static String getAvatarPath()
} {
return getProfile() + "/avatar";
}
/**
*
*/
public static String getDownloadPath()
{
return getProfile() + "/download/";
}
/**
*
*/
public static String getUploadPath()
{
return getProfile() + "/upload";
}
}

View File

@ -0,0 +1,44 @@
package com.ruoyi.common.constant;
/**
* key
*
* @author ruoyi
*/
public class CacheConstants
{
/**
* redis key
*/
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
/**
* redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/**
* cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/**
* redis key
*/
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
/**
* redis key
*/
public static final String RATE_LIMIT_KEY = "rate_limit:";
/**
* redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
}

View File

@ -1,139 +1,142 @@
package com.ruoyi.common.constant; package com.ruoyi.common.constant;
/** import io.jsonwebtoken.Claims;
*
* /**
* @author ruoyi *
*/ *
public class Constants * @author ruoyi
{ */
/** public class Constants
* UTF-8 {
*/ /**
public static final String UTF8 = "UTF-8"; * UTF-8
*/
/** public static final String UTF8 = "UTF-8";
* GBK
*/ /**
public static final String GBK = "GBK"; * GBK
*/
/** public static final String GBK = "GBK";
* http
*/ /**
public static final String HTTP = "http://"; * www
*/
/** public static final String WWW = "www.";
* https
*/ /**
public static final String HTTPS = "https://"; * http
*/
/** public static final String HTTP = "http://";
*
*/ /**
public static final String SUCCESS = "0"; * https
*/
/** public static final String HTTPS = "https://";
*
*/ /**
public static final String FAIL = "1"; *
*/
/** public static final String SUCCESS = "0";
*
*/ /**
public static final String LOGIN_SUCCESS = "Success"; *
*/
/** public static final String FAIL = "1";
*
*/ /**
public static final String LOGOUT = "Logout"; *
*/
/** public static final String LOGIN_SUCCESS = "Success";
*
*/ /**
public static final String LOGIN_ERROR_COUNT = "login_error_count:"; *
*/
/** public static final String LOGOUT = "Logout";
*
*/ /**
public static final String LOGIN_FAIL = "Error"; *
*/
/** public static final String REGISTER = "Register";
* redis key
*/ /**
public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; *
*/
/** public static final String LOGIN_FAIL = "Error";
* redis key
*/ /**
public static final String LOGIN_TOKEN_KEY = "login_tokens:"; *
*/
/** public static final Integer CAPTCHA_EXPIRATION = 2;
* redis key
*/ /**
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; *
*/
/** public static final String TOKEN = "token";
*
*/ /**
public static final Integer CAPTCHA_EXPIRATION = 2; *
*/
/** public static final String TOKEN_PREFIX = "Bearer ";
*
*/ /**
public static final String TOKEN = "token"; *
*/
/** public static final String LOGIN_USER_KEY = "login_user_key";
*
*/ /**
public static final String TOKEN_PREFIX = "Bearer "; * ID
*/
/** public static final String JWT_USERID = "userid";
*
*/ /**
public static final String LOGIN_USER_KEY = "login_user_key"; *
*/
/** public static final String JWT_USERNAME = Claims.SUBJECT;
* ID
*/ /**
public static final String JWT_USERID = "userid"; *
*/
/** public static final String JWT_AVATAR = "avatar";
*
*/ /**
public static final String JWT_USERNAME = "sub"; *
*/
/** public static final String JWT_CREATED = "created";
*
*/ /**
public static final String JWT_AVATAR = "avatar"; *
*/
/** public static final String JWT_AUTHORITIES = "authorities";
*
*/ /**
public static final String JWT_CREATED = "created"; *
*/
/** public static final String RESOURCE_PREFIX = "/profile";
*
*/ /**
public static final String JWT_AUTHORITIES = "authorities"; * RMI
*/
/** public static final String LOOKUP_RMI = "rmi:";
* cache key
*/ /**
public static final String SYS_CONFIG_KEY = "sys_config:"; * LDAP
*/
/** public static final String LOOKUP_LDAP = "ldap:";
* cache key
*/ /**
public static final String SYS_DICT_KEY = "sys_dict:"; * LDAPS
*/
/** public static final String LOOKUP_LDAPS = "ldaps:";
*
*/ /**
public static final String RESOURCE_PREFIX = "/profile"; * 访
*/
/** public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
* RMI
*/ /**
public static final String LOOKUP_RMI = "rmi://"; *
} */
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
}

View File

@ -1,114 +1,117 @@
package com.ruoyi.common.constant; package com.ruoyi.common.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 = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
"bit", "bigint", "float", "double", "decimal" }; "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 = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" }; "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 = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" }; "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", "children" }; public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
/** 文本框 */ /** 文本框 */
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 REQUIRE = "1"; public static final String QUERY_EQ = "EQ";
}
/** 需要 */
public static final String REQUIRE = "1";
}

View File

@ -1,89 +1,94 @@
package com.ruoyi.common.constant; package com.ruoyi.common.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;
}

View File

@ -1,50 +1,50 @@
package com.ruoyi.common.constant; package com.ruoyi.common.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"), NORMAL("0"),
/** /**
* *
*/ */
PAUSE("1"); PAUSE("1");
private String value; private String value;
private Status(String value) private Status(String value)
{ {
this.value = value; this.value = value;
} }
public String getValue() public String getValue()
{ {
return value; return value;
} }
} }
} }

View File

@ -1,66 +1,78 @@
package com.ruoyi.common.constant; package com.ruoyi.common.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_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 final static String LAYOUT = "Layout";
/** ParentView组件标识 */ /** ParentView组件标识 */
public final static String PARENT_VIEW = "ParentView"; public final static String PARENT_VIEW = "ParentView";
/** InnerLink组件标识 */ /** InnerLink组件标识 */
public final static String INNER_LINK = "InnerLink"; public final static String INNER_LINK = "InnerLink";
/** 校验返回结果码 */ /** 校验是否唯一的返回标识 */
public final static String UNIQUE = "0"; public final static boolean UNIQUE = true;
public final static String NOT_UNIQUE = "1"; public final static boolean NOT_UNIQUE = false;
}
/**
*
*/
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;
}

View File

@ -1,150 +1,202 @@
package com.ruoyi.common.core.controller; package com.ruoyi.common.core.controller;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
/** import com.ruoyi.common.utils.StringUtils;
* web import com.ruoyi.common.utils.sql.SqlUtil;
*
* @author ruoyi /**
*/ * web
public class BaseController *
{ * @author ruoyi
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); */
public class BaseController
/** {
* Date protected final Logger logger = LoggerFactory.getLogger(this.getClass());
*/
@InitBinder /**
public void initBinder(WebDataBinder binder) * Date
{ */
// Date 类型转换 @InitBinder
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() public void initBinder(WebDataBinder binder)
{ {
@Override // Date 类型转换
public void setAsText(String text) binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{ {
setValue(DateUtils.parseDate(text)); @Override
} public void setAsText(String text)
}); {
} setValue(DateUtils.parseDate(text));
}
/** });
* }
*/
protected void startPage() /**
{ *
PageDomain pageDomain = TableSupport.buildPageRequest(); */
Integer pageNum = pageDomain.getPageNum(); protected void startPage()
Integer pageSize = pageDomain.getPageSize(); {
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) PageUtils.startPage();
{ }
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy); /**
} *
} */
protected void startOrderBy()
/** {
* PageDomain pageDomain = TableSupport.buildPageRequest();
*/ if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
protected void startOrderBy() {
{ String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageDomain pageDomain = TableSupport.buildPageRequest(); PageHelper.orderBy(orderBy);
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) }
{ }
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.orderBy(orderBy); /**
} * 线
} */
protected void clearPage()
/** {
* PageUtils.clearPage();
*/ }
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list) /**
{ *
TableDataInfo rspData = new TableDataInfo(); */
rspData.setCode(HttpStatus.SUCCESS); @SuppressWarnings({ "rawtypes", "unchecked" })
rspData.setMsg("查询成功"); protected TableDataInfo getDataTable(List<?> list)
rspData.setRows(list); {
rspData.setTotal(new PageInfo(list).getTotal()); TableDataInfo rspData = new TableDataInfo();
return rspData; rspData.setCode(HttpStatus.SUCCESS);
} rspData.setMsg("查询成功");
rspData.setRows(list);
/** rspData.setTotal(new PageInfo(list).getTotal());
* return rspData;
* }
* @param rows
* @return /**
*/ *
protected AjaxResult toAjax(int rows) */
{ public AjaxResult success()
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); {
} return AjaxResult.success();
}
/**
* /**
* *
* @param result */
* @return public AjaxResult error()
*/ {
protected AjaxResult toAjax(boolean result) return AjaxResult.error();
{ }
return result ? success() : error();
} /**
*
/** */
* public AjaxResult success(String message)
*/ {
public AjaxResult success() return AjaxResult.success(message);
{ }
return AjaxResult.success();
} /**
*
/** */
* public AjaxResult success(Object data)
*/ {
public AjaxResult error() return AjaxResult.success(data);
{ }
return AjaxResult.error();
} /**
*
/** */
* public AjaxResult error(String message)
*/ {
public AjaxResult success(String message) return AjaxResult.error(message);
{ }
return AjaxResult.success(message);
} /**
*
/** */
* public AjaxResult warn(String message)
*/ {
public AjaxResult error(String message) return AjaxResult.warn(message);
{ }
return AjaxResult.error(message);
} /**
*
/** *
* * @param rows
*/ * @return
public String redirect(String url) */
{ protected AjaxResult toAjax(int rows)
return StringUtils.format("redirect:{}", url); {
} return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} }
/**
*
*
* @param result
* @return
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/**
*
*/
public String redirect(String url)
{
return StringUtils.format("redirect:{}", url);
}
/**
*
*/
public LoginUser getLoginUser()
{
return SecurityUtils.getLoginUser();
}
/**
* id
*/
public Long getUserId()
{
return getLoginUser().getUserId();
}
/**
* id
*/
public Long getDeptId()
{
return getLoginUser().getDeptId();
}
/**
*
*/
public String getUsername()
{
return getLoginUser().getUsername();
}
}

View File

@ -1,148 +1,216 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.util.HashMap; import java.util.HashMap;
import com.ruoyi.common.constant.HttpStatus; import java.util.Objects;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils;
/**
* /**
* *
* @author ruoyi *
*/ * @author ruoyi
public class AjaxResult extends HashMap<String, Object> */
{ public class AjaxResult extends HashMap<String, Object>
private static final long serialVersionUID = 1L; {
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code"; /** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg"; /** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data"; /** 数据对象 */
public static final String DATA_TAG = "data";
/**
* AjaxResult 使 /**
*/ * AjaxResult 使
public AjaxResult() */
{ public AjaxResult()
} {
}
/**
* AjaxResult /**
* * AjaxResult
* @param code *
* @param msg * @param code
*/ * @param msg
public AjaxResult(int code, String msg) */
{ public AjaxResult(int code, String msg)
super.put(CODE_TAG, code); {
super.put(MSG_TAG, msg); super.put(CODE_TAG, code);
} super.put(MSG_TAG, msg);
}
/**
* AjaxResult /**
* * AjaxResult
* @param code *
* @param msg * @param code
* @param data * @param msg
*/ * @param data
public AjaxResult(int code, String msg, Object data) */
{ public AjaxResult(int code, String msg, Object data)
super.put(CODE_TAG, code); {
super.put(MSG_TAG, msg); super.put(CODE_TAG, code);
if (StringUtils.isNotNull(data)) super.put(MSG_TAG, msg);
{ if (StringUtils.isNotNull(data))
super.put(DATA_TAG, data); {
} super.put(DATA_TAG, data);
} }
}
/**
* /**
* *
* @return *
*/ * @return
public static AjaxResult success() */
{ public static AjaxResult success()
return AjaxResult.success("操作成功"); {
} return AjaxResult.success("操作成功");
}
/**
* /**
* *
* @return *
*/ * @return
public static AjaxResult success(Object data) */
{ public static AjaxResult success(Object data)
return AjaxResult.success("操作成功", data); {
} return AjaxResult.success("操作成功", data);
}
/**
* /**
* *
* @param msg *
* @return * @param msg
*/ * @return
public static AjaxResult success(String msg) */
{ public static AjaxResult success(String msg)
return AjaxResult.success(msg, null); {
} return AjaxResult.success(msg, null);
}
/**
* /**
* *
* @param msg *
* @param data * @param msg
* @return * @param data
*/ * @return
public static AjaxResult success(String msg, Object data) */
{ public static AjaxResult success(String msg, Object data)
return new AjaxResult(HttpStatus.SUCCESS, msg, data); {
} return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
* /**
* *
* @return *
*/ * @param msg
public static AjaxResult error() * @return
{ */
return AjaxResult.error("操作失败"); public static AjaxResult warn(String msg)
} {
return AjaxResult.warn(msg, null);
/** }
*
* /**
* @param msg *
* @return *
*/ * @param msg
public static AjaxResult error(String msg) * @param data
{ * @return
return AjaxResult.error(msg, null); */
} public static AjaxResult warn(String msg, Object data)
{
/** return new AjaxResult(HttpStatus.WARN, msg, data);
* }
*
* @param msg /**
* @param data *
* @return *
*/ * @return
public static AjaxResult error(String msg, Object data) */
{ public static AjaxResult error()
return new AjaxResult(HttpStatus.ERROR, msg, data); {
} return AjaxResult.error("操作失败");
}
/**
* /**
* *
* @param code *
* @param msg * @param msg
* @return * @return
*/ */
public static AjaxResult error(int code, String msg) public static AjaxResult error(String msg)
{ {
return new AjaxResult(code, msg, null); return AjaxResult.error(msg, null);
} }
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static AjaxResult error(int code, String msg)
{
return new AjaxResult(code, msg, null);
}
/**
*
*
* @return
*/
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}

View File

@ -1,114 +1,118 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
/** import com.fasterxml.jackson.annotation.JsonInclude;
* Entity
* /**
* @author ruoyi * Entity
*/ *
public class BaseEntity implements Serializable * @author ruoyi
{ */
private static final long serialVersionUID = 1L; public class BaseEntity implements Serializable
{
/** 搜索值 */ private static final long serialVersionUID = 1L;
private String searchValue;
/** 搜索值 */
/** 创建者 */ @JsonIgnore
private String createBy; private String searchValue;
/** 创建时间 */ /** 创建者 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String createBy;
private Date createTime;
/** 创建时间 */
/** 更新者 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String updateBy; private Date createTime;
/** 更新时间 */ /** 更新者 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String updateBy;
private Date updateTime;
/** 更新时间 */
/** 备注 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String remark; private Date updateTime;
/** 请求参数 */ /** 备注 */
private Map<String, Object> params; private String remark;
public String getSearchValue() /** 请求参数 */
{ @JsonInclude(JsonInclude.Include.NON_EMPTY)
return searchValue; private Map<String, Object> params;
}
public String getSearchValue()
public void setSearchValue(String searchValue) {
{ return searchValue;
this.searchValue = searchValue; }
}
public void setSearchValue(String searchValue)
public String getCreateBy() {
{ this.searchValue = searchValue;
return createBy; }
}
public String getCreateBy()
public void setCreateBy(String createBy) {
{ return createBy;
this.createBy = createBy; }
}
public void setCreateBy(String createBy)
public Date getCreateTime() {
{ this.createBy = createBy;
return createTime; }
}
public Date getCreateTime()
public void setCreateTime(Date createTime) {
{ return createTime;
this.createTime = createTime; }
}
public void setCreateTime(Date createTime)
public String getUpdateBy() {
{ this.createTime = createTime;
return updateBy; }
}
public String getUpdateBy()
public void setUpdateBy(String updateBy) {
{ return updateBy;
this.updateBy = updateBy; }
}
public void setUpdateBy(String updateBy)
public Date getUpdateTime() {
{ this.updateBy = updateBy;
return updateTime; }
}
public Date getUpdateTime()
public void setUpdateTime(Date updateTime) {
{ return updateTime;
this.updateTime = updateTime; }
}
public void setUpdateTime(Date updateTime)
public String getRemark() {
{ this.updateTime = updateTime;
return remark; }
}
public String getRemark()
public void setRemark(String remark) {
{ return remark;
this.remark = remark; }
}
public void setRemark(String remark)
public Map<String, Object> getParams() {
{ this.remark = remark;
if (params == null) }
{
params = new HashMap<>(); public Map<String, Object> getParams()
} {
return params; if (params == null)
} {
params = new HashMap<>();
public void setParams(Map<String, Object> params) }
{ return params;
this.params = params; }
}
} public void setParams(Map<String, Object> params)
{
this.params = params;
}
}

View File

@ -0,0 +1,115 @@
package com.ruoyi.common.core.domain;
import java.io.Serializable;
import com.ruoyi.common.constant.HttpStatus;
/**
*
*
* @author ruoyi
*/
public class R<T> implements Serializable
{
private static final long serialVersionUID = 1L;
/** 成功 */
public static final int SUCCESS = HttpStatus.SUCCESS;
/** 失败 */
public static final int FAIL = HttpStatus.ERROR;
private int code;
private String msg;
private T data;
public static <T> R<T> ok()
{
return restResult(null, SUCCESS, "操作成功");
}
public static <T> R<T> ok(T data)
{
return restResult(data, SUCCESS, "操作成功");
}
public static <T> R<T> ok(T data, String msg)
{
return restResult(data, SUCCESS, msg);
}
public static <T> R<T> fail()
{
return restResult(null, FAIL, "操作失败");
}
public static <T> R<T> fail(String msg)
{
return restResult(null, FAIL, msg);
}
public static <T> R<T> fail(T data)
{
return restResult(data, FAIL, "操作失败");
}
public static <T> R<T> fail(T data, String msg)
{
return restResult(data, FAIL, msg);
}
public static <T> R<T> fail(int code, String msg)
{
return restResult(null, code, msg);
}
private static <T> R<T> restResult(T data, int code, String msg)
{
R<T> apiResult = new R<>();
apiResult.setCode(code);
apiResult.setData(data);
apiResult.setMsg(msg);
return apiResult;
}
public int getCode()
{
return code;
}
public void setCode(int code)
{
this.code = code;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public T getData()
{
return data;
}
public void setData(T data)
{
this.data = data;
}
public static <T> Boolean isError(R<T> ret)
{
return !isSuccess(ret);
}
public static <T> Boolean isSuccess(R<T> ret)
{
return R.SUCCESS == ret.getCode();
}
}

View File

@ -1,79 +1,79 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Tree * Tree
* *
* @author ruoyi * @author ruoyi
*/ */
public class TreeEntity extends BaseEntity public class TreeEntity extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 父菜单名称 */ /** 父菜单名称 */
private String parentName; private String parentName;
/** 父菜单ID */ /** 父菜单ID */
private Long parentId; private Long parentId;
/** 显示顺序 */ /** 显示顺序 */
private Integer orderNum; private Integer orderNum;
/** 祖级列表 */ /** 祖级列表 */
private String ancestors; private String ancestors;
/** 子部门 */ /** 子部门 */
private List<?> children = new ArrayList<>(); private List<?> children = new ArrayList<>();
public String getParentName() public String getParentName()
{ {
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName)
{ {
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId() public Long getParentId()
{ {
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
} }
public Integer getOrderNum() public Integer getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getAncestors() public String getAncestors()
{ {
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors)
{ {
this.ancestors = ancestors; this.ancestors = ancestors;
} }
public List<?> getChildren() public List<?> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<?> children) public void setChildren(List<?> children)
{ {
this.children = children; this.children = children;
} }
} }

View File

@ -1,77 +1,77 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
/** /**
* Treeselect * Treeselect
* *
* @author ruoyi * @author ruoyi
*/ */
public class TreeSelect implements Serializable public class TreeSelect implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 节点ID */ /** 节点ID */
private Long id; private Long id;
/** 节点名称 */ /** 节点名称 */
private String label; private String label;
/** 子节点 */ /** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children; private List<TreeSelect> children;
public TreeSelect() public TreeSelect()
{ {
} }
public TreeSelect(SysDept dept) public TreeSelect(SysDept dept)
{ {
this.id = dept.getDeptId(); this.id = dept.getDeptId();
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public TreeSelect(SysMenu menu) public TreeSelect(SysMenu menu)
{ {
this.id = menu.getMenuId(); this.id = menu.getMenuId();
this.label = menu.getMenuName(); this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public String getLabel() public String getLabel()
{ {
return label; return label;
} }
public void setLabel(String label) public void setLabel(String label)
{ {
this.label = label; this.label = label;
} }
public List<TreeSelect> getChildren() public List<TreeSelect> getChildren()
{ {
return children; return children;
} }
public void setChildren(List<TreeSelect> children) public void setChildren(List<TreeSelect> children)
{ {
this.children = children; this.children = children;
} }
} }

View File

@ -1,218 +1,203 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
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;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ToStringBuilder; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringBuilder;
import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.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 */
private Long deptId; /** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId; /** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors; /** 祖级列表 */
private String ancestors;
/** 新增部门代码 */
private String deptCode; /** 部门名称 */
private String deptName;
/** 显示顺序 */
/** 部门名称 */ private Integer orderNum;
private String deptName;
/** 负责人 */
/** 显示顺序 */ private String leader;
private String orderNum;
/** 联系电话 */
/** 负责人 */ private String phone;
private String leader;
/** 邮箱 */
/** 联系电话 */ private String email;
private String phone;
/** 部门状态:0正常,1停用 */
/** 邮箱 */ private String status;
private String email;
/** 删除标志0代表存在 2代表删除 */
/** 部门状态:0正常,1停用 */ private String delFlag;
private String status;
/** 父部门名称 */
/** 删除标志0代表存在 2代表删除 */ private String parentName;
private String delFlag;
/** 子部门 */
/** 父部门名称 */ private List<SysDept> children = new ArrayList<SysDept>();
private String parentName;
public Long getDeptId()
/** 子部门 */ {
private List<SysDept> children = new ArrayList<SysDept>(); return deptId;
}
public Long getDeptId()
{ public void setDeptId(Long deptId)
return deptId; {
} this.deptId = deptId;
}
public void setDeptId(Long deptId)
{ public Long getParentId()
this.deptId = deptId; {
} return parentId;
}
public Long getParentId()
{ public void setParentId(Long parentId)
return parentId; {
} this.parentId = parentId;
}
public void setParentId(Long parentId)
{ public String getAncestors()
this.parentId = parentId; {
} return ancestors;
}
public String getAncestors()
{ public void setAncestors(String ancestors)
return ancestors; {
} this.ancestors = ancestors;
}
public void setAncestors(String ancestors)
{ @NotBlank(message = "部门名称不能为空")
this.ancestors = ancestors; @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
} public String getDeptName()
{
/** 新增部门代码 */ return deptName;
@Size(min = 0, max = 50, message = "部门代码长度不能超过50个字符") }
public String getDeptCode() {
return deptCode; public void setDeptName(String deptName)
} {
this.deptName = deptName;
public void setDeptCode(String deptCode) { }
this.deptCode = deptCode;
} @NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
@NotBlank(message = "部门名称不能为空") {
@Size(min = 0, max = 200, message = "部门名称长度不能超过200个字符") return orderNum;
public String getDeptName() }
{
return deptName; public void setOrderNum(Integer orderNum)
} {
this.orderNum = orderNum;
public void setDeptName(String deptName) }
{
this.deptName = deptName; public String getLeader()
} {
return leader;
@NotBlank(message = "显示顺序不能为空") }
public String getOrderNum()
{ public void setLeader(String leader)
return orderNum; {
} this.leader = leader;
}
public void setOrderNum(String orderNum)
{ @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
this.orderNum = orderNum; public String getPhone()
} {
return phone;
public String getLeader() }
{
return leader; public void setPhone(String phone)
} {
this.phone = phone;
public void setLeader(String leader) }
{
this.leader = leader; @Email(message = "邮箱格式不正确")
} @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") {
public String getPhone() return email;
{ }
return phone;
} public void setEmail(String email)
{
public void setPhone(String phone) this.email = email;
{ }
this.phone = phone;
} public String getStatus()
{
@Email(message = "邮箱格式不正确") return status;
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") }
public String getEmail()
{ public void setStatus(String status)
return email; {
} this.status = status;
}
public void setEmail(String email)
{ public String getDelFlag()
this.email = email; {
} return delFlag;
}
public String getStatus()
{ public void setDelFlag(String delFlag)
return status; {
} this.delFlag = delFlag;
}
public void setStatus(String status)
{ public String getParentName()
this.status = status; {
} return parentName;
}
public String getDelFlag()
{ public void setParentName(String parentName)
return delFlag; {
} this.parentName = parentName;
}
public void setDelFlag(String delFlag)
{ public List<SysDept> getChildren()
this.delFlag = delFlag; {
} return children;
}
public String getParentName()
{ public void setChildren(List<SysDept> children)
return parentName; {
} this.children = children;
}
public void setParentName(String parentName)
{ @Override
this.parentName = parentName; public String toString() {
} return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId())
public List<SysDept> getChildren() .append("parentId", getParentId())
{ .append("ancestors", getAncestors())
return children; .append("deptName", getDeptName())
} .append("orderNum", getOrderNum())
.append("leader", getLeader())
public void setChildren(List<SysDept> children) .append("phone", getPhone())
{ .append("email", getEmail())
this.children = children; .append("status", getStatus())
} .append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
@Override .append("createTime", getCreateTime())
public String toString() { .append("updateBy", getUpdateBy())
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("updateTime", getUpdateTime())
.append("deptId", getDeptId()) .toString();
.append("parentId", getParentId()) }
.append("ancestors", getAncestors()) }
.append("deptCode", getDeptCode())
.append("deptName", getDeptName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,176 +1,176 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
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.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 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) ? true : false; 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,94 +1,96 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Pattern;
import org.apache.commons.lang3.builder.ToStringBuilder; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringBuilder;
import com.ruoyi.common.annotation.Excel; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.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) /** 字典主键 */
private Long dictId; @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId;
/** 字典名称 */
@Excel(name = "字典名称") /** 字典名称 */
private String dictName; @Excel(name = "字典名称")
private String dictName;
/** 字典类型 */
@Excel(name = "字典类型") /** 字典类型 */
private String dictType; @Excel(name = "字典类型")
private String dictType;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") /** 状态0正常 1停用 */
private String status; @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
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 = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") @NotBlank(message = "字典名称不能为空")
public String getDictName() @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
{ 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 = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @NotBlank(message = "字典类型不能为空")
public String getDictType() @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
{ @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
return dictType; public String getDictType()
} {
return dictType;
public void setDictType(String dictType) }
{
this.dictType = dictType; public void setDictType(String dictType)
} {
this.dictType = dictType;
public String getStatus() }
{
return status; public String getStatus()
} {
return status;
public void setStatus(String status) }
{
this.status = status; public void setStatus(String status)
} {
this.status = status;
@Override }
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @Override
.append("dictId", getDictId()) public String toString() {
.append("dictName", getDictName()) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictType", getDictType()) .append("dictId", getDictId())
.append("status", getStatus()) .append("dictName", getDictName())
.append("createBy", getCreateBy()) .append("dictType", getDictType())
.append("createTime", getCreateTime()) .append("status", getStatus())
.append("updateBy", getUpdateBy()) .append("createBy", getCreateBy())
.append("updateTime", getUpdateTime()) .append("createTime", getCreateTime())
.append("remark", getRemark()) .append("updateBy", getUpdateBy())
.toString(); .append("updateTime", getUpdateTime())
} .append("remark", getRemark())
} .toString();
}
}

View File

@ -1,245 +1,259 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ToStringBuilder; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringBuilder;
import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_menu /**
* * sys_menu
* @author ruoyi *
*/ * @author ruoyi
public class SysMenu extends BaseEntity */
{ public class SysMenu extends BaseEntity
private static final long serialVersionUID = 1L; {
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId; /** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName; /** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName; /** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId; /** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private String orderNum; /** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path; /** 路由地址 */
private String path;
/** 组件路径 */
private String component; /** 组件路径 */
private String component;
/** 是否为外链0是 1否 */
private String isFrame; /** 路由参数 */
private String query;
/** 是否缓存0缓存 1不缓存 */
private String isCache; /** 是否为外链0是 1否 */
private String isFrame;
/** 类型M目录 C菜单 F按钮 */
private String menuType; /** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 显示状态0显示 1隐藏 */
private String visible; /** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 菜单状态0显示 1隐藏 */
private String status; /** 显示状态0显示 1隐藏 */
private String visible;
/** 权限字符串 */
private String perms; /** 菜单状态0正常 1停用 */
private String status;
/** 菜单图标 */
private String icon; /** 权限字符串 */
private String perms;
/** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>(); /** 菜单图标 */
private String icon;
public Long getMenuId()
{ /** 子菜单 */
return menuId; private List<SysMenu> children = new ArrayList<SysMenu>();
}
public Long getMenuId()
public void setMenuId(Long menuId) {
{ return menuId;
this.menuId = menuId; }
}
public void setMenuId(Long menuId)
@NotBlank(message = "菜单名称不能为空") {
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") this.menuId = menuId;
public String getMenuName() }
{
return menuName; @NotBlank(message = "菜单名称不能为空")
} @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
public void setMenuName(String menuName) {
{ return menuName;
this.menuName = menuName; }
}
public void setMenuName(String menuName)
public String getParentName() {
{ this.menuName = menuName;
return parentName; }
}
public String getParentName()
public void setParentName(String parentName) {
{ return parentName;
this.parentName = parentName; }
}
public void setParentName(String parentName)
public Long getParentId() {
{ this.parentName = parentName;
return parentId; }
}
public Long getParentId()
public void setParentId(Long parentId) {
{ return parentId;
this.parentId = parentId; }
}
public void setParentId(Long parentId)
@NotBlank(message = "显示顺序不能为空") {
public String getOrderNum() this.parentId = parentId;
{ }
return orderNum;
} @NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
public void setOrderNum(String orderNum) {
{ return orderNum;
this.orderNum = orderNum; }
}
public void setOrderNum(Integer orderNum)
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符") {
public String getPath() this.orderNum = orderNum;
{ }
return path;
} @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
public void setPath(String path) {
{ return path;
this.path = path; }
}
public void setPath(String path)
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符") {
public String getComponent() this.path = path;
{ }
return component;
} @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
public void setComponent(String component) {
{ return component;
this.component = component; }
}
public void setComponent(String component)
public String getIsFrame() {
{ this.component = component;
return isFrame; }
}
public String getQuery()
public void setIsFrame(String isFrame) {
{ return query;
this.isFrame = isFrame; }
}
public void setQuery(String query)
public String getIsCache() {
{ this.query = query;
return isCache; }
}
public String getIsFrame()
public void setIsCache(String isCache) {
{ return isFrame;
this.isCache = isCache; }
}
public void setIsFrame(String isFrame)
@NotBlank(message = "菜单类型不能为空") {
public String getMenuType() this.isFrame = isFrame;
{ }
return menuType;
} public String getIsCache()
{
public void setMenuType(String menuType) return isCache;
{ }
this.menuType = menuType;
} public void setIsCache(String isCache)
{
public String getVisible() this.isCache = isCache;
{ }
return visible;
} @NotBlank(message = "菜单类型不能为空")
public String getMenuType()
public void setVisible(String visible) {
{ return menuType;
this.visible = visible; }
}
public void setMenuType(String menuType)
public String getStatus() {
{ this.menuType = menuType;
return status; }
}
public String getVisible()
public void setStatus(String status) {
{ return visible;
this.status = status; }
}
public void setVisible(String visible)
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") {
public String getPerms() this.visible = visible;
{ }
return perms;
} public String getStatus()
{
public void setPerms(String perms) return status;
{ }
this.perms = perms;
} public void setStatus(String status)
{
public String getIcon() this.status = status;
{ }
return icon;
} @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
public void setIcon(String icon) {
{ return perms;
this.icon = icon; }
}
public void setPerms(String perms)
public List<SysMenu> getChildren() {
{ this.perms = perms;
return children; }
}
public String getIcon()
public void setChildren(List<SysMenu> children) {
{ return icon;
this.children = children; }
}
public void setIcon(String icon)
@Override {
public String toString() { this.icon = icon;
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) }
.append("menuId", getMenuId())
.append("menuName", getMenuName()) public List<SysMenu> getChildren()
.append("parentId", getParentId()) {
.append("orderNum", getOrderNum()) return children;
.append("path", getPath()) }
.append("component", getComponent())
.append("isFrame", getIsFrame()) public void setChildren(List<SysMenu> children)
.append("IsCache", getIsCache()) {
.append("menuType", getMenuType()) this.children = children;
.append("visible", getVisible()) }
.append("status ", getStatus())
.append("perms", getPerms()) @Override
.append("icon", getIcon()) public String toString() {
.append("createBy", getCreateBy()) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("createTime", getCreateTime()) .append("menuId", getMenuId())
.append("updateBy", getUpdateBy()) .append("menuName", getMenuName())
.append("updateTime", getUpdateTime()) .append("parentId", getParentId())
.append("remark", getRemark()) .append("orderNum", getOrderNum())
.toString(); .append("path", getPath())
} .append("component", getComponent())
} .append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -1,226 +1,241 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import java.util.Set;
import javax.validation.constraints.Size; import javax.validation.constraints.NotBlank;
import org.apache.commons.lang3.builder.ToStringBuilder; import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ToStringStyle; import javax.validation.constraints.Size;
import com.ruoyi.common.annotation.Excel; import org.apache.commons.lang3.builder.ToStringBuilder;
import com.ruoyi.common.annotation.Excel.ColumnType; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
/** import com.ruoyi.common.core.domain.BaseEntity;
* sys_role
* /**
* @author ruoyi * sys_role
*/ *
public class SysRole extends BaseEntity * @author ruoyi
{ */
private static final long serialVersionUID = 1L; public class SysRole extends BaseEntity
{
/** 角色ID */ private static final long serialVersionUID = 1L;
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId; /** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
/** 角色名称 */ private Long roleId;
@Excel(name = "角色名称")
private String roleName; /** 角色名称 */
@Excel(name = "角色名称")
/** 角色权限 */ private String roleName;
@Excel(name = "角色权限")
private String roleKey; /** 角色权限 */
@Excel(name = "角色权限")
/** 角色排序 */ private String roleKey;
@Excel(name = "角色排序")
private String roleSort; /** 角色排序 */
@Excel(name = "角色排序")
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */ private Integer roleSort;
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope; /** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */ private String dataScope;
private boolean menuCheckStrictly;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */ private boolean menuCheckStrictly;
private boolean deptCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */
/** 角色状态0正常 1停用 */ private boolean deptCheckStrictly;
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status; /** 角色状态0正常 1停用 */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
/** 删除标志0代表存在 2代表删除 */ private String status;
private String delFlag;
/** 删除标志0代表存在 2代表删除 */
/** 用户是否存在此角色标识 默认不存在 */ private String delFlag;
private boolean flag = false;
/** 用户是否存在此角色标识 默认不存在 */
/** 菜单组 */ private boolean flag = false;
private Long[] menuIds;
/** 菜单组 */
/** 部门组(数据权限) */ private Long[] menuIds;
private Long[] deptIds;
/** 部门组(数据权限) */
public SysRole() private Long[] deptIds;
{
/** 角色菜单权限 */
} private Set<String> permissions;
public SysRole(Long roleId) public SysRole()
{ {
this.roleId = roleId;
} }
public Long getRoleId() public SysRole(Long roleId)
{ {
return roleId; this.roleId = roleId;
} }
public void setRoleId(Long roleId) public Long getRoleId()
{ {
this.roleId = roleId; return roleId;
} }
public boolean isAdmin() public void setRoleId(Long roleId)
{ {
return isAdmin(this.roleId); this.roleId = roleId;
} }
public static boolean isAdmin(Long roleId) public boolean isAdmin()
{ {
return roleId != null && 1L == roleId; return isAdmin(this.roleId);
} }
@NotBlank(message = "角色名称不能为空") public static boolean isAdmin(Long roleId)
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") {
public String getRoleName() return roleId != null && 1L == roleId;
{ }
return roleName;
} @NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public void setRoleName(String roleName) public String getRoleName()
{ {
this.roleName = roleName; return roleName;
} }
@NotBlank(message = "权限字符不能为空") public void setRoleName(String roleName)
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") {
public String getRoleKey() this.roleName = roleName;
{ }
return roleKey;
} @NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public void setRoleKey(String roleKey) public String getRoleKey()
{ {
this.roleKey = roleKey; return roleKey;
} }
@NotBlank(message = "显示顺序不能为空") public void setRoleKey(String roleKey)
public String getRoleSort() {
{ this.roleKey = roleKey;
return roleSort; }
}
@NotNull(message = "显示顺序不能为空")
public void setRoleSort(String roleSort) public Integer getRoleSort()
{ {
this.roleSort = roleSort; return roleSort;
} }
public String getDataScope() public void setRoleSort(Integer roleSort)
{ {
return dataScope; this.roleSort = roleSort;
} }
public void setDataScope(String dataScope) public String getDataScope()
{ {
this.dataScope = dataScope; return dataScope;
} }
public boolean isMenuCheckStrictly() public void setDataScope(String dataScope)
{ {
return menuCheckStrictly; this.dataScope = dataScope;
} }
public void setMenuCheckStrictly(boolean menuCheckStrictly) public boolean isMenuCheckStrictly()
{ {
this.menuCheckStrictly = menuCheckStrictly; return menuCheckStrictly;
} }
public boolean isDeptCheckStrictly() public void setMenuCheckStrictly(boolean menuCheckStrictly)
{ {
return deptCheckStrictly; this.menuCheckStrictly = menuCheckStrictly;
} }
public void setDeptCheckStrictly(boolean deptCheckStrictly) public boolean isDeptCheckStrictly()
{ {
this.deptCheckStrictly = deptCheckStrictly; return deptCheckStrictly;
} }
public String getStatus() public void setDeptCheckStrictly(boolean deptCheckStrictly)
{ {
return status; this.deptCheckStrictly = deptCheckStrictly;
} }
public void setStatus(String status) public String getStatus()
{ {
this.status = status; return status;
} }
public String getDelFlag() public void setStatus(String status)
{ {
return delFlag; this.status = status;
} }
public void setDelFlag(String delFlag) public String getDelFlag()
{ {
this.delFlag = delFlag; return delFlag;
} }
public boolean isFlag() public void setDelFlag(String delFlag)
{ {
return flag; this.delFlag = delFlag;
} }
public void setFlag(boolean flag) public boolean isFlag()
{ {
this.flag = flag; return flag;
} }
public Long[] getMenuIds() public void setFlag(boolean flag)
{ {
return menuIds; this.flag = flag;
} }
public void setMenuIds(Long[] menuIds) public Long[] getMenuIds()
{ {
this.menuIds = menuIds; return menuIds;
} }
public Long[] getDeptIds() public void setMenuIds(Long[] menuIds)
{ {
return deptIds; this.menuIds = menuIds;
} }
public void setDeptIds(Long[] deptIds) public Long[] getDeptIds()
{ {
this.deptIds = deptIds; return deptIds;
} }
@Override public void setDeptIds(Long[] deptIds)
public String toString() { {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) this.deptIds = deptIds;
.append("roleId", getRoleId()) }
.append("roleName", getRoleName())
.append("roleKey", getRoleKey()) public Set<String> getPermissions()
.append("roleSort", getRoleSort()) {
.append("dataScope", getDataScope()) return permissions;
.append("menuCheckStrictly", isMenuCheckStrictly()) }
.append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus()) public void setPermissions(Set<String> permissions)
.append("delFlag", getDelFlag()) {
.append("createBy", getCreateBy()) this.permissions = permissions;
.append("createTime", getCreateTime()) }
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) @Override
.append("remark", getRemark()) public String toString() {
.toString(); return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
} .append("roleId", getRoleId())
} .append("roleName", getRoleName())
.append("roleKey", getRoleKey())
.append("roleSort", getRoleSort())
.append("dataScope", getDataScope())
.append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -1,436 +1,426 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonProperty; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excel.Type; import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.annotation.Excels; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.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 = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", 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;
/** 分公司ID */ /** 分公司ID */
private Long countyCode; private Long countyCode;
/** 用户账号 */ /** 用户账号 */
@Excel(name = "登录名称") @Excel(name = "登录名称")
private String userName; private String userName;
private String userCode; /** 用户昵称 */
public String getUserCode() { @Excel(name = "用户名称")
return userCode; private String nickName;
}
/** 用户邮箱 */
public void setUserCode(String userCode) { @Excel(name = "用户邮箱")
this.userCode = userCode; private String email;
}
/** 手机号码 */
/** 用户昵称 */ @Excel(name = "手机号码")
@Excel(name = "用户名称") private String phonenumber;
private String nickName;
/** 用户性别 */
/** 用户邮箱 */ @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
@Excel(name = "用户邮箱") private String sex;
private String email;
/** 用户头像 */
/** 手机号码 */ private String avatar;
@Excel(name = "手机号码")
private String phonenumber; /** 微信openid */
private String wechatOpenid;
/** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") /** 微信unionid */
private String sex; private String wechatUnionid;
/** 用户头像 */ /** 微信昵称 */
private String avatar; private String wechatNickname;
/** 微信openid */ /** 微信头像 */
private String wechatOpenid; private String wechatAvatar;
/** 微信unionid */ /** 是否绑定微信 */
private String wechatUnionid; private String bindWechat;
/** 微信昵称 */ /** 密码 */
private String wechatNickname; private String password;
/** 微信头像 */ /** 盐加密 */
private String wechatAvatar; private String salt;
/** 是否绑定微信 */ /** 帐号状态0正常 1停用 */
private String bindWechat; @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 密码 */
private String password; /** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 盐加密 */
private String salt; /** 最后登录IP */
@Excel(name = "最后登录IP", type = Type.EXPORT)
/** 帐号状态0正常 1停用 */ private String loginIp;
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status; /** 最后登录时间 */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
/** 删除标志0代表存在 2代表删除 */ private Date loginDate;
private String delFlag;
/** 部门对象 */
/** 最后登录IP */ @Excels({
@Excel(name = "最后登录IP", type = Type.EXPORT) @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
private String loginIp; @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
})
/** 最后登录时间 */ private SysDept dept;
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate; /** 角色对象 */
private List<SysRole> roles;
/** 部门对象 */
@Excels({ /** 角色组 */
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), private Long[] roleIds;
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
}) /** 岗位组 */
private SysDept dept; private Long[] postIds;
/** 角色对象 */ /** 角色ID */
private List<SysRole> roles; private Long roleId;
/** 角色组 */ public SysUser()
private Long[] roleIds; {
/** 岗位组 */ }
private Long[] postIds;
public SysUser(Long userId)
/** 角色ID */ {
private Long roleId; this.userId = userId;
}
public SysUser()
{ public Long getUserId()
{
} return userId;
}
public SysUser(Long userId)
{ public void setUserId(Long userId)
this.userId = userId; {
} this.userId = userId;
}
public Long getUserId()
{ public boolean isAdmin()
return userId; {
} return isAdmin(this.userId);
}
public void setUserId(Long userId)
{ public static boolean isAdmin(Long userId)
this.userId = userId; {
} return userId != null && 1L == userId;
}
public boolean isAdmin()
{ public Long getDeptId()
return isAdmin(this.userId); {
} return deptId;
}
public static boolean isAdmin(Long userId)
{ public void setDeptId(Long deptId)
return userId != null && 1L == userId; {
} this.deptId = deptId;
}
public Long getDeptId()
{ public Long getCountyCode() {
return deptId; return countyCode;
} }
public void setDeptId(Long deptId) public void setCountyCode(Long countyCode) {
{ this.countyCode = countyCode;
this.deptId = deptId; }
}
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public Long getCountyCode() { public String getNickName()
return countyCode; {
} return nickName;
}
public void setCountyCode(Long countyCode) {
this.countyCode = countyCode; public void setNickName(String nickName)
} {
this.nickName = nickName;
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") }
public String getNickName()
{ @NotBlank(message = "用户账号不能为空")
return nickName; @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
} public String getUserName()
{
public void setNickName(String nickName) return userName;
{ }
this.nickName = nickName;
} public void setUserName(String userName)
{
@NotBlank(message = "用户账号不能为空") this.userName = userName;
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") }
public String getUserName()
{ @Email(message = "邮箱格式不正确")
return userName; @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
} public String getEmail()
{
public void setUserName(String userName) return email;
{ }
this.userName = userName;
} public void setEmail(String email)
{
@Email(message = "邮箱格式不正确") this.email = email;
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") }
public String getEmail()
{ @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
return email; public String getPhonenumber()
} {
return phonenumber;
public void setEmail(String email) }
{
this.email = email; public void setPhonenumber(String phonenumber)
} {
this.phonenumber = phonenumber;
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") }
public String getPhonenumber()
{ public String getSex()
return phonenumber; {
} return sex;
}
public void setPhonenumber(String phonenumber)
{ public void setSex(String sex)
this.phonenumber = phonenumber; {
} this.sex = sex;
}
public String getSex()
{ public String getAvatar()
return sex; {
} return avatar;
}
public void setSex(String sex)
{ public void setAvatar(String avatar)
this.sex = sex; {
} this.avatar = avatar;
}
public String getAvatar()
{ public String getWechatOpenid()
return avatar; {
} return wechatOpenid;
}
public void setAvatar(String avatar)
{ public void setWechatOpenid(String wechatOpenid)
this.avatar = avatar; {
} this.wechatOpenid = wechatOpenid;
}
public String getWechatOpenid()
{ public String getWechatUnionid()
return wechatOpenid; {
} return wechatUnionid;
}
public void setWechatOpenid(String wechatOpenid)
{ public void setWechatUnionid(String wechatUnionid)
this.wechatOpenid = wechatOpenid; {
} this.wechatUnionid = wechatUnionid;
}
public String getWechatUnionid()
{ public String getWechatNickname()
return wechatUnionid; {
} return wechatNickname;
}
public void setWechatUnionid(String wechatUnionid)
{ public void setWechatNickname(String wechatNickname)
this.wechatUnionid = wechatUnionid; {
} this.wechatNickname = wechatNickname;
}
public String getWechatNickname()
{ public String getWechatAvatar()
return wechatNickname; {
} return wechatAvatar;
}
public void setWechatNickname(String wechatNickname)
{ public void setWechatAvatar(String wechatAvatar)
this.wechatNickname = wechatNickname; {
} this.wechatAvatar = wechatAvatar;
}
public String getWechatAvatar()
{ public String getBindWechat()
return wechatAvatar; {
} return bindWechat;
}
public void setWechatAvatar(String wechatAvatar)
{ public void setBindWechat(String bindWechat)
this.wechatAvatar = wechatAvatar; {
} this.bindWechat = bindWechat;
}
public String getBindWechat()
{ @JsonIgnore
return bindWechat; @JsonProperty
} public String getPassword()
{
public void setBindWechat(String bindWechat) return password;
{ }
this.bindWechat = bindWechat;
} public void setPassword(String password)
{
@JsonIgnore this.password = password;
@JsonProperty }
public String getPassword()
{ public String getSalt()
return password; {
} return salt;
}
public void setPassword(String password)
{ public void setSalt(String salt)
this.password = password; {
} this.salt = salt;
}
public String getSalt()
{ public String getStatus()
return salt; {
} return status;
}
public void setSalt(String salt)
{ public void setStatus(String status)
this.salt = salt; {
} this.status = status;
}
public String getStatus()
{ public String getDelFlag()
return status; {
} return delFlag;
}
public void setStatus(String status)
{ public void setDelFlag(String delFlag)
this.status = status; {
} this.delFlag = delFlag;
}
public String getDelFlag()
{ public String getLoginIp()
return delFlag; {
} return loginIp;
}
public void setDelFlag(String delFlag)
{ public void setLoginIp(String loginIp)
this.delFlag = delFlag; {
} this.loginIp = loginIp;
}
public String getLoginIp()
{ public Date getLoginDate()
return loginIp; {
} return loginDate;
}
public void setLoginIp(String loginIp)
{ public void setLoginDate(Date loginDate)
this.loginIp = loginIp; {
} this.loginDate = loginDate;
}
public Date getLoginDate()
{ public SysDept getDept()
return loginDate; {
} return dept;
}
public void setLoginDate(Date loginDate)
{ public void setDept(SysDept dept)
this.loginDate = loginDate; {
} this.dept = dept;
}
public SysDept getDept()
{ public List<SysRole> getRoles()
return dept; {
} return roles;
}
public void setDept(SysDept dept)
{ public void setRoles(List<SysRole> roles)
this.dept = dept; {
} this.roles = roles;
}
public List<SysRole> getRoles()
{ public Long[] getRoleIds()
return roles; {
} return roleIds;
}
public void setRoles(List<SysRole> roles)
{ public void setRoleIds(Long[] roleIds)
this.roles = roles; {
} this.roleIds = roleIds;
}
public Long[] getRoleIds()
{ public Long[] getPostIds()
return roleIds; {
} return postIds;
}
public void setRoleIds(Long[] roleIds)
{ public void setPostIds(Long[] postIds)
this.roleIds = roleIds; {
} this.postIds = postIds;
}
public Long[] getPostIds()
{ public Long getRoleId()
return postIds; {
} return roleId;
}
public void setPostIds(Long[] postIds)
{ public void setRoleId(Long roleId)
this.postIds = postIds; {
} this.roleId = roleId;
}
public Long getRoleId()
{ @Override
return roleId; public String toString() {
} return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
public void setRoleId(Long roleId) .append("deptId", getDeptId())
{ .append("countyCode",getCountyCode())
this.roleId = roleId; .append("userName", getUserName())
} .append("nickName", getNickName())
.append("email", getEmail())
@Override .append("phonenumber", getPhonenumber())
public String toString() { .append("sex", getSex())
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("avatar", getAvatar())
.append("userId", getUserId()) .append("wechatOpenid", getWechatOpenid())
.append("deptId", getDeptId()) .append("wechatUnionid", getWechatUnionid())
.append("countyCode",getCountyCode()) .append("wechatNickname", getWechatNickname())
.append("userCode",getUserCode()) .append("wechatAvatar", getWechatAvatar())
.append("userName", getUserName()) .append("bindWechat", getBindWechat())
.append("nickName", getNickName()) .append("password", getPassword())
.append("email", getEmail()) .append("salt", getSalt())
.append("phonenumber", getPhonenumber()) .append("status", getStatus())
.append("sex", getSex()) .append("delFlag", getDelFlag())
.append("avatar", getAvatar()) .append("loginIp", getLoginIp())
.append("wechatOpenid", getWechatOpenid()) .append("loginDate", getLoginDate())
.append("wechatUnionid", getWechatUnionid()) .append("postIds",getPostIds())
.append("wechatNickname", getWechatNickname()) .append("roleIds",getRoleIds())
.append("wechatAvatar", getWechatAvatar()) .append("createBy", getCreateBy())
.append("bindWechat", getBindWechat()) .append("createTime", getCreateTime())
.append("password", getPassword()) .append("updateBy", getUpdateBy())
.append("salt", getSalt()) .append("updateTime", getUpdateTime())
.append("status", getStatus()) .append("remark", getRemark())
.append("delFlag", getDelFlag()) .append("dept", getDept())
.append("loginIp", getLoginIp()) .toString();
.append("loginDate", getLoginDate()) }
.append("postIds",getPostIds()) }
.append("roleIds",getRoleIds())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.toString();
}
}

View File

@ -1,128 +0,0 @@
package com.ruoyi.common.core.domain.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
/**
*
*
* @author ruoyi
* @date 2024-08-24
*/
public class WechatLoginStatus
{
/** 登录状态ID */
private String id;
/** 二维码URL */
@Excel(name = "二维码URL")
private String qrCodeUrl;
/** 登录状态(0-待扫码 1-已扫码 2-已确认 3-已过期) */
@Excel(name = "登录状态", readConverterExp = "0=待扫码,1=已扫码,2=已确认,3=已过期")
private String status;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 微信openid */
@Excel(name = "微信openid")
private String openid;
/** 过期时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "过期时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date expireTime;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setQrCodeUrl(String qrCodeUrl)
{
this.qrCodeUrl = qrCodeUrl;
}
public String getQrCodeUrl()
{
return qrCodeUrl;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getOpenid()
{
return openid;
}
public void setExpireTime(Date expireTime)
{
this.expireTime = expireTime;
}
public Date getExpireTime()
{
return expireTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getCreateTime()
{
return createTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public Date getUpdateTime()
{
return updateTime;
}
}

View File

@ -1,69 +1,69 @@
package com.ruoyi.common.core.domain.model; package com.ruoyi.common.core.domain.model;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginBody public class LoginBody
{ {
/** /**
* *
*/ */
private String username; private String username;
/** /**
* *
*/ */
private String password; private String password;
/** /**
* *
*/ */
private String code; private String code;
/** /**
* *
*/ */
private String uuid = ""; private String uuid;
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;
} }
public String getCode() public String getCode()
{ {
return code; return code;
} }
public void setCode(String code) public void setCode(String code)
{ {
this.code = code; this.code = code;
} }
public String getUuid() public String getUuid()
{ {
return uuid; return uuid;
} }
public void setUuid(String uuid) public void setUuid(String uuid)
{ {
this.uuid = uuid; this.uuid = uuid;
} }
} }

View File

@ -1,228 +1,266 @@
package com.ruoyi.common.core.domain.model; package com.ruoyi.common.core.domain.model;
import java.util.Collection; import com.alibaba.fastjson2.annotation.JSONField;
import java.util.Set; import com.ruoyi.common.core.domain.entity.SysUser;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.Collection;
import com.ruoyi.common.core.domain.entity.SysUser; import java.util.Set;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class LoginUser implements UserDetails public class LoginUser implements UserDetails
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* * ID
*/ */
private String token; private Long userId;
/** /**
* * ID
*/ */
private Long loginTime; private Long deptId;
/** /**
* *
*/ */
private Long expireTime; private String token;
/** /**
* IP *
*/ */
private String ipaddr; private Long loginTime;
/** /**
* *
*/ */
private String loginLocation; private Long expireTime;
/** /**
* * IP
*/ */
private String browser; private String ipaddr;
/** /**
* *
*/ */
private String os; private String loginLocation;
/** /**
* *
*/ */
private Set<String> permissions; private String browser;
/** /**
* *
*/ */
private SysUser user; private String os;
public String getToken() /**
{ *
return token; */
} private Set<String> permissions;
public void setToken(String token) /**
{ *
this.token = token; */
} private SysUser user;
public LoginUser() public LoginUser()
{ {
} }
public LoginUser(SysUser user, Set<String> permissions) public LoginUser(SysUser user, Set<String> permissions)
{ {
this.user = user; this.user = user;
this.permissions = permissions; this.permissions = permissions;
} }
@JsonIgnore public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
@Override {
public String getPassword() this.userId = userId;
{ this.deptId = deptId;
return user.getPassword(); this.user = user;
} this.permissions = permissions;
}
@Override
public String getUsername() public Long getUserId()
{ {
return user.getUserName(); return userId;
} }
/** public void setUserId(Long userId)
* , {
*/ this.userId = userId;
@JsonIgnore }
@Override
public boolean isAccountNonExpired() public Long getDeptId()
{ {
return true; return deptId;
} }
/** public void setDeptId(Long deptId)
* , {
* this.deptId = deptId;
* @return }
*/
@JsonIgnore public String getToken()
@Override {
public boolean isAccountNonLocked() return token;
{ }
return true;
} public void setToken(String token)
{
/** this.token = token;
* (), }
*
* @return @JSONField(serialize = false)
*/ @Override
@JsonIgnore public String getPassword()
@Override {
public boolean isCredentialsNonExpired() return user.getPassword();
{ }
return true;
} @Override
public String getUsername()
/** {
* , return user.getUserName();
* }
* @return
*/ /**
@JsonIgnore * ,
@Override */
public boolean isEnabled() @JSONField(serialize = false)
{ @Override
return true; public boolean isAccountNonExpired()
} {
return true;
public Long getLoginTime() }
{
return loginTime; /**
} * ,
*
public void setLoginTime(Long loginTime) * @return
{ */
this.loginTime = loginTime; @JSONField(serialize = false)
} @Override
public boolean isAccountNonLocked()
public String getIpaddr() {
{ return true;
return ipaddr; }
}
/**
public void setIpaddr(String ipaddr) * (),
{ *
this.ipaddr = ipaddr; * @return
} */
@JSONField(serialize = false)
public String getLoginLocation() @Override
{ public boolean isCredentialsNonExpired()
return loginLocation; {
} return true;
}
public void setLoginLocation(String loginLocation)
{ /**
this.loginLocation = loginLocation; * ,
} *
* @return
public String getBrowser() */
{ @JSONField(serialize = false)
return browser; @Override
} public boolean isEnabled()
{
public void setBrowser(String browser) return true;
{ }
this.browser = browser;
} public Long getLoginTime()
{
public String getOs() return loginTime;
{ }
return os;
} public void setLoginTime(Long loginTime)
{
public void setOs(String os) this.loginTime = loginTime;
{ }
this.os = os;
} public String getIpaddr()
{
public Long getExpireTime() return ipaddr;
{ }
return expireTime;
} public void setIpaddr(String ipaddr)
{
public void setExpireTime(Long expireTime) this.ipaddr = ipaddr;
{ }
this.expireTime = expireTime;
} public String getLoginLocation()
{
public Set<String> getPermissions() return loginLocation;
{ }
return permissions;
} public void setLoginLocation(String loginLocation)
{
public void setPermissions(Set<String> permissions) this.loginLocation = loginLocation;
{ }
this.permissions = permissions;
} public String getBrowser()
{
public SysUser getUser() return browser;
{ }
return user;
} public void setBrowser(String browser)
{
public void setUser(SysUser user) this.browser = browser;
{ }
this.user = user;
} public String getOs()
{
@Override return os;
public Collection<? extends GrantedAuthority> getAuthorities() }
{
return null; public void setOs(String os)
} {
} this.os = os;
}
public Long getExpireTime()
{
return expireTime;
}
public void setExpireTime(Long expireTime)
{
this.expireTime = expireTime;
}
public Set<String> getPermissions()
{
return permissions;
}
public void setPermissions(Set<String> permissions)
{
this.permissions = permissions;
}
public SysUser getUser()
{
return user;
}
public void setUser(SysUser user)
{
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities()
{
return null;
}
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.common.core.domain.model;
/**
*
*
* @author ruoyi
*/
public class RegisterBody extends LoginBody
{
}

View File

@ -21,6 +21,9 @@ public class PageDomain
/** 排序的方向desc或者asc */ /** 排序的方向desc或者asc */
private String isAsc = "asc"; private String isAsc = "asc";
/** 分页参数合理化 */
private Boolean reasonable = true;
public String getOrderBy() public String getOrderBy()
{ {
if (StringUtils.isEmpty(orderByColumn)) if (StringUtils.isEmpty(orderByColumn))
@ -81,4 +84,18 @@ public class PageDomain
this.isAsc = isAsc; this.isAsc = isAsc;
} }
} }
public Boolean getReasonable()
{
if (StringUtils.isNull(reasonable))
{
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
this.reasonable = reasonable;
}
} }

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