120 Commits

Author SHA1 Message Date
Barudisshu
5cc591ba04 Pre Merge pull request !444 from Barudisshu/master 2025-12-14 07:01:28 +00:00
Galudisu
a5fb62f1e5 添加google-style 格式化maven插件,fix utf8文件编码问题 2025-12-14 15:00:22 +08:00
RuoYi
f53b783049 优化数据权限控制逻辑,放开permission限制 2025-12-04 17:35:47 +08:00
RuoYi
97f30a5415 支持Excel导出对象的多个子列表 2025-12-04 16:48:19 +08:00
RuoYi
ad1d009165 升级tomcat到最新版本9.0.112 2025-12-04 16:43:11 +08:00
RuoYi
90cbabb7a7 优化代码 2025-12-04 16:42:55 +08:00
RuoYi
1c4dbb1e46 优化表单构建关闭页签销毁复制插件 2025-12-04 13:15:50 +08:00
RuoYi
a3eefb6bad 优化生成代码下载的zip文件名 2025-12-03 10:27:23 +08:00
RuoYi
09e8e9995a 网页标题设置新增SET_TITLE方法 2025-12-02 19:31:23 +08:00
RuoYi
381151bc50 支持Excel导出对象的多个子列表 2025-12-02 19:14:04 +08:00
RuoYi
66e502727a 登录/注册页面底部版权信息修改为读取配置 2025-12-02 15:34:27 +08:00
RuoYi
4265f8ecb7 修复v3时间控件between选择后清空报错问题 2025-12-02 15:00:36 +08:00
RuoYi
2c82079d04 修复表单构建移除所有控件后切换路由回来空白问题 2025-12-02 13:12:55 +08:00
RuoYi
6aecd35a4f 修复combo属性过多sheet出现的异常问题 2025-11-13 11:58:03 +08:00
RuoYi
ac92ae3ae6 修复固定头部时出现的导航栏偏移问题 2025-09-04 20:06:26 +08:00
RuoYi
1d2c8378f7 文件支持防盗链配置 2025-09-02 13:26:33 +08:00
RuoYi
50a9337ee8 优化代码 2025-08-28 13:51:15 +08:00
RuoYi
e6a3415a71 优化代码 2025-08-27 16:01:28 +08:00
RuoYi
7919af54da 用户导入添加验证提示 2025-08-23 11:46:49 +08:00
RuoYi
3503005f9d 优化布局设置显示 2025-08-23 11:46:39 +08:00
RuoYi
b304a41194 修复用户归属部门无法修改为空问题 2025-08-21 14:59:10 +08:00
RuoYi
a39ae33c82 columns default value 2025-08-09 16:13:49 +08:00
RuoYi
b9a27657c5 显示列信息支持对象格式 2025-08-09 15:19:13 +08:00
RuoYi
2e009841ca 自动识别json对象白名单配置范围缩小 2025-08-09 15:18:29 +08:00
RuoYi
2cbe4a8234 升级tomcat到最新版本9.0.108 2025-08-09 15:17:10 +08:00
RuoYi
4b37049713 添加新群号:112869560 2025-07-19 19:28:44 +08:00
RuoYi
e549210ad6 优化定时任务包名白名单匹配方式 2025-06-20 11:56:03 +08:00
RuoYi
ad988d54bb 优化Excel统计行数值的单元格样式显示 2025-06-19 14:54:00 +08:00
RuoYi
51a6fce0a5 升级tomcat到最新版本9.0.106 2025-06-18 13:41:37 +08:00
RuoYi
c86bfa9243 用户头像更换后移除旧头像文件 2025-06-06 19:36:36 +08:00
RuoYi
8aca11c2a2 若依 3.6.6 2025-05-30 08:03:00 +08:00
RuoYi
725033e361 升级fastjson到最新版2.0.57 2025-05-26 11:14:45 +08:00
RuoYi
d29e49e23b 注册账号设置默认密码最后更新时间 2025-05-26 11:14:06 +08:00
RuoYi
706c3bb69b 添加底部版权信息及开关 2025-05-24 14:33:51 +08:00
RuoYi
cd0ee95b9c 添加页签图标显示开关功能 2025-05-23 14:57:49 +08:00
RuoYi
3293e2fb56 账号密码支持自定义更新周期 2025-05-23 10:19:47 +08:00
RuoYi
924ec0eb6e 初始密码支持自定义修改策略 2025-05-23 09:58:23 +08:00
RuoYi
135b1204a9 升级tomcat到最新版本9.0.105 2025-05-15 10:55:18 +08:00
RuoYi
cb566a704b 升级commons.io到最新版本2.19.0 2025-05-15 10:23:50 +08:00
RuoYi
aadba0382e delete vue-meta 2025-05-15 10:23:34 +08:00
RuoYi
a0ce1cf33b delete eslint 2025-05-15 10:22:46 +08:00
RuoYi
3915c77391 优化导航栏显示昵称&设置 2025-05-09 14:02:09 +08:00
RuoYi
b80932ceb4 菜单搜索支持键盘选择&悬浮主题背景 2025-05-07 13:27:13 +08:00
RuoYi
056cf94082 图片上传组件新增disabled属性 2025-05-06 19:14:54 +08:00
RuoYi
0dcd3e6183 add columnName Drag 2025-05-06 14:54:44 +08:00
RuoYi
07be5ceb26 修复上传组件被多次引用拖动仅对第一个有效的问题 2025-05-06 13:46:21 +08:00
RuoYi
cc59502d7c update icon 2025-05-05 11:22:35 +08:00
RuoYi
98738f23ad 上传组件新增拖动排序属性 2025-04-30 10:31:03 +08:00
RuoYi
57fe1c663e 优化Excel匹配数值型.0结尾 2025-04-28 11:20:48 +08:00
RuoYi
7b6fdb3a89 remove all semicolons 2025-04-27 11:56:21 +08:00
RuoYi
79c885decb 使用Gateway CacheRequestBody代替CacheRequestFilter 2025-04-25 15:11:17 +08:00
RuoYi
1a0f37a2dc 富文本复制粘贴图片上传至url 2025-04-24 18:19:16 +08:00
RuoYi
02de344d8c update package.json 2025-04-24 18:18:44 +08:00
RuoYi
189100f74e 优化低版本node无法启动的问题 2025-04-22 12:07:07 +08:00
RuoYi
e29284e687 优化代码 2025-04-22 12:06:59 +08:00
RuoYi
d4af286f41 显隐列组件支持全选/全不选 2025-04-21 15:30:32 +08:00
RuoYi
60e2d55a23 优化菜单搜索查询页 2025-04-21 13:28:32 +08:00
RuoYi
bbd112d5a3 支持文件&图片组件自定义地址&参数 2025-04-18 13:25:28 +08:00
RuoYi
90922844ea 优化角色禁用不允许分配 2025-04-17 15:36:18 +08:00
RuoYi
3a9f56f04b update status name 2025-04-17 15:35:58 +08:00
RuoYi
a1ec1d57d4 remove dev runjs 2025-03-18 16:01:46 +08:00
RuoYi
060959a7c5 登录页和注册页表头使用VUE_APP_TITLE配置值 2025-03-18 16:01:20 +08:00
RuoYi
43e1d8d573 升级tomcat到最新版本9.0.102 2025-03-14 16:12:40 +08:00
RuoYi
67cf51ba77 update handleTree 2025-03-14 16:12:29 +08:00
RuoYi
a256618d5d 优化代码 2025-03-11 12:52:17 +08:00
若依
a6bcebb62b !397 修复actuator暴漏问题
Merge pull request !397 from 威士忌的纯度/N/A
2025-03-10 03:45:34 +00:00
威士忌的纯度
1cb262daa3 修复actuator暴漏问题
Signed-off-by: 威士忌的纯度 <whr888888@vip.qq.com>
2025-03-07 10:22:52 +00:00
RuoYi
8c096cba8d 优化isAdmin方法,避免脱敏模块security依赖 2025-03-07 12:56:31 +08:00
RuoYi
088cec8adf 菜单管理新增路由名称 2025-03-06 11:09:34 +08:00
RuoYi
85ff6a9910 优化顶部菜单搜索栏为多层级显示 2025-03-05 18:14:13 +08:00
RuoYi
cab5beaca7 文件上传组件新增disabled属性&类型 2025-03-05 18:13:40 +08:00
RuoYi
fc8069a250 优化导出Excel日期格式双击离开后与设定的格式不一致问题 2025-03-05 18:13:12 +08:00
RuoYi
924e705dca 代码生成列表支持按时间排序 2025-03-05 18:12:52 +08:00
RuoYi
049ba453d1 优化空指针异常时无法获取错误信息问题 2025-03-05 18:10:56 +08:00
RuoYi
4aa261e8f7 优化定时任务字符包含多个括号导致数据错误 2025-03-05 18:10:12 +08:00
RuoYi
914a6620f5 升级tomcat到最新版本9.0.98 2025-03-05 18:08:29 +08:00
RuoYi
3dcee7057d 优化代码 2025-03-05 18:01:33 +08:00
RuoYi
0467631319 update ry_config.sql 2025-02-24 16:24:36 +08:00
若依
a11df90255 !393 config(nacos):增加nacos2.5.0配置文件sql
Merge pull request !393 from 牟雷/master
2025-02-18 00:33:39 +00:00
牟雷
596e4fe756 config(nacos):增加nacos2.5.0配置文件sql 2025-02-17 20:19:22 +08:00
RuoYi
37219e4ae6 copyright 2025 2025-01-07 10:55:58 +08:00
RuoYi
adaa3e1db8 代码生成新增配置是否允许文件覆盖到本地 2024-12-25 16:30:44 +08:00
RuoYi
88ad5a2c19 优化导入带标题文件关闭清理 2024-12-25 16:24:38 +08:00
RuoYi
b45dc2ec25 update sqlkeyword 2024-12-25 16:24:02 +08:00
RuoYi
67b17da06f 优化特殊字符密码修改失败问题 2024-12-17 14:28:17 +08:00
RuoYi
b25a280ebb 优化TopNav内链菜单点击没有高亮(IB8WHJ) 2024-12-17 11:57:05 +08:00
RuoYi
cc026e75a3 优化菜单管理切换Mini布局错乱问题 2024-12-17 11:25:03 +08:00
RuoYi
7216b56a56 用户管理过滤掉已禁用部门 2024-12-11 11:43:00 +08:00
RuoYi
a326e880a1 修改主题样式本地读取 2024-12-07 17:08:53 +08:00
RuoYi
92c6d21855 优化文件异常输入流未关闭的问题 2024-12-05 14:27:54 +08:00
RuoYi
2335157f6e 白名单支持对通配符路径匹配 2024-12-04 08:52:13 +08:00
RuoYi
6c3b01c3c5 Excel注解支持wrapText是否允许内容换行 2024-12-03 09:07:04 +08:00
RuoYi
8faea60191 修复导出子列表对象只能在最后的问题 2024-12-02 20:37:12 +08:00
RuoYi
28a16d9878 修复默认关闭Tags-Views时,内链页面打不开 2024-11-27 19:49:12 +08:00
RuoYi
dd3cf18e27 修复TopNav无法正确获取active的问题 2024-11-27 09:02:26 +08:00
RuoYi
65d03dc014 优化代码 2024-11-25 22:30:03 +08:00
RuoYi
7912fd81bd 面板兼容移动端显示 2024-11-25 15:41:00 +08:00
RuoYi
e2175e5b9d 参数键值更换为多行文本 2024-11-25 12:15:49 +08:00
RuoYi
c0e119f8e0 菜单面包屑导航支持多层级显示 2024-11-22 20:45:08 +08:00
RuoYi
fa77b2a08c 分栏参数微调 2024-11-22 14:46:59 +08:00
RuoYi
a222c24796 用户管理支持分栏拖动 2024-11-22 13:58:37 +08:00
RuoYi
08f4b877ce 优化代码 2024-11-20 11:13:24 +08:00
RuoYi
aa607d135c update .env.staging 2024-11-20 10:43:07 +08:00
RuoYi
6d34cdb8a3 若依 3.6.5 2024-11-13 08:38:24 +08:00
RuoYi
d47352253e 升级spring-cloud相关组件到最新版 2024-11-12 15:12:01 +08:00
RuoYi
61cbd470e1 update datascope 2024-11-12 15:10:47 +08:00
RuoYi
b3ef4adfed 支持自定义显示Excel属性列 2024-11-07 22:25:48 +08:00
RuoYi
856c471472 优化代码 2024-11-06 10:20:18 +08:00
RuoYi
bec5600f16 优化无用户编号不校验数据权限 2024-11-05 16:30:15 +08:00
RuoYi
5b485e7934 校检文件名是否包含特殊字符 2024-11-05 12:50:12 +08:00
RuoYi
73a752d3ab 优化身份证脱敏正则 2024-10-21 17:16:01 +08:00
RuoYi
1899a832b9 优化权限更新后同步缓存 2024-10-21 17:15:30 +08:00
RuoYi
e6796c0954 操作日志记录DELETE请求参数 2024-10-17 13:17:25 +08:00
RuoYi
4987289a98 升级quill到最新版本2.0.2 2024-10-15 16:21:20 +08:00
RuoYi
18409922a5 修改代码生成上级菜单字段类型 2024-09-27 16:23:36 +08:00
RuoYi
3dca02b306 修复角色禁用权限不失效问题 2024-09-21 12:08:41 +08:00
RuoYi
75f3275e15 修复角色禁用权限不失效问题 2024-09-21 12:01:48 +08:00
RuoYi
b2e4a7046b update ry_config 2024-09-02 20:21:30 +08:00
RuoYi
60618c1da9 优化提示 2024-09-02 20:21:15 +08:00
RuoYi
3b499b1344 使用SpringDoc代替Swagger 2024-08-30 11:26:57 +08:00
449 changed files with 24923 additions and 28674 deletions

