742 Commits

Author SHA1 Message Date
刘继东
88931298c5 Pre Merge pull request !252 from 刘继东/N/A 2025-03-05 10:15:10 +00: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
RuoYi
8984ecba86 记录用户登录IP地址和登录时间 2024-07-09 12:12:01 +08:00
RuoYi
0953a9c0b2 记录用户登录IP地址和登录时间 2024-07-09 12:06:40 +08:00
RuoYi
fcff9dfdea 修改时间范围日期格式 2024-07-08 16:57:25 +08:00
RuoYi
d1cb4e1f71 remove sub resultType 2024-07-08 16:57:04 +08:00
RuoYi
68ef1297cb avatar add headers 2024-07-02 16:10:58 +08:00
RuoYi
b79f01e051 升级axios到最新版本0.28.1 2024-07-02 12:58:10 +08:00
RuoYi
095f3a126f 菜单管理新增路由名称 2024-06-29 22:46:54 +08:00
RuoYi
ce94a9d620 升级core-js到最新版本3.37.1 2024-06-29 22:46:18 +08:00
RuoYi
2a73de34f0 优化代码 2024-06-29 22:45:51 +08:00
RuoYi
8694501a7e 升级druid到最新版本1.2.23 2024-06-25 13:55:12 +08:00
RuoYi
4dfc3d766e 优化代码 2024-06-25 13:53:58 +08:00
RuoYi
0680d1ed1f 优化数据权限代码 2024-06-05 12:48:37 +08:00
RuoYi
493dee03c8 优化代码生成主子表关联查询方式 2024-06-05 12:48:18 +08:00
RuoYi
3992b1e666 添加新群号:158753145 2024-05-29 15:18:57 +08:00
RuoYi
c855884ebd update sql 2024-05-29 15:18:36 +08:00
RuoYi
19c457ae5f 限制用户操作数据权限范围 2024-05-29 15:18:20 +08:00
若依
1a3751ab71 !368 未合理判断验证码失效
Merge pull request !368 from PowderSnow/N/A
2024-05-29 07:00:02 +00:00
PowderSnow
af8d62e5e2 update ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java.
目前报”验证码已失效“的场景是uuid为空,应通过判断captcha是否为null得出验证码是否已过期的结果。

Signed-off-by: PowderSnow <1109835296@qq.com>
2024-05-12 19:21:59 +00:00
RuoYi
cf03781bd7 升级spring-framework到安全版本,防止漏洞风险 2024-04-11 17:01:16 +08:00
RuoYi
fa2a28e877 新增数据脱敏过滤注解 2024-04-08 13:16:52 +08:00
RuoYi
e2f1b31735 若依 3.6.4 2024-04-01 09:28:45 +08:00
RuoYi
488aafb683 升级spring-boot-admin到最新版2.7.15 2024-03-29 11:08:23 +08:00
RuoYi
735273d69f Excel注解ColumnType类型新增文本 2024-03-22 16:44:18 +08:00
RuoYi
f2a587c2f9 更新compressionPlugin到6.1.2以兼容node18+ 2024-03-18 14:30:11 +08:00
RuoYi
4f7bcef44c 定时任务白名单配置范围缩小 2024-03-11 11:23:38 +08:00
RuoYi
393a9326c8 update copyright 2024 2024-03-11 10:48:30 +08:00
若依
33a52c8166 !360 update ruoyi-modules/ruoyi-job/src/main/resources/mapper/job/SysJobLogMapper.xml.
Merge pull request !360 from 刘继东/N/A
2024-03-04 01:48:41 +00:00
刘继东
b44e0e4de6 update ruoyi-modules/ruoyi-job/src/main/resources/mapper/job/SysJobLogMapper.xml.
任务运行日志列表增加按创建日期倒叙排序

Signed-off-by: 刘继东 <wwwliujidong@163.com>
2024-03-02 03:52:29 +00:00
RuoYi
3fa4901d57 用户密码新增非法字符验证 2024-03-01 21:55:38 +08:00
RuoYi
2dca6f0a12 优化匹配方式 2024-03-01 21:55:28 +08:00
RuoYi
78e61d89ba 添加新群号:179219821 2024-01-11 15:47:14 +08:00
RuoYi
4908b6230b update vue.config.js 2024-01-11 15:47:05 +08:00
RuoYi
f6d4f5c6e3 升级element-ui到最新版本2.15.14 2023-12-07 11:19:06 +08:00
RuoYi
1580c1e672 删除无用的代码 2023-12-07 11:18:32 +08:00
RuoYi
6ff45b2644 升级spring-cloud相关组件到最新版 2023-12-04 16:46:42 +08:00
RuoYi
ae77c82304 update ry_config.sql 2023-12-04 16:45:53 +08:00
RuoYi
41c2d6fc2a 显隐列组件支持复选框弹出类型 2023-12-01 11:20:51 +08:00
RuoYi
d0e9e07e9c 代码生成支持选择前端模板类型 2023-11-30 09:46:27 +08:00
RuoYi
210626b21f 修复头像上传成功图片不显示问题 2023-11-30 09:46:06 +08:00
RuoYi
85ab6236e7 优化代码 2023-11-30 09:45:07 +08:00
RuoYi
0037e65ca0 优化头像上传参数新增文件名称 2023-11-29 13:00:45 +08:00
RuoYi
adec3f0608 优化字典标签支持自定义分隔符 2023-11-29 12:59:55 +08:00
RuoYi
e7adf59b88 优化下载zip方法新增遮罩层 2023-11-29 12:59:42 +08:00
RuoYi
21a17945fa 优化代码 2023-11-29 12:59:22 +08:00
RuoYi
b7abcd8374 优化个人中心/基本资料修改时数据显示问题 2023-11-28 13:07:42 +08:00
RuoYi
2eeb642f07 优化白名单页面放行逻辑 2023-11-28 13:06:20 +08:00
RuoYi
4512af436d 防止高频率定时任务不执行问题 2023-11-28 13:06:06 +08:00
若依
6a8964f086 !347 update ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java.
Merge pull request !347 from 刚刚好/N/A
2023-11-28 05:04:55 +00:00
刚刚好
75b2eb067d update ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java.
提交错别字

Signed-off-by: 刚刚好 <380862139@qq.com>
2023-11-12 02:40:27 +00:00
RuoYi
2eaabefeac 修改权限字符匹配方式 2023-11-10 16:18:24 +08:00
RuoYi
c3ab80967c 修复五级路由缓存无效问题 2023-11-10 15:31:43 +08:00
RuoYi
892e3ac822 修复内链iframe没有传递参数问题 2023-11-10 11:19:31 +08:00
RuoYi
e2b4bb0420 修复外链带端口出现的异常 2023-11-07 11:41:50 +08:00
RuoYi
d6b4806e43 修复数据字典列表页重置后标签值无法输入问题 2023-11-01 10:01:47 +08:00
RuoYi
7df1b02476 优化数字金额大写转换精度丢失问题 2023-11-01 10:00:21 +08:00
RuoYi
6d9cbe218c 升级fastjson到最新版2.0.41 2023-10-21 15:16:38 +08:00
RuoYi
302299bbb0 登录不做数据重复提交验证 2023-10-21 14:32:50 +08:00
RuoYi
437301d5d9 去掉多余的参数 2023-10-21 14:32:43 +08:00
RuoYi
dc121ff4aa 富文本Editor组件检验图片格式 2023-10-02 12:46:35 +08:00
RuoYi
c4cda3f4ad 修复HeaderSearch组件跳转query参数丢失问题 2023-09-28 22:21:50 +08:00
RuoYi
e067c04464 操作日志列表新增IP地址查询 2023-09-27 15:27:29 +08:00
RuoYi
af03fefc83 全局数据存储用户编号 2023-09-27 15:27:07 +08:00
RuoYi
2d49f2a56e 优化菜单管理类型为按钮状态可选 2023-09-18 15:05:23 +08:00
RuoYi
2af351f898 修复自定义字典样式不生效的问题 2023-09-14 17:27:13 +08:00
wind
a709c8f06e update docker/copy.sh.
Signed-off-by: wind <zhangmrit@126.com>
2023-09-05 08:50:40 +00:00
RuoYi
b00775f988 删除无用的传参 2023-09-01 09:40:02 +08:00
RuoYi
48711178ec 优化TopNav菜单没有图标svg不显示 2023-08-31 10:21:59 +08:00
RuoYi
07bb636109 修改未登录访问需要登录的资源,在登录后重定向丢失请求参数问题 2023-08-31 10:21:08 +08:00
RuoYi
24e0fa863e 优化代码 2023-08-25 09:45:44 +08:00
RuoYi
fb6d93fbab 修复字典缓存删除方法参数错误问题 2023-08-23 14:56:07 +08:00
RuoYi
db18477786 修复Excels导入时无法获取到readConverterExp内容转表达式问题 2023-08-21 16:01:55 +08:00
RuoYi
91575613a8 防重复提交数据大小限制 2023-08-21 11:57:58 +08:00
RuoYi
a5354083b9 Excel导入数据临时文件无法删除问题 2023-08-19 16:24:04 +08:00
RuoYi
1665fa2793 升级fastjson到最新版2.0.39 2023-08-15 12:24:16 +08:00
RuoYi
df8d6bcd33 升级commons.io到最新版本2.13.0 2023-08-15 12:20:37 +08:00
若依
2fecc6273b !340 修改个人信息:防止用户有目的性的修改其他属性
Merge pull request !340 from 码上秃Hello/N/A
2023-08-15 04:17:49 +00:00
码上秃Hello
8b252709a4 修改个人信息:防止用户有目的性的修改其他属性
Signed-off-by: 码上秃Hello <19973252123@163.com>
2023-08-15 03:25:00 +00:00
RuoYi
b2cb085f21 Excel自定义数据处理器增加单元格/工作簿对象 2023-08-14 19:20:04 +08:00
RuoYi
1b1bc96bd5 优化定时任务状态页面显示 2023-08-14 19:19:55 +08:00
RuoYi
a416d55780 优化代码 2023-08-14 19:19:35 +08:00
RuoYi
1994aff544 添加新群号:128355254 2023-07-28 11:22:41 +08:00
RuoYi
b18eced03d 若依 3.6.3 2023-07-07 08:30:21 +08:00
RuoYi
ee2fef02f8 排序属性orderBy参数限制长度 2023-07-06 22:29:30 +08:00
RuoYi
ad954dacb7 屏蔽定时任务bean违规的字符 2023-07-06 22:29:09 +08:00
RuoYi
10de4eb96d 升级spring-cloud相关组件到最新版 2023-07-06 20:01:30 +08:00
RuoYi
a5b612c8e4 update sql 2023-07-06 20:00:45 +08:00
RuoYi
ebc848b5b5 优化页签在Firefox浏览器被遮挡的问题(I7BVAJ) 2023-07-06 09:27:48 +08:00
若依
f31c207551 !333 注释名称与参数名不一致
Merge pull request !333 from mxy/master
2023-07-06 01:26:09 +00:00
若依
dd338b56da !332 在全局异常拦截器中增加两类异常处理
Merge pull request !332 from OTTO/master
2023-07-06 01:26:05 +00:00
BearXuan
7c3d7b384c 注释名称与参数名不一致 2023-07-03 15:18:33 +08:00
otto
0647ca8b66 style(在全局异常拦截器中增加两类异常处理): 格式化代码 2023-07-03 11:52:23 +08:00
otto
f3477f75e6 Merge branch 'master' of gitee.com:OTTTTO/RuoYi-Cloud 2023-07-03 11:04:55 +08:00
otto
22fa7ac6f6 feat(在全局异常拦截器中增加两类异常处理): 1、请求路径中缺少必需的路径变量;2、请求参数类型不匹配; 2023-07-03 11:04:22 +08:00
otto
924aafae86 feat(在全局异常拦截器中增加两类异常处理): 1、请求路径中缺少必需的路径变量;2、请求参数类型不匹配 2023-07-03 11:02:12 +08:00
RuoYi
5280fb5a0d 升级element-ui到最新版本2.15.13 2023-06-30 14:05:22 +08:00
RuoYi
d3c6ba2598 升级fastjson到最新版2.0.34 2023-06-30 14:05:13 +08:00
RuoYi
08308d61c7 优化侧边栏的平台标题与VUE_APP_TITLE保持同步 2023-06-30 14:04:52 +08:00
RuoYi
356b451b2a optimized code 2023-06-30 14:03:52 +08:00
RuoYi
a606973cbe 恢复翻页/切换路由滚动功能 2023-04-23 16:59:22 +08:00
RuoYi
19fb27502b 修复代码生成表字段注释不全问题 2023-04-23 16:58:43 +08:00
RuoYi
d7b309afd9 修复路由跳转被阻止时vue-router内部产生报错信息问题 2023-04-23 16:58:19 +08:00
RuoYi
d9bfc3e322 DictTag组件,当value没有匹配的值时,展示value 2023-04-23 16:57:54 +08:00
RuoYi
74045776d6 优化文件输入流可能为空的问题 2023-04-18 16:14:08 +08:00
若依
5fcec99e6c !321 解决文件输入流为可能为空的问题
Merge pull request !321 from maochd/master
2023-04-18 08:07:22 +00:00
maochd
102a5ac575 简化允许下载的文件规则判断 2023-04-18 13:56:59 +08:00
maochd
3786f3671d 解决文件输入流为可能为空的问题 2023-04-18 13:55:07 +08:00
RuoYi
49e6fbf2ff 修复开启TopNav后一级菜单路由参数设置无效问题(I6T1DK) 2023-04-11 16:52:35 +08:00
RuoYi
81a8192de7 修复导入用户时无法更新存在用户数据的问题 2023-04-10 18:17:12 +08:00
RuoYi
a366d09659 优化已选择下拉图标高亮回显 2023-04-10 18:17:00 +08:00
RuoYi
2fe7341fa7 优化避免鼠标移出时无法隐藏滚动条的问题 2023-04-10 18:15:36 +08:00
RuoYi
a3615e5c6c 优化代码 2023-04-10 18:14:54 +08:00
RuoYi
68eac98acf 优化代码 2023-04-05 19:16:25 +08:00
RuoYi
d4bae9745c 修复tab栏”关闭其他“异常的问题 2023-04-05 19:03:18 +08:00
RuoYi
23ae0eb43b 修复tab栏”关闭其他“异常的问题 2023-04-05 19:02:44 +08:00
RuoYi
308d497d74 优化生成表字段comment过长问题 2023-04-05 19:00:27 +08:00
RuoYi
7af254ee51 delete vue-multiselect style 2023-04-05 18:59:31 +08:00
RuoYi
2ad13c9f72 优化固定头部页签滚动条被隐藏的问题(I6ORT1) 2023-04-05 16:19:47 +08:00
RuoYi
56d50d10e9 update docker 2023-04-05 16:04:07 +08:00
RuoYi
0b21d15f26 优化代码 2023-03-29 10:45:46 +08:00
若依
7421d7ccce !313 异步保存日志的时候,报错被吞 ,导致没跑进RemoteLogFallbackFactory中
Merge pull request !313 from Llorando/master
2023-03-29 02:44:23 +00:00
若依
84ba2dbd93 !310 完善ruoyi-file模块的upload接口在文件过大和文件名过长的情况下的返回值中的msg提示信息
Merge pull request !310 from pigwantacat/master
2023-03-29 02:39:08 +00:00
若依
55447c72e9 !306 注释 @EnableCustomSwagger2 注解后,项目启动失败
Merge pull request !306 from Gelis/master
2023-03-29 02:30:18 +00:00
若依
26c63520f2 !302 【轻量级 PR】 文件上传服务获取InputStream未关闭
Merge pull request !302 from 程序凡/master
2023-03-29 02:02:48 +00:00
Llorando
8b52b90670 异步保存日志的时候,报错被吞,导致没跑进RemoteLogFallbackFactory中 2023-03-21 17:24:33 +08:00
RuoYi
05ca78e82f 添加新群号:101038945 2023-03-18 10:51:46 +08:00
RuoYi
b155059d66 升级fastjson到最新版2.0.25 2023-03-18 10:45:57 +08:00
RuoYi
f8ad7ea3ce 支持自定义隐藏属性列过滤子对象 2023-03-18 10:45:29 +08:00
RuoYi
feff419641 关闭页签后存在其他页签时不应该跳转首页 2023-03-18 10:44:37 +08:00
RuoYi
33a0806cbe 优化弹窗后导航栏偏移的问题 2023-03-18 10:43:52 +08:00
RuoYi
230e2bb3f4 delete build style 2023-03-18 10:42:44 +08:00
RuoYi
24d9ccba40 修复页面切换时布局错乱的问题 2023-03-18 10:42:31 +08:00
RuoYi
dc24ed81b8 修复用户多角色数据权限可能出现权限抬升的情况 2023-03-18 10:41:33 +08:00
pigwantacat
504a4e8e66 完善ruoyi-file模块的upload接口在文件过大和文件名过长的情况下的返回值中的msg提示信息 2023-03-16 23:48:40 +08:00
RuoYi
775234dabe 优化修改密码日志存储明文问题(I6ESO9) 2023-03-05 13:07:22 +08:00
RuoYi
7fdd20c054 优化文件下载出现的异常(I6DLNU) 2023-02-28 15:02:20 +08:00
Gelis
1eeed86b65 修复注释 @EnableCustomSwagger2 后,项目启动失败
Signed-off-by: Gelis <806938079@qq.com>
2023-02-24 08:56:26 +00:00
RuoYi
7c9903e057 日志管理使用索引提升查询性能 2023-02-23 12:32:02 +08:00
若依
20dd6d37ea !305 修复新增参数时判断错误的问题
Merge pull request !305 from Rain/N/A
2023-02-22 02:54:42 +00:00
Rain
89a04423cd 修复新增参数管理时判断错误的问题
Signed-off-by: Rain <938448486@qq.com>
2023-02-22 02:53:40 +00:00
若依
c42b4cad02 !304 修复isMatchedIp的参数判断产生NullPointerException的问题
Merge pull request !304 from wangfeiyu/dev20230222
2023-02-22 02:23:46 +00:00
wangfeiyu
4b21a3bc48 在方法isMatchedIp的参数中,当filter为null而ip非null/空时,报filter为null异常。把判断条件由&&改为||解决此bug。 2023-02-22 08:54:10 +08:00
RuoYi
1ef82d75b1 移除apache/commons-fileupload依赖 2023-02-21 22:55:51 +08:00
RuoYi
c10a3b6dbb 升级druid到最新版本1.2.16 2023-02-21 22:50:54 +08:00
RuoYi
b93c9bfc5d 优化代码 2023-02-21 22:50:27 +08:00
RuoYi
cd5556d188 支持登录IP黑名单限制 2023-02-21 10:31:54 +08:00
RuoYi
1126e2234f 日志注解支持排除指定的请求参数 2023-02-21 09:14:37 +08:00
CQG
dce91a03ef 文件上传服务获取InputStream未关闭,导致删除临时文件删除失败 2023-02-17 14:19:16 +08:00
RuoYi
8dff14a6cc 操作日志新增消耗时间属性 2023-02-16 11:10:00 +08:00
RuoYi
3462c58ce4 升级fastjson到最新版2.0.23 2023-02-16 11:07:41 +08:00
RuoYi
6c3e88ee6d 首页页签右键选择时不显示关闭左侧 2023-02-04 22:45:01 +08:00
RuoYi
da2e5a2d93 update copyright 2023 2023-02-04 22:44:29 +08:00
RuoYi
12c51fc8e3 若依 3.6.2 2023-01-16 11:42:23 +08:00
RuoYi
736b6348bc 移除commons-collections依赖 2023-01-13 16:26:18 +08:00
RuoYi
6317e902e3 升级element-ui到最新版本2.15.12 2023-01-13 11:45:09 +08:00
RuoYi
94590a008d 升级spring-boot-admin到最新版2.7.10 2023-01-13 11:44:39 +08:00
RuoYi
8b5acaf341 升级spring-cloud相关组件到最新版 2023-01-12 11:44:49 +08:00
RuoYi
8eb22e86e0 字符未使用下划线不进行驼峰式处理 2023-01-12 11:44:12 +08:00
RuoYi
853040cd42 修复gateway流控规则生效但不显示问题 2023-01-12 11:42:39 +08:00
RuoYi
17364e2699 v3最新版本不需要render-after-expand 2022-12-23 16:11:57 +08:00
RuoYi
9f48ff40d2 升级pagehelper到最新版1.4.6 2022-12-14 11:32:25 +08:00
RuoYi
f93fc98b4f 修改参数键名时移除前缓存配置 2022-12-14 11:31:58 +08:00
RuoYi
c03a671de8 修复代码生成图片/文件/单选时选择必填无法校验问题 2022-12-08 10:29:01 +08:00
RuoYi
6d6d5140fe 升级fastjson到最新版2.0.20 2022-12-08 10:27:36 +08:00
RuoYi
f016006224 删除fuse无效选项maxPatternLength 2022-12-08 10:27:12 +08:00
RuoYi
abcc045cad 修复Vue3树形下拉不能默认选中 2022-12-07 20:37:52 +08:00
RuoYi
d76fab1d0c 升级druid到最新版本1.2.15 2022-12-07 12:46:39 +08:00
RuoYi
a0d2b383ef 升级kaptcha到最新版2.3.3 2022-12-07 12:46:32 +08:00
RuoYi
af33456ca8 升级echarts到最新版本5.4.0 2022-12-07 12:43:12 +08:00
RuoYi
3d2f9aa9c6 优化弹窗内容过多展示不全问题 2022-12-03 13:21:07 +08:00
RuoYi
a8be0ccb35 修复Log注解GET请求记录不到参数问题 2022-12-03 13:20:48 +08:00
若依
f646bfc0f5 !286 此处修改曾导致 nacos修改xss开关时,spring容器未重启,filter仍起效。故增加参数判断,参数刷新后,xss开关正常关闭。
Merge pull request !286 from ylwang/N/A
2022-12-03 05:14:59 +00:00
若依
6efd427f79 !290 修复没有指定 spring-boot-maven-plugin 的版本号默认去拉取基于 JDK17 编译的 3.0 版本导致打包失败的问题
Merge pull request !290 from hjk2008/N/A
2022-12-03 05:14:11 +00:00
hjk2008
04a042c585 修复没有指定 spring-boot-maven-plugin 的版本号默认去拉取基于 JDK17 编译的 3.0 版本导致打包失败的问题
Signed-off-by: hjk2008 <hjk2008ext@163.com>
2022-11-25 09:32:35 +00:00
RuoYi
ee3f03f1f1 修复某些特性的环境生成代码变乱码TXT文件问题 2022-11-22 09:25:59 +08:00
RuoYi
b1a67a113e 消除Vue3控制台出现的警告信息 2022-11-21 19:46:47 +08:00
ylwang
bc1c1dbfa7 此处修改曾导致 nacos修改xss开关时,spring容器未重启,filter仍起效。故增加参数判断,参数刷新后,xss开关正常关闭。
此处修改曾导致 nacos修改xss开关时,spring容器未重启,filter仍起效。故增加参数判断,参数刷新后,xss开关正常关闭。

Signed-off-by: ylwang <ylwang@makwing.com>
2022-11-21 08:58:44 +00:00
RuoYi
7a112c7317 兼容Excel下拉框内容过多无法显示的问题 2022-11-21 12:32:09 +08:00
RuoYi
d2bd73b4dc 开启TopNav没有子菜单隐藏侧边栏 2022-11-17 14:26:43 +08:00
RuoYi
a211d93092 修复回显数据字典数组异常问题(I60UYQ) 2022-11-15 14:31:23 +08:00
RuoYi
a9938302f0 修复调度日志点击多次数据不变化的问题 2022-11-15 14:31:04 +08:00
RuoYi
6e5d7a6dab 升级druid到最新版本1.2.14 2022-11-14 11:34:59 +08:00
RuoYi
7a3892a77a 忽略不必要的属性数据返回 2022-11-12 11:47:20 +08:00
RuoYi
e0a5e704b0 优化导出对象的子列表为空会出现[]问题 2022-11-11 11:36:02 +08:00
RuoYi
d936ce76b1 修复sheet超出最大行数异常问题(I5YQ7Z) 2022-11-04 16:08:45 +08:00
RuoYi
f2320d356d 添加新群号:118752664 2022-11-02 10:44:43 +08:00
若依
b50e79bbde !278 根据调度编号获取详细信息参数名改正
Merge pull request !278 from Rain/N/A
2022-10-31 05:47:43 +00:00
Rain
295b5d5cfd 修复根据调度编号获取详细信息参数名错误
Signed-off-by: Rain <938448486@qq.com>
2022-10-31 02:10:10 +00:00
RuoYi
8f4ac612c8 新增返回警告消息提示 2022-10-30 13:04:31 +08:00
RuoYi
b3f9e1f2de 升级fastjson到最新版2.0.16 2022-10-30 13:04:10 +08:00
RuoYi
bcbc9d7adc 修复table中更多按钮切换主题色未生效修复问题 2022-10-28 21:01:57 +08:00
RuoYi
6421f68964 修复使用透明底png图片时,自动填充黑色背景 2022-10-28 20:40:41 +08:00
RuoYi
652f4372c0 重置时取消部门选中 2022-10-28 20:39:26 +08:00
RuoYi
cff5fe93a5 去除某些svg图标的fill属性,避免菜单激活无法填充颜色 2022-10-28 20:38:56 +08:00
RuoYi
c759728269 优化修改头像在小屏幕上页面布局错位的问题 2022-10-21 12:02:25 +08:00
RuoYi
58e07ba142 修复用户编辑时角色和部门存在无法修改情况 2022-10-21 12:01:42 +08:00
若依
43b336d26b !266 升级fastjson到最新版2.0.15
Merge pull request !266 from Rain/N/A
2022-10-21 03:13:18 +00:00
若依
8eeb73eabb !267 修改注释文案
Merge pull request !267 from runphp/N/A
2022-10-21 03:12:04 +00:00
runphp
98c3e4b48a 修改注释文案
Signed-off-by: runphp <runphp@qq.com>
2022-10-21 03:04:00 +00:00
Rain
839366f2b0 升级fastjson到最新版2.0.15
Signed-off-by: Rain <938448486@qq.com>
2022-10-21 01:53:32 +00:00
RuoYi
65cf05fddb 修复主题颜色在Drawer组件不会加载问题(I5VCF0) 2022-10-19 10:55:34 +08:00
RuoYi
a9a8f94ae2 修复文件上传组件格式验证问题(I5V32H) 2022-10-12 19:34:45 +08:00
RuoYi
1617c74d4d 升级core-js到最新版本3.25.3 2022-10-10 09:32:39 +08:00
RuoYi
01c1505340 修复导出包含空子列表数据异常的问题 2022-10-10 09:31:10 +08:00
RuoYi
c2708f2ba4 若依 3.6.1 2022-09-30 11:48:39 +08:00
若依
48a0d5bc9d !258 fix: 改为静态方法, isError和isSuccess方法会被json序列化
Merge pull request !258 from runphp/N/A
2022-09-30 01:24:09 +00:00
runphp
a057b7a4b9 fix: 改为静态方法, isError和isSuccess方法会被json序列化
isError和isSuccess会被json序列化
`{"error":false,"success":true}`

Signed-off-by: runphp <runphp@qq.com>
2022-09-29 10:16:11 +00:00
RuoYi
0e4a1c872c update ry_config.sql 2022-09-29 12:14:06 +08:00
RuoYi
5faa1af464 升级spring-cloud相关组件到最新版 2022-09-29 11:45:05 +08:00
RuoYi
0dfbb5fbf3 seata单独依赖模块 2022-09-29 11:29:41 +08:00
RuoYi
3b4f1d7937 优化代码生成同步后字典值NULL问题 2022-09-28 21:15:45 +08:00
RuoYi
07c2e08e4a 导入更新用户数据前校验数据权限 2022-09-28 21:15:34 +08:00
RuoYi
e03cebac57 升级core-js到最新版本3.25.2 2022-09-22 13:24:24 +08:00
RuoYi
0c36921587 升级fastjson到最新版2.0.14 2022-09-22 13:23:25 +08:00
若依
53b84261f8 !253 AjaxResult中isError方法逻辑修改
Merge pull request !253 from taest/N/A
2022-09-22 01:59:28 +00:00
taest
11de8aa17b AjaxResult中isError方法错误修改
Signed-off-by: taest <876239615@qq.com>
2022-09-22 01:21:17 +00:00
刘继东
988c8b23ac update ruoyi-modules/ruoyi-gen/src/main/resources/mapper/generator/GenTableMapper.xml.
增加按表名排序,表特别多时方便找到表!

Signed-off-by: 刘继东 <wwwliujidong@163.com>
2022-09-20 23:51:20 +00:00
RuoYi
f250c6ee93 优化日志操作中重置按钮时重复查询的问题 2022-09-19 14:47:28 +08:00
RuoYi
fd89356ed7 通用下载方法新增config配置选项 2022-09-19 13:22:35 +08:00
RuoYi
ad54d36385 修改用户登录账号重复验证 2022-09-18 11:26:44 +08:00
RuoYi
3cf088a0d8 升级element-ui到最新版本2.15.10 2022-09-15 08:39:59 +08:00
若依
22fac34b82 !248 【轻量级 PR】:优化注释
Merge pull request !248 from CHY/dev
2022-09-15 00:26:17 +00:00
CHY
7f0f842651 【轻量级 PR】:简化return 2022-09-13 15:29:46 +08:00
CHY
1124c27f06 【轻量级 PR】:优化注释 2022-09-13 15:18:25 +08:00
RuoYi
adbba02cb8 定时任务支持执行父类方法 2022-09-09 10:27:42 +08:00
RuoYi
5b6dc85b62 日志注解限制operUrl属性的长度 2022-09-09 10:27:15 +08:00
RuoYi
62eec4df51 删除多余的style重复赋值 2022-09-09 10:26:55 +08:00
若依
11d8274462 !246 feat: add isError and isSuccess method
Merge pull request !246 from runphp/N/A
2022-09-09 02:10:24 +00:00
runphp
732071ef58 feat: add isError and isSuccess method
Signed-off-by: runphp <runphp@qq.com>
2022-09-07 08:52:23 +00:00
若依
afa23c2111 !240 update ruoyi-ui/src/components/FileUpload/index.vue.
Merge pull request !240 from exiace/N/A
2022-08-24 07:31:31 +00:00
exiace
4bf9f3cff5 update ruoyi-ui/src/components/FileUpload/index.vue.
文件上传组件提示信息错误