10
.editorconfig Normal file
View File

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

1
.java-version Normal file
View File

@@ -0,0 +1 @@
1.8

12
.mvn/jvm.config Normal file
View File

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

3
.mvn/maven.config Normal file
View File

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

View File

@@ -1,11 +1,11 @@
<p align="center"> <p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png"> <img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
</p> </p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.4</h1> <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.6</h1>
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4> <h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
<p align="center"> <p align="center">
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a> <a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.4-brightgreen.svg"></a> <a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.6-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a> <a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p> </p>
@@ -17,12 +17,9 @@
* 后端采用Spring Boot、Spring Cloud & Alibaba。 * 后端采用Spring Boot、Spring Cloud & Alibaba。
* 注册中心、配置中心选型Nacos权限认证使用Redis。 * 注册中心、配置中心选型Nacos权限认证使用Redis。
* 流量控制框架选型Sentinel分布式事务选型Seata。 * 流量控制框架选型Sentinel分布式事务选型Seata。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Cloud-Vue3](https://github.com/yangzongzhuan/RuoYi-Cloud-Vue3),保持同步更新。 * 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Cloud-Vue3](https://gitcode.com/yangzongzhuan/RuoYi-Cloud-Vue3),保持同步更新。
* 如需不分离应用,请移步 [RuoYi](https://gitee.com/y_project/RuoYi),如需分离应用,请移步 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) * 如需不分离应用,请移步 [RuoYi](https://gitee.com/y_project/RuoYi),如需分离应用,请移步 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue)
* 阿里云折扣场[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp; * 阿里云优惠券[点我进入](http://aly.ruoyi.vip),腾讯云优惠券[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
* 阿里云优惠券:[点我领取](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)&nbsp;&nbsp;
#### 友情链接 [若依/RuoYi-Cloud](https://gitee.com/zhangmrit/ruoyi-cloud) Ant Design版本。
## 系统模块 ## 系统模块
@@ -41,6 +38,7 @@ com.ruoyi
│ └── ruoyi-common-redis // 缓存服务 │ └── ruoyi-common-redis // 缓存服务
│ └── ruoyi-common-seata // 分布式事务 │ └── ruoyi-common-seata // 分布式事务
│ └── ruoyi-common-security // 安全模块 │ └── ruoyi-common-security // 安全模块
│ └── ruoyi-common-sensitive // 数据脱敏
│ └── ruoyi-common-swagger // 系统接口 │ └── ruoyi-common-swagger // 系统接口
├── ruoyi-modules // 业务模块 ├── ruoyi-modules // 业务模块
│ └── ruoyi-system // 系统模块 [9201] │ └── ruoyi-system // 系统模块 [9201]
@@ -128,4 +126,4 @@ com.ruoyi
## 若依微服务交流群 ## 若依微服务交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-42799195-blue.svg)](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [![加入QQ群](https://img.shields.io/badge/已满-170157040-blue.svg)](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [![加入QQ群](https://img.shields.io/badge/已满-130643120-blue.svg)](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [![加入QQ群](https://img.shields.io/badge/已满-225920371-blue.svg)](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [![加入QQ群](https://img.shields.io/badge/已满-201705537-blue.svg)](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [![加入QQ群](https://img.shields.io/badge/已满-236543183-blue.svg)](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [![加入QQ群](https://img.shields.io/badge/已满-213618602-blue.svg)](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [![加入QQ群](https://img.shields.io/badge/已满-148794840-blue.svg)](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [![加入QQ群](https://img.shields.io/badge/已满-118752664-blue.svg)](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [![加入QQ群](https://img.shields.io/badge/已满-101038945-blue.svg)](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [![加入QQ群](https://img.shields.io/badge/已满-128355254-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [![加入QQ群](https://img.shields.io/badge/已满-179219821-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [![加入QQ群](https://img.shields.io/badge/158753145-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) 点击按钮入群。 QQ群 [![加入QQ群](https://img.shields.io/badge/已满-42799195-blue.svg)](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [![加入QQ群](https://img.shields.io/badge/已满-170157040-blue.svg)](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [![加入QQ群](https://img.shields.io/badge/已满-130643120-blue.svg)](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [![加入QQ群](https://img.shields.io/badge/已满-225920371-blue.svg)](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [![加入QQ群](https://img.shields.io/badge/已满-201705537-blue.svg)](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [![加入QQ群](https://img.shields.io/badge/已满-236543183-blue.svg)](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [![加入QQ群](https://img.shields.io/badge/已满-213618602-blue.svg)](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [![加入QQ群](https://img.shields.io/badge/已满-148794840-blue.svg)](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [![加入QQ群](https://img.shields.io/badge/已满-118752664-blue.svg)](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [![加入QQ群](https://img.shields.io/badge/已满-101038945-blue.svg)](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [![加入QQ群](https://img.shields.io/badge/已满-128355254-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [![加入QQ群](https://img.shields.io/badge/已满-179219821-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [![加入QQ群](https://img.shields.io/badge/已满-158753145-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) [![加入QQ群](https://img.shields.io/badge/112869560-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Kuaw0Xdlw2Nlgn6s8h9elzuquHGxGObD&authKey=cSrQcWQ%2BzQZAFFrwxaR%2BbzcumX4WRduZnd1O6JO1dlclQMiu%2BKwxAy8t2JfNp67V&noverify=0&group_code=112869560) 点击按钮入群。

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,8 +9,8 @@ usage() {
# copy sql # copy sql
echo "begin copy sql " echo "begin copy sql "
cp ../sql/ry_20231130.sql ./mysql/db cp ../sql/ry_20250523.sql ./mysql/db
cp ../sql/ry_config_20231204.sql ./mysql/db cp ../sql/ry_config_20250224.sql ./mysql/db
# copy html # copy html
echo "begin copy html " echo "begin copy html "

View File

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

7
docker/mysql/Dockerfile Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,7 +29,7 @@ http {
} }
# 避免actuator暴露 # 避免actuator暴露
if ($request_uri ~ "/actuator") { if ($uri ~ "/actuator") {
return 403; return 403;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

114
pom.xml
View File

@@ -6,43 +6,47 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
<name>ruoyi</name> <name>ruoyi</name>
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description> <description>若依微服务系统</description>
<properties> <properties>
<ruoyi.version>3.6.4</ruoyi.version> <ruoyi.version>3.6.6</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<spring-boot.version>2.7.18</spring-boot.version> <spring-boot.version>2.7.18</spring-boot.version>
<spring-cloud.version>2021.0.8</spring-cloud.version> <spring-cloud.version>2021.0.9</spring-cloud.version>
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version>
<spring-framework.version>5.3.33</spring-framework.version> <spring-boot-admin.version>2.7.16</spring-boot-admin.version>
<spring-boot-admin.version>2.7.15</spring-boot-admin.version>
<swagger.fox.version>3.0.0</swagger.fox.version>
<swagger.core.version>1.6.2</swagger.core.version>
<tobato.version>1.27.2</tobato.version> <tobato.version>1.27.2</tobato.version>
<kaptcha.version>2.3.3</kaptcha.version> <kaptcha.version>2.3.3</kaptcha.version>
<pagehelper.boot.version>2.0.0</pagehelper.boot.version> <pagehelper.boot.version>2.0.0</pagehelper.boot.version>
<druid.version>1.2.23</druid.version> <druid.version>1.2.23</druid.version>
<dynamic-ds.version>4.2.0</dynamic-ds.version> <dynamic-ds.version>4.3.1</dynamic-ds.version>
<commons.io.version>2.13.0</commons.io.version> <commons.io.version>2.19.0</commons.io.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<fastjson.version>2.0.43</fastjson.version> <fastjson.version>2.0.57</fastjson.version>
<jjwt.version>0.9.1</jjwt.version> <jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version> <minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<springdoc.version>1.6.9</springdoc.version>
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version> <transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
<!-- override dependency version -->
<tomcat.version>9.0.112</tomcat.version>
<logback.version>1.2.13</logback.version>
<spring-framework.version>5.3.39</spring-framework.version>
<!-- plugin version -->
<git-code-format-maven-plugin.version>5.4</git-code-format-maven-plugin.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!-- SpringFramework的依赖配置--> <!-- 覆盖SpringFramework的依赖配置-->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId> <artifactId>spring-framework-bom</artifactId>
@@ -78,6 +82,38 @@
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- 覆盖logback的依赖配置-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- 覆盖tomcat的依赖配置-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- FastDFS 分布式文件系统 --> <!-- FastDFS 分布式文件系统 -->
<dependency> <dependency>
<groupId>com.github.tobato</groupId> <groupId>com.github.tobato</groupId>
@@ -85,16 +121,11 @@
<version>${tobato.version}</version> <version>${tobato.version}</version>
</dependency> </dependency>
<!-- Swagger 依赖配置 --> <!-- Springdoc webmvc 依赖配置 -->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>org.springdoc</groupId>
<artifactId>swagger-models</artifactId> <artifactId>springdoc-openapi-ui</artifactId>
<version>${swagger.core.version}</version> <version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.core.version}</version>
</dependency> </dependency>
<!-- 验证码 --> <!-- 验证码 -->
@@ -255,6 +286,10 @@
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
</plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
@@ -270,6 +305,43 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
<executions>
<execution>
<id>install-formatter-hook</id>
<goals>
<goal>install-hooks</goal>
</goals>
</execution>
<execution>
<id>git-code-format</id>
<phase>validate</phase>
<goals>
<goal>format-code</goal>
<goal>validate-code-format</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.cosium.code</groupId>
<artifactId>google-java-format</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<formatterOptions>
<googleJavaFormat.aosp>false</googleJavaFormat.aosp>
<googleJavaFormat.formatJavadoc>true</googleJavaFormat.formatJavadoc>
<googleJavaFormat.fixImportsOnly>false</googleJavaFormat.fixImportsOnly>
<googleJavaFormat.skipSortingImports>false</googleJavaFormat.skipSortingImports>
<googleJavaFormat.skipRemoveUnusedImports>false</googleJavaFormat.skipRemoveUnusedImports>
</formatterOptions>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api</artifactId> <artifactId>ruoyi-api</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -1,23 +1,27 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysFile; import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory; import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 文件服务 * 文件服务
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class) @FeignClient(
public interface RemoteFileService contextId = "remoteFileService",
{ value = ServiceNameConstants.FILE_SERVICE,
fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
/** /**
* 上传文件 * 上传文件
* *
@@ -26,4 +30,13 @@ public interface RemoteFileService
*/ */
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
/**
* 删除文件
*
* @param fileUrl 文件地址
* @return 结果
*/
@DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl);
} }

View File

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

View File

@@ -1,5 +1,11 @@
package com.ruoyi.system.api; package com.ruoyi.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -7,21 +13,17 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
/** /**
* 用户服务 * 用户服务
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) @FeignClient(
public interface RemoteUserService contextId = "remoteUserService",
{ value = ServiceNameConstants.SYSTEM_SERVICE,
fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {
/** /**
* 通过用户名查询用户信息 * 通过用户名查询用户信息
* *
@@ -30,7 +32,9 @@ public interface RemoteUserService
* @return 结果 * @return 结果
*/ */
@GetMapping("/user/info/{username}") @GetMapping("/user/info/{username}")
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<LoginUser> getUserInfo(
@PathVariable("username") String username,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* 注册用户信息 * 注册用户信息
@@ -40,7 +44,8 @@ public interface RemoteUserService
* @return 结果 * @return 结果
*/ */
@PostMapping("/user/register") @PostMapping("/user/register")
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> registerUserInfo(
@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* 记录用户登录IP地址和登录时间 * 记录用户登录IP地址和登录时间
@@ -50,5 +55,6 @@ public interface RemoteUserService
* @return 结果 * @return 结果
*/ */
@PutMapping("/user/recordlogin") @PutMapping("/user/recordlogin")
public R<Boolean> recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> recordUserLogin(
@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,24 +1,24 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type;
import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type;
import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss;
/** /**
* 用户对象 sys_user * 用户对象 sys_user
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysUser extends BaseEntity public class SysUser extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /** 用户ID */
@@ -55,8 +55,8 @@ public class SysUser extends BaseEntity
/** 密码 */ /** 密码 */
private String password; private String password;
/** 号状态0正常 1停用 */ /** 号状态0正常 1停用 */
@Excel(name = "号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
@@ -70,6 +70,9 @@ public class SysUser extends BaseEntity
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate; private Date loginDate;
/** 密码最后更新时间 */
private Date pwdUpdateDate;
/** 部门对象 */ /** 部门对象 */
@Excels({ @Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@@ -89,216 +92,183 @@ public class SysUser extends BaseEntity
/** 角色ID */ /** 角色ID */
private Long roleId; private Long roleId;
public SysUser() public SysUser() {}
{
} public SysUser(Long userId) {
public SysUser(Long userId)
{
this.userId = userId; this.userId = userId;
} }
public Long getUserId() public Long getUserId() {
{
return userId; return userId;
} }
public void setUserId(Long userId) public void setUserId(Long userId) {
{
this.userId = userId; this.userId = userId;
} }
public boolean isAdmin() public boolean isAdmin() {
{
return isAdmin(this.userId); return isAdmin(this.userId);
} }
public static boolean isAdmin(Long userId) public static boolean isAdmin(Long userId) {
{ return UserConstants.isAdmin(userId);
return userId != null && 1L == userId;
} }
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户昵称不能包含脚本字符") @Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName() {
{
return nickName; return nickName;
} }
public void setNickName(String nickName) public void setNickName(String nickName) {
{
this.nickName = nickName; this.nickName = nickName;
} }
@Xss(message = "用户账号不能包含脚本字符") @Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空") @NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() public String getUserName() {
{
return userName; return userName;
} }
public void setUserName(String userName) public void setUserName(String userName) {
{
this.userName = userName; this.userName = userName;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() public String getPhonenumber() {
{
return phonenumber; return phonenumber;
} }
public void setPhonenumber(String phonenumber) public void setPhonenumber(String phonenumber) {
{
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
} }
public String getSex() public String getSex() {
{
return sex; return sex;
} }
public void setSex(String sex) public void setSex(String sex) {
{
this.sex = sex; this.sex = sex;
} }
public String getAvatar() public String getAvatar() {
{
return avatar; return avatar;
} }
public void setAvatar(String avatar) public void setAvatar(String avatar) {
{
this.avatar = avatar; this.avatar = avatar;
} }
public String getPassword() public String getPassword() {
{
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password) {
{
this.password = password; this.password = password;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getLoginIp() public String getLoginIp() {
{
return loginIp; return loginIp;
} }
public void setLoginIp(String loginIp) public void setLoginIp(String loginIp) {
{
this.loginIp = loginIp; this.loginIp = loginIp;
} }
public Date getLoginDate() public Date getLoginDate() {
{
return loginDate; return loginDate;
} }
public void setLoginDate(Date loginDate) public void setLoginDate(Date loginDate) {
{
this.loginDate = loginDate; this.loginDate = loginDate;
} }
public SysDept getDept() public Date getPwdUpdateDate() {
{ return pwdUpdateDate;
}
public void setPwdUpdateDate(Date pwdUpdateDate) {
this.pwdUpdateDate = pwdUpdateDate;
}
public SysDept getDept() {
return dept; return dept;
} }
public void setDept(SysDept dept) public void setDept(SysDept dept) {
{
this.dept = dept; this.dept = dept;
} }
public List<SysRole> getRoles() public List<SysRole> getRoles() {
{
return roles; return roles;
} }
public void setRoles(List<SysRole> roles) public void setRoles(List<SysRole> roles) {
{
this.roles = roles; this.roles = roles;
} }
public Long[] getRoleIds() public Long[] getRoleIds() {
{
return roleIds; return roleIds;
} }
public void setRoleIds(Long[] roleIds) public void setRoleIds(Long[] roleIds) {
{
this.roleIds = roleIds; this.roleIds = roleIds;
} }
public Long[] getPostIds() public Long[] getPostIds() {
{
return postIds; return postIds;
} }
public void setPostIds(Long[] postIds) public void setPostIds(Long[] postIds) {
{
this.postIds = postIds; this.postIds = postIds;
} }
public Long getRoleId() public Long getRoleId() {
{
return roleId; return roleId;
} }
public void setRoleId(Long roleId) public void setRoleId(Long roleId) {
{
this.roleId = roleId; this.roleId = roleId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId()) .append("userId", getUserId())
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())
@@ -312,6 +282,7 @@ public class SysUser extends BaseEntity
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("loginIp", getLoginIp()) .append("loginIp", getLoginIp())
.append("loginDate", getLoginDate()) .append("loginDate", getLoginDate())
.append("pwdUpdateDate", getPwdUpdateDate())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<version>3.6.4</version> <version>3.6.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -107,12 +107,6 @@
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
<!-- Swagger -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,98 +1,82 @@
package com.ruoyi.common.core.context; package com.ruoyi.common.core.context;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.alibaba.ttl.TransmittableThreadLocal; import com.alibaba.ttl.TransmittableThreadLocal;
import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* 获取当前线程变量中的 用户id、用户名称、Token等信息 * 获取当前线程变量中的 用户id、用户名称、Token等信息 注意: 必须在网关通过请求头的方法传入同时在HeaderInterceptor拦截器设置值。 否则这里无法获取
* 注意: 必须在网关通过请求头的方法传入同时在HeaderInterceptor拦截器设置值。 否则这里无法获取
* *
* @author ruoyi * @author ruoyi
*/ */
public class SecurityContextHolder public class SecurityContextHolder {
{ private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL =
private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>(); new TransmittableThreadLocal<>();
public static void set(String key, Object value) public static void set(String key, Object value) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
map.put(key, value == null ? StringUtils.EMPTY : value); map.put(key, value == null ? StringUtils.EMPTY : value);
} }
public static String get(String key) public static String get(String key) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY)); return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY));
} }
public static <T> T get(String key, Class<T> clazz) public static <T> T get(String key, Class<T> clazz) {
{
Map<String, Object> map = getLocalMap(); Map<String, Object> map = getLocalMap();
return StringUtils.cast(map.getOrDefault(key, null)); return StringUtils.cast(map.getOrDefault(key, null));
} }
public static Map<String, Object> getLocalMap() public static Map<String, Object> getLocalMap() {
{
Map<String, Object> map = THREAD_LOCAL.get(); Map<String, Object> map = THREAD_LOCAL.get();
if (map == null) if (map == null) {
{
map = new ConcurrentHashMap<String, Object>(); map = new ConcurrentHashMap<String, Object>();
THREAD_LOCAL.set(map); THREAD_LOCAL.set(map);
} }
return map; return map;
} }
public static void setLocalMap(Map<String, Object> threadLocalMap) public static void setLocalMap(Map<String, Object> threadLocalMap) {
{
THREAD_LOCAL.set(threadLocalMap); THREAD_LOCAL.set(threadLocalMap);
} }
public static Long getUserId() public static Long getUserId() {
{
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
} }
public static void setUserId(String account) public static void setUserId(String account) {
{
set(SecurityConstants.DETAILS_USER_ID, account); set(SecurityConstants.DETAILS_USER_ID, account);
} }
public static String getUserName() public static String getUserName() {
{
return get(SecurityConstants.DETAILS_USERNAME); return get(SecurityConstants.DETAILS_USERNAME);
} }
public static void setUserName(String username) public static void setUserName(String username) {
{
set(SecurityConstants.DETAILS_USERNAME, username); set(SecurityConstants.DETAILS_USERNAME, username);
} }
public static String getUserKey() public static String getUserKey() {
{
return get(SecurityConstants.USER_KEY); return get(SecurityConstants.USER_KEY);
} }
public static void setUserKey(String userKey) public static void setUserKey(String userKey) {
{
set(SecurityConstants.USER_KEY, userKey); set(SecurityConstants.USER_KEY, userKey);
} }
public static String getPermission() public static String getPermission() {
{
return get(SecurityConstants.ROLE_PERMISSION); return get(SecurityConstants.ROLE_PERMISSION);
} }
public static void setPermission(String permissions) public static void setPermission(String permissions) {
{
set(SecurityConstants.ROLE_PERMISSION, permissions); set(SecurityConstants.ROLE_PERMISSION, permissions);
} }
public static void remove() public static void remove() {
{
THREAD_LOCAL.remove(); THREAD_LOCAL.remove();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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