Signed-off-by: exiace <exiace@qq.com>
2022-08-24 06:18:18 +00:00
RuoYi
8c7986acdb 修复多文件上传报错出现的异常问题 2022-08-24 14:08:38 +08:00
RuoYi
52d50e4e47 优化页面内嵌iframe切换tab不刷新数据 2022-08-23 21:19:45 +08:00
RuoYi
f0bfff1ff3 优化页面内嵌iframe切换tab不刷新数据 2022-08-23 17:38:00 +08:00
若依
a37315d513 !238 https://github.com/alibaba/nacos/issues/8960
Merge pull request !238 from 云飞扬/N/A
2022-08-23 01:20:32 +00:00
云飞扬
479755650c https://github.com/alibaba/nacos/issues/8960
Signed-off-by: 云飞扬 <15678871232@qq.com>
2022-08-22 16:52:14 +00:00
RuoYi
73256dfeaf 升级fastjson到最新版2.0.12 2022-08-22 15:02:58 +08:00
RuoYi
767f7c8621 优化多角色数据权限匹配规则 2022-08-22 15:02:29 +08:00
RuoYi
12d335b9ac 添加菜单管理遗漏的prop属性 2022-08-22 14:45:51 +08:00
若依
bc7a743998 !237 fix: user_key 头信息未传递
Merge pull request !237 from runphp/N/A
2022-08-22 06:40:57 +00:00
若依
ca36f9fc6e !236 代码小整理
Merge pull request !236 from taest/N/A
2022-08-22 06:39:30 +00:00
若依
8345eed709 !235 RedisService 删除Hash中的某条数据 方法返回值必为false问题修复
Merge pull request !235 from taest/N/A
2022-08-22 06:38:34 +00:00
若依
2af8e817bd !233 密码变量命名风格统一
Merge pull request !233 from taest/N/A
2022-08-22 06:32:49 +00:00
runphp
fcb58876e7 fix: user_key 头信息未传递
Signed-off-by: runphp <runphp@qq.com>
2022-08-22 03:13:56 +00:00
taest
d4c61daf9b 代码小整理
Signed-off-by: taest <876239615@qq.com>
2022-08-19 08:32:42 +00:00
taest
31523867e7 RedisService 删除Hash中的某条数据 方法返回值必为false问题修复
Signed-off-by: taest <876239615@qq.com>
2022-08-19 08:26:05 +00:00
taest
a8daa1f044 密码变量命名风格统一
Signed-off-by: taest <876239615@qq.com>
2022-08-19 08:17:45 +00:00
RuoYi
858f576fa3 修复图片预览组件src属性为null值控制台报错问题(I5KBAS) 2022-08-15 12:08:00 +08:00
RuoYi
c960108b12 字典管理操作类型新增其他 2022-08-14 09:42:25 +08:00
RuoYi
59b867dcca 限制用户个人信息修改部门 2022-08-12 12:19:42 +08:00
若依
b9fdc4de87 !229 修复个人中心卡死或鼠标点击和键盘输入无效
Merge pull request !229 from Dincat/master
2022-08-12 04:05:10 +00:00
Dincat
d504a7df2f 修复个人中心卡死或鼠标点击和键盘输入无效 2022-08-11 14:12:10 +08:00
RuoYi
2a675aa304 优化修改资料头像被覆盖的问题(I5LK04) 2022-08-11 13:21:45 +08:00
RuoYi
d6df1fe7b3 操作日志记录支持排除敏感属性字段 2022-08-10 18:46:21 +08:00
RuoYi
428255ddcf 升级fastjson到最新版2.0.11 2022-08-10 18:46:08 +08:00
RuoYi
a92ca233aa 优化导出对象的子列表判断条件 2022-08-10 18:45:55 +08:00
若依
537105b2a9 !228 修复账户解锁接口请求路径错误的问题
Merge pull request !228 from Rain/N/A
2022-08-08 23:39:15 +00:00
若依
d56ef651e3 !227 update ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java.
Merge pull request !227 from 颜奕强/N/A
2022-08-08 23:38:58 +00:00
Rain
9d21b1627b 修复账户解锁接口请求路径错误的问题 2022-08-08 15:00:41 +00:00
颜奕强
467557fef3 update ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java.
* update:  数字类型应该转为double输出。若使用string输出,会导致生成的单元格变成文本类型。
2022-08-08 12:29:03 +00:00
RuoYi
c8a108b93a 登录日志新增解锁账户功能 2022-08-08 09:26:29 +08:00
RuoYi
5408af9d1f Excel支持导出对象的子列表方法 2022-08-07 18:49:09 +08:00
若依
e7b9e12d15 !225 新增删除Hash中的某条数据
Merge pull request !225 from runphp/N/A
2022-08-07 10:47:53 +00:00
若依
a4b714b95a !224 处理XSS攻击问题
Merge pull request !224 from Pcat/hotfix-3.6.1.pcat#I5IRC8
2022-08-07 10:47:16 +00:00
runphp
4ae26c2f86 新增删除Hash中的某条数据 2022-08-04 01:39:58 +00:00
RuoYi
b51c127eb7 数据逻辑删除不进行唯一验证 2022-08-03 16:53:11 +08:00
huyupeng
c5eb7458c8 fix: 处理XSS攻击问题(#I5IRC8) 2022-08-01 14:52:18 +08:00
RuoYi
347a717d5c 升级spring-boot到最新版本2.7.2 2022-08-01 13:35:52 +08:00
RuoYi
0484c63d9b 升级spring-boot-admin到最新版2.7.3 2022-08-01 13:35:41 +08:00
RuoYi
4d21c11acd 修复密码输入错误次数变量 2022-08-01 13:35:19 +08:00
RuoYi
8fdb3c4d14 修复使用FastDFS上传头像失败提示文件名没有后缀问题 2022-07-30 22:53:44 +08:00
RuoYi
0ef63207f4 新增密码错误次数限制 2022-07-30 13:56:46 +08:00
RuoYi
1295177393 优化任务过期不执行调度 2022-07-30 13:49:36 +08:00
RuoYi
67a6841043 优化表格上右侧工具条(搜索按钮显隐&右侧样式凸出) 2022-07-29 20:43:36 +08:00
RuoYi
d4930f6a88 自定义数据权限不排除重复 2022-07-26 20:06:14 +08:00
RuoYi
c98f452431 防止vue3主键字段名与row或ids一致导致报错的问题 2022-07-26 20:05:56 +08:00
RuoYi
fb35360f81 支持自定义隐藏Excel属性列 2022-07-21 13:52:33 +08:00
RuoYi
5e20f99a99 优化布局设置使用el-drawer抽屉显示 2022-07-21 08:51:47 +08:00
RuoYi
9f90b4eba7 优化字典数据使用store存取 2022-07-20 19:39:15 +08:00
RuoYi
ce82095f04 防止date-picker组件报错,降级element-ui版本 2022-07-20 19:14:47 +08:00
RuoYi
9ebd484f46 Excel注解支持backgroundColor属性设置背景色 2022-07-20 09:40:42 +08:00
RuoYi
cc0e184314 优化多个相同角色数据导致权限SQL重复问题 2022-07-19 16:08:11 +08:00
RuoYi
87009e72bf 若依 3.6.0 2022-07-16 10:34:02 +08:00
RuoYi
d6a2028ec3 升级transmittable-thread-local到最新版本2.13.2 2022-07-15 15:19:22 +08:00
RuoYi
ef28473992 升级Spring Cloud相关组件到最新版 2022-07-15 14:32:58 +08:00
RuoYi
1543fb801b 升级element-ui到最新版本2.15.9 2022-07-15 10:03:48 +08:00
RuoYi
e753cea03e 修改验证码开关变量名 2022-07-15 10:02:59 +08:00
RuoYi
78332c2786 升级fastjson到最新版2.0.9 2022-07-12 18:20:46 +08:00
RuoYi
4b1351ef21 修改验证码开关变量名 2022-07-12 18:19:35 +08:00
RuoYi
f12baad00c 优化代码 2022-07-12 18:19:10 +08:00
RuoYi
81d3c90bbc 添加新群号:148794840 2022-07-09 16:47:52 +08:00
疯狂的狮子Li
0d58ecb09c 删除重复注释 2022-07-03 04:22:19 +00:00
RuoYi
1e16852a3c 升级spring-boot到最新版本2.6.8 2022-06-26 13:47:58 +08:00
RuoYi
57e63a184d 升级fastjson到最新版2.0.8 2022-06-26 13:15:38 +08:00
RuoYi
20476e9dd1 默认不启用压缩文件缓存防止node_modules过大 2022-06-26 13:15:28 +08:00
RuoYi
95aa343805 优化字典数据回显样式下拉框显示值 2022-06-26 13:15:17 +08:00
RuoYi
a573c4b10d 字典类型删除多余的mapper注解 2022-06-26 13:13:20 +08:00
疯狂的狮子Li
5964dc81ab remove 删除无用 admin-client 依赖声明 避免造成误解 2022-06-24 04:54:54 +00:00
RuoYi
721701274b 升级seata到最新版1.5.1 2022-06-17 21:41:23 +08:00
RuoYi
78c356a9f3 升级fastjson到最新版2.0.7 2022-06-17 20:52:41 +08:00
若依
b622675522 使用Lazy,AutoConfigureBefore注解解决循环引用及Bean重复问题
Merge pull request !205 from 淡然逝去/N/A
2022-06-17 12:51:22 +00:00
若依
912f607062 !203 WebSecurityConfigurerAdapter 在Spring Security 5.7过时
Merge pull request !203 from 板砖/master
2022-06-17 12:37:36 +00:00
淡然逝去
1297d094cb 使用 @Lazy,@AutoConfigureBefore注解解决循环引用及Bean重复问题,删除allow-bean-definition-overriding: true, allow-circular-references: true配置信息 2022-06-16 04:56:12 +00:00
RuoYi
ccfc4f7ad7 升级druid到最新版本1.2.11 2022-06-14 21:35:47 +08:00
RuoYi
8ee702e4a2 reset babel 2022-06-14 21:26:24 +08:00
wuzh
5945537ade WebSecurityConfigurerAdapter 过时更新 2022-06-13 21:34:59 +08:00
RuoYi
2051819d2d 删除多余的工具类 2022-06-13 21:07:11 +08:00
RuoYi
570d468814 optimized code 2022-06-13 20:57:03 +08:00
若依
5fd16ff806 !202 update ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/XssFilter.java.
Merge pull request !202 from 光速蜗牛/N/A
2022-06-13 12:49:34 +00:00
若依
17246d8a27 !199 简化逻辑判断
Merge pull request !199 from 光速蜗牛/master
2022-06-13 12:48:42 +00:00
若依
6d404a1f3b !198 去除多余的逗号
Merge pull request !198 from runphp/N/A
2022-06-13 12:48:18 +00:00
若依
7417c1d473 !197 update 优化新增用户与角色信息、用户与岗位信息逻辑
Merge pull request !197 from 疯狂的狮子Li/N/A
2022-06-13 12:48:11 +00:00
若依
9b35679ba6 !196 修正OpenFeign部分情况下传递header中Authorization参数值为空导致获取用户信息失败问题
Merge pull request !196 from JellyBins/N/A
2022-06-13 12:45:30 +00:00
若依
7af84cb923 !195 修复【增加对空字符串参数的过滤】提交的参数判断问题
Merge pull request !195 from 清溪先生/master
2022-06-13 12:42:23 +00:00
若依
8242cec9ac !194 update 使用 gateway 自带工具 优化缓存Request与body
Merge pull request !194 from 疯狂的狮子Li/N/A
2022-06-13 12:41:24 +00:00
光速蜗牛
5b8cf9701f update ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/XssFilter.java.
update 优化 XssFilter 使用枚举替换字符串
2022-06-13 10:12:38 +00:00
cgl
a52d455032 简化逻辑判断 2022-06-13 17:05:23 +08:00
runphp
d28f81dc68 去除多余的逗号 2022-06-11 01:13:30 +00:00
疯狂的狮子Li
7475cff47d update 优化新增用户与角色信息、用户与岗位信息逻辑 2022-06-08 13:55:25 +00:00
我以为
d6e6b99316 修正OpenFeign部分情况下传递header认证信息为空问题 #https://gitee.com/y_project/RuoYi-Cloud/issues/I5AGRR 2022-06-02 03:00:16 +00:00
清溪先生
5a48c5dba7 修复【增加对空字符串参数的过滤】提交的参数判断问题;
Signed-off-by: 清溪先生 <usfree2021@163.com>
2022-06-02 08:53:31 +08:00
疯狂的狮子Li
ad7133f39d update 使用 gateway 自带工具 优化缓存Request与body 2022-05-31 05:03:34 +00:00
疯狂的狮子Li
fca189fa73 update 优化 CacheRequestFilter 使用枚举替换字符串 2022-05-31 02:55:17 +00:00
RuoYi
6cda8cb28f 表单构建按钮不显示正则校验 2022-05-29 09:49:54 +08:00
RuoYi
9c29907d57 增加对空字符串参数的过滤 2022-05-29 09:49:43 +08:00
RuoYi
b3d462e873 用户列表查询不显示密码字段 2022-05-29 09:49:29 +08:00
RuoYi
cdcc466300 升级fastjson到最新版2.0.4 2022-05-26 10:04:13 +08:00
RuoYi
12ca164c44 升级fastjson到最新版1.2.83 2022-05-24 10:14:31 +08:00
RuoYi
1d1b9501b7 用户头像上传限制只能为图片格式 2022-05-22 19:16:52 +08:00
RuoYi
24376681b8 优化switch case条件 2022-05-22 19:14:27 +08:00
RuoYi
386f3eb016 修复操作日志查询类型条件为0时会查到所有数据 2022-05-22 19:14:12 +08:00
疯狂的狮子Li
2a6a74ead5 fix 修复编辑报错 去除 NOT NULL 判断 兼容 nacos 低版本 2022-05-16 02:22:17 +00:00
若依
01e4e619e6 !188 【轻量级 PR】代码异味。项目review时发现多了逗号。
Merge pull request !188 from Tigger_hyk/master
2022-05-13 08:21:36 +00:00
若依
f6f07f255a !187 【轻量级 PR】:体验优化。用户管理左侧树型组件增加选中高亮保持。
Merge pull request !187 from Tigger_hyk/dev
2022-05-13 07:00:33 +00:00
huyikai
2eaa52c7aa Unexpected use of comma operator 2022-05-13 14:54:40 +08:00
huyikai
86b9e675b5 体验优化-用户管理左侧树型组件增加选中高亮保持。 2022-05-12 10:55:34 +08:00
RuoYi
b76cd4d0e2 update ry_config.sql 2022-05-10 17:23:33 +08:00
RuoYi
a4ad2b8b3c 升级spring-boot-admin到最新版2.6.7 2022-05-10 10:17:36 +08:00
RuoYi
103bf66f77 修复字典数据显示不全问题 2022-05-10 10:17:17 +08:00
RuoYi
5dbed46552 优化excel创建表格样式 2022-05-09 17:48:20 +08:00
若依
97500fbccb !182 简化返回值
Merge pull request !182 from shawn/dev
2022-05-09 09:44:49 +00:00
RuoYi
70f306418f 修改代码生成树形选择器组件 2022-04-25 10:30:02 +08:00
RuoYi
6bc77169fe 修改显示顺序orderNum类型为整型 2022-04-25 10:29:46 +08:00
RuoYi
742f3106a2 修复长主键溢出问题 将查询返回类型改为 Long 2022-04-24 19:10:41 +08:00
RuoYi
9ec4d19384 update ry_config.sql 2022-04-24 19:10:13 +08:00
RuoYi
68040827e2 最新alibaba/seata版本无需处理循环引用问题 2022-04-24 19:09:44 +08:00
若依
75d91c7d1d !185 spring-cloud.version 2021.0.1 官方推荐对应 spring-cloud-alibaba 2021.0.1.0
Merge pull request !185 from abbfun/N/A
2022-04-24 10:18:47 +00:00
若依
95c1286f06 !184 spring-boot 最新版本 2.6.7
Merge pull request !184 from abbfun/N/A
2022-04-24 10:18:40 +00:00
abbfun
f63a76f661 spring-cloud.version 2021.0.1 官方推荐对应 spring-cloud-alibaba 2021.0.1.0
spring-cloud.version 2021.0.1 对应 spring-cloud-alibaba 2021.0.1.0,
官方说明
https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E#%E6%AF%95%E4%B8%9A%E7%89%88%E6%9C%AC%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%E6%8E%A8%E8%8D%90%E4%BD%BF%E7%94%A8
2022-04-23 14:36:48 +00:00
abbfun
6644d3077d spring-boot 最新版本 2.6.7 2022-04-23 13:44:57 +00:00
RuoYi
54d1c58338 Excel注解支持color字体颜色 2022-04-23 21:07:52 +08:00
shawn
9da3b34b9c 简化返回值逻辑判断 2022-04-20 21:37:59 +08:00
RuoYi
1ec806ae80 设置分页参数默认值 2022-04-17 10:35:15 +08:00
RuoYi
4df2b72b30 检查定时任务bean所在包名是否为白名单配置 2022-04-17 10:35:00 +08:00
RuoYi
a0ce434163 升级element-ui到最新版本2.15.8 2022-04-15 09:39:15 +08:00
RuoYi
5053510236 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线) 2022-04-15 09:38:39 +08:00
RuoYi
d14f27e5eb 若依 3.5.0 2022-04-11 09:02:50 +08:00
RuoYi
72cf2edf03 升级spring-boot-admin到最新版2.6.6 2022-04-10 18:55:27 +08:00
RuoYi
8c6035c8f9 升级spring-boot-admin到最新版2.6.5 2022-04-09 18:06:23 +08:00
RuoYi
f7b761275c 添加页签openPage支持传递参数 2022-04-08 15:43:52 +08:00
RuoYi
6f7b02372e 代码生成树表新增(展开/折叠) 2022-04-07 11:04:16 +08:00
RuoYi
0b6166663c 用户缓存信息添加部门ancestors祖级列表 2022-04-07 09:52:00 +08:00
RuoYi
723583a3b8 修复Excel注解prompt/combo同时使用不生效问题 2022-04-03 18:28:58 +08:00
RuoYi
6a017dddd1 升级spring-boot到最新版本2.6.6 防止RCE漏洞 2022-04-02 10:25:23 +08:00
RuoYi
6f5c149ba0 降级jsencrypt版本兼容IE浏览器 2022-04-02 10:25:04 +08:00
RuoYi
5d44d2b5a6 新增清理分页的线程变量方法 2022-03-31 11:58:23 +08:00
RuoYi
7c3425ee9b 升级spring-boot到最新版本2.6.5 2022-03-30 10:26:02 +08:00
RuoYi
6133563bf3 升级spring-boot-admin到最新版2.6.3 2022-03-30 10:25:35 +08:00
RuoYi
2d67d7c8e2 升级fastjson到最新版1.2.80 2022-03-30 10:25:17 +08:00
RuoYi
55a7a90bab update registry source 2022-03-30 10:23:51 +08:00
RuoYi
a70d5ee2ab topNav自定义隐藏侧边栏路由 2022-03-30 10:21:28 +08:00
RuoYi
e5c938c64a 优化IP地址获取到多个的问题 2022-03-27 15:35:20 +08:00
RuoYi
ccf84377f8 优化导出excel单元格验证,包含变更为开头.防止正常内容被替换 2022-03-27 15:34:13 +08:00
RuoYi
dc8938ab2f 优化固定Header后顶部导航栏样式问题(I4XDN5) 2022-03-17 09:49:05 +08:00
RuoYi
bc05b453df update README 2022-03-17 09:48:53 +08:00
RuoYi
368a9044be 修复Oracle数据库用户表头像列为null时不显示默认头像问题 2022-03-17 09:48:00 +08:00
RuoYi
242101ae6e 添加新群号:213618602 2022-03-16 09:18:21 +08:00
RuoYi
0b08933a8c 优化导出数据LocalDateTime类型无数据问题 2022-03-15 14:42:44 +08:00
RuoYi
99932d91c0 优化菜单名称过长悬停显示标题 2022-03-15 12:03:01 +08:00
若依
59387216b4 !168 登录信息状态常量值更正
Merge pull request !168 from mastery/my-ry-cloud
2022-03-11 02:12:24 +00:00
YangHuang
66f5f11069 登录信息状态枚举值更正 2022-03-11 10:04:26 +08:00
若依
33694c860f !165 记录登录信息状态值改为常量
Merge pull request !165 from mastery/my-ry-cloud
2022-03-09 02:29:28 +00:00
RuoYi
4c5c1d1f78 文件上传兼容Weblogic环境 2022-03-09 10:17:51 +08:00
若依
14cd3e2c6a !164 fix_bug 修复遗漏的拼写错误
Merge pull request !164 from 董浩然/fix_bug
2022-03-09 01:38:20 +00:00
YangHuang
34487865f3 记录登录信息状态值改为常量 2022-03-09 00:46:24 +08:00
donghaoran
2444fcc646 fix_bug 修复遗漏的拼写错误 2022-03-07 21:30:26 +08:00
RuoYi
8b3d75a6a0 开启TopNav没有子菜单情况隐藏侧边栏 2022-03-06 09:05:56 +08:00
疯狂的狮子Li
4feb0adb6e fix 修复变量拼写错误 2022-03-05 05:07:40 +00:00
RuoYi
82535c82d3 修复导入Excel时字典字段类型为Long转义为空问题 2022-03-05 08:41:19 +08:00
RuoYi
7a09412ecb 修复表单清除元素位置未垂直居中问题(I4V27B) 2022-03-04 19:26:47 +08:00
RuoYi
a30622b460 升级spring-boot到最新版本2.6.4 2022-02-26 09:59:39 +08:00
若依
df0813089e !159 解决 docker/copy.sh 复制文件名错误问题
Merge pull request !159 from ningqingsheng/N/A
2022-02-26 01:09:27 +00:00
若依
e059ed9c7f !160 【轻量级pr】poi ExcelUtil 增加对java8 日期的支持
Merge pull request !160 from dazer007/excelUtil_add_java8_date
2022-02-26 01:08:00 +00:00
duandazhi
105c9d99c8 poi ExcelUtil 增加对java8 日志类型的支持 2022-02-25 21:09:50 +08:00
ningqingsheng
a65eaf880d 解决 docker/copy.sh 复制命错误问题 2022-02-25 09:28:51 +00:00
RuoYi
04706403d3 组件fileUpload支持多文件同时选择上传 2022-02-25 11:44:05 +08:00
RuoYi
c43565ef43 组件ImageUpload支持多图同时选择上传 2022-02-25 09:11:31 +08:00
RuoYi
089ebaf9c5 代码生成子表支持日期/字典配置 2022-02-24 09:29:53 +08:00
RuoYi
6f3c3f1b7e 页面若未匹配到字典标签则返回原字典值 2022-02-23 16:52:31 +08:00
若依
2dc5e7319a !157 【轻量级 PR】:修复个人中心页面,修改个人信息功能的email字段的表单验证信息错误
Merge pull request !157 from East/master
2022-02-23 01:36:30 +00:00
East
b5d2628b71 修复个人中心页面,修改个人信息的时候,表单验证里email字段的验证message多一个单引号的问题 2022-02-23 09:27:15 +08:00
RuoYi
9460acd91b 优化菜单关键字导致的插件报错问题 2022-02-22 19:44:24 +08:00
若依
480d49f2b3 !154 优化2022-02-17的【修复分页组件请求两次问题】的实现
Merge pull request !154 from East/master
2022-02-21 07:13:44 +00:00
East
1358b21c3a 优化分页组件发送两次请求的实现 2022-02-21 13:12:03 +08:00
RuoYi
480bba4f9d 升级spring-cloud到最新版2021.0.1 2022-02-20 16:51:42 +08:00
RuoYi
a14c06a1f1 升级spring-boot-mybatis到最新版2.2.2 2022-02-20 16:51:08 +08:00
RuoYi
2e1ef93aa6 修改登录超时刷新页面跳转登录页面还提示重新登录问题 2022-02-19 17:12:50 +08:00
疯狂的狮子Li
14c412113f update 补全事务注解异常 2022-02-17 11:15:34 +00:00
RuoYi
642cfbda0a 修复分页组件请求两次问题 2022-02-17 18:56:21 +08:00
RuoYi
0e13296752 代码生成同步保留必填/类型选项 2022-02-13 21:09:16 +08:00
若依
8fac26edca !151 fix Value 'baos' is always 'null'
Merge pull request !151 from runphp/N/A
2022-02-13 12:59:10 +00:00
runphp
b0b16e1fc5 fix Value 'baos' is always 'null' 2022-02-13 01:22:42 +00:00
RuoYi
297193b6ce 代码生成编辑修改打开新页签 2022-02-12 14:28:30 +08:00
RuoYi
99e14d0e29 update gitignore 2022-02-12 14:23:33 +08:00
RuoYi
dbca691746 优化代码 2022-02-12 14:23:11 +08:00
若依
e66f65b257 !149 Result type not match for select id="selectMenuListByRoleId"
Merge pull request !149 from runphp/N/A
2022-02-12 06:06:08 +00:00
若依
5f60a37d8a !148 Condition 'DEFAULT_MAX_SIZE != -1' is always 'true'
Merge pull request !148 from runphp/N/A
2022-02-12 06:05:33 +00:00
若依
d30e136c1d !147 变量filename赋值后未使用
Merge pull request !147 from runphp/N/A
2022-02-12 06:03:45 +00:00
若依
9c122a4bfe !146 The 'filter().findAny().isPresent()' chain can be replaced with 'anyMatch()'
Merge pull request !146 from runphp/N/A
2022-02-12 06:03:20 +00:00
若依
1761a4f588 !145 修复文档参数名错误
Merge pull request !145 from runphp/N/A
2022-02-12 06:02:37 +00:00
若依
b60fa5c920 !144 删除方法无返回值时,方法注释上的@return
Merge pull request !144 from 我的世界有我/master
2022-02-12 06:01:41 +00:00
runphp
4191f5ca5c Result type not match for select id="selectMenuListByRoleId" 2022-02-11 10:35:57 +00:00
runphp
a00482d5d7 Condition 'DEFAULT_MAX_SIZE != -1' is always 'true' 2022-02-11 07:46:11 +00:00
runphp
2610869e9c 变量filename赋值后未使用 2022-02-11 07:18:44 +00:00
runphp
155eb55953 The 'filter().findAny().isPresent()' chain can be replaced with 'anyMatch()' 2022-02-11 06:15:39 +00:00
runphp
8541ca99af 修复文档参数名错误 2022-02-11 06:00:57 +00:00
caohong
9cb15ec2ae 方法结果没有返回值时,去掉方法注释 @Return 2022-02-11 09:23:24 +08:00
RuoYi
27d46fc0a4 修复Xss注解字段值为空时的异常问题 2022-02-10 17:09:20 +08:00
若依
5800ac6b9e !143 修改错误单词拼写
Merge pull request !143 from 云川/master
2022-02-10 09:04:58 +00:00
liuyuchuan
c57ec64e63 修改错误单词拼写,由**Capcha**改为**Captcha** 2022-02-08 18:08:22 +08:00
RuoYi
1a1d6562d2 用户访问控制时校验数据权限,防止越权 2022-01-27 12:21:02 +08:00
RuoYi
255101f6f7 导出Excel时屏蔽公式,防止CSV注入风险 2022-01-27 12:20:41 +08:00
RuoYi
bd30f3d53a 若依 3.4.0 2022-01-24 10:09:41 +08:00
RuoYi
0c24d59a2c 升级spring-boot-admin到最新版2.6.2 2022-01-23 10:52:39 +08:00
RuoYi
4557ca0ace fix css class name 2022-01-23 10:51:01 +08:00
RuoYi
18c0b3dec4 升级nacos到最新版2.0.4 2022-01-22 14:32:44 +08:00
RuoYi
674b7a0b04 升级spring-boot到最新版本2.6.3 2022-01-22 11:25:41 +08:00
RuoYi
d511f1bd94 升级spring-boot-admin到最新版2.6.1 2022-01-20 11:37:26 +08:00
RuoYi
fa75346763 修复选项卡点击右键刷新丢失参数问题 2022-01-18 11:44:30 +08:00
RuoYi
79b1717f9a vue3下点击编辑,取消修改报错问题 2022-01-18 11:42:45 +08:00
RuoYi
6b4d03cb8d update copyright 2022 2022-01-14 10:53:41 +08:00
RuoYi
2d7fd84c57 swagger 在 springboot 2.6.x 不兼容问题的处理 2022-01-14 10:53:30 +08:00
RuoYi
d0a19e5b6f 定时任务屏蔽违规的字符 2022-01-14 10:53:03 +08:00
若依
14db619b20 !136 优化加载字典缓存数据
Merge pull request !136 from runphp/N/A
2022-01-14 02:46:59 +00:00
若依
c166bb0a89 !135 字段更新未同步
Merge pull request !135 from runphp/N/A
2022-01-14 02:44:44 +00:00
runphp
4a60f91994 优化加载字典缓存数据 2022-01-12 03:42:38 +00:00
runphp
d601b5781e 字段更新未同步 2022-01-12 02:12:09 +00:00
RuoYi
8223a5dcc4 Vue3前端代码生成模板同步到最新 2022-01-11 18:10:40 +08:00
RuoYi
b40e5c19b2 升级Spring Cloud相关组件到最新版本 2022-01-10 15:02:13 +08:00
RuoYi
5ebc354cfc 优化部门修改缩放后出现的错位问题 2022-01-08 09:24:27 +08:00
RuoYi
ca5d3e3556 添加遗漏的分页参数合理化属性 2022-01-07 13:17:06 +08:00
RuoYi
c44cf9b9f6 定时任务目标字符串验证包名白名单 2022-01-06 14:58:56 +08:00
RuoYi
cde32b45c0 定时任务目标字符串过滤特殊字符 2022-01-05 15:04:51 +08:00
RuoYi
6274bfcd8c 代码生成列表图片支持预览 2022-01-04 20:20:11 +08:00
RuoYi
29fac802f3 update donate 2022-01-04 20:19:18 +08:00
RuoYi
37597a85d5 update README.md 2022-01-04 20:13:22 +08:00
若依
f46aa17c77 Create FUNDING.yml 2022-01-04 19:50:34 +08:00
RuoYi
6c70291d0a update README.md 2022-01-04 10:56:25 +08:00
RuoYi
14ff957bde 前端支持设置是否需要防止数据重复提交 2022-01-02 10:37:58 +08:00
RuoYi
34439a6532 空值不进行回显数据字典 2022-01-02 10:30:35 +08:00
RuoYi
db07f4a354 预览组件支持多图显示 2022-01-01 09:47:14 +08:00
RuoYi
820ea549e3 代码生成新增Java类型Boolean 2022-01-01 09:39:41 +08:00
若依
2b42931486 !133 减少一次sql查询(SysUser对象包含了角色列表)
Merge pull request !133 from runphp/N/A
2022-01-01 01:38:22 +00:00
runphp
9bf5dfdc5f 减少一次sql查询(SysUser对象包含了角色列表)
减少一次sql查询(SysUser对象包含了角色列表)
2021-12-31 06:54:22 +00:00
RuoYi
a3f8d03611 修复登录失效后多次请求提示多次弹窗问题 2021-12-31 10:04:46 +08:00
RuoYi
b6f21f451d 升级log4j2到2.17.1,防止漏洞风险 2021-12-30 14:48:33 +08:00
RuoYi
418b74b39d 用户管理部门查询选择节点后分页参数初始 2021-12-29 15:39:34 +08:00
RuoYi
919190dedc 定时任务cron表达式小时设置24 2021-12-29 15:39:19 +08:00
若依
81ccdc49ec !132 修改单词拼写错误:praseStrEmpty -> parseStrEmpty
Merge pull request !132 from 我的世界有我/master
2021-12-29 07:35:56 +00:00
caohong
b006fad9b6 修改单词拼写错误:praseStrEmpty -> parseStrEmpty 2021-12-29 14:29:33 +08:00
RuoYi
74a02ca3dc 升级spring-boot到最新版本2.5.8 2021-12-27 12:41:42 +08:00
RuoYi
efaaacabb0 优化代码生成字典组重复问题 2021-12-24 15:47:48 +08:00
RuoYi
3410150e28 升级fastjson到最新版1.2.79 2021-12-21 13:41:49 +08:00
RuoYi
054fd7546f SQL工具类新增检查关键字方法 2021-12-21 13:41:40 +08:00
RuoYi
1797831afc 新增使用Gzip解压缩静态文件地址 2021-12-20 14:26:05 +08:00
RuoYi
24be94be5e 集成compression-webpack-plugin插件实现打包Gzip压缩 2021-12-20 09:44:13 +08:00
RuoYi
33ba42a759 升级log4j2到安全版本,防止漏洞风险 2021-12-19 20:01:17 +08:00
RuoYi
1e7b9fb94c 路由支持单独配置菜单或角色权限 2021-12-18 18:27:14 +08:00
RuoYi
45e5133e97 新增图片预览组件 2021-12-18 18:25:56 +08:00
RuoYi
7713948f5c 修复菜单图标缺少的prop属性 2021-12-18 18:21:23 +08:00
RuoYi
b64507d64a 请求分页方法设置成通用方便灵活调用 2021-12-18 18:20:25 +08:00
RuoYi
b06db48891 修复打包后字体图标偶现的乱码问题 2021-12-17 11:37:58 +08:00
RuoYi
43f1681f51 修复版本差异导致的懒加载报错问题 2021-12-16 16:45:17 +08:00
RuoYi
5c90f0bbb7 新增Vue3前端代码生成模板 2021-12-16 09:59:46 +08:00
RuoYi
c1b223e3a7 用户导入提示溢出则显示滚动条 2021-12-16 09:58:48 +08:00
RuoYi
0d7b23a44f 优化cron组件中周回显问题 2021-12-16 09:58:27 +08:00
RuoYi
f91f931c0b 自定义xss校验注解实现 2021-12-15 11:00:47 +08:00
RuoYi
329e124db0 add docker/copy.sh. 2021-12-14 17:41:36 +08:00
RuoYi
c64b5edf20 数据库脚本设置默认编码 2021-12-14 17:40:02 +08:00
若依
c049d29eee !124 解决deplon.sh脚本启动docker然后gateway总是报nacos9848端口问题
Merge pull request !124 from zbk/master
2021-12-14 09:33:46 +00:00
RuoYi
7804d0bd2f 升级log4j2到安全版本,防止漏洞风险 2021-12-14 12:10:20 +08:00
RuoYi
7901116744 升级log4j2到安全版本,防止漏洞风险 2021-12-14 10:50:14 +08:00
RuoYi
eb5df8834b 修复多参数逗号分隔的问题 2021-12-14 10:46:49 +08:00
zbk
711aa763b9 update docker/deploy.sh. 2021-12-13 15:45:42 +00:00
RuoYi
3c7018b38a 若依 3.3.0 2021-12-13 09:02:33 +08:00
RuoYi
2a5091c6f4 优化下载解析blob异常提示 2021-12-10 10:02:22 +08:00
RuoYi
b6222b9755 升级dynamic-ds到最新版本3.5.0 2021-12-10 09:51:22 +08:00
RuoYi
4db3e90872 代码生成预览支持复制内容 2021-12-09 10:03:43 +08:00
RuoYi
19ac02fd70 自定义文字复制剪贴指令 2021-12-09 10:03:07 +08:00
RuoYi
9d094587b3 升级clipboard到最新版本2.0.8 2021-12-09 10:02:42 +08:00
RuoYi
2bc2b08bc7 升级spring-boot-admin到最新版2.5.4 2021-12-07 13:48:52 +08:00
RuoYi
f64a5dd5ca 修正用户分配角色属性错误 2021-12-06 21:56:00 +08:00
RuoYi
9f21dbbc5c 修复长主键溢出问题 将查询返回类型改为 Long 2021-12-06 21:55:41 +08:00
RuoYi
05ce7d92a9 🎉 RuoYi-Cloud-Vue3(Vue3 Element Plus Vite)版本 2021-12-02 10:47:30 +08:00
RuoYi
2e17d9c084 Crontab组件优化 2021-12-02 10:44:46 +08:00
RuoYi
82779f3c70 优化提示信息 2021-12-02 10:44:15 +08:00
RuoYi
b1bc3ceb27 注册成功提示类型success 2021-11-26 18:10:34 +08:00
RuoYi
e2a7df4a2c camelCase中应该是下划线,而不是横杠 2021-11-26 18:09:50 +08:00
Ricky
2a452a00e0 升级velocity到最新版本2.3(语法升级) 2021-11-25 15:23:46 +08:00
Ricky
4d4123243c 修复代码生成复选框字典遗漏问题 2021-11-25 13:42:06 +08:00
RuoYi
2c1bdc9670 添加新群号:236543183 2021-11-25 10:06:29 +08:00
RuoYi
08885f65cd 升级velocity到最新版本2.3 2021-11-24 16:40:18 +08:00
RuoYi
961825d25c update bin 2021-11-24 16:39:55 +08:00
RuoYi
337d1bab02 优化前端代码 2021-11-24 16:37:20 +08:00
Ricky
b6a71fe988 防止修改用户个人信息接口修改用户名 2021-11-22 22:54:24 +08:00
RuoYi
786df8e278 升级js-cookie到最新版本3.0.1 2021-11-22 18:13:49 +08:00
RuoYi
451d218f4b 优化提示信息 2021-11-22 18:13:39 +08:00
RuoYi
adcb6194c8 新增tab对象简化页签操作 2021-11-19 17:58:55 +08:00
RuoYi
334f79efe4 升级jsencrypt到最新版本3.2.1 2021-11-18 17:54:57 +08:00
RuoYi
73b38b143b 代码生成模板主子表删除方法缺少事务 2021-11-18 17:54:20 +08:00
RuoYi
ef541b220b 删除多余的通用配置 2021-11-18 17:53:31 +08:00
RuoYi
173c0e384f 优化导出数据操作 2021-11-17 12:12:58 +08:00
RuoYi
360ccc7adc 修复响应体过大出现的乱码问题 2021-11-16 18:50:17 +08:00
RuoYi
df760d3504 任务参数忽略双引号中的逗号 2021-11-16 18:49:36 +08:00
RuoYi
0beecf7ea1 升级core-js到最新版本3.19.1 2021-11-16 18:49:26 +08:00
若依
aa2821a19d !118 update ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java.
Merge pull request !118 from TwelveT/N/A
2021-11-16 10:43:54 +00:00
TwelveT
2288fa218e update ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java.
修复feign对过大的参数会直接报错,无法调用BUG
2021-11-12 09:01:56 +00:00
RuoYi
6adc583c38 升级spring-boot-admin到最新版2.5.3 2021-11-10 11:29:39 +08:00
RuoYi
52111e4bf9 升级axios到最新版本0.24.0 2021-11-10 11:27:54 +08:00
RuoYi
68db4092ed 任务屏蔽违规字符 2021-11-01 15:45:22 +08:00
RuoYi
acf8d9719f 修复字符串无法被反转义问题 2021-11-01 15:45:10 +08:00
RuoYi
92e5d2a97a 回显数据字典键值修正 2021-11-01 15:44:58 +08:00
RuoYi
e165901506 登录/验证码请求headers不设置token 2021-11-01 15:44:42 +08:00
RuoYi
3187b1c46e 升级spring-boot到最新版本2.5.6 2021-10-27 16:56:54 +08:00
RuoYi
662dec2fe2 修正错别字 2021-10-25 10:29:27 +08:00
RuoYi
3901695a6f 解析blob响应是否登录失效 2021-10-25 09:49:13 +08:00
RuoYi
d0a5c25b5d 新增认证对象简化权限验证 2021-10-20 11:23:18 +08:00
RuoYi
9c5c6c6be7 优化获取缓存信息方式 2021-10-18 10:59:56 +08:00
RuoYi
d8da1b796c 优化权限认证注解 2021-10-16 18:28:38 +08:00
RuoYi
e2dfdb2236 生产环境使用路由懒加载提升页面响应速度 2021-10-15 17:56:28 +08:00
RuoYi
a8eba6949e 角色列表返回类型保持一致 2021-10-15 17:30:30 +08:00
RuoYi
3e907e8da7 修复五级以上菜单404问题 2021-10-14 16:24:39 +08:00
RuoYi
af1b557bc8 若依 3.2.0 2021-10-12 09:01:05 +08:00
RuoYi
e6c3bd1ce5 升级spring-boot-admin到最新版2.5.2 2021-10-11 18:57:21 +08:00
RuoYi
046d25f35d 升级spring-boot到最新版本2.5.5 2021-10-10 16:07:43 +08:00
RuoYi
d20d4ffa16 菜单子项添加路由参数 2021-10-10 16:07:06 +08:00
RuoYi
76f2273d0b Excel导入支持@Excels注解 2021-10-10 16:02:54 +08:00
RuoYi
dda78c95b7 升级pagehelper到最新版1.4.0 2021-10-10 16:01:07 +08:00
RuoYi
ebbeb047be 升级druid到最新版1.2.8 2021-10-10 09:46:21 +08:00
RuoYi
ebd7fd59d0 升级element-ui到最新版本2.15.6 2021-10-09 11:54:18 +08:00
RuoYi
c20c2c221f 导入模板标题默认空参数 2021-10-09 11:53:36 +08:00
RuoYi
ee33dbdc0e 升级sass-loader到最新版本10.1.1 2021-09-27 19:06:57 +08:00
RuoYi
5d8d4fa530 升级dart-sass到版本1.32.13 2021-09-27 19:06:43 +08:00
RuoYi
2021028cad 升级file-saver到最新版本2.0.5 2021-09-27 19:06:23 +08:00
RuoYi
7fcb1b2e0a 新增通用方法简化下载使用 2021-09-27 12:10:39 +08:00
RuoYi
f4a2f909a7 Excel注解支持导入导出标题信息 2021-09-26 09:03:28 +08:00
RuoYi
328630fe5d 修复xss过滤后格式出现的异常 2021-09-25 17:16:42 +08:00
RuoYi
f7ae7e29d1 修正代码生成编辑页面单词拼写错误 2021-09-24 14:56:08 +08:00
RuoYi
e46ea3ebac 自动生成代码漏掉 this.#[[$modal]]# 2021-09-24 14:55:11 +08:00
RuoYi
d565fa4883 升级springcloud到最新版2020.0.4 2021-09-24 09:54:05 +08:00
RuoYi
a627108dfe 升级fastjson到最新版1.2.78 2021-09-24 09:53:31 +08:00
RuoYi
829451f05e 新增通用方法简化模态/缓存使用 2021-09-23 09:59:17 +08:00
RuoYi
cae41a8da2 新增通用方法简化模态/缓存使用 2021-09-23 09:35:59 +08:00
RuoYi
a4099cf645 Excel注解支持自定义数据处理器 2021-09-22 09:06:51 +08:00
RuoYi
0a104689ed Excel注解支持自定义数据处理器 2021-09-22 09:03:21 +08:00
RuoYi
97d0226c78 升级spring-boot-admin到最新版2.5.1 2021-09-18 21:34:55 +08:00
RuoYi
3a04dda55d 升级spring-boot到最新版本2.5.4 2021-09-18 21:34:31 +08:00
RuoYi
94310c4f3d 代码生成点击预览重置激活tab 2021-09-18 21:20:45 +08:00
RuoYi
39e7d8a84b 优化aop语法 使用spring自动注入注解 基于注解拦截的aop注解不可能为空 2021-09-18 21:20:18 +08:00
RuoYi
e1037ac125 Cron表达式生成器关闭时销毁,避免再次打开时存在上一次修改的数据 2021-09-18 21:19:52 +08:00
RuoYi
a10384c009 使用vue-data-dict简化数据字典使用 2021-09-17 15:43:02 +08:00
RuoYi
ab8215d1ce 日志注解新增是否保存响应参数 2021-09-16 16:19:23 +08:00
RuoYi
524982c7bd 禁用el-tag组件的渐变动画 2021-09-16 16:19:11 +08:00
RuoYi
d6188aa009 修复后端主子表代码模板方法名生成错误问题 2021-09-16 16:18:48 +08:00
RuoYi
7e8b08a58c 修复多图组件验证失败被删除问题 2021-09-10 11:08:23 +08:00
RuoYi
14771f0ab4 修复代码生成页面数据编辑保存之后总是跳转第一页的问题 2021-09-08 11:29:20 +08:00
RuoYi
97c0603269 优化提示 2021-09-08 11:28:54 +08:00
RuoYi
a58c430858 菜单管理支持配置路由参数 2021-09-08 10:04:23 +08:00
RuoYi
cd4119b26a 修正单词拼写错误 2021-09-08 09:31:37 +08:00
RuoYi
ea20fa3ce2 页签新增关闭左侧 2021-09-05 13:28:32 +08:00
RuoYi
3b54208ac9 页签右键按钮添加图标 2021-09-05 13:27:20 +08:00
RuoYi
d2de744c3f 菜单&部门新增展开/折叠功能 2021-09-04 12:21:33 +08:00
RuoYi
655249d67a 新增暗色菜单风格主题 2021-09-04 12:21:18 +08:00
RuoYi
80a890549d 修复保存配置主题颜色失效问题 2021-09-03 16:52:14 +08:00
RuoYi
5da1979ce6 自定义弹层溢出滚动样式 2021-09-03 13:28:37 +08:00
RuoYi
642512aa91 定时任务支持在线生成cron表达式 2021-09-03 09:53:26 +08:00
RuoYi
4a32a8e725 代码生成导入表按创建时间排序 2021-09-03 09:52:49 +08:00
RuoYi
bb30ae7086 防止表格最后页最后项删除变成暂无数据 2021-09-02 10:46:16 +08:00
RuoYi
34a6f2e1f1 查询列表设置数据字典样式回显 2021-09-01 14:03:59 +08:00
RuoYi
0e51d1e7b1 根据用户ID查询菜单条件加别名 2021-08-30 17:08:55 +08:00
RuoYi
40bdf7b100 修复字典组件值为整形不显示问题 2021-08-29 17:39:43 +08:00
RuoYi
57f51249b6 验证码默认20s超时 2021-08-29 17:39:25 +08:00
RuoYi
dcc5dc0d16 修复带utc日期格式 yyyy-MM-dd'T'HH:mm:ss.SSS 在safari浏览器中无法正确格式化的问题 2021-08-29 17:39:10 +08:00
RuoYi
e87a818706 添加日期范围支持重复添加多组日期范围 2021-08-29 17:38:36 +08:00
RuoYi
67df97d5a7 修改时检查用户数据权限范围 2021-08-24 16:24:25 +08:00
RuoYi
3f8fd0a0f8 定时任务对检查异常进行事务回滚 2021-08-24 11:19:09 +08:00
RuoYi
961fe9a5f1 自定义可拖动弹窗宽高指令 2021-08-20 21:25:53 +08:00
RuoYi
22f156bbb7 补充定时任务表字段注释 2021-08-20 11:07:38 +08:00
RuoYi
22c22c4246 定时任务屏蔽ldap远程调用 2021-08-19 15:34:13 +08:00
RuoYi
994cd62c7a 删掉此处代码,使右边栏动画生效。 2021-08-19 15:32:01 +08:00
RuoYi
1e4ed04a65 优化异常信息 2021-08-16 22:26:29 +08:00
RuoYi
139b25639e 日期范围支持添加多组 2021-08-16 22:26:20 +08:00
RuoYi
13800738cb 修改Dashboard名称 2021-08-16 22:25:09 +08:00
RuoYi
98c538c9e3 默认首页使用keep-alive缓存 2021-08-13 16:41:56 +08:00
RuoYi
0e7c45173c 代码生成主子表多选行数据 2021-08-13 16:41:41 +08:00
RuoYi
132b23dc33 补充遗漏的@Override注解 2021-08-13 16:37:47 +08:00
RuoYi
c3f1dd846c update bin 2021-08-13 16:32:40 +08:00
RuoYi
7b7abde756 添加新群号:201705537 2021-08-08 19:55:51 +08:00
RuoYi
aeeb0eb26b 字典工具类更换路径 2021-08-06 17:52:44 +08:00
RuoYi
265a181891 http请求默认外链打开 2021-08-06 17:02:37 +08:00
RuoYi
22663e1b43 升级element-ui到最新版本2.15.5 2021-08-06 14:33:23 +08:00
RuoYi
24be1a436e 若依 3.1.0 2021-08-01 09:01:15 +08:00
RuoYi
370c53edfa 文件服务本地资源允许跨域访问 2021-07-31 21:51:40 +08:00
RuoYi
f112133ddf 是否开启用户注册功能sql脚本 2021-07-31 21:49:44 +08:00
RuoYi
93ee021b6e XSS过滤排除非json类型 2021-07-31 12:18:24 +08:00
RuoYi
e57d2ea17c 升级nacos到最新版2.0.3 2021-07-31 09:54:28 +08:00
RuoYi
ea038a5437 优化代码生成模板 2021-07-30 22:33:09 +08:00
RuoYi
329aa68644 新增是否开启用户注册功能 2021-07-30 20:03:59 +08:00
Ricky
887430874d 优化代码生成 2021-07-30 18:41:46 +08:00
Ricky
52f8693e1d 优化代码生成 2021-07-30 18:35:52 +08:00
RuoYi
8057dcc4fc 定时任务屏蔽http(s)远程调用 2021-07-30 11:06:11 +08:00
RuoYi
66e0f9a53d 启用部门状态排除顶级节点 2021-07-30 11:05:54 +08:00
RuoYi
7a35c474d6 统一网关错误码响应 2021-07-29 14:51:27 +08:00
RuoYi
892065003d 修复导出含params属性对象参数问题 2021-07-29 10:38:34 +08:00
RuoYi
ede8353503 升级common-pool到最新版本2.10.0 2021-07-28 20:34:41 +08:00
RuoYi
60796ca8fb rollback pr 2021-07-28 20:33:46 +08:00
RuoYi
25e9112ccc 升级minio到最新版本8.2.2 2021-07-28 20:12:50 +08:00
RuoYi
f6c5c91eb1 升级commons.io到最新版本v2.11.0 2021-07-28 14:00:32 +08:00
若依
740da06972 !91 【轻量级PR】 [SysUser] 返回给前端数据的时候,隐藏密码和加盐,防止别人猜测加密方式 或者 暴力破击
Merge pull request !91 from dazer007/master
2021-07-28 05:51:09 +00:00
RuoYi
2a363f9c17 升级tobato到最新版本1.27.2 2021-07-28 13:33:49 +08:00
RuoYi
3c649a8814 升级minio到最新版本8.3.0 2021-07-28 13:30:46 +08:00
RuoYi
a144bf2bff 升级dynamic-ds到最新版本3.4.1 2021-07-28 13:28:50 +08:00
RuoYi
83ee4223be 升级spring-boot-mybatis到最新版2.2.0 2021-07-28 13:24:29 +08:00
RuoYi
8f6c864e96 升级spring-boot-admin到最新版2.4.3 2021-07-28 13:19:50 +08:00
RuoYi
12209ae5a4 升级spring-boot到最新版本2.5.3 2021-07-28 13:17:20 +08:00
duandazhi
4e0301a7b2 [SysUser] 返回给前端数据的时候,隐藏密码和加盐,防止别人猜测加密方式 或者 暴力破击 2021-07-28 13:07:06 +08:00
RuoYi
00fa1c3158 支持配置XSS跨站脚本过滤 2021-07-28 13:05:18 +08:00
若依
04edd66199 !90 【轻量级PR】SysUserController remove 解决把自己删除的bug
Merge pull request !90 from dazer007/secerity-fix-remove-self-ok
2021-07-28 05:01:49 +00:00
若依
d8896c9054 !89 update ruoyi-ui/src/utils/zipdownload.js.
Merge pull request !89 from ytzjf/N/A
2021-07-28 05:01:46 +00:00
duandazhi
dd70c1950e sysuercontroller remove self 问题修复 2021-07-28 10:24:14 +08:00
RuoYi
954d208ac6 支持配置XSS跨站脚本过滤 2021-07-28 09:58:59 +08:00
ytzjf
98d25fa16e update ruoyi-ui/src/utils/zipdownload.js.
BLOB下载时清除URL对象引用
2021-07-28 01:57:11 +00:00
RuoYi
3af7af265b 验证码配置 2021-07-27 20:47:57 +08:00
RuoYi
436c2154ad 支持配置验证码开关&类型 2021-07-27 20:39:46 +08:00
RuoYi
42e8baa85c 添加新群号 2021-07-27 20:38:30 +08:00
RuoYi
0dff71bd4d 跳转路由高亮相对应的菜单栏 2021-07-27 13:09:30 +08:00
RuoYi
20ce9da509 修复任意账户越权问题 2021-07-27 13:08:37 +08:00
RuoYi
a044b0d205 升级element-ui到最新版本2.15.3 2021-07-26 10:11:08 +08:00
RuoYi
698200ecc2 角色&菜单新增字段属性提示信息 2021-07-26 10:10:39 +08:00
RuoYi
883d89ee0b 内链设置meta信息 2021-07-26 10:08:42 +08:00
RuoYi
fb9a480f3c 密码框新增显示切换密码图标 2021-07-26 10:08:28 +08:00
RuoYi
e288710251 导入用户样式调整 2021-07-26 10:06:08 +08:00
RuoYi
1019aa58ce 顶部菜单样式调整 2021-07-26 10:03:52 +08:00
RuoYi
e9621469b2 更多操作按钮添加权限控制 2021-07-25 11:47:55 +08:00
RuoYi
57c4910605 富文本新增上传文件大小限制 2021-07-25 11:39:12 +08:00
RuoYi
9920957796 状态码401返回Promise.reject 2021-07-25 11:36:31 +08:00
RuoYi
e798f46876 顶部菜单排除隐藏的默认路由 2021-07-24 19:15:16 +08:00
RuoYi
caa7537607 修复定时任务日志执行状态显示 2021-07-17 16:51:37 +08:00
若依
8b23c97fdb !83 【轻量级PR】RuoYiFileApplication 重命名为RuoYiFileApplication
Merge pull request !83 from dazer007/RuoYFileApplication-rename-
2021-07-17 08:48:40 +00:00
duandazhi
af49ad54f6 RuoYFileApplication-rename 2021-07-16 12:26:07 +08:00
RuoYi
816479e092 定时任务新增更多操作 2021-07-15 17:36:14 +08:00
RuoYi
7e72849d05 修复多图时无法删除相应图片问题 2021-07-13 10:32:48 +08:00
RuoYi
99206a5d65 删除富文本video事件 2021-07-13 10:32:23 +08:00
RuoYi
114c9f3af6 菜单路由配置支持内链访问 2021-07-11 19:30:24 +08:00
RuoYi
e14fb70c26 自定义弹窗拖拽指令 2021-07-09 21:14:16 +08:00
RuoYi
201149a131 富文本默认上传返回url类型 2021-07-09 21:13:54 +08:00
RuoYi
2bc80c4c07 授权用户添加事务 2021-07-09 21:13:09 +08:00
RuoYi
ee7607bcca 全局注册通用组件 2021-07-09 21:12:37 +08:00
RuoYi
7e2dbc5608 ImageUpload组件支持多图片上传 2021-07-09 21:11:07 +08:00
RuoYi
8eac239e48 FileUpload组件支持多文件上传 2021-07-09 21:10:08 +08:00
若依
6650397e38 !79 【轻量级 PR】:修改登录失效返回值code401
Merge pull request !79 from bug制造者/master
2021-07-09 12:57:28 +00:00
bug制造者
1ca4c26d81 修改登录失效返回值code401
之前返回的code200,前端就会$message一下错误信息,不会弹出401重新登录跳转的弹框。
2021-07-07 09:16:05 +00:00
RuoYi
0b0da91139 角色管理新增分配用户功能 2021-07-06 14:02:37 +08:00
RuoYi
3d47ec2e73 用户管理新增分配角色功能 2021-07-02 10:59:22 +08:00
RuoYi
1f21102204 升级pagehelper到最新版1.3.1 2021-06-25 17:42:41 +08:00
RuoYi
58b4600144 用户信息长度校验限制 2021-06-25 17:41:40 +08:00
RuoYi
6146d63f2c 修复日志列表取消字段排序时的报错问题 2021-06-25 17:40:05 +08:00
RuoYi
dbf42739ca 全局挂载字典标签组件 2021-06-25 17:39:43 +08:00
Ricky
57f56c2769 增加字典标签样式回显 2021-06-22 14:47:28 +08:00
RuoYi
5c130cfda6 封装iframe组件 2021-06-17 20:19:31 +08:00
RuoYi
df284ff6f5 日志列表支持排序操作 2021-06-17 20:18:59 +08:00
RuoYi
1b7550f9a2 升级commons.fileupload到最新版本v1.4 2021-06-16 10:06:09 +08:00
RuoYi
195df24b4b 升级commons.io到最新版本v2.10.0 2021-06-16 10:05:53 +08:00
RuoYi
68de85aa5f 升级nacos到最新版2.0.2 2021-06-15 10:42:03 +08:00
RuoYi
8b6784d8e2 升级element-ui到最新版本2.15.2 2021-06-15 10:41:31 +08:00
RuoYi
b73c14400c 升级spring-boot到最新版本2.5.1 2021-06-12 14:05:27 +08:00
RuoYi
54922af7db 升级dynamic-ds到最新版本3.4.0 2021-06-12 14:05:07 +08:00
RuoYi
23944b2f9c 系统布局配置支持动态标题开关 2021-06-11 11:04:06 +08:00
RuoYi
9d0240b831 分页组件新增pagerCount属性 2021-06-11 11:03:54 +08:00
RuoYi
1aef90d506 修复用户搜索分页变量错误 2021-06-11 11:03:33 +08:00
RuoYi
41b7e62b02 优化部门父级启用状态 2021-06-11 10:49:26 +08:00
428 changed files with 17688 additions and 6942 deletions

1
.github/FUNDING.yml vendored Normal file
View File

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

3
.gitignore vendored
View File

@@ -25,6 +25,8 @@ target/
*.iml *.iml
*.ipr *.ipr
### JRebel ###
rebel.xml
### NetBeans ### ### NetBeans ###
nbproject/private/ nbproject/private/
build/* build/*
@@ -37,6 +39,7 @@ nbdist/
# Others # Others
*.log *.log
*.xml.versionsBackup *.xml.versionsBackup
*.swp
!*/build/*.java !*/build/*.java
!*/build/*.html !*/build/*.html

View File

@@ -1,3 +1,14 @@
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.5</h1>
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
<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"><img src="https://img.shields.io/badge/RuoYi-v3.6.5-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## 平台简介 ## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
@@ -6,11 +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://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版本。
## 系统模块 ## 系统模块
@@ -27,7 +36,9 @@ com.ruoyi
│ └── ruoyi-common-datasource // 多数据源 │ └── ruoyi-common-datasource // 多数据源
│ └── ruoyi-common-log // 日志记录 │ └── ruoyi-common-log // 日志记录
│ └── ruoyi-common-redis // 缓存服务 │ └── ruoyi-common-redis // 缓存服务
│ └── 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]
@@ -115,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群 [![加入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) 点击按钮入群。

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

41
docker/copy.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
# 复制项目的文件到对应docker路径便于一键生成镜像。
usage() {
echo "Usage: sh copy.sh"
exit 1
}
# copy sql
echo "begin copy sql "
cp ../sql/ry_20240629.sql ./mysql/db
cp ../sql/ry_config_20250224.sql ./mysql/db
# copy html
echo "begin copy html "
cp -r ../ruoyi-ui/dist/** ./nginx/html/dist
# copy jar
echo "begin copy ruoyi-gateway "
cp ../ruoyi-gateway/target/ruoyi-gateway.jar ./ruoyi/gateway/jar
echo "begin copy ruoyi-auth "
cp ../ruoyi-auth/target/ruoyi-auth.jar ./ruoyi/auth/jar
echo "begin copy ruoyi-visual "
cp ../ruoyi-visual/ruoyi-monitor/target/ruoyi-visual-monitor.jar ./ruoyi/visual/monitor/jar
echo "begin copy ruoyi-modules-system "
cp ../ruoyi-modules/ruoyi-system/target/ruoyi-modules-system.jar ./ruoyi/modules/system/jar
echo "begin copy ruoyi-modules-file "
cp ../ruoyi-modules/ruoyi-file/target/ruoyi-modules-file.jar ./ruoyi/modules/file/jar
echo "begin copy ruoyi-modules-job "
cp ../ruoyi-modules/ruoyi-job/target/ruoyi-modules-job.jar ./ruoyi/modules/job/jar
echo "begin copy ruoyi-modules-gen "
cp ../ruoyi-modules/ruoyi-gen/target/ruoyi-modules-gen.jar ./ruoyi/modules/gen/jar

View File

@@ -26,12 +26,12 @@ port(){
# 启动基础环境(必须) # 启动基础环境(必须)
base(){ base(){
docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos ruoyi-nginx docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos
} }
# 启动程序模块(必须) # 启动程序模块(必须)
modules(){ modules(){
docker-compose up -d ruoyi-gateway ruoyi-auth ruoyi-modules-system docker-compose up -d ruoyi-nginx ruoyi-gateway ruoyi-auth ruoyi-modules-system
} }
# 关闭所有环境/模块 # 关闭所有环境/模块

View File

@@ -16,7 +16,7 @@ management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.basedir= server.tomcat.basedir=/home/ruoyi/nacos/tomcat/logs
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**

View File

@@ -14,23 +14,28 @@ http {
listen 80; listen 80;
server_name localhost; server_name localhost;
location / { location / {
root /home/ruoyi/projects/ruoyi-ui; root /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
index index.html index.htm; index index.html index.htm;
} }
location /prod-api/{ location /prod-api/{
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://ruoyi-gateway:8080/; proxy_pass http://ruoyi-gateway:8080/;
} }
# 避免actuator暴露
if ($request_uri ~ "/actuator") {
return 403;
}
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root html; root html;
} }
} }
}# requirepass 123456 }

254
pom.xml
View File

@@ -6,44 +6,54 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.0.0</version> <version>3.6.5</version>
<name>ruoyi</name> <name>ruoyi</name>
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description> <description>若依微服务系统</description>
<properties> <properties>
<ruoyi.version>3.0.0</ruoyi.version> <ruoyi.version>3.6.5</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<spring-boot.version>2.5.0</spring-boot.version> <spring-boot.version>2.7.18</spring-boot.version>
<spring-cloud.version>2020.0.3</spring-cloud.version> <spring-cloud.version>2021.0.9</spring-cloud.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version>
<alibaba.nacos.version>2.0.1</alibaba.nacos.version> <spring-boot-admin.version>2.7.16</spring-boot-admin.version>
<spring-boot-admin.version>2.4.1</spring-boot-admin.version> <tobato.version>1.27.2</tobato.version>
<spring-boot.mybatis>2.1.4</spring-boot.mybatis> <kaptcha.version>2.3.3</kaptcha.version>
<swagger.fox.version>3.0.0</swagger.fox.version> <pagehelper.boot.version>2.0.0</pagehelper.boot.version>
<swagger.core.version>1.6.2</swagger.core.version> <druid.version>1.2.23</druid.version>
<tobato.version>1.26.5</tobato.version> <dynamic-ds.version>4.3.1</dynamic-ds.version>
<kaptcha.version>2.3.2</kaptcha.version> <commons.io.version>2.13.0</commons.io.version>
<pagehelper.boot.version>1.3.0</pagehelper.boot.version> <velocity.version>2.3</velocity.version>
<druid.version>1.2.6</druid.version> <fastjson.version>2.0.53</fastjson.version>
<dynamic-ds.version>3.3.2</dynamic-ds.version> <jjwt.version>0.9.1</jjwt.version>
<commons.io.version>2.5</commons.io.version> <minio.version>8.2.2</minio.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version> <poi.version>4.1.2</poi.version>
<velocity.version>1.7</velocity.version> <springdoc.version>1.6.9</springdoc.version>
<fastjson.version>1.2.76</fastjson.version> <transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
<minio.version>8.2.1</minio.version>
<poi.version>4.1.2</poi.version> <!-- override dependency version -->
<common-pool.version>2.6.2</common-pool.version> <tomcat.version>9.0.98</tomcat.version>
<commons-collections.version>3.2.2</commons-collections.version> <logback.version>1.2.13</logback.version>
<spring-framework.version>5.3.39</spring-framework.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!-- 覆盖SpringFramework的依赖配置-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud 微服务 --> <!-- SpringCloud 微服务 -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
@@ -53,7 +63,7 @@
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- SpringCloud Alibaba 微服务 --> <!-- SpringCloud Alibaba 微服务 -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId> <artifactId>spring-cloud-alibaba-dependencies</artifactId>
@@ -62,13 +72,6 @@
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- Alibaba Nacos 配置 -->
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${alibaba.nacos.version}</version>
</dependency>
<!-- SpringBoot 依赖配置 --> <!-- SpringBoot 依赖配置 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@@ -77,43 +80,56 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- SpringBoot 监控客户端 --> <!-- 覆盖logback的依赖配置-->
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId> <artifactId>logback-core</artifactId>
<version>${spring-boot-admin.version}</version> <version>${logback.version}</version>
</dependency> </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>
<artifactId>fastdfs-client</artifactId> <artifactId>fastdfs-client</artifactId>
<version>${tobato.version}</version> <version>${tobato.version}</version>
</dependency> </dependency>
<!-- Mybatis 依赖配置 --> <!-- Springdoc webmvc 依赖配置 -->
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.springdoc</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>springdoc-openapi-ui</artifactId>
<version>${spring-boot.mybatis}</version> <version>${springdoc.version}</version>
</dependency>
<!-- Swagger 依赖配置 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>${swagger.core.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.core.version}</version>
</dependency> </dependency>
<!-- 验证码 --> <!-- 验证码 -->
<dependency> <dependency>
<groupId>com.github.penggle</groupId> <groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId> <artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version> <version>${kaptcha.version}</version>
</dependency> </dependency>
@@ -139,113 +155,114 @@
<version>${poi.version}</version> <version>${poi.version}</version>
</dependency> </dependency>
<!-- 文件上传工具类 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
</dependency>
<!-- 代码生成使用模板 --> <!-- 代码生成使用模板 -->
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId> <artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version> <version>${velocity.version}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Collection 增强Java集合框架 -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons-collections.version}</version>
</dependency> </dependency>
<!-- JSON 解析器和生成器 --> <!-- JSON 解析器和生成器 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version> <version>${fastjson.version}</version>
</dependency> </dependency>
<!-- 公共资源池 --> <!-- JWT -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>jjwt</artifactId>
<version>${common-pool.version}</version> <version>${jjwt.version}</version>
</dependency>
<!-- 线程传递值 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version>
</dependency> </dependency>
<!-- 核心模块 --> <!-- 核心模块 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId> <artifactId>ruoyi-common-core</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 接口模块 --> <!-- 接口模块 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId> <artifactId>ruoyi-common-swagger</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 安全模块 --> <!-- 安全模块 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId> <artifactId>ruoyi-common-security</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 数据脱敏 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 权限范围 --> <!-- 权限范围 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId> <artifactId>ruoyi-common-datascope</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 多数据源 --> <!-- 多数据源 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId> <artifactId>ruoyi-common-datasource</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 分布式事务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-seata</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 日志记录 --> <!-- 日志记录 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId> <artifactId>ruoyi-common-log</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 缓存服务 --> <!-- 缓存服务 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId> <artifactId>ruoyi-common-redis</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 系统接口 --> <!-- 系统接口 -->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId> <artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<modules> <modules>
<module>ruoyi-auth</module> <module>ruoyi-auth</module>
<module>ruoyi-gateway</module> <module>ruoyi-gateway</module>
<module>ruoyi-visual</module> <module>ruoyi-visual</module>
<module>ruoyi-modules</module> <module>ruoyi-modules</module>
<module>ruoyi-api</module> <module>ruoyi-api</module>
<module>ruoyi-common</module> <module>ruoyi-common</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
@@ -269,6 +286,47 @@
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project> </project>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.0.0</version> <version>3.6.5</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.0.0</version> <version>3.6.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,9 +3,11 @@ package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; 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.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.SysOperLog; import com.ruoyi.system.api.domain.SysOperLog;
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory; import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
@@ -21,20 +23,19 @@ public interface RemoteLogService
* 保存系统日志 * 保存系统日志
* *
* @param sysOperLog 日志实体 * @param sysOperLog 日志实体
* @param source 请求来源
* @return 结果 * @return 结果
*/ */
@PostMapping("/operlog") @PostMapping("/operlog")
R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog); public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
/** /**
* 保存访问记录 * 保存访问记录
* *
* @param username 用户名称 * @param sysLogininfor 访问实体
* @param status 状态 * @param source 请求来源
* @param message 消息
* @return 结果 * @return 结果
*/ */
@PostMapping("/logininfor") @PostMapping("/logininfor")
R<Boolean> saveLogininfor(@RequestParam("username") String username, @RequestParam("status") String status, public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@RequestParam("message") String message);
} }

View File

@@ -3,8 +3,14 @@ package com.ruoyi.system.api;
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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.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.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory; import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
@@ -20,8 +26,29 @@ public interface RemoteUserService
* 通过用户名查询用户信息 * 通过用户名查询用户信息
* *
* @param username 用户名 * @param username 用户名
* @param source 请求来源
* @return 结果 * @return 结果
*/ */
@GetMapping(value = "/user/info/{username}") @GetMapping("/user/info/{username}")
public R<LoginUser> getUserInfo(@PathVariable("username") String username); public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 注册用户信息
*
* @param sysUser 用户信息
* @param source 请求来源
* @return 结果
*/
@PostMapping("/user/register")
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 记录用户登录IP地址和登录时间
*
* @param sysUser 用户信息
* @param source 请求来源
* @return 结果
*/
@PutMapping("/user/recordlogin")
public R<Boolean> recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.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;
@@ -31,7 +32,7 @@ public class SysDept extends BaseEntity
private String deptName; private String deptName;
/** 显示顺序 */ /** 显示顺序 */
private String orderNum; private Integer orderNum;
/** 负责人 */ /** 负责人 */
private String leader; private String leader;
@@ -96,13 +97,13 @@ public class SysDept extends BaseEntity
this.deptName = deptName; this.deptName = deptName;
} }
@NotBlank(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public String getOrderNum() public Integer getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(String orderNum) public void setOrderNum(Integer orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }

View File

@@ -1,4 +1,4 @@
package com.ruoyi.system.domain; package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@@ -131,7 +131,7 @@ public class SysDictData extends BaseEntity
public boolean getDefault() public boolean getDefault()
{ {
return UserConstants.YES.equals(this.isDefault) ? true : false; return UserConstants.YES.equals(this.isDefault);
} }
public String getIsDefault() public String getIsDefault()

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.domain; package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
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;
@@ -57,6 +58,7 @@ public class SysDictType extends BaseEntity
@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 = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType() public String getDictType()
{ {
return dictType; return dictType;

View File

@@ -1,4 +1,4 @@
package com.ruoyi.system.domain; package com.ruoyi.system.api.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;

View File

@@ -79,6 +79,10 @@ public class SysOperLog 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 operTime; private Date operTime;
/** 消耗时间 */
@Excel(name = "消耗时间", suffix = "毫秒")
private Long costTime;
public Long getOperId() public Long getOperId()
{ {
return operId; return operId;
@@ -238,4 +242,14 @@ public class SysOperLog extends BaseEntity
{ {
this.operTime = operTime; this.operTime = operTime;
} }
public Long getCostTime()
{
return costTime;
}
public void setCostTime(Long costTime)
{
this.costTime = costTime;
}
} }

View File

@@ -1,6 +1,8 @@
package com.ruoyi.system.api.domain; package com.ruoyi.system.api.domain;
import java.util.Set;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
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;
@@ -31,7 +33,7 @@ public class SysRole extends BaseEntity
/** 角色排序 */ /** 角色排序 */
@Excel(name = "角色排序") @Excel(name = "角色排序")
private String roleSort; private Integer roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */ /** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
@@ -59,6 +61,9 @@ public class SysRole extends BaseEntity
/** 部门组(数据权限) */ /** 部门组(数据权限) */
private Long[] deptIds; private Long[] deptIds;
/** 角色菜单权限 */
private Set<String> permissions;
public SysRole() public SysRole()
{ {
@@ -113,13 +118,13 @@ public class SysRole extends BaseEntity
this.roleKey = roleKey; this.roleKey = roleKey;
} }
@NotBlank(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public String getRoleSort() public Integer getRoleSort()
{ {
return roleSort; return roleSort;
} }
public void setRoleSort(String roleSort) public void setRoleSort(Integer roleSort)
{ {
this.roleSort = roleSort; this.roleSort = roleSort;
} }
@@ -203,7 +208,18 @@ public class SysRole extends BaseEntity
{ {
this.deptIds = deptIds; this.deptIds = deptIds;
} }
public Set<String> getPermissions()
{
return permissions;
}
public void setPermissions(Set<String> permissions)
{
this.permissions = permissions;
}
@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())

View File

@@ -2,17 +2,15 @@ package com.ruoyi.system.api.domain;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type; import com.ruoyi.common.core.annotation.Excel.Type;
import com.ruoyi.common.core.annotation.Excels; import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss;
/** /**
* 用户对象 sys_user * 用户对象 sys_user
@@ -24,7 +22,7 @@ public class SysUser extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /** 用户ID */
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId; private Long userId;
/** 部门ID */ /** 部门ID */
@@ -44,7 +42,7 @@ public class SysUser extends BaseEntity
private String email; private String email;
/** 手机号码 */ /** 手机号码 */
@Excel(name = "手机号码") @Excel(name = "手机号码", cellType = ColumnType.TEXT)
private String phonenumber; private String phonenumber;
/** 用户性别 */ /** 用户性别 */
@@ -57,9 +55,6 @@ public class SysUser extends BaseEntity
/** 密码 */ /** 密码 */
private String password; private String password;
/** 盐加密 */
private String salt;
/** 帐号状态0正常 1停用 */ /** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
@@ -91,6 +86,9 @@ public class SysUser extends BaseEntity
/** 岗位组 */ /** 岗位组 */
private Long[] postIds; private Long[] postIds;
/** 角色ID */
private Long roleId;
public SysUser() public SysUser()
{ {
@@ -131,6 +129,7 @@ public class SysUser extends BaseEntity
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName()
{ {
@@ -142,6 +141,7 @@ public class SysUser extends BaseEntity
this.nickName = nickName; this.nickName = nickName;
} }
@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()
@@ -197,7 +197,6 @@ public class SysUser extends BaseEntity
this.avatar = avatar; this.avatar = avatar;
} }
@JsonProperty
public String getPassword() public String getPassword()
{ {
return password; return password;
@@ -208,16 +207,6 @@ public class SysUser extends BaseEntity
this.password = password; this.password = password;
} }
public String getSalt()
{
return salt;
}
public void setSalt(String salt)
{
this.salt = salt;
}
public String getStatus() public String getStatus()
{ {
return status; return status;
@@ -297,7 +286,16 @@ public class SysUser extends BaseEntity
{ {
this.postIds = postIds; this.postIds = postIds;
} }
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long 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)
@@ -310,7 +308,6 @@ public class SysUser extends BaseEntity
.append("sex", getSex()) .append("sex", getSex())
.append("avatar", getAvatar()) .append("avatar", getAvatar())
.append("password", getPassword()) .append("password", getPassword())
.append("salt", getSalt())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("loginIp", getLoginIp()) .append("loginIp", getLoginIp())

View File

@@ -6,6 +6,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; 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.SysOperLog; import com.ruoyi.system.api.domain.SysOperLog;
/** /**
@@ -25,15 +26,15 @@ public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogServic
return new RemoteLogService() return new RemoteLogService()
{ {
@Override @Override
public R<Boolean> saveLog(SysOperLog sysOperLog) public R<Boolean> saveLog(SysOperLog sysOperLog, String source)
{ {
return null; return R.fail("保存操作日志失败:" + throwable.getMessage());
} }
@Override @Override
public R<Boolean> saveLogininfor(String username, String status, String message) public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
{ {
return null; return R.fail("保存登录日志失败:" + throwable.getMessage());
} }
}; };

View File

@@ -6,6 +6,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; 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.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
/** /**
@@ -25,10 +26,22 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
return new RemoteUserService() return new RemoteUserService()
{ {
@Override @Override
public R<LoginUser> getUserInfo(String username) public R<LoginUser> getUserInfo(String username, String source)
{ {
return R.fail("获取用户失败:" + throwable.getMessage()); return R.fail("获取用户失败:" + throwable.getMessage());
} }
@Override
public R<Boolean> registerUserInfo(SysUser sysUser, String source)
{
return R.fail("注册用户失败:" + throwable.getMessage());
}
@Override
public R<Boolean> recordUserLogin(SysUser sysUser, String source)
{
return R.fail("记录用户登录信息失败:" + throwable.getMessage());
}
}; };
} }
} }

View File

@@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.ruoyi.system.api.factory.RemoteUserFallbackFactory,\
com.ruoyi.system.api.factory.RemoteLogFallbackFactory, \
com.ruoyi.system.api.factory.RemoteFileFallbackFactory

View File

@@ -0,0 +1,3 @@
com.ruoyi.system.api.factory.RemoteUserFallbackFactory
com.ruoyi.system.api.factory.RemoteLogFallbackFactory
com.ruoyi.system.api.factory.RemoteFileFallbackFactory

View File

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

View File

@@ -7,10 +7,14 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; 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.service.SysLoginService; import com.ruoyi.auth.service.SysLoginService;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.JwtUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
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.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
/** /**
@@ -39,12 +43,12 @@ public class TokenController
@DeleteMapping("logout") @DeleteMapping("logout")
public R<?> logout(HttpServletRequest request) public R<?> logout(HttpServletRequest request)
{ {
LoginUser loginUser = tokenService.getLoginUser(request); String token = SecurityUtils.getToken(request);
if (StringUtils.isNotNull(loginUser)) if (StringUtils.isNotEmpty(token))
{ {
String username = loginUser.getUsername(); String username = JwtUtils.getUserName(token);
// 删除用户缓存记录 // 删除用户缓存记录
tokenService.delLoginUser(loginUser.getToken()); AuthUtil.logoutByToken(token);
// 记录用户退出日志 // 记录用户退出日志
sysLoginService.logout(username); sysLoginService.logout(username);
} }
@@ -63,4 +67,12 @@ public class TokenController
} }
return R.ok(); return R.ok();
} }
@PostMapping("register")
public R<?> register(@RequestBody RegisterBody registerBody)
{
// 用户注册
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
return R.ok();
}
} }

View File

@@ -0,0 +1,11 @@
package com.ruoyi.auth.form;
/**
* 用户注册对象
*
* @author ruoyi
*/
public class RegisterBody extends LoginBody
{
}

View File

@@ -2,14 +2,19 @@ package com.ruoyi.auth.service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
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.UserConstants; import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.enums.UserStatus; import com.ruoyi.common.core.enums.UserStatus;
import com.ruoyi.common.core.exception.BaseException; import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.SecurityUtils; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.RemoteLogService; import com.ruoyi.common.core.utils.ip.IpUtils;
import com.ruoyi.common.redis.service.RedisService;
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;
@@ -23,10 +28,16 @@ import com.ruoyi.system.api.model.LoginUser;
public class SysLoginService public class SysLoginService
{ {
@Autowired @Autowired
private RemoteLogService remoteLogService; private RemoteUserService remoteUserService;
@Autowired @Autowired
private RemoteUserService remoteUserService; private SysPasswordService passwordService;
@Autowired
private SysRecordLogService recordLogService;
@Autowired
private RedisService redisService;
/** /**
* 登录 * 登录
@@ -36,60 +47,109 @@ public class SysLoginService
// 用户名或密码为空 错误 // 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) if (StringUtils.isAnyBlank(username, password))
{ {
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new BaseException("用户/密码必须填写"); 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)
{ {
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
throw new BaseException("用户密码不在指定范围"); 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)
{ {
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
throw new BaseException("用户名不在指定范围"); throw new ServiceException("用户名不在指定范围");
}
// IP黑名单校验
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾访问IP已被列入系统黑名单");
throw new ServiceException("很遗憾访问IP已被列入系统黑名单");
} }
// 查询用户信息 // 查询用户信息
R<LoginUser> userResult = remoteUserService.getUserInfo(username); R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
if (R.FAIL == userResult.getCode()) if (R.FAIL == userResult.getCode())
{ {
throw new BaseException(userResult.getMsg()); throw new ServiceException(userResult.getMsg());
} }
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
{
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
throw new BaseException("登录用户:" + username + " 不存在");
}
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()))
{ {
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
throw new BaseException("对不起,您的账号:" + username + " 已被删除");
} }
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{ {
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new BaseException("对不起,您的账号:" + username + " 已停用"); throw new ServiceException("对不起,您的账号:" + username + " 已停用");
} }
if (!SecurityUtils.matchesPassword(password, user.getPassword())) passwordService.validate(user, password);
{ recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户密码错误"); recordLoginInfo(user.getUserId());
throw new BaseException("用户不存在/密码错误");
}
remoteLogService.saveLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
return userInfo; return userInfo;
} }
/**
* 记录登录信息
*
* @param userId 用户ID
*/
public void recordLoginInfo(Long userId)
{
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
// 更新用户登录IP
sysUser.setLoginIp(IpUtils.getIpAddr());
// 更新用户登录时间
sysUser.setLoginDate(DateUtils.getNowDate());
remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER);
}
public void logout(String loginName) public void logout(String loginName)
{ {
remoteLogService.saveLogininfor(loginName, Constants.LOGOUT, "退出成功"); recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
} }
}
/**
* 注册
*/
public void register(String username, String password)
{
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
throw new ServiceException("用户/密码必须填写");
}
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
throw new ServiceException("账户长度必须在2到20个字符之间");
}
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
throw new ServiceException("密码长度必须在5到20个字符之间");
}
// 注册用户信息
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPassword(SecurityUtils.encryptPassword(password));
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
if (R.FAIL == registerResult.getCode())
{
throw new ServiceException(registerResult.getMsg());
}
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
}
}

View File

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

View File

@@ -0,0 +1,48 @@
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.SecurityConstants;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.ip.IpUtils;
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysLogininfor;
/**
* 记录日志方法
*
* @author ruoyi
*/
@Component
public class SysRecordLogService
{
@Autowired
private RemoteLogService remoteLogService;
/**
* 记录登录信息
*
* @param username 用户名
* @param status 状态
* @param message 消息内容
* @return
*/
public void recordLogininfor(String username, String status, String message)
{
SysLogininfor logininfor = new SysLogininfor();
logininfor.setUserName(username);
logininfor.setIpaddr(IpUtils.getIpAddr());
logininfor.setMsg(message);
// 日志状态
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
{
logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
}
else if (Constants.LOGIN_FAIL.equals(status))
{
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
}
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.0.0</version> <version>3.6.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -12,17 +12,19 @@
<module>ruoyi-common-log</module> <module>ruoyi-common-log</module>
<module>ruoyi-common-core</module> <module>ruoyi-common-core</module>
<module>ruoyi-common-redis</module> <module>ruoyi-common-redis</module>
<module>ruoyi-common-seata</module>
<module>ruoyi-common-swagger</module> <module>ruoyi-common-swagger</module>
<module>ruoyi-common-security</module> <module>ruoyi-common-security</module>
<module>ruoyi-common-sensitive</module>
<module>ruoyi-common-datascope</module> <module>ruoyi-common-datascope</module>
<module>ruoyi-common-datasource</module> <module>ruoyi-common-datasource</module>
</modules> </modules>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<description> <description>
ruoyi-common通用模块 ruoyi-common通用模块
</description> </description>
</project> </project>

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.0.0</version> <version>3.6.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -41,10 +41,10 @@
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<!-- Apache Commons Pool2 --> <!-- Transmittable ThreadLocal -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>com.alibaba</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>transmittable-thread-local</artifactId>
</dependency> </dependency>
<!-- Pagehelper --> <!-- Pagehelper -->
@@ -67,8 +67,20 @@
<!-- Alibaba Fastjson --> <!-- Alibaba Fastjson -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson2</artifactId>
</dependency>
<!-- Jwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<!-- Jaxb -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency> </dependency>
<!-- Apache Lang3 --> <!-- Apache Lang3 -->
@@ -83,12 +95,6 @@
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
</dependency> </dependency>
<!-- Commons Fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<!-- excel工具 --> <!-- excel工具 -->
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
@@ -101,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

@@ -5,6 +5,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
/** /**
* 自定义导出Excel数据注解 * 自定义导出Excel数据注解
@@ -51,17 +54,12 @@ public @interface Excel
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/** /**
* 导出类型0数字 1字符串 * 导出时在excel中每个列的高度
*/
public ColumnType cellType() default ColumnType.STRING;
/**
* 导出时在excel中每个列的高度 单位为字符
*/ */
public double height() default 14; public double height() default 14;
/** /**
* 导出时在excel中每个列的宽 单位为字符 * 导出时在excel中每个列的宽
*/ */
public double width() default 16; public double width() default 16;
@@ -80,11 +78,21 @@ public @interface Excel
*/ */
public String prompt() default ""; public String prompt() default "";
/**
* 是否允许内容换行
*/
public boolean wrapText() default false;
/** /**
* 设置只能选择不能输入的列内容. * 设置只能选择不能输入的列内容.
*/ */
public String[] combo() default {}; public String[] combo() default {};
/**
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
*/
public boolean needMerge() default false;
/** /**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/ */
@@ -101,25 +109,44 @@ public @interface Excel
public boolean isStatistics() default false; public boolean isStatistics() default false;
/** /**
* 导出字段对齐方式0默认1靠左2居中3靠右 * 导出类型0数字 1字符串
*/ */
Align align() default Align.AUTO; public ColumnType cellType() default ColumnType.STRING;
public enum Align /**
{ * 导出列头背景颜色
AUTO(0), LEFT(1), CENTER(2), RIGHT(3); */
private final int value; public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
Align(int value) /**
{ * 导出列头字体颜色
this.value = value; */
} public IndexedColors headerColor() default IndexedColors.WHITE;
public int value() /**
{ * 导出单元格背景颜色
return this.value; */
} public IndexedColors backgroundColor() default IndexedColors.WHITE;
}
/**
* 导出单元格字体颜色
*/
public IndexedColors color() default IndexedColors.BLACK;
/**
* 导出字段对齐方式
*/
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/**
* 自定义数据处理器
*/
public Class<?> handler() default ExcelHandlerAdapter.class;
/**
* 自定义数据处理器参数
*/
public String[] args() default {};
/** /**
* 字段类型0导出导入1仅导出2仅导入 * 字段类型0导出导入1仅导出2仅导入
@@ -144,7 +171,7 @@ public @interface Excel
public enum ColumnType public enum ColumnType
{ {
NUMERIC(0), STRING(1), IMAGE(2); NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
private final int value; private final int value;
ColumnType(int value) ColumnType(int value)

View File

@@ -1,21 +1,31 @@
package com.ruoyi.common.core.constant; package com.ruoyi.common.core.constant;
/** /**
* 缓存的key 常量 * 缓存常量信息
* *
* @author ruoyi * @author ruoyi
*/ */
public class CacheConstants public class CacheConstants
{ {
/** /**
* 令牌自定义标识 * 缓存有效期默认720分钟
*/ */
public static final String HEADER = "Authorization"; public final static long EXPIRATION = 720;
/** /**
* 令牌前缀 * 缓存刷新时间默认120分钟
*/ */
public static final String TOKEN_PREFIX = "Bearer "; public final static long REFRESH_TIME = 120;
/**
* 密码最大错误次数
*/
public final static int PASSWORD_MAX_RETRY_COUNT = 5;
/**
* 密码锁定时间默认10分钟
*/
public final static long PASSWORD_LOCK_TIME = 10;
/** /**
* 权限缓存前缀 * 权限缓存前缀
@@ -23,17 +33,27 @@ public class CacheConstants
public final static String LOGIN_TOKEN_KEY = "login_tokens:"; public final static String LOGIN_TOKEN_KEY = "login_tokens:";
/** /**
* 用户ID字段 * 验证码 redis key
*/ */
public static final String DETAILS_USER_ID = "user_id"; public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/** /**
* 用户名字段 * 参数管理 cache key
*/ */
public static final String DETAILS_USERNAME = "username"; public static final String SYS_CONFIG_KEY = "sys_config:";
/** /**
* 授权信息字段 * 字典管理 cache key
*/ */
public static final String AUTHORIZATION_HEADER = "authorization"; public static final String SYS_DICT_KEY = "sys_dict:";
/**
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* 登录IP黑名单 cache key
*/
public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList";
} }

View File

@@ -17,6 +17,26 @@ public class Constants
*/ */
public static final String GBK = "GBK"; public static final String GBK = "GBK";
/**
* www主域
*/
public static final String WWW = "www.";
/**
* RMI 远程方法调用
*/
public static final String LOOKUP_RMI = "rmi:";
/**
* LDAP 远程方法调用
*/
public static final String LOOKUP_LDAP = "ldap:";
/**
* LDAPS 远程方法调用
*/
public static final String LOOKUP_LDAPS = "ldaps:";
/** /**
* http请求 * http请求
*/ */
@@ -37,6 +57,16 @@ public class Constants
*/ */
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_FAIL_STATUS = "1";
/** /**
* 登录成功 * 登录成功
*/ */
@@ -77,33 +107,29 @@ public class Constants
*/ */
public static final String IS_ASC = "isAsc"; public static final String IS_ASC = "isAsc";
/**
* 验证码 redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/** /**
* 验证码有效期(分钟) * 验证码有效期(分钟)
*/ */
public static final long CAPTCHA_EXPIRATION = 2; public static final long CAPTCHA_EXPIRATION = 2;
/**
* 令牌有效期(分钟)
*/
public final static long TOKEN_EXPIRE = 720;
/**
* 参数管理 cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/** /**
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */
public static final String RESOURCE_PREFIX = "/profile"; public static final String RESOURCE_PREFIX = "/profile";
/**
* 自动识别json对象白名单配置仅允许解析的包名范围越小越安全
*/
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_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" };
} }

View File

@@ -42,7 +42,7 @@ public class GenConstants
/** 数据库数字类型 */ /** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
"bigint", "float", "double", "decimal" }; "bit", "bigint", "float", "double", "decimal" };
/** 页面不需要编辑字段 */ /** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
@@ -109,6 +109,9 @@ public class GenConstants
/** 模糊查询 */ /** 模糊查询 */
public static final String QUERY_LIKE = "LIKE"; public static final String QUERY_LIKE = "LIKE";
/** 相等查询 */
public static final String QUERY_EQ = "EQ";
/** 需要 */ /** 需要 */
public static final String REQUIRE = "1"; public static final String REQUIRE = "1";
} }

View File

@@ -86,4 +86,9 @@ public class HttpStatus
* 接口未实现 * 接口未实现
*/ */
public static final int NOT_IMPLEMENTED = 501; public static final int NOT_IMPLEMENTED = 501;
/**
* 系统警告消息
*/
public static final int WARN = 601;
} }

View File

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

View File

@@ -0,0 +1,20 @@
package com.ruoyi.common.core.constant;
/**
* Token的Key常量
*
* @author ruoyi
*/
public class TokenConstants
{
/**
* 令牌前缀
*/
public static final String PREFIX = "Bearer ";
/**
* 令牌秘钥
*/
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
}

View File

@@ -21,6 +21,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";
@@ -57,10 +60,12 @@ public class UserConstants
/** ParentView组件标识 */ /** ParentView组件标识 */
public final static String PARENT_VIEW = "ParentView"; public final static String PARENT_VIEW = "ParentView";
/** 校验返回结果码 */ /** InnerLink组件标识 */
public final static String UNIQUE = "0"; public final static String INNER_LINK = "InnerLink";
public final static String NOT_UNIQUE = "1"; /** 校验是否唯一的返回标识 */
public final static boolean UNIQUE = true;
public final static boolean NOT_UNIQUE = false;
/** /**
* 用户名长度限制 * 用户名长度限制

View File

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

View File

@@ -102,4 +102,14 @@ public class R<T> implements Serializable
{ {
this.data = data; this.data = data;
} }
public static <T> Boolean isError(R<T> ret)
{
return !isSuccess(ret);
}
public static <T> Boolean isSuccess(R<T> ret)
{
return R.SUCCESS == ret.getCode();
}
} }

View File

@@ -1,43 +0,0 @@
package com.ruoyi.common.core.exception;
/**
* 自定义异常
*
* @author ruoyi
*/
public class CustomException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private Integer code;
private String message;
public CustomException(String message)
{
this.message = message;
}
public CustomException(String message, Integer code)
{
this.message = message;
this.code = code;
}
public CustomException(String message, Throwable e)
{
super(message, e);
this.message = message;
}
@Override
public String getMessage()
{
return message;
}
public Integer getCode()
{
return code;
}
}

View File

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

View File

@@ -0,0 +1,16 @@
package com.ruoyi.common.core.exception;
/**
* 内部认证异常
*
* @author ruoyi
*/
public class InnerAuthException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public InnerAuthException(String message)
{
super(message);
}
}

View File

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

View File

@@ -0,0 +1,16 @@
package com.ruoyi.common.core.exception.auth;
/**
* 未能通过的登录认证异常
*
* @author ruoyi
*/
public class NotLoginException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public NotLoginException(String message)
{
super(message);
}
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.common.core.exception.auth;
import org.apache.commons.lang3.StringUtils;
/**
* 未能通过的权限认证异常
*
* @author ruoyi
*/
public class NotPermissionException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public NotPermissionException(String permission)
{
super(permission);
}
public NotPermissionException(String[] permissions)
{
super(StringUtils.join(permissions, ","));
}
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.common.core.exception.auth;
import org.apache.commons.lang3.StringUtils;
/**
* 未能通过的角色认证异常
*
* @author ruoyi
*/
public class NotRoleException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public NotRoleException(String role)
{
super(role);
}
public NotRoleException(String[] roles)
{
super(StringUtils.join(roles, ","));
}
}

View File

@@ -1,79 +1,79 @@
package com.ruoyi.common.core.exception; 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

@@ -1,6 +1,6 @@
package com.ruoyi.common.core.exception.file; package com.ruoyi.common.core.exception.file;
import com.ruoyi.common.core.exception.BaseException; import com.ruoyi.common.core.exception.base.BaseException;
/** /**
* 文件信息异常类 * 文件信息异常类
@@ -11,9 +11,9 @@ public class FileException extends BaseException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args) public FileException(String code, Object[] args, String msg)
{ {
super("file", code, args, null); super("file", code, args, msg);
} }
} }

View File

@@ -11,6 +11,6 @@ public class FileNameLengthLimitExceededException extends FileException
public FileNameLengthLimitExceededException(int defaultFileNameLength) public FileNameLengthLimitExceededException(int defaultFileNameLength)
{ {
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }, "the filename is too long");
} }
} }

View File

@@ -11,6 +11,6 @@ public class FileSizeLimitExceededException extends FileException
public FileSizeLimitExceededException(long defaultMaxSize) public FileSizeLimitExceededException(long defaultMaxSize)
{ {
super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); super("upload.exceed.maxSize", new Object[] { defaultMaxSize }, "the filesize is too large");
} }
} }

View File

@@ -0,0 +1,61 @@
package com.ruoyi.common.core.exception.file;
import java.io.PrintStream;
import java.io.PrintWriter;
/**
* 文件上传异常类
*
* @author ruoyi
*/
public class FileUploadException extends Exception
{
private static final long serialVersionUID = 1L;
private final Throwable cause;
public FileUploadException()
{
this(null, null);
}
public FileUploadException(final String msg)
{
this(msg, null);
}
public FileUploadException(String msg, Throwable cause)
{
super(msg);
this.cause = cause;
}
@Override
public void printStackTrace(PrintStream stream)
{
super.printStackTrace(stream);
if (cause != null)
{
stream.println("Caused by:");
cause.printStackTrace(stream);
}
}
@Override
public void printStackTrace(PrintWriter writer)
{
super.printStackTrace(writer);
if (cause != null)
{
writer.println("Caused by:");
cause.printStackTrace(writer);
}
}
@Override
public Throwable getCause()
{
return cause;
}
}

View File

@@ -1,7 +1,6 @@
package com.ruoyi.common.core.exception.file; package com.ruoyi.common.core.exception.file;
import java.util.Arrays; import java.util.Arrays;
import org.apache.commons.fileupload.FileUploadException;
/** /**
* 文件上传 误异常类 * 文件上传 误异常类

View File

@@ -1,6 +1,6 @@
package com.ruoyi.common.core.exception.user; package com.ruoyi.common.core.exception.user;
import com.ruoyi.common.core.exception.BaseException; import com.ruoyi.common.core.exception.base.BaseException;
/** /**
* 用户信息异常类 * 用户信息异常类

View File

@@ -2,6 +2,7 @@ package com.ruoyi.common.core.text;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.NumberFormat; import java.text.NumberFormat;
@@ -313,7 +314,7 @@ public class Convert
* 转换为Integer数组<br> * 转换为Integer数组<br>
* *
* @param split 分隔符 * @param split 分隔符
* @param split 被转换的值 * @param str 被转换的值
* @return 结果 * @return 结果
*/ */
public static Integer[] toIntArray(String split, String str) public static Integer[] toIntArray(String split, String str)
@@ -363,6 +364,10 @@ public class Convert
*/ */
public static String[] toStrArray(String str) public static String[] toStrArray(String str)
{ {
if (StringUtils.isEmpty(str))
{
return new String[] {};
}
return toStrArray(",", str); return toStrArray(",", str);
} }
@@ -370,7 +375,7 @@ public class Convert
* 转换为String数组<br> * 转换为String数组<br>
* *
* @param split 分隔符 * @param split 分隔符
* @param split 被转换的值 * @param str 被转换的值
* @return 结果 * @return 结果
*/ */
public static String[] toStrArray(String split, String str) public static String[] toStrArray(String split, String str)
@@ -535,9 +540,9 @@ public class Convert
/** /**
* 转换为boolean<br> * 转换为boolean<br>
* String支持的值为true、false、yes、ok、no1,0 如果给定的值为空,或者转换失败,返回默认值<br> * String支持的值为true、false、yes、ok、no、1、0、是、否, 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错 * 转换失败不会报错
* *
* @param value 被转换的值 * @param value 被转换的值
* @param defaultValue 转换错误时的默认值 * @param defaultValue 转换错误时的默认值
* @return 结果 * @return 结果
@@ -561,18 +566,15 @@ public class Convert
switch (valueStr) switch (valueStr)
{ {
case "true": case "true":
case "yes":
case "ok":
case "1":
case "":
return true; return true;
case "false": case "false":
return false;
case "yes":
return true;
case "ok":
return true;
case "no": case "no":
return false;
case "1":
return true;
case "0": case "0":
case "":
return false; return false;
default: default:
return defaultValue; return defaultValue;
@@ -717,7 +719,7 @@ public class Convert
} }
if (value instanceof Double) if (value instanceof Double)
{ {
return new BigDecimal((Double) value); return BigDecimal.valueOf((Double) value);
} }
if (value instanceof Integer) if (value instanceof Integer)
{ {
@@ -907,7 +909,7 @@ public class Convert
*/ */
public static String toSBC(String input, Set<Character> notConvertSet) public static String toSBC(String input, Set<Character> notConvertSet)
{ {
char c[] = input.toCharArray(); char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) for (int i = 0; i < c.length; i++)
{ {
if (null != notConvertSet && notConvertSet.contains(c[i])) if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -949,7 +951,7 @@ public class Convert
*/ */
public static String toDBC(String text, Set<Character> notConvertSet) public static String toDBC(String text, Set<Character> notConvertSet)
{ {
char c[] = text.toCharArray(); char[] c = text.toCharArray();
for (int i = 0; i < c.length; i++) for (int i = 0; i < c.length; i++)
{ {
if (null != notConvertSet && notConvertSet.contains(c[i])) if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -967,9 +969,7 @@ public class Convert
c[i] = (char) (c[i] - 65248); c[i] = (char) (c[i] - 65248);
} }
} }
String returnString = new String(c); return new String(c);
return returnString;
} }
/** /**
@@ -990,7 +990,12 @@ public class Convert
String s = ""; String s = "";
for (int i = 0; i < fraction.length; i++) for (int i = 0; i < fraction.length; i++)
{ {
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); // 优化double计算精度丢失问题
BigDecimal nNum = new BigDecimal(n);
BigDecimal decimal = new BigDecimal(10);
BigDecimal scale = nNum.multiply(decimal).setScale(2, RoundingMode.HALF_EVEN);
double d = scale.doubleValue();
s += (digit[(int) (Math.floor(d * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
} }
if (s.length() < 1) if (s.length() < 1)
{ {

View File

@@ -3,12 +3,17 @@ package com.ruoyi.common.core.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
/** /**
* 时间工具类 * 时间工具类
* *
* @author ruoyi * @author ruoyi
*/ */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils public class DateUtils extends org.apache.commons.lang3.time.DateUtils
@@ -22,15 +27,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = { private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/** /**
* 获取当前Date型日期 * 获取当前Date型日期
* *
* @return Date() 当前日期 * @return Date() 当前日期
*/ */
public static Date getNowDate() public static Date getNowDate()
@@ -40,7 +45,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/** /**
* 获取当前日期, 默认格式为yyyy-MM-dd * 获取当前日期, 默认格式为yyyy-MM-dd
* *
* @return String * @return String
*/ */
public static String getDate() public static String getDate()
@@ -121,7 +126,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return null; return null;
} }
} }
/** /**
* 获取服务器启动时间 * 获取服务器启动时间
*/ */
@@ -132,16 +137,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
} }
/** /**
* 计算两个时间差 * 计算时间差
*
* @param endDate 最后时间
* @param startTime 开始时间
* @return 时间差(天/小时/分钟)
*/ */
public static String getDatePoor(Date endDate, Date nowDate) public static String timeDistance(Date endDate, Date startTime)
{ {
long nd = 1000 * 24 * 60 * 60; long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60; long nh = 1000 * 60 * 60;
long nm = 1000 * 60; long nm = 1000 * 60;
// long ns = 1000; // long ns = 1000;
// 获得两个时间的毫秒时间差异 // 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime(); long diff = endDate.getTime() - startTime.getTime();
// 计算差多少天 // 计算差多少天
long day = diff / nd; long day = diff / nd;
// 计算差多少小时 // 计算差多少小时
@@ -152,4 +161,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
// long sec = diff % nd % nh % nm / ns; // long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟"; return day + "" + hour + "小时" + min + "分钟";
} }
/**
* 增加 LocalDateTime ==> Date
*/
public static Date toDate(LocalDateTime temporalAccessor)
{
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
/**
* 增加 LocalDate ==> Date
*/
public static Date toDate(LocalDate temporalAccessor)
{
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
} }

View File

@@ -18,8 +18,7 @@ public class ExceptionUtil
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true)); e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString(); return sw.toString();
return str;
} }
public static String getRootErrorMessage(Exception e) public static String getRootErrorMessage(Exception e)

View File

@@ -0,0 +1,123 @@
package com.ruoyi.common.core.utils;
import java.util.Map;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.TokenConstants;
import com.ruoyi.common.core.text.Convert;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
/**
* Jwt工具类
*
* @author ruoyi
*/
public class JwtUtils
{
public static String secret = TokenConstants.SECRET;
/**
* 从数据声明生成令牌
*
* @param claims 数据声明
* @return 令牌
*/
public static String createToken(Map<String, Object> claims)
{
String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
return token;
}
/**
* 从令牌中获取数据声明
*
* @param token 令牌
* @return 数据声明
*/
public static Claims parseToken(String token)
{
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
}
/**
* 根据令牌获取用户标识
*
* @param token 令牌
* @return 用户ID
*/
public static String getUserKey(String token)
{
Claims claims = parseToken(token);
return getValue(claims, SecurityConstants.USER_KEY);
}
/**
* 根据令牌获取用户标识
*
* @param claims 身份信息
* @return 用户ID
*/
public static String getUserKey(Claims claims)
{
return getValue(claims, SecurityConstants.USER_KEY);
}
/**
* 根据令牌获取用户ID
*
* @param token 令牌
* @return 用户ID
*/
public static String getUserId(String token)
{
Claims claims = parseToken(token);
return getValue(claims, SecurityConstants.DETAILS_USER_ID);
}
/**
* 根据身份信息获取用户ID
*
* @param claims 身份信息
* @return 用户ID
*/
public static String getUserId(Claims claims)
{
return getValue(claims, SecurityConstants.DETAILS_USER_ID);
}
/**
* 根据令牌获取用户名
*
* @param token 令牌
* @return 用户名
*/
public static String getUserName(String token)
{
Claims claims = parseToken(token);
return getValue(claims, SecurityConstants.DETAILS_USERNAME);
}
/**
* 根据身份信息获取用户名
*
* @param claims 身份信息
* @return 用户名
*/
public static String getUserName(Claims claims)
{
return getValue(claims, SecurityConstants.DETAILS_USERNAME);
}
/**
* 根据身份信息获取键值
*
* @param claims 身份信息
* @param key 键
* @return 值
*/
public static String getValue(Claims claims, String key)
{
return Convert.toStr(claims.get(key), "");
}
}

View File

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

View File

@@ -1,164 +0,0 @@
package com.ruoyi.common.core.utils;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.StringUtils;
public class ReUtil
{
public final static Pattern GROUP_VAR = Pattern.compile("\\$(\\d+)");
/**
* 正则中需要被转义的关键字
*/
public final static Set<Character> RE_KEYS = new HashSet<>(
Arrays.asList('$', '(', ')', '*', '+', '.', '[', ']', '?', '\\', '^', '{', '}', '|'));;
/**
* 正则替换指定值<br>
* 通过正则查找到字符串然后把匹配到的字符串加入到replacementTemplate中$1表示分组1的字符串
*
* <p>
* 例如原字符串是中文1234我想把1234换成(1234),则可以:
*
* <pre>
* ReUtil.replaceAll("中文1234", "(\\d+)", "($1)"))
*
* 结果:中文(1234)
* </pre>
*
* @param content 文本
* @param regex 正则
* @param replacementTemplate 替换的文本模板,可以使用$1类似的变量提取正则匹配出的内容
* @return 处理后的文本
*/
public static String replaceAll(CharSequence content, String regex, String replacementTemplate)
{
final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
return replaceAll(content, pattern, replacementTemplate);
}
/**
* 正则替换指定值<br>
* 通过正则查找到字符串然后把匹配到的字符串加入到replacementTemplate中$1表示分组1的字符串
*
* @param content 文本
* @param pattern {@link Pattern}
* @param replacementTemplate 替换的文本模板,可以使用$1类似的变量提取正则匹配出的内容
* @return 处理后的文本
* @since 3.0.4
*/
public static String replaceAll(CharSequence content, Pattern pattern, String replacementTemplate)
{
if (StringUtils.isEmpty(content))
{
return StringUtils.EMPTY;
}
final Matcher matcher = pattern.matcher(content);
boolean result = matcher.find();
if (result)
{
final Set<String> varNums = findAll(GROUP_VAR, replacementTemplate, 1, new HashSet<>());
final StringBuffer sb = new StringBuffer();
do
{
String replacement = replacementTemplate;
for (String var : varNums)
{
int group = Integer.parseInt(var);
replacement = replacement.replace("$" + var, matcher.group(group));
}
matcher.appendReplacement(sb, escape(replacement));
result = matcher.find();
}
while (result);
matcher.appendTail(sb);
return sb.toString();
}
return Convert.toStr(content);
}
/**
* 取得内容中匹配的所有结果
*
* @param <T> 集合类型
* @param pattern 编译后的正则模式
* @param content 被查找的内容
* @param group 正则的分组
* @param collection 返回的集合类型
* @return 结果集
*/
public static <T extends Collection<String>> T findAll(Pattern pattern, CharSequence content, int group,
T collection)
{
if (null == pattern || null == content)
{
return null;
}
if (null == collection)
{
throw new NullPointerException("Null collection param provided!");
}
final Matcher matcher = pattern.matcher(content);
while (matcher.find())
{
collection.add(matcher.group(group));
}
return collection;
}
/**
* 转义字符,将正则的关键字转义
*
* @param c 字符
* @return 转义后的文本
*/
public static String escape(char c)
{
final StringBuilder builder = new StringBuilder();
if (RE_KEYS.contains(c))
{
builder.append('\\');
}
builder.append(c);
return builder.toString();
}
/**
* 转义字符串,将正则的关键字转义
*
* @param content 文本
* @return 转义后的文本
*/
public static String escape(CharSequence content)
{
if (StringUtils.isBlank(content))
{
return StringUtils.EMPTY;
}
final StringBuilder builder = new StringBuilder();
int len = content.length();
char current;
for (int i = 0; i < len; i++)
{
current = content.charAt(i);
if (RE_KEYS.contains(current))
{
builder.append('\\');
}
builder.append(current);
}
return builder.toString();
}
}

View File

@@ -4,17 +4,28 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.LinkedHashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.LinkedCaseInsensitiveMap;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import reactor.core.publisher.Mono;
/** /**
* 客户端工具类 * 客户端工具类
@@ -55,6 +66,50 @@ public class ServletUtils
return Convert.toInt(getRequest().getParameter(name), defaultValue); return Convert.toInt(getRequest().getParameter(name), defaultValue);
} }
/**
* 获取Boolean参数
*/
public static Boolean getParameterToBool(String name)
{
return Convert.toBool(getRequest().getParameter(name));
}
/**
* 获取Boolean参数
*/
public static Boolean getParameterToBool(String name, Boolean defaultValue)
{
return Convert.toBool(getRequest().getParameter(name), defaultValue);
}
/**
* 获得所有请求参数
*
* @param request 请求对象{@link ServletRequest}
* @return Map
*/
public static Map<String, String[]> getParams(ServletRequest request)
{
final Map<String, String[]> map = request.getParameterMap();
return Collections.unmodifiableMap(map);
}
/**
* 获得所有请求参数
*
* @param request 请求对象{@link ServletRequest}
* @return Map
*/
public static Map<String, String> getParamMap(ServletRequest request)
{
Map<String, String> params = new HashMap<>();
for (Map.Entry<String, String[]> entry : getParams(request).entrySet())
{
params.put(entry.getKey(), StringUtils.join(entry.getValue(), ","));
}
return params;
}
/** /**
* 获取request * 获取request
*/ */
@@ -106,9 +161,19 @@ public class ServletUtils
} }
} }
public static String getHeader(HttpServletRequest request, String name)
{
String value = request.getHeader(name);
if (StringUtils.isEmpty(value))
{
return StringUtils.EMPTY;
}
return urlDecode(value);
}
public static Map<String, String> getHeaders(HttpServletRequest request) public static Map<String, String> getHeaders(HttpServletRequest request)
{ {
Map<String, String> map = new LinkedHashMap<>(); Map<String, String> map = new LinkedCaseInsensitiveMap<>();
Enumeration<String> enumeration = request.getHeaderNames(); Enumeration<String> enumeration = request.getHeaderNames();
if (enumeration != null) if (enumeration != null)
{ {
@@ -127,9 +192,8 @@ public class ServletUtils
* *
* @param response 渲染对象 * @param response 渲染对象
* @param string 待渲染的字符串 * @param string 待渲染的字符串
* @return null
*/ */
public static String renderString(HttpServletResponse response, String string) public static void renderString(HttpServletResponse response, String string)
{ {
try try
{ {
@@ -142,7 +206,6 @@ public class ServletUtils
{ {
e.printStackTrace(); e.printStackTrace();
} }
return null;
} }
/** /**
@@ -153,13 +216,13 @@ public class ServletUtils
public static boolean isAjaxRequest(HttpServletRequest request) public static boolean isAjaxRequest(HttpServletRequest request)
{ {
String accept = request.getHeader("accept"); String accept = request.getHeader("accept");
if (accept != null && accept.indexOf("application/json") != -1) if (accept != null && accept.contains("application/json"))
{ {
return true; return true;
} }
String xRequestedWith = request.getHeader("X-Requested-With"); String xRequestedWith = request.getHeader("X-Requested-With");
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest"))
{ {
return true; return true;
} }
@@ -171,11 +234,7 @@ public class ServletUtils
} }
String ajax = request.getParameter("__ajax"); String ajax = request.getParameter("__ajax");
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) return StringUtils.inStringIgnoreCase(ajax, "json", "xml");
{
return true;
}
return false;
} }
/** /**
@@ -192,7 +251,7 @@ public class ServletUtils
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
return ""; return StringUtils.EMPTY;
} }
} }
@@ -210,7 +269,65 @@ public class ServletUtils
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
return ""; return StringUtils.EMPTY;
} }
} }
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, R.FAIL);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value, int code)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, HttpStatus status, Object value, int code)
{
return webFluxResponseWriter(response, MediaType.APPLICATION_JSON_VALUE, status, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param contentType content-type
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, String contentType, HttpStatus status, Object value, int code)
{
response.setStatusCode(status);
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType);
R<?> result = R.fail(code, value.toString());
DataBuffer dataBuffer = response.bufferFactory().wrap(JSON.toJSONString(result).getBytes());
return response.writeWith(Mono.just(dataBuffer));
}
} }

View File

@@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.text.StrFormatter; import com.ruoyi.common.core.text.StrFormatter;
/** /**
@@ -19,6 +20,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** 下划线 */ /** 下划线 */
private static final char SEPARATOR = '_'; private static final char SEPARATOR = '_';
/** 星号 */
private static final char ASTERISK = '*';
/** /**
* 获取参数不为空值 * 获取参数不为空值
* *
@@ -159,6 +163,49 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return (str == null ? "" : str.trim()); return (str == null ? "" : str.trim());
} }
/**
* 替换指定字符串的指定区间内字符为"*"
*
* @param str 字符串
* @param startInclude 开始位置(包含)
* @param endExclude 结束位置(不包含)
* @return 替换后的字符串
*/
public static String hide(CharSequence str, int startInclude, int endExclude)
{
if (isEmpty(str))
{
return NULLSTR;
}
final int strLength = str.length();
if (startInclude > strLength)
{
return NULLSTR;
}
if (endExclude > strLength)
{
endExclude = strLength;
}
if (startInclude > endExclude)
{
// 如果起始位置大于结束位置,不替换
return NULLSTR;
}
final char[] chars = new char[strLength];
for (int i = 0; i < strLength; i++)
{
if (i >= startInclude && i < endExclude)
{
chars[i] = ASTERISK;
}
else
{
chars[i] = str.charAt(i);
}
}
return new String(chars);
}
/** /**
* 截取字符串 * 截取字符串
* *
@@ -236,6 +283,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return str.substring(start, end); return str.substring(start, end);
} }
/**
* 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
*
* @param str 要截取的字符串
* @param open 起始字符串
* @param close 结束字符串
* @return 截取结果
*/
public static String substringBetweenLast(final String str, final String open, final String close)
{
if (isEmpty(str) || isEmpty(open) || isEmpty(close))
{
return NULLSTR;
}
final int start = str.indexOf(open);
if (start != INDEX_NOT_FOUND)
{
final int end = str.lastIndexOf(close);
if (end != INDEX_NOT_FOUND)
{
return str.substring(start + open.length(), end);
}
}
return NULLSTR;
}
/** /**
* 判断是否为空,并且不是空白字符 * 判断是否为空,并且不是空白字符
* *
@@ -282,6 +355,43 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return StrFormatter.format(template, params); return StrFormatter.format(template, params);
} }
/**
* 是否为http(s)://开头
*
* @param link 链接
* @return 结果
*/
public static boolean ishttp(String link)
{
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
}
/**
* 判断给定的collection列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value
*
* @param collection 给定的集合
* @param array 给定的数组
* @return boolean 结果
*/
public static boolean containsAny(Collection<String> collection, String... array)
{
if (isEmpty(collection) || isEmpty(array))
{
return false;
}
else
{
for (String str : array)
{
if (collection.contains(str))
{
return true;
}
}
return false;
}
}
/** /**
* 驼峰转下划线命名 * 驼峰转下划线命名
*/ */
@@ -390,7 +500,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
/** /**
* 驼峰式命名法 例如user_name->userName * 驼峰式命名法
* 例如user_name->userName
*/ */
public static String toCamelCase(String s) public static String toCamelCase(String s)
{ {
@@ -398,6 +509,10 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
{ {
return null; return null;
} }
if (s.indexOf(SEPARATOR) == -1)
{
return s;
}
s = s.toLowerCase(); s = s.toLowerCase();
StringBuilder sb = new StringBuilder(s.length()); StringBuilder sb = new StringBuilder(s.length());
boolean upperCase = false; boolean upperCase = false;
@@ -466,4 +581,53 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
{ {
return (T) obj; return (T) obj;
} }
}
/**
* 数字左边补齐0使之达到指定长度。注意如果数字转换为字符串后长度大于size则只保留 最后size个字符。
*
* @param num 数字对象
* @param size 字符串指定长度
* @return 返回数字的字符串格式,该字符串为指定长度。
*/
public static final String padl(final Number num, final int size)
{
return padl(num.toString(), size, '0');
}
/**
* 字符串左补齐。如果原始字符串s长度大于size则只保留最后size个字符。
*
* @param s 原始字符串
* @param size 字符串指定长度
* @param c 用于补齐的字符
* @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
*/
public static final String padl(final String s, final int size, final char c)
{
final StringBuilder sb = new StringBuilder(size);
if (s != null)
{
final int len = s.length();
if (s.length() <= size)
{
for (int i = size - len; i > 0; i--)
{
sb.append(c);
}
sb.append(s);
}
else
{
return s.substring(len - size, len);
}
}
else
{
for (int i = size; i > 0; i--)
{
sb.append(c);
}
}
return sb.toString();
}
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.common.core.utils.bean;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
/**
* bean对象属性验证
*
* @author ruoyi
*/
public class BeanValidators
{
public static void validateWithException(Validator validator, Object object, Class<?>... groups)
throws ConstraintViolationException
{
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty())
{
throw new ConstraintViolationException(constraintViolations);
}
}
}

View File

@@ -1,7 +1,10 @@
package com.ruoyi.common.core.utils.file; package com.ruoyi.common.core.utils.file;
import java.io.File; import java.io.File;
import java.util.Objects;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 文件类型工具类 * 文件类型工具类
@@ -45,6 +48,22 @@ public class FileTypeUtils
return fileName.substring(separatorIndex + 1).toLowerCase(); return fileName.substring(separatorIndex + 1).toLowerCase();
} }
/**
* 获取文件名的后缀
*
* @param file 表单文件
* @return 后缀名
*/
public static final String getExtension(MultipartFile file)
{
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension))
{
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
}
return extension;
}
/** /**
* 获取文件类型 * 获取文件类型
* *

View File

@@ -18,7 +18,7 @@ import com.ruoyi.common.core.utils.StringUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileUtils extends org.apache.commons.io.FileUtils public class FileUtils
{ {
/** 字符常量:斜杠 {@code '/'} */ /** 字符常量:斜杠 {@code '/'} */
public static final char SLASH = '/'; public static final char SLASH = '/';
@@ -97,8 +97,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
// 路径为文件且不为空则进行删除 // 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) if (file.isFile() && file.exists())
{ {
file.delete(); flag = file.delete();
flag = true;
} }
return flag; return flag;
} }
@@ -127,15 +126,8 @@ public class FileUtils extends org.apache.commons.io.FileUtils
{ {
return false; return false;
} }
// 判断是否在允许下载的文件规则内
// 检查允许下载的文件规则 return ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource));
if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
{
return true;
}
// 不在允许下载的文件规则
return false;
} }
/** /**
@@ -244,6 +236,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
.append(percentEncodedFileName); .append(percentEncodedFileName);
response.setHeader("Content-disposition", contentDispositionValue.toString()); response.setHeader("Content-disposition", contentDispositionValue.toString());
response.setHeader("download-filename", percentEncodedFileName);
} }
/** /**

View File

@@ -1,7 +1,6 @@
package com.ruoyi.common.core.utils.file; package com.ruoyi.common.core.utils.file;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
@@ -55,13 +54,12 @@ public class ImageUtils
/** /**
* 读取文件为字节数据 * 读取文件为字节数据
* *
* @param key 地址 * @param url 地址
* @return 字节数据 * @return 字节数据
*/ */
public static byte[] readFile(String url) public static byte[] readFile(String url)
{ {
InputStream in = null; InputStream in = null;
ByteArrayOutputStream baos = null;
try try
{ {
// 网络地址 // 网络地址
@@ -81,7 +79,6 @@ public class ImageUtils
finally finally
{ {
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
IOUtils.closeQuietly(baos);
} }
} }
} }

View File

@@ -0,0 +1,167 @@
package com.ruoyi.common.core.utils.html;
import com.ruoyi.common.core.utils.StringUtils;
/**
* 转义和反转义工具类
*
* @author ruoyi
*/
public class EscapeUtil
{
public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)";
private static final char[][] TEXT = new char[64][];
static
{
for (int i = 0; i < 64; i++)
{
TEXT[i] = new char[] { (char) i };
}
// special HTML characters
TEXT['\''] = "&#039;".toCharArray(); // 单引号
TEXT['"'] = "&#34;".toCharArray(); // 双引号
TEXT['&'] = "&#38;".toCharArray(); // &符
TEXT['<'] = "&#60;".toCharArray(); // 小于号
TEXT['>'] = "&#62;".toCharArray(); // 大于号
}
/**
* 转义文本中的HTML字符为安全的字符
*
* @param text 被转义的文本
* @return 转义后的文本
*/
public static String escape(String text)
{
return encode(text);
}
/**
* 还原被转义的HTML特殊字符
*
* @param content 包含转义符的HTML内容
* @return 转换后的字符串
*/
public static String unescape(String content)
{
return decode(content);
}
/**
* 清除所有HTML标签但是不删除标签内的内容
*
* @param content 文本
* @return 清除标签后的文本
*/
public static String clean(String content)
{
return new HTMLFilter().filter(content);
}
/**
* Escape编码
*
* @param text 被编码的文本
* @return 编码后的字符
*/
private static String encode(String text)
{
if (StringUtils.isEmpty(text))
{
return StringUtils.EMPTY;
}
final StringBuilder tmp = new StringBuilder(text.length() * 6);
char c;
for (int i = 0; i < text.length(); i++)
{
c = text.charAt(i);
if (c < 256)
{
tmp.append("%");
if (c < 16)
{
tmp.append("0");
}
tmp.append(Integer.toString(c, 16));
}
else
{
tmp.append("%u");
if (c <= 0xfff)
{
// issue#I49JU8@Gitee
tmp.append("0");
}
tmp.append(Integer.toString(c, 16));
}
}
return tmp.toString();
}
/**
* Escape解码
*
* @param content 被转义的内容
* @return 解码后的字符串
*/
public static String decode(String content)
{
if (StringUtils.isEmpty(content))
{
return content;
}
StringBuilder tmp = new StringBuilder(content.length());
int lastPos = 0, pos = 0;
char ch;
while (lastPos < content.length())
{
pos = content.indexOf("%", lastPos);
if (pos == lastPos)
{
if (content.charAt(pos + 1) == 'u')
{
ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16);
tmp.append(ch);
lastPos = pos + 6;
}
else
{
ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16);
tmp.append(ch);
lastPos = pos + 3;
}
}
else
{
if (pos == -1)
{
tmp.append(content.substring(lastPos));
lastPos = content.length();
}
else
{
tmp.append(content.substring(lastPos, pos));
lastPos = pos;
}
}
}
return tmp.toString();
}
public static void main(String[] args)
{
String html = "<script>alert(1);</script>";
String escape = EscapeUtil.escape(html);
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
// String html = "<123";
// String html = "123>";
System.out.println("clean: " + EscapeUtil.clean(html));
System.out.println("escape: " + escape);
System.out.println("unescape: " + EscapeUtil.unescape(escape));
}
}

View File

@@ -0,0 +1,570 @@
package com.ruoyi.common.core.utils.html;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* HTML过滤器用于去除XSS漏洞隐患。
*
* @author ruoyi
*/
public final class HTMLFilter
{
/**
* regex flag union representing /si modifiers in php
**/
private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL;
private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL);
private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI);
private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL);
private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI);
private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI);
private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI);
private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI);
private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI);
private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?");
private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?");
private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?");
private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))");
private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL);
private static final Pattern P_END_ARROW = Pattern.compile("^>");
private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)");
private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)");
private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)");
private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)");
private static final Pattern P_AMP = Pattern.compile("&");
private static final Pattern P_QUOTE = Pattern.compile("\"");
private static final Pattern P_LEFT_ARROW = Pattern.compile("<");
private static final Pattern P_RIGHT_ARROW = Pattern.compile(">");
private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>");
// @xxx could grow large... maybe use sesat's ReferenceMap
private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>();
private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>();
/**
* set of allowed html elements, along with allowed attributes for each element
**/
private final Map<String, List<String>> vAllowed;
/**
* counts of open tags for each (allowable) html element
**/
private final Map<String, Integer> vTagCounts = new HashMap<>();
/**
* html elements which must always be self-closing (e.g. "<img />")
**/
private final String[] vSelfClosingTags;
/**
* html elements which must always have separate opening and closing tags (e.g. "<b></b>")
**/
private final String[] vNeedClosingTags;
/**
* set of disallowed html elements
**/
private final String[] vDisallowed;
/**
* attributes which should be checked for valid protocols
**/
private final String[] vProtocolAtts;
/**
* allowed protocols
**/
private final String[] vAllowedProtocols;
/**
* tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />")
**/
private final String[] vRemoveBlanks;
/**
* entities allowed within html markup
**/
private final String[] vAllowedEntities;
/**
* flag determining whether comments are allowed in input String.
*/
private final boolean stripComment;
private final boolean encodeQuotes;
/**
* flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "<b text </b>"
* becomes "<b> text </b>"). If set to false, unbalanced angle brackets will be html escaped.
*/
private final boolean alwaysMakeTags;
/**
* Default constructor.
*/
public HTMLFilter()
{
vAllowed = new HashMap<>();
final ArrayList<String> a_atts = new ArrayList<>();
a_atts.add("href");
a_atts.add("target");
vAllowed.put("a", a_atts);
final ArrayList<String> img_atts = new ArrayList<>();
img_atts.add("src");
img_atts.add("width");
img_atts.add("height");
img_atts.add("alt");
vAllowed.put("img", img_atts);
final ArrayList<String> no_atts = new ArrayList<>();
vAllowed.put("b", no_atts);
vAllowed.put("strong", no_atts);
vAllowed.put("i", no_atts);
vAllowed.put("em", no_atts);
vSelfClosingTags = new String[] { "img" };
vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" };
vDisallowed = new String[] {};
vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp.
vProtocolAtts = new String[] { "src", "href" };
vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" };
vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" };
stripComment = true;
encodeQuotes = true;
alwaysMakeTags = false;
}
/**
* Map-parameter configurable constructor.
*
* @param conf map containing configuration. keys match field names.
*/
@SuppressWarnings("unchecked")
public HTMLFilter(final Map<String, Object> conf)
{
assert conf.containsKey("vAllowed") : "configuration requires vAllowed";
assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags";
assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags";
assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed";
assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols";
assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts";
assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks";
assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities";
vAllowed = Collections.unmodifiableMap((HashMap<String, List<String>>) conf.get("vAllowed"));
vSelfClosingTags = (String[]) conf.get("vSelfClosingTags");
vNeedClosingTags = (String[]) conf.get("vNeedClosingTags");
vDisallowed = (String[]) conf.get("vDisallowed");
vAllowedProtocols = (String[]) conf.get("vAllowedProtocols");
vProtocolAtts = (String[]) conf.get("vProtocolAtts");
vRemoveBlanks = (String[]) conf.get("vRemoveBlanks");
vAllowedEntities = (String[]) conf.get("vAllowedEntities");
stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true;
encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true;
alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true;
}
private void reset()
{
vTagCounts.clear();
}
// ---------------------------------------------------------------
// my versions of some PHP library functions
public static String chr(final int decimal)
{
return String.valueOf((char) decimal);
}
public static String htmlSpecialChars(final String s)
{
String result = s;
result = regexReplace(P_AMP, "&amp;", result);
result = regexReplace(P_QUOTE, "&quot;", result);
result = regexReplace(P_LEFT_ARROW, "&lt;", result);
result = regexReplace(P_RIGHT_ARROW, "&gt;", result);
return result;
}
// ---------------------------------------------------------------
/**
* given a user submitted input String, filter out any invalid or restricted html.
*
* @param input text (i.e. submitted by a user) than may contain html
* @return "clean" version of input, with only valid, whitelisted html elements allowed
*/
public String filter(final String input)
{
reset();
String s = input;
s = escapeComments(s);
s = balanceHTML(s);
s = checkTags(s);
s = processRemoveBlanks(s);
// s = validateEntities(s);
return s;
}
public boolean isAlwaysMakeTags()
{
return alwaysMakeTags;
}
public boolean isStripComments()
{
return stripComment;
}
private String escapeComments(final String s)
{
final Matcher m = P_COMMENTS.matcher(s);
final StringBuffer buf = new StringBuffer();
if (m.find())
{
final String match = m.group(1); // (.*?)
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
}
m.appendTail(buf);
return buf.toString();
}
private String balanceHTML(String s)
{
if (alwaysMakeTags)
{
//
// try and form html
//
s = regexReplace(P_END_ARROW, "", s);
// 不追加结束标签
s = regexReplace(P_BODY_TO_END, "<$1>", s);
s = regexReplace(P_XML_CONTENT, "$1<$2", s);
}
else
{
//
// escape stray brackets
//
s = regexReplace(P_STRAY_LEFT_ARROW, "&lt;$1", s);
s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2&gt;<", s);
//
// the last regexp causes '<>' entities to appear
// (we need to do a lookahead assertion so that the last bracket can
// be used in the next pass of the regexp)
//
s = regexReplace(P_BOTH_ARROWS, "", s);
}
return s;
}
private String checkTags(String s)
{
Matcher m = P_TAGS.matcher(s);
final StringBuffer buf = new StringBuffer();
while (m.find())
{
String replaceStr = m.group(1);
replaceStr = processTag(replaceStr);
m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr));
}
m.appendTail(buf);
// these get tallied in processTag
// (remember to reset before subsequent calls to filter method)
final StringBuilder sBuilder = new StringBuilder(buf.toString());
for (String key : vTagCounts.keySet())
{
for (int ii = 0; ii < vTagCounts.get(key); ii++)
{
sBuilder.append("</").append(key).append(">");
}
}
s = sBuilder.toString();
return s;
}
private String processRemoveBlanks(final String s)
{
String result = s;
for (String tag : vRemoveBlanks)
{
if (!P_REMOVE_PAIR_BLANKS.containsKey(tag))
{
P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">"));
}
result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result);
if (!P_REMOVE_SELF_BLANKS.containsKey(tag))
{
P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>"));
}
result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result);
}
return result;
}
private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s)
{
Matcher m = regex_pattern.matcher(s);
return m.replaceAll(replacement);
}
private String processTag(final String s)
{
// ending tags
Matcher m = P_END_TAG.matcher(s);
if (m.find())
{
final String name = m.group(1).toLowerCase();
if (allowed(name))
{
if (!inArray(name, vSelfClosingTags))
{
if (vTagCounts.containsKey(name))
{
vTagCounts.put(name, vTagCounts.get(name) - 1);
return "</" + name + ">";
}
}
}
}
// starting tags
m = P_START_TAG.matcher(s);
if (m.find())
{
final String name = m.group(1).toLowerCase();
final String body = m.group(2);
String ending = m.group(3);
// debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" );
if (allowed(name))
{
final StringBuilder params = new StringBuilder();
final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body);
final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body);
final List<String> paramNames = new ArrayList<>();
final List<String> paramValues = new ArrayList<>();
while (m2.find())
{
paramNames.add(m2.group(1)); // ([a-z0-9]+)
paramValues.add(m2.group(3)); // (.*?)
}
while (m3.find())
{
paramNames.add(m3.group(1)); // ([a-z0-9]+)
paramValues.add(m3.group(3)); // ([^\"\\s']+)
}
String paramName, paramValue;
for (int ii = 0; ii < paramNames.size(); ii++)
{
paramName = paramNames.get(ii).toLowerCase();
paramValue = paramValues.get(ii);
// debug( "paramName='" + paramName + "'" );
// debug( "paramValue='" + paramValue + "'" );
// debug( "allowed? " + vAllowed.get( name ).contains( paramName ) );
if (allowedAttribute(name, paramName))
{
if (inArray(paramName, vProtocolAtts))
{
paramValue = processParamProtocol(paramValue);
}
params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\\\"");
}
}
if (inArray(name, vSelfClosingTags))
{
ending = " /";
}
if (inArray(name, vNeedClosingTags))
{
ending = "";
}
if (ending == null || ending.length() < 1)
{
if (vTagCounts.containsKey(name))
{
vTagCounts.put(name, vTagCounts.get(name) + 1);
}
else
{
vTagCounts.put(name, 1);
}
}
else
{
ending = " /";
}
return "<" + name + params + ending + ">";
}
else
{
return "";
}
}
// comments
m = P_COMMENT.matcher(s);
if (!stripComment && m.find())
{
return "<" + m.group() + ">";
}
return "";
}
private String processParamProtocol(String s)
{
s = decodeEntities(s);
final Matcher m = P_PROTOCOL.matcher(s);
if (m.find())
{
final String protocol = m.group(1);
if (!inArray(protocol, vAllowedProtocols))
{
// bad protocol, turn into local anchor link instead
s = "#" + s.substring(protocol.length() + 1);
if (s.startsWith("#//"))
{
s = "#" + s.substring(3);
}
}
}
return s;
}
private String decodeEntities(String s)
{
StringBuffer buf = new StringBuffer();
Matcher m = P_ENTITY.matcher(s);
while (m.find())
{
final String match = m.group(1);
final int decimal = Integer.decode(match).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
buf = new StringBuffer();
m = P_ENTITY_UNICODE.matcher(s);
while (m.find())
{
final String match = m.group(1);
final int decimal = Integer.valueOf(match, 16).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
buf = new StringBuffer();
m = P_ENCODE.matcher(s);
while (m.find())
{
final String match = m.group(1);
final int decimal = Integer.valueOf(match, 16).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
s = validateEntities(s);
return s;
}
private String validateEntities(final String s)
{
StringBuffer buf = new StringBuffer();
// validate entities throughout the string
Matcher m = P_VALID_ENTITIES.matcher(s);
while (m.find())
{
final String one = m.group(1); // ([^&;]*)
final String two = m.group(2); // (?=(;|&|$))
m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two)));
}
m.appendTail(buf);
return encodeQuotes(buf.toString());
}
private String encodeQuotes(final String s)
{
if (encodeQuotes)
{
StringBuffer buf = new StringBuffer();
Matcher m = P_VALID_QUOTES.matcher(s);
while (m.find())
{
final String one = m.group(1); // (>|^)
final String two = m.group(2); // ([^<]+?)
final String three = m.group(3); // (<|$)
// 不替换双引号为&quot;防止json格式无效 regexReplace(P_QUOTE, "&quot;", two)
m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
}
m.appendTail(buf);
return buf.toString();
}
else
{
return s;
}
}
private String checkEntity(final String preamble, final String term)
{
return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&amp;" + preamble;
}
private boolean isValidEntity(final String entity)
{
return inArray(entity, vAllowedEntities);
}
private static boolean inArray(final String s, final String[] array)
{
for (String item : array)
{
if (item != null && item.equals(s))
{
return true;
}
}
return false;
}
private boolean allowed(final String name)
{
return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed);
}
private boolean allowedAttribute(final String name, final String paramName)
{
return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName));
}
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.common.core.utils.ip;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
/** /**
@@ -12,58 +13,79 @@ import com.ruoyi.common.core.utils.StringUtils;
*/ */
public class IpUtils public class IpUtils
{ {
public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)";
// 匹配 ip
public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")";
public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))";
// 匹配网段
public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")";
/**
* 获取客户端IP
*
* @return IP地址
*/
public static String getIpAddr()
{
return getIpAddr(ServletUtils.getRequest());
}
/**
* 获取客户端IP
*
* @param request 请求对象
* @return IP地址
*/
public static String getIpAddr(HttpServletRequest request) public static String getIpAddr(HttpServletRequest request)
{ {
if (request == null) if (request == null)
{ {
return null; return "unknown";
}
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("X-Real-IP");
} }
String ip = null; if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
// X-Forwarded-ForSquid 服务代理
String ipAddresses = request.getHeader("X-Forwarded-For");
if (ipAddresses == null || ipAddresses.length() == 0 || "unknown".equalsIgnoreCase(ipAddresses))
{
// Proxy-Client-IPapache 服务代理
ipAddresses = request.getHeader("Proxy-Client-IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || "unknown".equalsIgnoreCase(ipAddresses))
{
// WL-Proxy-Client-IPweblogic 服务代理
ipAddresses = request.getHeader("WL-Proxy-Client-IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || "unknown".equalsIgnoreCase(ipAddresses))
{
// HTTP_CLIENT_IP有些代理服务器
ipAddresses = request.getHeader("HTTP_CLIENT_IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || "unknown".equalsIgnoreCase(ipAddresses))
{
// X-Real-IPnginx服务代理
ipAddresses = request.getHeader("X-Real-IP");
}
// 有些网络通过多层代理那么获取到的ip就会有多个一般都是通过逗号,分割开来并且第一个ip为客户端的真实IP
if (ipAddresses != null && ipAddresses.length() != 0)
{
ip = ipAddresses.split(",")[0];
}
// 还是不能获取到最后再通过request.getRemoteAddr();获取
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ipAddresses))
{ {
ip = request.getRemoteAddr(); ip = request.getRemoteAddr();
} }
return ip.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ip;
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
} }
/**
* 检查是否为内部IP地址
*
* @param ip IP地址
* @return 结果
*/
public static boolean internalIp(String ip) public static boolean internalIp(String ip)
{ {
byte[] addr = textToNumericFormatV4(ip); byte[] addr = textToNumericFormatV4(ip);
return internalIp(addr) || "127.0.0.1".equals(ip); return internalIp(addr) || "127.0.0.1".equals(ip);
} }
/**
* 检查是否为内部IP地址
*
* @param addr byte地址
* @return 结果
*/
private static boolean internalIp(byte[] addr) private static boolean internalIp(byte[] addr)
{ {
if (StringUtils.isNull(addr) || addr.length < 2) if (StringUtils.isNull(addr) || addr.length < 2)
@@ -124,7 +146,8 @@ public class IpUtils
{ {
case 1: case 1:
l = Long.parseLong(elements[0]); l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)){ if ((l < 0L) || (l > 4294967295L))
{
return null; return null;
} }
bytes[0] = (byte) (int) (l >> 24 & 0xFF); bytes[0] = (byte) (int) (l >> 24 & 0xFF);
@@ -134,12 +157,14 @@ public class IpUtils
break; break;
case 2: case 2:
l = Integer.parseInt(elements[0]); l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[0] = (byte) (int) (l & 0xFF); bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]); l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) { if ((l < 0L) || (l > 16777215L))
{
return null; return null;
} }
bytes[1] = (byte) (int) (l >> 16 & 0xFF); bytes[1] = (byte) (int) (l >> 16 & 0xFF);
@@ -150,13 +175,15 @@ public class IpUtils
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
} }
l = Integer.parseInt(elements[2]); l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) { if ((l < 0L) || (l > 65535L))
{
return null; return null;
} }
bytes[2] = (byte) (int) (l >> 8 & 0xFF); bytes[2] = (byte) (int) (l >> 8 & 0xFF);
@@ -166,7 +193,8 @@ public class IpUtils
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
@@ -183,6 +211,11 @@ public class IpUtils
return bytes; return bytes;
} }
/**
* 获取IP地址
*
* @return 本地IP地址
*/
public static String getHostIp() public static String getHostIp()
{ {
try try
@@ -195,6 +228,11 @@ public class IpUtils
return "127.0.0.1"; return "127.0.0.1";
} }
/**
* 获取主机名
*
* @return 本地主机名
*/
public static String getHostName() public static String getHostName()
{ {
try try
@@ -206,4 +244,139 @@ public class IpUtils
} }
return "未知"; return "未知";
} }
/**
* 从多级反向代理中获得第一个非unknown IP地址
*
* @param ip 获得的IP地址
* @return 第一个非unknown IP地址
*/
public static String getMultistageReverseProxyIp(String ip)
{
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0)
{
final String[] ips = ip.trim().split(",");
for (String subIp : ips)
{
if (false == isUnknown(subIp))
{
ip = subIp;
break;
}
}
}
return StringUtils.substring(ip, 0, 255);
}
/**
* 检测给定字符串是否为未知多用于检测HTTP请求相关
*
* @param checkString 被检测的字符串
* @return 是否未知
*/
public static boolean isUnknown(String checkString)
{
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
}
/**
* 是否为IP
*/
public static boolean isIP(String ip)
{
return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP);
}
/**
* 是否为IP或 *为间隔的通配符地址
*/
public static boolean isIpWildCard(String ip)
{
return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD);
}
/**
* 检测参数是否在ip通配符里
*/
public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip)
{
String[] s1 = ipWildCard.split("\\.");
String[] s2 = ip.split("\\.");
boolean isMatchedSeg = true;
for (int i = 0; i < s1.length && !s1[i].equals("*"); i++)
{
if (!s1[i].equals(s2[i]))
{
isMatchedSeg = false;
break;
}
}
return isMatchedSeg;
}
/**
* 是否为特定格式如:“10.10.10.1-10.10.10.99”的ip段字符串
*/
public static boolean isIPSegment(String ipSeg)
{
return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG);
}
/**
* 判断ip是否在指定网段中
*/
public static boolean ipIsInNetNoCheck(String iparea, String ip)
{
int idx = iparea.indexOf('-');
String[] sips = iparea.substring(0, idx).split("\\.");
String[] sipe = iparea.substring(idx + 1).split("\\.");
String[] sipt = ip.split("\\.");
long ips = 0L, ipe = 0L, ipt = 0L;
for (int i = 0; i < 4; ++i)
{
ips = ips << 8 | Integer.parseInt(sips[i]);
ipe = ipe << 8 | Integer.parseInt(sipe[i]);
ipt = ipt << 8 | Integer.parseInt(sipt[i]);
}
if (ips > ipe)
{
long t = ips;
ips = ipe;
ipe = t;
}
return ips <= ipt && ipt <= ipe;
}
/**
* 校验ip是否符合过滤串规则
*
* @param filter 过滤IP列表,支持后缀'*'通配,支持网段如:`10.10.10.1-10.10.10.99`
* @param ip 校验IP地址
* @return boolean 结果
*/
public static boolean isMatchedIp(String filter, String ip)
{
if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip))
{
return false;
}
String[] ips = filter.split(";");
for (String iStr : ips)
{
if (isIP(iStr) && iStr.equals(ip))
{
return true;
}
else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip))
{
return true;
}
else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip))
{
return true;
}
}
return false;
}
} }

View File

@@ -0,0 +1,24 @@
package com.ruoyi.common.core.utils.poi;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook;
/**
* Excel数据格式处理适配器
*
* @author ruoyi
*/
public interface ExcelHandlerAdapter
{
/**
* 格式化
*
* @param value 单元格数据值
* @param args excel注解args参数组
* @param cell 单元格对象
* @param wb 工作簿对象
*
* @return 处理后的值
*/
Object format(Object value, String[] args, Cell cell, Workbook wb);
}

View File

@@ -1,6 +1,6 @@
package com.ruoyi.common.core.utils.sql; package com.ruoyi.common.core.utils.sql;
import com.ruoyi.common.core.exception.BaseException; import com.ruoyi.common.core.exception.UtilException;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
/** /**
@@ -10,11 +10,21 @@ import com.ruoyi.common.core.utils.StringUtils;
*/ */
public class SqlUtil public class SqlUtil
{ {
/**
* 定义常用的 sql关键字
*/
public static String SQL_REGEX = "\u000B|and |extractvalue|updatexml|sleep|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |union |like |+|/*|user()";
/** /**
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
*/ */
public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
/**
* 限制orderBy最大长度
*/
private static final int ORDER_BY_MAX_LENGTH = 500;
/** /**
* 检查字符,防止注入绕过 * 检查字符,防止注入绕过
*/ */
@@ -22,7 +32,11 @@ public class SqlUtil
{ {
if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value))
{ {
throw new BaseException("参数不符合规范,不能进行查询"); throw new UtilException("参数不符合规范,不能进行查询");
}
if (StringUtils.length(value) > ORDER_BY_MAX_LENGTH)
{
throw new UtilException("参数已超过最大限制,不能进行查询");
} }
return value; return value;
} }
@@ -34,4 +48,23 @@ public class SqlUtil
{ {
return value.matches(SQL_PATTERN); return value.matches(SQL_PATTERN);
} }
/**
* SQL关键字检查
*/
public static void filterKeyword(String value)
{
if (StringUtils.isEmpty(value))
{
return;
}
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
for (String sqlKeyword : sqlKeywords)
{
if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1)
{
throw new UtilException("参数存在SQL注入风险");
}
}
}
} }

View File

@@ -1,6 +1,4 @@
package com.ruoyi.common.core.utils; package com.ruoyi.common.core.utils.uuid;
import com.ruoyi.common.core.text.UUID;
/** /**
* ID生成器工具类 * ID生成器工具类

View File

@@ -0,0 +1,86 @@
package com.ruoyi.common.core.utils.uuid;
import java.util.concurrent.atomic.AtomicInteger;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
/**
* @author ruoyi 序列生成类
*/
public class Seq
{
// 通用序列类型
public static final String commSeqType = "COMMON";
// 上传序列类型
public static final String uploadSeqType = "UPLOAD";
// 通用接口序列数
private static AtomicInteger commSeq = new AtomicInteger(1);
// 上传接口序列数
private static AtomicInteger uploadSeq = new AtomicInteger(1);
// 机器标识
private static final String machineCode = "A";
/**
* 获取通用序列号
*
* @return 序列值
*/
public static String getId()
{
return getId(commSeqType);
}
/**
* 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串
*
* @return 序列值
*/
public static String getId(String type)
{
AtomicInteger atomicInt = commSeq;
if (uploadSeqType.equals(type))
{
atomicInt = uploadSeq;
}
return getId(atomicInt, 3);
}
/**
* 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串
*
* @param atomicInt 序列数
* @param length 数值长度
* @return 序列值
*/
public static String getId(AtomicInteger atomicInt, int length)
{
String result = DateUtils.dateTimeNow();
result += machineCode;
result += getSeq(atomicInt, length);
return result;
}
/**
* 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数
*
* @return 序列值
*/
private synchronized static String getSeq(AtomicInteger atomicInt, int length)
{
// 先取值再+1
int value = atomicInt.getAndIncrement();
// 如果更新后值>=10 的 (length)幂次方则重置为1
int maxSeq = (int) Math.pow(10, length);
if (atomicInt.get() >= maxSeq)
{
atomicInt.set(1);
}
// 转字符串用0左补齐
return StringUtils.padl(value, length);
}
}

View File

@@ -1,4 +1,4 @@
package com.ruoyi.common.core.text; package com.ruoyi.common.core.utils.uuid;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@@ -66,7 +66,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
} }
/** /**
* 获取类型 4伪随机生成的UUID 的静态工厂 使用加密的本地线程伪随机数生成器生成该 UUID * 获取类型 4伪随机生成的UUID 的静态工厂
* *
* @return 随机生成的 {@code UUID} * @return 随机生成的 {@code UUID}
*/ */

View File

@@ -7,16 +7,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.PageUtils;
import com.ruoyi.common.core.utils.sql.SqlUtil;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.core.web.page.TableSupport;
/** /**
* web层通用数据处理 * web层通用数据处理
@@ -49,14 +45,15 @@ public class BaseController
*/ */
protected void startPage() protected void startPage()
{ {
PageDomain pageDomain = TableSupport.buildPageRequest(); PageUtils.startPage();
Integer pageNum = pageDomain.getPageNum(); }
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) /**
{ * 清理分页的线程变量
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); */
PageHelper.startPage(pageNum, pageSize, orderBy); protected void clearPage()
} {
PageUtils.clearPage();
} }
/** /**
@@ -73,6 +70,54 @@ public class BaseController
return rspData; return rspData;
} }
/**
* 返回成功
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
* 返回成功消息
*/
public AjaxResult success(Object data)
{
return AjaxResult.success(data);
}
/**
* 返回失败消息
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
/**
* 返回警告消息
*/
public AjaxResult warn(String message)
{
return AjaxResult.warn(message);
}
/** /**
* 响应返回结果 * 响应返回结果
* *
@@ -94,36 +139,4 @@ public class BaseController
{ {
return result ? success() : error(); return result ? success() : error();
} }
/**
* 返回成功
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
* 返回失败消息
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
} }

View File

@@ -1,6 +1,7 @@
package com.ruoyi.common.core.web.domain; package com.ruoyi.common.core.web.domain;
import java.util.HashMap; import java.util.HashMap;
import java.util.Objects;
import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
@@ -57,20 +58,6 @@ public class AjaxResult extends HashMap<String, Object>
super.put(DATA_TAG, data); super.put(DATA_TAG, data);
} }
} }
/**
* 方便链式调用
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
/** /**
* 返回成功消息 * 返回成功消息
@@ -115,10 +102,33 @@ public class AjaxResult extends HashMap<String, Object>
return new AjaxResult(HttpStatus.SUCCESS, msg, data); return new AjaxResult(HttpStatus.SUCCESS, msg, data);
} }
/**
* 返回警告消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult warn(String msg)
{
return AjaxResult.warn(msg, null);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data)
{
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/** /**
* 返回错误消息 * 返回错误消息
* *
* @return * @return 错误消息
*/ */
public static AjaxResult error() public static AjaxResult error()
{ {
@@ -129,7 +139,7 @@ public class AjaxResult extends HashMap<String, Object>
* 返回错误消息 * 返回错误消息
* *
* @param msg 返回内容 * @param msg 返回内容
* @return 警告消息 * @return 错误消息
*/ */
public static AjaxResult error(String msg) public static AjaxResult error(String msg)
{ {
@@ -141,7 +151,7 @@ public class AjaxResult extends HashMap<String, Object>
* *
* @param msg 返回内容 * @param msg 返回内容
* @param data 数据对象 * @param data 数据对象
* @return 警告消息 * @return 错误消息
*/ */
public static AjaxResult error(String msg, Object data) public static AjaxResult error(String msg, Object data)
{ {
@@ -153,10 +163,54 @@ public class AjaxResult extends HashMap<String, Object>
* *
* @param code 状态码 * @param code 状态码
* @param msg 返回内容 * @param msg 返回内容
* @return 警告消息 * @return 错误消息
*/ */
public static AjaxResult error(int code, String msg) public static AjaxResult error(int code, String msg)
{ {
return new AjaxResult(code, msg, null); return new AjaxResult(code, msg, null);
} }
/**
* 是否为成功消息
*
* @return 结果
*/
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
* 是否为警告消息
*
* @return 结果
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
* 是否为错误消息
*
* @return 结果
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 方便链式调用
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
} }

View File

@@ -5,6 +5,8 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
/** /**
* Entity基类 * Entity基类
@@ -16,6 +18,7 @@ public class BaseEntity implements Serializable
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 搜索值 */ /** 搜索值 */
@JsonIgnore
private String searchValue; private String searchValue;
/** 创建者 */ /** 创建者 */
@@ -36,6 +39,7 @@ public class BaseEntity implements Serializable
private String remark; private String remark;
/** 请求参数 */ /** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params; private Map<String, Object> params;
public String getSearchValue() public String getSearchValue()

View File

@@ -21,6 +21,9 @@ public class PageDomain
/** 排序的方向desc或者asc */ /** 排序的方向desc或者asc */
private String isAsc = "asc"; private String isAsc = "asc";
/** 分页参数合理化 */
private Boolean reasonable = true;
public String getOrderBy() public String getOrderBy()
{ {
if (StringUtils.isEmpty(orderByColumn)) if (StringUtils.isEmpty(orderByColumn))
@@ -67,6 +70,32 @@ public class PageDomain
public void setIsAsc(String isAsc) public void setIsAsc(String isAsc)
{ {
this.isAsc = isAsc; if (StringUtils.isNotEmpty(isAsc))
{
// 兼容前端排序类型
if ("ascending".equals(isAsc))
{
isAsc = "asc";
}
else if ("descending".equals(isAsc))
{
isAsc = "desc";
}
this.isAsc = isAsc;
}
}
public Boolean getReasonable()
{
if (StringUtils.isNull(reasonable))
{
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
this.reasonable = reasonable;
} }
} }

View File

@@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable
* @param list 列表数据 * @param list 列表数据
* @param total 总记录数 * @param total 总记录数
*/ */
public TableDataInfo(List<?> list, int total) public TableDataInfo(List<?> list, long total)
{ {
this.rows = list; this.rows = list;
this.total = total; this.total = total;

View File

@@ -1,5 +1,6 @@
package com.ruoyi.common.core.web.page; package com.ruoyi.common.core.web.page;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.ServletUtils;
/** /**
@@ -29,16 +30,22 @@ public class TableSupport
*/ */
public static final String IS_ASC = "isAsc"; public static final String IS_ASC = "isAsc";
/**
* 分页参数合理化
*/
public static final String REASONABLE = "reasonable";
/** /**
* 封装分页对象 * 封装分页对象
*/ */
public static PageDomain getPageDomain() public static PageDomain getPageDomain()
{ {
PageDomain pageDomain = new PageDomain(); PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
return pageDomain; return pageDomain;
} }

View File

@@ -0,0 +1,27 @@
package com.ruoyi.common.core.xss;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 自定义xss校验注解
*
* @author ruoyi
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER })
@Constraint(validatedBy = { XssValidator.class })
public @interface Xss
{
String message()
default "不允许任何脚本运行";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

View File

@@ -0,0 +1,39 @@
package com.ruoyi.common.core.xss;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import com.ruoyi.common.core.utils.StringUtils;
/**
* 自定义xss校验注解实现
*
* @author ruoyi
*/
public class XssValidator implements ConstraintValidator<Xss, String>
{
private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />";
@Override
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
{
if (StringUtils.isBlank(value))
{
return true;
}
return !containsHtml(value);
}
public static boolean containsHtml(String value)
{
StringBuilder sHtml = new StringBuilder();
Pattern pattern = Pattern.compile(HTML_PATTERN);
Matcher matcher = pattern.matcher(value);
while (matcher.find())
{
sHtml.append(matcher.group());
}
return pattern.matcher(sHtml).matches();
}
}

View File

@@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.ruoyi.common.core.utils.SpringUtils

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.0.0</version> <version>3.6.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -25,4 +25,9 @@ public @interface DataScope
* 用户表的别名 * 用户表的别名
*/ */
public String userAlias() default ""; public String userAlias() default "";
/**
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取多个权限用逗号分隔开来
*/
public String permission() default "";
} }

View File

@@ -1,18 +1,18 @@
package com.ruoyi.common.datascope.aspect; package com.ruoyi.common.datascope.aspect;
import java.lang.reflect.Method; import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysRole; import com.ruoyi.system.api.domain.SysRole;
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;
@@ -56,40 +56,25 @@ public class DataScopeAspect
*/ */
public static final String DATA_SCOPE = "dataScope"; public static final String DATA_SCOPE = "dataScope";
@Autowired @Before("@annotation(controllerDataScope)")
private TokenService tokenService; public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
// 配置织入点
@Pointcut("@annotation(com.ruoyi.common.datascope.annotation.DataScope)")
public void dataScopePointCut()
{
}
@Before("dataScopePointCut()")
public void doBefore(JoinPoint point) throws Throwable
{ {
clearDataScope(point); clearDataScope(point);
handleDataScope(point); handleDataScope(point, controllerDataScope);
} }
protected void handleDataScope(final JoinPoint joinPoint) protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope)
{ {
// 获得注解
DataScope controllerDataScope = getAnnotationLog(joinPoint);
if (controllerDataScope == null)
{
return;
}
// 获取当前的用户 // 获取当前的用户
LoginUser loginUser = tokenService.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (StringUtils.isNotNull(loginUser)) if (StringUtils.isNotNull(loginUser))
{ {
SysUser currentUser = loginUser.getSysUser(); SysUser currentUser = loginUser.getSysUser();
// 如果是超级管理员,则不过滤数据 // 如果是超级管理员,则不过滤数据
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
{ {
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission());
controllerDataScope.userAlias()); dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(), permission);
} }
} }
} }
@@ -101,24 +86,48 @@ public class DataScopeAspect
* @param user 用户 * @param user 用户
* @param deptAlias 部门别名 * @param deptAlias 部门别名
* @param userAlias 用户别名 * @param userAlias 用户别名
* @param permission 权限字符
*/ */
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias) public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
{ {
StringBuilder sqlString = new StringBuilder(); StringBuilder sqlString = new StringBuilder();
List<String> conditions = new ArrayList<String>();
List<String> scopeCustomIds = new ArrayList<String>();
user.getRoles().forEach(role -> {
if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
{
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
}
});
for (SysRole role : user.getRoles()) for (SysRole role : user.getRoles())
{ {
String dataScope = role.getDataScope(); String dataScope = role.getDataScope();
if (conditions.contains(dataScope) || StringUtils.equals(role.getStatus(), UserConstants.ROLE_DISABLE))
{
continue;
}
if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
{
continue;
}
if (DATA_SCOPE_ALL.equals(dataScope)) if (DATA_SCOPE_ALL.equals(dataScope))
{ {
sqlString = new StringBuilder(); sqlString = new StringBuilder();
conditions.add(dataScope);
break; break;
} }
else if (DATA_SCOPE_CUSTOM.equals(dataScope)) else if (DATA_SCOPE_CUSTOM.equals(dataScope))
{ {
sqlString.append(StringUtils.format( if (scopeCustomIds.size() > 1)
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, {
role.getRoleId())); // 多个自定数据权限使用in查询避免多次拼接。
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptAlias, String.join(",", scopeCustomIds)));
}
else
{
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, role.getRoleId()));
}
} }
else if (DATA_SCOPE_DEPT.equals(dataScope)) else if (DATA_SCOPE_DEPT.equals(dataScope))
{ {
@@ -126,9 +135,7 @@ public class DataScopeAspect
} }
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
{ {
sqlString.append(StringUtils.format( sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptAlias, user.getDeptId(), user.getDeptId()));
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
deptAlias, user.getDeptId(), user.getDeptId()));
} }
else if (DATA_SCOPE_SELF.equals(dataScope)) else if (DATA_SCOPE_SELF.equals(dataScope))
{ {
@@ -139,9 +146,16 @@ public class DataScopeAspect
else else
{ {
// 数据权限为仅本人且没有userAlias别名不查询任何数据 // 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(" OR 1=0 "); sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
} }
} }
conditions.add(dataScope);
}
// 角色都不包含传递过来的权限字符这个时候sqlString也会为空所以要限制一下,不查询任何数据
if (StringUtils.isEmpty(conditions))
{
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
} }
if (StringUtils.isNotBlank(sqlString.toString())) if (StringUtils.isNotBlank(sqlString.toString()))
@@ -155,22 +169,6 @@ public class DataScopeAspect
} }
} }
/**
* 是否存在注解,如果存在就获取
*/
private DataScope getAnnotationLog(JoinPoint joinPoint)
{
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method != null)
{
return method.getAnnotation(DataScope.class);
}
return null;
}
/** /**
* 拼接权限sql前先清空params.dataScope参数防止注入 * 拼接权限sql前先清空params.dataScope参数防止注入
*/ */

View File

@@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.ruoyi.common.datascope.aspect.DataScopeAspect

View File

@@ -0,0 +1 @@
com.ruoyi.common.datascope.aspect.DataScopeAspect

View File

@@ -5,19 +5,19 @@
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<version>3.0.0</version> <version>3.6.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common-datasource</artifactId> <artifactId>ruoyi-common-datasource</artifactId>
<description> <description>
ruoyi-common-datasource多数据源 ruoyi-common-datasource多数据源
</description> </description>
<dependencies> <dependencies>
<!-- Druid --> <!-- Druid -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId> <artifactId>druid-spring-boot-starter</artifactId>
@@ -30,12 +30,6 @@
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic-ds.version}</version> <version>${dynamic-ds.version}</version>
</dependency> </dependency>
<!-- SpringBoot Seata -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

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