122 Commits

Author SHA1 Message Date
RuoYi
df0f7d16a4 添加菜单路由地址和名称的校验规则 2026-01-09 11:19:12 +08:00
RuoYi
a5ced3b531 优化防重提交间隔时间可自定义 2026-01-08 13:42:35 +08:00
RuoYi
2d9ce89b2e 修复Excel自定义格式样式污染问题 2026-01-06 13:55:05 +08:00
RuoYi
ec8e955955 copyright 2026 2026-01-05 15:10:29 +08:00
RuoYi
0398aa0333 将isAdmin方法统一到SecurityUtils 2026-01-05 15:10:16 +08:00
RuoYi
14063cd6ed 若依 3.6.7 2025-12-22 09:17:25 +08:00
RuoYi
a8b6799d8d 优化topbar顶部菜单样式 2025-12-18 14:46:55 +08:00
RuoYi
a492ebf41e 默认固定头部 2025-12-18 14:42:47 +08:00
RuoYi
8d6790b358 优化字典组件值宽松匹配 2025-12-16 16:42:25 +08:00
RuoYi
c763a0f356 升级fastjson到最新版2.0.60 2025-12-16 13:47:55 +08:00
RuoYi
227f62dbe2 升级commons.io到最新版本2.21.0 2025-12-16 13:47:39 +08:00
RuoYi
e5d494d018 升级druid到最新版本1.2.27 2025-12-16 13:47:17 +08:00
RuoYi
0f9e698fb5 菜单导航设置支持纯顶部 2025-12-16 13:03:25 +08:00
RuoYi
3d4c6f4fa1 优化数据权限控制逻辑,放开permission限制 2025-12-04 17:36:17 +08:00
RuoYi
40a52af8ee 优化代码 2025-12-04 16:51:23 +08:00
RuoYi
9e67041290 优化表单构建关闭页签销毁复制插件 2025-12-04 13:55:04 +08:00
RuoYi
c17ed8bb04 支持Excel导出对象的多个子列表 2025-12-03 11:26:41 +08:00
RuoYi
64e5288625 优化生成代码下载的zip文件名 2025-12-03 10:28:19 +08:00
RuoYi
afe8236b42 网页标题设置新增SET_TITLE方法 2025-12-02 19:31:12 +08:00
RuoYi
21ee628202 支持Excel导出对象的多个子列表 2025-12-02 19:14:14 +08:00
RuoYi
b54e00529a 登录/注册页面底部版权信息修改为读取配置 2025-12-02 15:34:40 +08:00
RuoYi
3f4484107a 修复v3时间控件between选择后清空报错问题 2025-12-02 15:00:49 +08:00
RuoYi
341c9a8851 修复表单构建移除所有控件后切换路由回来空白问题 2025-12-02 13:14:02 +08:00
RuoYi
81bfef9a3c 修复combo属性过多sheet出现的异常问题 2025-11-13 11:58:59 +08:00
RuoYi
7238dbb807 修复固定头部时出现的导航栏偏移问题 2025-09-04 20:06:41 +08:00
RuoYi
ff9068b9d4 文件支持防盗链配置 2025-09-02 13:27:08 +08:00
RuoYi
ea8351cce0 优化代码 2025-08-28 13:52:06 +08:00
RuoYi
8ef3b5490e 优化代码 2025-08-27 16:02:32 +08:00
RuoYi
1284f6763f 用户导入添加验证提示 2025-08-23 11:47:17 +08:00
RuoYi
eeb6303200 优化布局设置显示 2025-08-23 11:47:07 +08:00
RuoYi
513335d9db 修复用户归属部门无法修改为空问题 2025-08-21 15:00:54 +08:00
RuoYi
1a373f41e6 columns default value 2025-08-09 16:14:01 +08:00
RuoYi
e73aa3b497 显示列信息支持对象格式 2025-08-09 15:19:23 +08:00
RuoYi
d5d6b9789c 自动识别json对象白名单配置范围缩小 2025-08-09 15:18:37 +08:00
RuoYi
6b0bd81f56 添加新群号:112869560 2025-07-19 19:28:57 +08:00
RuoYi
0be3a0720d 优化定时任务包名白名单匹配方式 2025-06-20 11:56:39 +08:00
RuoYi
83e5f2e24d 优化Excel统计行数值的单元格样式显示 2025-06-19 14:54:12 +08:00
RuoYi
942df70c21 用户头像更换后移除旧头像文件 2025-06-06 19:38:36 +08:00
RuoYi
32cb5e8851 若依 3.6.6 2025-05-30 08:03:15 +08:00
若依
ffce2af11e !412 升级到springboot3后 HttpServletResponse的包名发生变化
Merge pull request !412 from coach-tam/N/A
2025-05-28 01:52:58 +00:00
coach-tam
aeb698985b 升级到springboot3后 HttpServletResponse的包名发生变化
Signed-off-by: coach-tam <yaorange2019@sina.com>
2025-05-28 01:44:11 +00:00
RuoYi
ec15604725 升级fastjson到最新版2.0.57 2025-05-26 11:17:18 +08:00
RuoYi
67642ed19a 注册账号设置默认密码最后更新时间 2025-05-26 11:17:06 +08:00
RuoYi
604345f72b 添加底部版权信息及开关 2025-05-24 14:34:05 +08:00
RuoYi
eb01cde0b1 添加页签图标显示开关功能 2025-05-23 14:58:02 +08:00
RuoYi
217119575d 账号密码支持自定义更新周期 2025-05-23 10:35:58 +08:00
RuoYi
86d5eae71f 初始密码支持自定义修改策略 2025-05-23 10:33:48 +08:00
RuoYi
aa72ac20d1 升级commons.io到最新版本2.19.0 2025-05-15 10:28:53 +08:00
RuoYi
b1e0418c77 delete eslint&vue-meta 2025-05-15 10:28:18 +08:00
RuoYi
8e32654d46 优化导航栏显示昵称&设置 2025-05-09 14:02:42 +08:00
RuoYi
c8c0127185 菜单搜索支持键盘选择&悬浮主题背景 2025-05-07 13:25:29 +08:00
RuoYi
46e75b4d7e 图片上传组件新增disabled属性 2025-05-06 19:15:04 +08:00
RuoYi
a735ed90f7 add columnName Drag 2025-05-06 14:54:22 +08:00
RuoYi
e64bb2d7be 修复上传组件被多次引用拖动仅对第一个有效的问题 2025-05-06 13:47:03 +08:00
RuoYi
496d6113c4 update icon 2025-05-06 11:09:46 +08:00
RuoYi
f871171d32 上传组件新增拖动排序属性 2025-04-30 10:31:53 +08:00
RuoYi
a36e19d88e 优化Excel匹配数值型.0结尾 2025-04-28 11:22:04 +08:00
RuoYi
235728fdb9 remove all semicolons 2025-04-27 11:56:31 +08:00
RuoYi
381077253d 使用Gateway CacheRequestBody代替CacheRequestFilter 2025-04-25 15:12:16 +08:00
RuoYi
5f3a93d12e 优化代码 2025-04-25 15:12:03 +08:00
RuoYi
e22323971e 富文本复制粘贴图片上传至url 2025-04-24 18:20:01 +08:00
RuoYi
f593d36745 update package.json 2025-04-24 18:19:44 +08:00
RuoYi
9978594069 优化低版本node无法启动的问题 2025-04-22 12:07:33 +08:00
RuoYi
9026c8e49e 优化代码 2025-04-22 12:07:27 +08:00
RuoYi
c359924d4e 显隐列组件支持全选/全不选 2025-04-21 15:30:44 +08:00
RuoYi
f8d726f966 优化菜单搜索查询页 2025-04-21 13:28:45 +08:00
RuoYi
cbdbc91784 支持文件&图片组件自定义地址&参数 2025-04-18 13:25:08 +08:00
RuoYi
3a61e8df5a 优化角色禁用不允许分配 2025-04-17 15:42:20 +08:00
RuoYi
9d242f0182 update status name 2025-04-17 15:42:03 +08:00
RuoYi
2afad16eba remove dev runjs 2025-03-18 16:04:35 +08:00
RuoYi
637a628cfc 登录页和注册页表头使用VUE_APP_TITLE配置值 2025-03-18 16:04:25 +08:00
RuoYi
785f3c3515 update handleTree 2025-03-14 16:14:24 +08:00
RuoYi
85dc2aef8f 优化代码 2025-03-11 12:55:20 +08:00
RuoYi
3a91cb47a4 修复actuator暴漏问题 2025-03-10 11:47:59 +08:00
RuoYi
7d611b754f 优化isAdmin方法,避免脱敏模块security依赖 2025-03-07 12:59:16 +08:00
RuoYi
6be79bd7d4 菜单管理新增路由名称 2025-03-06 11:09:28 +08:00
RuoYi
13942b41b2 优化顶部菜单搜索栏为多层级显示 2025-03-05 20:32:38 +08:00
RuoYi
583f653890 文件上传组件新增disabled属性&类型 2025-03-05 20:32:30 +08:00
RuoYi
9ebb230d66 优化导出Excel日期格式双击离开后与设定的格式不一致问题 2025-03-05 20:32:18 +08:00
RuoYi
65cc92286f 代码生成列表支持按时间排序 2025-03-05 20:31:10 +08:00
RuoYi
fe1badd9a6 优化空指针异常时无法获取错误信息问题 2025-03-05 20:30:52 +08:00
RuoYi
48830b1181 优化定时任务字符包含多个括号导致数据错误 2025-03-05 20:30:04 +08:00
RuoYi
4257ca91b2 优化代码 2025-03-05 20:28:38 +08:00
RuoYi
15b2502ffa update ry_config_20250224 2025-02-24 16:26:28 +08:00
RuoYi
eb035d179b add nacos2.5.0 sql 2025-02-18 08:42:57 +08:00
RuoYi
b959a91d26 copyright 2025 2025-01-07 10:58:41 +08:00
RuoYi
28377670bb 代码生成新增配置是否允许文件覆盖到本地 2024-12-25 16:40:33 +08:00
RuoYi
1215d5d474 优化导入带标题文件关闭清理 2024-12-25 16:37:26 +08:00
RuoYi
7b4fbf4e13 update sqlkeyword 2024-12-25 16:37:14 +08:00
RuoYi
eaeb8d759e 优化特殊字符密码修改失败问题 2024-12-17 14:40:29 +08:00
RuoYi
bba6433113 优化TopNav内链菜单点击没有高亮(IB8WHJ) 2024-12-17 14:39:49 +08:00
RuoYi
61a49b5951 优化菜单管理切换Mini布局错乱问题 2024-12-17 14:39:37 +08:00
RuoYi
8d631d1325 用户管理过滤掉已禁用部门 2024-12-11 11:52:50 +08:00
RuoYi
d302cdb324 修改主题样式本地读取 2024-12-10 16:43:28 +08:00
RuoYi
33af14461f 优化文件异常输入流未关闭的问题 2024-12-07 14:53:38 +08:00
RuoYi
cff2e611c5 白名单支持对通配符路径匹配 2024-12-07 14:53:07 +08:00
RuoYi
72bc8bfc53 Excel注解支持wrapText是否允许内容换行 2024-12-07 14:52:52 +08:00
RuoYi
4a6603d8b3 修复导出子列表对象只能在最后的问题 2024-12-07 14:52:31 +08:00
RuoYi
2b425e62e4 修复默认关闭Tags-Views时,内链页面打不开 2024-11-27 20:02:51 +08:00
RuoYi
a837f49291 修复TopNav无法正确获取active的问题 2024-11-27 20:02:40 +08:00
RuoYi
3a2e434a53 菜单面包屑导航支持多层级显示 2024-11-25 22:40:49 +08:00
RuoYi
08484eea75 优化代码 2024-11-25 22:40:21 +08:00
RuoYi
a5f3be78ec 分栏参数微调 2024-11-22 14:53:51 +08:00
RuoYi
0fc5c7199e 用户管理支持分栏拖动 2024-11-22 14:16:07 +08:00
RuoYi
1af0861a3b 优化代码 2024-11-22 14:15:50 +08:00
RuoYi
bea8f763bb update .env.staging 2024-11-22 14:15:13 +08:00
RuoYi
78d958ec8c 若依 3.6.5 2024-11-13 11:21:07 +08:00
RuoYi
101f7e3cf7 升级quill到最新版本2.0.2 2024-11-13 11:10:27 +08:00
RuoYi
b92fb20439 支持自定义显示Excel属性列 2024-11-07 22:48:35 +08:00
RuoYi
264d6e320e update pom.xml 2024-11-06 22:07:16 +08:00
RuoYi
1f0eb72a58 优化代码 2024-11-06 22:06:44 +08:00
RuoYi
eb2e089d57 优化无用户编号不校验数据权限 2024-11-05 16:45:33 +08:00
RuoYi
efdc96abb6 校检文件名是否包含特殊字符 2024-11-05 16:44:17 +08:00
RuoYi
64dc968949 优化身份证脱敏正则 2024-10-21 17:31:33 +08:00
RuoYi
dcc303a8d4 优化权限更新后同步缓存 2024-10-21 17:31:22 +08:00
RuoYi
cc0c6deb38 操作日志记录DELETE请求参数 2024-10-17 13:20:28 +08:00
RuoYi
c2157d7f2a 修改代码生成上级菜单字段类型 2024-10-17 13:20:06 +08:00
RuoYi
f6c8be3285 修复角色禁用权限不失效问题 2024-09-21 12:06:51 +08:00
RuoYi
4f8c2215b3 update ry_config 2024-09-14 12:52:24 +08:00
RuoYi
6f94f4d1e0 update ry_config 2024-09-02 20:30:38 +08:00
RuoYi
f2aad7a76c 优化提示 2024-09-02 20:26:00 +08:00
RuoYi
c50a2b4200 update springboot3 2024-08-29 21:00:35 +08:00
267 changed files with 4168 additions and 5105 deletions

View File

@@ -1,11 +1,11 @@
<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>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.7</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"><img src="https://img.shields.io/badge/RuoYi-v3.6.7-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>
@@ -126,4 +126,4 @@ com.ruoyi
## 若依微服务交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-42799195-blue.svg)](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [![加入QQ群](https://img.shields.io/badge/已满-170157040-blue.svg)](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [![加入QQ群](https://img.shields.io/badge/已满-130643120-blue.svg)](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [![加入QQ群](https://img.shields.io/badge/已满-225920371-blue.svg)](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [![加入QQ群](https://img.shields.io/badge/已满-201705537-blue.svg)](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [![加入QQ群](https://img.shields.io/badge/已满-236543183-blue.svg)](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [![加入QQ群](https://img.shields.io/badge/已满-213618602-blue.svg)](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [![加入QQ群](https://img.shields.io/badge/已满-148794840-blue.svg)](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [![加入QQ群](https://img.shields.io/badge/已满-118752664-blue.svg)](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [![加入QQ群](https://img.shields.io/badge/已满-101038945-blue.svg)](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [![加入QQ群](https://img.shields.io/badge/已满-128355254-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [![加入QQ群](https://img.shields.io/badge/已满-179219821-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [![加入QQ群](https://img.shields.io/badge/158753145-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) 点击按钮入群。
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-42799195-blue.svg)](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [![加入QQ群](https://img.shields.io/badge/已满-170157040-blue.svg)](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [![加入QQ群](https://img.shields.io/badge/已满-130643120-blue.svg)](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [![加入QQ群](https://img.shields.io/badge/已满-225920371-blue.svg)](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [![加入QQ群](https://img.shields.io/badge/已满-201705537-blue.svg)](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [![加入QQ群](https://img.shields.io/badge/已满-236543183-blue.svg)](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [![加入QQ群](https://img.shields.io/badge/已满-213618602-blue.svg)](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [![加入QQ群](https://img.shields.io/badge/已满-148794840-blue.svg)](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [![加入QQ群](https://img.shields.io/badge/已满-118752664-blue.svg)](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [![加入QQ群](https://img.shields.io/badge/已满-101038945-blue.svg)](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [![加入QQ群](https://img.shields.io/badge/已满-128355254-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [![加入QQ群](https://img.shields.io/badge/已满-179219821-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [![加入QQ群](https://img.shields.io/badge/已满-158753145-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) [![加入QQ群](https://img.shields.io/badge/112869560-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Kuaw0Xdlw2Nlgn6s8h9elzuquHGxGObD&authKey=cSrQcWQ%2BzQZAFFrwxaR%2BbzcumX4WRduZnd1O6JO1dlclQMiu%2BKwxAy8t2JfNp67V&noverify=0&group_code=112869560) 点击按钮入群。

View File

@@ -1,54 +0,0 @@
# Kubernates 部署Ruoyi-Cloud项目
本部署所用到的k8s配置均为简易版仅作为初步入门学习使用有不合理的地方还请见谅。
### 后期考虑功能:
* HPA自动扩缩容
* MySQL主从、Redis集群、服务集群
* ELK日志收集
## 容器分布
~~~
namespace
├── redis
│ └── redis // StatefulSet
├── kube-ruoyi
│ └── ruoyi-mysql // Deployment
│ └── ruoyi-nacos
│ └── ruoyi-nginx
│ └── ruoyi-sentinel
│ └── ruoyi-gateway
│ └── ruoyi-auth
│ └── ruoyi-system
│ └── ruoyi-gen
│ └── ruoyi-job
│ └── ruoyi-file
│ └── ruoyi-monitor
│ └── elasticsearch
│ └── skywalking
│ └── skywalking-ui
├── minio
│ └── minio
├── monitor-sa
│ └── node-exporter
│ └── prometheus-server
│ └── monitoring-grafana
~~~
## 部署顺序及要点
1. Redis
2. MySQL手动Dockerfile打包镜像初始化准备好的数据脚本。使用了Secret加密密码等配置。
3. Nacos, 配置好MODE=standalone使用configMap设置数据库。
4. Sentinel
5. Gateway本服务需要用Dockerfile打包镜像否则会报错。其他RuoYi服务可以直接使用spring-boot的image命令一键打包生成镜像[每个服务都有使用额外的SpringBoot配置文件bootstrap-k8s.yml加入到服务中同时在原配置文件中把active换成${SPRING_PROFILES_ACTIVE:dev}后再打包以读取deployment的env变量。启动服务前记得提前在nacos中克隆新增服务配置以把dev改成k8sdeployment中启动的环境是SPRING_PROFILES_ACTIVE=k8s修改好Redis地址redis.redis、MySQL地址(ruoyi-mysql)、Sentinel地址(ruoyi-sentinel)]
6. Nginx部署之前先打包好前端静态文件使用本地磁盘方式挂载到容器 (注我使用的是Window的DockerDesktop启动的K8s挂载磁盘路径必须带/run/desktop/mnt/host)修改好nginx配置ruoyi-gateway就可以启动启动后输入localhost:30080就可以访问前端项目
7. Auth
8. System配置好后就可以登录了
9. Gen
10. Job
11. File改成minio服务之后需要修改静态文件中读取文件的端口地址
12. Monitor需要修改前端静态文件中的Monitor端口地址
13. Minio挂载本地文件。修改ruoyi-file服务中@Primary注释改到MinioServer上以使用Minio服务记得修改nacos配置
14. Elasticsearch部署文件一并放入到了skywalking文件夹中
15. skywalking需要在Java服务中使用agent进行跟踪自制agent镜像然后使用initContainers方式挂载到同一个容器模板放到了agent-in-server文件
16. skywalking-ui

View File

@@ -1,54 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: minio
name: minio
namespace: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio
imagePullPolicy: Always
ports:
- containerPort: 9000
name: tcp
- containerPort: 9090
protocol: TCP
name: console
command:
- /bin/sh
- -c
- minio server /data --console-address ":9090"
env:
- name: MINIO_ACCESS_KEY
value: minioadmin
- name: MINIO_SECRET_KEY
value: minioadmin
readinessProbe:
failureThreshold: 3
httpGet:
path: /minio/health/ready
port: 9000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
volumeMounts:
- mountPath: /data
name: minio-data
volumes:
- name: minio-data
hostPath:
path: /run/desktop/mnt/host/c/k8sVolume/minio/data
type: Directory

View File

@@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: minio

View File

@@ -1,20 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: minio
labels:
app: minio
spec:
type: NodePort
publishNotReadyAddresses: true
ports:
- port: 9000
name: tcp
targetPort: 9000
- port: 9090
name: console
targetPort: 9090
nodePort: 30090
selector:
app: minio

View File

@@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: monitor-sa

View File

@@ -1,63 +0,0 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-exporter
namespace: monitor-sa
labels:
name: node-exporter
spec:
selector:
matchLabels:
name: node-exporter
template:
metadata:
labels:
name: node-exporter
spec:
hostPID: true
hostIPC: true
hostNetwork: true # 共享宿主机网络和进程
containers:
- name: node-exporter
image: prom/node-exporter:v0.16.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9100 # 容器暴露端口为9100
resources:
requests:
cpu: 0.15
securityContext:
privileged: true # 开启特权模式
args:
- --path.procfs
- /host/proc
- --path.sysfs
- /host/sys
- --collector.filesystem.ignored-mount-points
- '"^/(sys|proc|dev|host|etc)($|/)"'
volumeMounts: # 挂载宿主机目录以收集宿主机信息
- name: dev
mountPath: /host/dev
- name: proc
mountPath: /host/proc
- name: sys
mountPath: /host/sys
- name: rootfs
mountPath: /rootfs
tolerations: # 定义容忍度使其可调度到默认有污点的master
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
volumes: # 定义存储卷
- name: proc
hostPath:
path: /proc
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: rootfs
hostPath:
path: /

View File

@@ -1,169 +0,0 @@
apiVersion: v1
kind: ConfigMap #
metadata:
name: prometheus-config
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: EnsureExists
data:
prometheus.yml: |
rule_files:
- /etc/config/rules/*.rules
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: kubernetes-nodes
scrape_interval: 30s
static_configs:
- targets:
- 192.168.73.135:9100
- 192.168.73.138:9100
- 192.168.73.139:9100
- 192.168.73.140:9100
- job_name: kubernetes-apiservers
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: keep
regex: default;kubernetes;https
source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
- __meta_kubernetes_endpoint_port_name
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
- job_name: kubernetes-nodes-kubelet
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
- job_name: kubernetes-nodes-cadvisor
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __metrics_path__
replacement: /metrics/cadvisor
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
- job_name: kubernetes-service-endpoints
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: keep
regex: true
source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scrape
- action: replace
regex: (https?)
source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scheme
target_label: __scheme__
- action: replace
regex: (.+)
source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
target_label: __metrics_path__
- action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- action: replace
source_labels:
- __meta_kubernetes_service_name
target_label: kubernetes_name
- job_name: kubernetes-services
kubernetes_sd_configs:
- role: service
metrics_path: /probe
params:
module:
- http_2xx
relabel_configs:
- action: keep
regex: true
source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_probe
- source_labels:
- __address__
target_label: __param_target
- replacement: blackbox
target_label: __address__
- source_labels:
- __param_target
target_label: instance
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- source_labels:
- __meta_kubernetes_service_name
target_label: kubernetes_name
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
relabel_configs:
- action: keep
regex: true
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
- action: replace
regex: (.+)
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_path
target_label: __metrics_path__
- action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
source_labels:
- __address__
- __meta_kubernetes_pod_annotation_prometheus_io_port
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- action: replace
source_labels:
- __meta_kubernetes_pod_name
target_label: kubernetes_pod_name
alerting:
alertmanagers:
- static_configs:
- targets: ["alertmanager:80"]

View File

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

View File

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

View File

@@ -1,47 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ruoyi-mysql #指定deployment的名字
namespace: kube-ruoyi
labels:
app: ruoyi-mysql-local
spec: #规约
replicas: 1 #pod的副本数量就是希望创建多少个pod的副本.可p选字段。它的默认值是1。
selector: #selector 字段定义 Deployment 如何查找要管理的 Pods。必须匹配 .spec.template.metadata.labels否则请求会被 API 拒绝。
matchLabels:
app: ruoyi-mysql-local
template: #Deployment Pod 模板;它和 Pod 的语法规则完全相同。 只是这里它是嵌套的,因此不需要 apiVersion 或 kind。
metadata:
labels:
app: ruoyi-mysql-local
spec: #pod模板规约
containers: #容器
- name: ruoyi-mysql #容器的名称
image: ruoyi/mysql:5.7 #容器使用的镜像
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-local-data #pv的name
mountPath: /var/lib/mysql #MySQL容器的数据都是存在这个目录的要对这个目录做数据持久化
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom: # Read environment variables from kubernetes secrets
secretKeyRef:
name: ruoyi-mysql-secret
key: mysql-root-pass
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: ruoyi-mysql-secret
key: mysql-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: ruoyi-mysql-secret
key: mysql-password
volumes:
- name: mysql-local-data #pv的name
hostPath:
path: /run/desktop/mnt/host/c/k8sVolume/mysql/data
type: Directory
restartPolicy: Always #Deployment 中的 Pod 模板必须指定适当的标签和适当的重新启动策略。只有 .spec.template.spec.restartPolicy 等于 Always 才是被允许的,这也是在没有指定时的默认设置

View File

@@ -1,29 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
namespace: kube-ruoyi
spec:
capacity:
storage: 3Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain # 手动删除
storageClassName: hostpath #表明这个pv所属的storageClass
hostPath:
path: /mnt/data #节点上卷的完整路径。必须是存在的路径不然容器无法创建deployment会报错可以是目录或块设备(磁盘、分区…)。
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pvc-local
namespace: kube-ruoyi
spec:
accessModes: #访问模式 申领在请求具有特定访问模式的存储时,使用与卷相同的访问模式约定。
- ReadWriteMany
volumeMode: Filesystem #卷模式
resources:
requests:
storage: 1Gi
storageClassName: hostpath # 此处须显式设置空字符串或指定值,否则会被设置为默认的 StorageClass

View File

@@ -1,10 +0,0 @@
apiVersion: v1
kind: Secret
metadata:
name: ruoyi-mysql-secret
namespace: kube-ruoyi
type: Opaque #base-64加密
data:
mysql-root-pass: cGFzc3dvcmQ=
mysql-user: YWRtaW4=
mysql-password: MTIzNDU2

View File

@@ -1,12 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: ruoyi-mysql
namespace: kube-ruoyi
spec:
ports:
- port: 3306
nodePort: 30060
selector:
app: ruoyi-mysql-local # 该 Service 会将所有具有标签 app: mysql-labels-app暴露到一个抽象的 Service 端口上targetPort容器接收流量的端口port可任意取值的抽象的 Service 端口,其他 Pod 通过该端口访问 Service
type: NodePort

View File

@@ -1,31 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ruoyi-nacos-config
namespace: kube-ruoyi
data:
application.properties: |
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://ruoyi-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=password
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
management.endpoints.web.exposure.include=*
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
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.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.core.auth.system.type=nacos
nacos.core.auth.enabled=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=false
nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security
nacos.istio.mcp.server.enabled=false

View File

@@ -1,37 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ruoyi-nacos
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: ruoyi-nacos
template:
metadata:
labels:
app: ruoyi-nacos
spec:
containers:
- name: ruoyi-nacos
image: nacos/nacos-server
imagePullPolicy: Always
ports:
- containerPort: 8848
name: client
- containerPort: 9848
name: client-rpc
- containerPort: 9849
name: raft-rpc
env:
- name: MODE
value: standalone
volumeMounts:
- mountPath: /home/nacos/conf/application.properties
name: nacos-conf
subPath: application.properties
volumes:
- name: nacos-conf
configMap:
name: ruoyi-nacos-config

View File

@@ -1,23 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: ruoyi-nacos
namespace: kube-ruoyi
labels:
app: ruoyi-nacos
spec:
type: NodePort
publishNotReadyAddresses: true
ports:
- port: 8848
name: server
targetPort: 8848
nodePort: 30848
- port: 9848
name: client-rpc
targetPort: 9848
- port: 9849
name: raft-rpc
targetPort: 9849
selector:
app: ruoyi-nacos

View File

@@ -1,37 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ruoyi-nginx-config
namespace: kube-ruoyi
data:
nginx.conf: |
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://ruoyi-gateway:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@@ -1,53 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ruoyi-nginx
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: ruoyi-nginx
template:
metadata:
labels:
app: ruoyi-nginx
spec:
containers:
- name: ruoyi-nginx
image: nginx
imagePullPolicy: Always
ports:
- containerPort: 80
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
name: nginx-conf
subPath: nginx.conf
- mountPath: /home/ruoyi/projects/ruoyi-ui
name: local-path #/usr/share/nginx/html 挂载到volumes中server+path
volumes:
- name: nginx-conf
configMap:
name: ruoyi-nginx-config
- name: local-path
hostPath:
path: /run/desktop/mnt/host/c/k8sVolume/dist
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: ruoyi-nginx
namespace: kube-ruoyi
labels:
name: ruoyi-nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30080
selector:
app: ruoyi-nginx

View File

@@ -1,58 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
namespace: redis
data:
redis.conf: |-
maxmemory 1000mb
maxmemory-policy allkeys-lru
protected-mode no
tcp-backlog 511
daemonize no
supervised no
dir /data
pidfile /data/redis_6379.pid
port 6379
loglevel notice
logfile ""
databases 16
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
replica-serve-stale-data yes
replica-read-only no
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
set-max-intset-entries 512
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

View File

@@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: redis

View File

@@ -1,98 +0,0 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
labels:
app: redis
namespace: redis
spec:
serviceName: redis
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
initContainers:
- name: config
image: redis:7.0.6
command: [ "sh", "-c" ]
args:
- |
cp /tmp/redis/redis.conf /etc/redis/redis.conf
echo "finding master..."
MASTER_FDQN=`hostname -f | sed -e 's/redis-[0-9]\./redis-0./'`
if [ "$(redis-cli -h sentinel -p 5000 ping)" != "PONG" ]; then
echo "master not found, defaulting to redis-0"
if [ "$(hostname)" = "redis-0" ]; then
echo "this is redis-0, not updating config..."
else
echo "updating redis.conf..."
echo "\nslaveof $MASTER_FDQN 6379" >> /etc/redis/redis.conf
fi
else
echo "sentinel found, finding master"
MASTER="$(redis-cli -h sentinel -p 5000 sentinel get-master-addr-by-name mymaster | grep -E '(^redis-\d{1,})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')"
echo "master found : $MASTER, updating redis.conf"
echo "slaveof $MASTER 6379" >> /etc/redis/redis.conf
fi
volumeMounts:
- name: redis-config
mountPath: /etc/redis/
- name: config
mountPath: /tmp/redis/
containers:
- name: redis
image: redis:7.0.6
command: [ "redis-server" ]
args: [ "/etc/redis/redis.conf" ]
ports:
- containerPort: 6379
name: redis
volumeMounts:
- name: data
mountPath: /data
- name: redis-config
mountPath: /etc/redis/
resources:
limits:
memory: 1100Mi
requests:
memory: 1100Mi
volumes:
- name: redis-config
emptyDir: { }
- name: config
configMap:
name: redis-config
volumeClaimTemplates:
- metadata:
name: data
spec:
storageClassName: hostpath
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: redis # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: redis
namespace: redis
spec:
selector:
app: redis # The service exposes Pods with label `app=redis`
ports:
- name: redis-port
port: 6379
nodePort: 30079
type: NodePort

View File

@@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: kube-ruoyi

View File

@@ -1,41 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ruoyi-sentinel
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: ruoyi-sentinel
template:
metadata:
labels:
app: ruoyi-sentinel
spec:
containers:
- name: ruoyi-sentinel
image: bladex/sentinel-dashboard
imagePullPolicy: Always
ports:
- containerPort: 8858
env: # Environment variables supplied to the Pod
- name: JAVA_TOOL_OPTIONS
value: "-Dserver.port=8858 -Dcsp.sentinel.dashboard.server=localhost:8858 -Dproject.name=sentinel-dashboard"
---
apiVersion: v1
kind: Service
metadata:
name: ruoyi-sentinel
namespace: kube-ruoyi
labels:
name: ruoyi-sentinel
spec:
type: NodePort
ports:
- port: 8858
targetPort: 8858
nodePort: 30858
selector:
app: ruoyi-sentinel

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-auth # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-auth
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-auth
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-auth
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-auth-server
image: ruoyi-auth:3.6.2
ports:
- name: http
containerPort: 9200 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-auth
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-auth # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-auth
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-auth # The service exposes Pods with label `app=ruoyi-auth`
ports: # Forward incoming connections on port 9200 to the target port 9200
- name: http
port: 9200
targetPort: 9200

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-gateway # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-gateway
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-gateway
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-gateway
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-gateway-server
image: ruoyi-gateway:3.6.2
ports:
- name: http
containerPort: 8080 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-gateway
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-gateway # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-gateway
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-gateway # The service exposes Pods with label `app=ruoyi-gateway`
ports: # Forward incoming connections on port 8080 to the target port 8080
- name: http
port: 8080
targetPort: 8080

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-file # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-file
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-file
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-file
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-file-server
image: ruoyi-modules-file:3.6.2
ports:
- name: http
containerPort: 9300 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-file
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-file # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-file
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-file # The service exposes Pods with label `app=ruoyi-file`
ports: # Forward incoming connections on port 9300 to the target port 9300
- name: http
port: 9300
targetPort: 9300

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-gen # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-gen
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-gen
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-gen
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-gen-server
image: ruoyi-modules-gen:3.6.2
ports:
- name: http
containerPort: 9202 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-gen
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-gen # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-gen
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-gen # The service exposes Pods with label `app=ruoyi-gen`
ports: # Forward incoming connections on port 9202 to the target port 9202
- name: http
port: 9202
targetPort: 9202

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-job # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-job
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-job
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-job
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-job-server
image: ruoyi-modules-job:3.6.2
ports:
- name: http
containerPort: 9203 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-job
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-job # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-job
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-job # The service exposes Pods with label `app=ruoyi-job`
ports: # Forward incoming connections on port 9203 to the target port 9203
- name: http
port: 9203
targetPort: 9203

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-system # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-system
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-system
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-system
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-system-server
image: ruoyi-modules-system:3.6.2
ports:
- name: http
containerPort: 9201 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-system
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-system # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-system
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-system # The service exposes Pods with label `app=ruoyi-system`
ports: # Forward incoming connections on port 9201 to the target port 9201
- name: http
port: 9201
targetPort: 9201

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-monitor # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-monitor
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-monitor
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-monitor
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-monitor-server
image: ruoyi-visual-monitor:3.6.2
ports:
- name: http
containerPort: 9100 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-monitor
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-monitor # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-monitor
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-monitor # The service exposes Pods with label `app=ruoyi-monitor`
ports: # Forward incoming connections on port 9100 to the target port 9100
- name: http
port: 9100
targetPort: 9100

View File

@@ -1,37 +0,0 @@
# Tomcat
server:
port: 8080
# Spring
spring:
application:
# 应用名称
name: ${SERVER_NAME}
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
config:
# 配置中心地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- ${NACOS_SHARED_CONFIGS}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow

View File

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

View File

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

View File

@@ -1,73 +0,0 @@
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: ruoyi-system # Name of the kubernetes resource
namespace: kube-ruoyi
labels: # Labels that will be applied to this resource
app: ruoyi-system
spec:
replicas: 1 # No. of replicas/pods to run in this deployment
selector:
matchLabels: # The deployment applies to any pods matching the specified labels
app: ruoyi-system
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: ruoyi-system
spec: # Spec for the containers that will be run in the Pods
containers:
- name: ruoyi-system-server
image: ruoyi-modules-system:3.6.2
ports:
- name: http
containerPort: 9201 # The port that the container exposes
env: # Environment variables supplied to the Pod
- name: SPRING_PROFILES_ACTIVE
value: k8s
- name: SERVER_NAME
value: ruoyi-system
- name: NACOS_SERVER
value: ruoyi-nacos # nacos svc name
- name: NACOS_PORT
value: "8848"
- name: NACOS_SHARED_CONFIGS
value: application-dev.yml
- name: JAVA_OPTS
value: -javaagent:/javaagent/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=k8s::$(SERVER_NAME) -Dskywalking.collector.backend_service=skywalking:11800
volumeMounts:
- mountPath: /javaagent
name: agent-jar
volumes:
- emptyDir: { }
name: agent-jar
initContainers:
# 官网用脚本命令行+args的方式执行多条command语句
- command: ['sh']
args:
- "-c"
- |
cp -r /opt/skywalking-agent /javaagent
chown -R 65534:65534 /javaagent
/bin/chmod -R 777 /javaagent
image: skywalking-agent:8.14.0
imagePullPolicy: IfNotPresent
name: skywalking-agent
volumeMounts:
- mountPath: /javaagent
name: agent-jar
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: ruoyi-system # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: ruoyi-system
namespace: kube-ruoyi
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: ruoyi-system # The service exposes Pods with label `app=ruoyi-system`
ports: # Forward incoming connections on port 9201 to the target port 9201
- name: http
port: 9201
targetPort: 9201

View File

@@ -1,17 +0,0 @@
## cat Dcokerfile
FROM docker.io/library/busybox:latest AS base
# 使用 ADD 下载 java-agent,你也可以使用其他下载命令,或者下载到本地,再 使用 COPY或者ADD 指令添加到 镜像里
ADD https://dlcdn.apache.org/skywalking/java-agent/9.0.0/apache-skywalking-java-agent-9.0.0.tgz /tmp/
RUN mkdir -p /opt \
&& tar -xzf /tmp/apache-skywalking-java-agent-9.0.0.tgz -C /opt/ \
&& rm -rf /tmp/*
#ADD skywalking-agent.tar.gz /opt/
RUN mkdir -p /javaagent
## java-agent 使用 方法
## https://skywalking.apache.org/docs/skywalking-java/next/en/setup/service-agent/java-agent/readme/
## java -javaagent:/opt/skywalking-agent/skywalking-agent.jar -jar yourApp.jar
## -javaagent:/opt/skywalking-agent/skywalking-agent.jar=agent.service_name=yourAppName,collector.backend_service=127.0.0.1:11800
## -javaagent:/opt/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=yourAppName -Dskywalking.collector.backend_service=127.0.0.1:11800

View File

@@ -1,44 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: elasticsearch
name: elasticsearch
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- name: elasticsearch
image: elasticsearch:7.14.2
ports:
- containerPort: 9200
name: cluster-node
env:
- name: discovery.type
value: single-node
- name: TZ
value: Asia/Shanghai
- name: ES_JAVA_OPTS
value: -Xms512m -Xmx512m
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
namespace: kube-ruoyi
spec:
ports:
- port: 9220 # 和auth-server的端口冲突了对外暴露换一个端口访问
targetPort: 9200
name: cluster-node
selector:
app: elasticsearch # 该 Service 会将所有具有标签 app: mysql-labels-app暴露到一个抽象的 Service 端口上targetPort容器接收流量的端口port可任意取值的抽象的 Service 端口,其他 Pod 通过该端口访问 Service
type: NodePort

View File

@@ -1,50 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: skywalking
name: skywalking
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: skywalking
template:
metadata:
labels:
app: skywalking
spec:
containers:
- name: skywalking
image: apache/skywalking-oap-server
imagePullPolicy: Always
ports:
- containerPort: 11800
name: collector
- containerPort: 12800
name: oap
env:
- name: SW_STORAGE
value: elasticsearch
- name: TZ
value: Asia/Shanghai
- name: SW_STORAGE_ES_CLUSTER_NODES
value: elasticsearch:9220
---
apiVersion: v1
kind: Service
metadata:
name: skywalking
namespace: kube-ruoyi
spec:
ports:
- port: 11800
targetPort: 11800
name: collector
- port: 12800
targetPort: 12800
name: oap
selector:
app: skywalking # 该 Service 会将所有具有标签 app: mysql-labels-app暴露到一个抽象的 Service 端口上targetPort容器接收流量的端口port可任意取值的抽象的 Service 端口,其他 Pod 通过该端口访问 Service
type: NodePort

View File

@@ -1,42 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: skywalking-ui
name: skywalking-ui
namespace: kube-ruoyi
spec:
replicas: 1
selector:
matchLabels:
app: skywalking-ui
template:
metadata:
labels:
app: skywalking-ui
spec:
containers:
- name: skywalking-ui
image: apache/skywalking-ui
imagePullPolicy: Always
ports:
- containerPort: 8080
name: console
env:
- name: SW_OAP_ADDRESS
value: http://skywalking:12800
- name: TZ
value: Asia/Shanghai
---
apiVersion: v1
kind: Service
metadata:
name: skywalking-ui
namespace: kube-ruoyi
spec:
ports:
- port: 8080
nodePort: 30088
selector:
app: skywalking-ui # 该 Service 会将所有具有标签 app: mysql-labels-app暴露到一个抽象的 Service 端口上targetPort容器接收流量的端口port可任意取值的抽象的 Service 端口,其他 Pod 通过该端口访问 Service
type: NodePort

View File

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

View File

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

95
pom.xml
View File

@@ -6,54 +6,40 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description>
<properties>
<ruoyi.version>3.6.5</ruoyi.version>
<ruoyi.version>3.6.7</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.7.18</spring-boot.version>
<spring-cloud.version>2021.0.9</spring-cloud.version>
<spring-cloud-alibaba.version>2021.0.6.1</spring-cloud-alibaba.version>
<spring-boot-admin.version>2.7.16</spring-boot-admin.version>
<tobato.version>1.27.2</tobato.version>
<java.version>17</java.version>
<spring-boot.version>3.3.5</spring-boot.version>
<spring-cloud.version>2023.0.3</spring-cloud.version>
<spring-cloud-alibaba.version>2023.0.1.2</spring-cloud-alibaba.version>
<spring-boot-admin.version>3.3.5</spring-boot-admin.version>
<mybatis-spring.version>3.0.3</mybatis-spring.version>
<kaptcha.version>2.3.3</kaptcha.version>
<pagehelper.boot.version>2.0.0</pagehelper.boot.version>
<druid.version>1.2.23</druid.version>
<pagehelper.boot.version>2.1.0</pagehelper.boot.version>
<druid.version>1.2.27</druid.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
<commons.io.version>2.13.0</commons.io.version>
<commons.io.version>2.21.0</commons.io.version>
<velocity.version>2.3</velocity.version>
<fastjson.version>2.0.53</fastjson.version>
<fastjson.version>2.0.60</fastjson.version>
<jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version>
<springdoc.version>1.6.9</springdoc.version>
<springdoc.version>2.6.0</springdoc.version>
<transmittable-thread-local.version>2.14.4</transmittable-thread-local.version>
<!-- override dependency version -->
<tomcat.version>9.0.98</tomcat.version>
<logback.version>1.2.13</logback.version>
<spring-framework.version>5.3.39</spring-framework.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- 覆盖SpringFramework的依赖配置-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud 微服务 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -81,49 +67,10 @@
<scope>import</scope>
</dependency>
<!-- 覆盖logback的依赖配置-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- 覆盖tomcat的依赖配置-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- FastDFS 分布式文件系统 -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${tobato.version}</version>
</dependency>
<!-- Springdoc webmvc 依赖配置 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
@@ -139,6 +86,18 @@
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
<exclusions>
<exclusion>
<artifactId>mybatis-spring</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<!-- io常用工具类 -->
@@ -279,7 +238,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<parameters>true</parameters>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>

View File

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

View File

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

View File

@@ -2,7 +2,9 @@ package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.constant.ServiceNameConstants;
@@ -26,4 +28,13 @@ public interface RemoteFileService
*/
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
/**
* 删除文件
*
* @param fileUrl 文件地址
* @return 结果
*/
@DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl);
}

View File

@@ -2,10 +2,10 @@ package com.ruoyi.system.api.domain;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.web.domain.BaseEntity;

View File

@@ -1,7 +1,7 @@
package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;

View File

@@ -1,8 +1,8 @@
package com.ruoyi.system.api.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;

View File

@@ -1,9 +1,9 @@
package com.ruoyi.system.api.domain;
import java.util.Set;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;

View File

@@ -2,7 +2,7 @@ package com.ruoyi.system.api.domain;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;
import jakarta.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
@@ -56,8 +56,8 @@ public class SysUser extends BaseEntity
/** 密码 */
private String password;
/** 号状态0正常 1停用 */
@Excel(name = "号状态", readConverterExp = "0=正常,1=停用")
/** 号状态0正常 1停用 */
@Excel(name = "号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
@@ -71,6 +71,9 @@ public class SysUser extends BaseEntity
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate;
/** 密码最后更新时间 */
private Date pwdUpdateDate;
/** 部门对象 */
@Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@@ -111,11 +114,6 @@ public class SysUser extends BaseEntity
}
public boolean isAdmin()
{
return isAdmin(this.userId);
}
public static boolean isAdmin(Long userId)
{
return UserConstants.isAdmin(userId);
}
@@ -248,6 +246,16 @@ public class SysUser extends BaseEntity
this.loginDate = loginDate;
}
public Date getPwdUpdateDate()
{
return pwdUpdateDate;
}
public void setPwdUpdateDate(Date pwdUpdateDate)
{
this.pwdUpdateDate = pwdUpdateDate;
}
public SysDept getDept()
{
return dept;
@@ -297,6 +305,7 @@ public class SysUser extends BaseEntity
{
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -313,6 +322,7 @@ public class SysUser extends BaseEntity
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("pwdUpdateDate", getPwdUpdateDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@@ -30,6 +30,12 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
{
return R.fail("上传文件失败:" + throwable.getMessage());
}
@Override
public R<Boolean> delete(String fileUrl)
{
return R.fail("删除文件失败:" + throwable.getMessage());
}
};
}
}

View File

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

View File

@@ -1,6 +1,6 @@
package com.ruoyi.auth.controller;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -143,6 +143,7 @@ public class SysLoginService
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPwdUpdateDate(DateUtils.getNowDate());
sysUser.setPassword(SecurityUtils.encryptPassword(password));
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);

View File

@@ -1,22 +0,0 @@
# Tomcat
server:
port: 9200
# Spring
spring:
application:
# 应用名称
name: ${SERVER_NAME}
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
config:
# 配置中心地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- ${NACOS_SHARED_CONFIGS}

View File

@@ -9,7 +9,7 @@ spring:
name: ruoyi-auth
profiles:
# 环境配置
active: ${SPRING_PROFILES_ACTIVE:dev}
active: dev
cloud:
nacos:
discovery:

View File

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

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -53,12 +53,24 @@
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- Mybatis Spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</dependency>
<!-- Hibernate Validator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Spring Aop -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -81,6 +93,7 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- Apache Lang3 -->
@@ -103,8 +116,8 @@
<!-- Java Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
</dependencies>

View File

@@ -51,7 +51,8 @@ public @interface Excel
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
@SuppressWarnings("deprecation")
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
* 导出时在excel中每个列的高度

View File

@@ -87,6 +87,16 @@ public class Constants
*/
public static final String LOGIN_FAIL = "Error";
/**
* 所有权限标识
*/
public static final String ALL_PERMISSION = "*:*:*";
/**
* 管理员角色权限标识
*/
public static final String SUPER_ADMIN = "admin";
/**
* 当前记录起始索引
*/
@@ -120,7 +130,7 @@ public class Constants
/**
* 自动识别json对象白名单配置仅允许解析的包名范围越小越安全
*/
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
public static final String[] JSON_WHITELIST_STR = { "com.ruoyi" };
/**
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)

View File

@@ -3,7 +3,7 @@ package com.ruoyi.common.core.exception.file;
import java.util.Arrays;
/**
* 文件上传异常类
* 文件上传无效扩展名异常类
*
* @author ruoyi
*/

View File

@@ -136,6 +136,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return new Date(time);
}
/**
* 计算相差天数
*/
public static int differentDaysByMillisecond(Date date1, Date date2)
{
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
/**
* 计算时间差
*

View File

@@ -8,10 +8,10 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;

View File

@@ -1,9 +1,9 @@
package com.ruoyi.common.core.utils.bean;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.Validator;
/**
* bean对象属性验证

View File

@@ -8,8 +8,8 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.core.utils.StringUtils;
@@ -114,20 +114,20 @@ public class FileUtils
}
/**
* 检查文件是否可下载
* 校验文件路径合法性(安全性与扩展名)
*
* @param resource 需要下载的文件
* @param fileUrl 待校验的文件地址
* @return true 正常 false 非法
*/
public static boolean checkAllowDownload(String resource)
public static boolean validateFilePath(String fileUrl)
{
// 禁止目录上跳级别
if (StringUtils.contains(resource, ".."))
if (StringUtils.contains(fileUrl, ".."))
{
return false;
}
// 判断是否在允许下载的文件规则内
return ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource));
return ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(fileUrl));
}
/**

View File

@@ -2,7 +2,7 @@ package com.ruoyi.common.core.utils.ip;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;

View File

@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
@@ -73,6 +73,8 @@ public class ExcelUtil<T>
{
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
public static final String SEPARATOR = ",";
public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
public static final String[] FORMULA_STR = { "=", "-", "+", "@" };
@@ -145,23 +147,18 @@ public class ExcelUtil<T>
/**
* 对象的子列表方法
*/
private Method subMethod;
private Map<String, Method> subMethods;
/**
* 对象的子列表属性
*/
private List<Field> subFields;
private Map<String, List<Field>> subFieldsMap;
/**
* 统计列表
*/
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
/**
* 数字格式
*/
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
/**
* 实体对象
*/
@@ -228,7 +225,10 @@ public class ExcelUtil<T>
int titleLastCol = this.fields.size() - 1;
if (isSubList())
{
titleLastCol = titleLastCol + subFields.size() - 1;
for (List<Field> currentSubFields : subFieldsMap.values())
{
titleLastCol = titleLastCol + currentSubFields.size() - 1;
}
}
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
titleRow.setHeightInPoints(30);
@@ -248,16 +248,17 @@ public class ExcelUtil<T>
{
Row subRow = sheet.createRow(rownum);
int column = 0;
int subFieldSize = subFields != null ? subFields.size() : 0;
for (Object[] objects : fields)
{
Field field = (Field) objects[0];
Excel attr = (Excel) objects[1];
CellStyle cellStyle = styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()));
if (Collection.class.isAssignableFrom(field.getType()))
{
Cell cell = subRow.createCell(column);
cell.setCellValue(attr.name());
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
cell.setCellStyle(cellStyle);
int subFieldSize = subFieldsMap != null ? subFieldsMap.get(field.getName()).size() : 0;
if (subFieldSize > 1)
{
CellRangeAddress cellAddress = new CellRangeAddress(rownum, rownum, column, column + subFieldSize - 1);
@@ -269,7 +270,7 @@ public class ExcelUtil<T>
{
Cell cell = subRow.createCell(column++);
cell.setCellValue(attr.name());
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
cell.setCellStyle(cellStyle);
}
}
rownum++;
@@ -341,7 +342,11 @@ public class ExcelUtil<T>
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(titleNum);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
if (heard == null)
{
throw new UtilException("文件标题行为空请检查Excel文件格式");
}
for (int i = 0; i < heard.getLastCellNum(); i++)
{
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell))
@@ -349,10 +354,6 @@ public class ExcelUtil<T>
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
}
else
{
cellMap.put(null, i);
}
}
// 有数据时才处理 得到类的所有field.
List<Object[]> fields = this.getFields();
@@ -381,7 +382,7 @@ public class ExcelUtil<T>
Object val = this.getCellValue(row, entry.getKey());
// 如果不存在实例则新建.
entity = (entity == null ? clazz.newInstance() : entity);
entity = (entity == null ? clazz.getDeclaredConstructor().newInstance() : entity);
// 从map中得到对应列的field.
Field field = (Field) entry.getValue()[0];
Excel attr = (Excel) entry.getValue()[1];
@@ -390,7 +391,7 @@ public class ExcelUtil<T>
if (String.class == fieldType)
{
String s = Convert.toStr(val);
if (StringUtils.endsWith(s, ".0"))
if (s.matches("^\\d+\\.0$"))
{
val = StringUtils.substringBefore(s, ".0");
}
@@ -565,7 +566,8 @@ public class ExcelUtil<T>
Excel excel = (Excel) os[1];
if (Collection.class.isAssignableFrom(field.getType()))
{
for (Field subField : subFields)
List<Field> currentSubFields = subFieldsMap.get(field.getName());
for (Field subField : currentSubFields)
{
Excel subExcel = subField.getAnnotation(Excel.class);
this.createHeadCell(subExcel, row, column++);
@@ -578,7 +580,7 @@ public class ExcelUtil<T>
}
if (Type.EXPORT.equals(type))
{
fillExcelData(index, row);
fillExcelData(index);
addStatisticsRow();
}
}
@@ -588,10 +590,9 @@ public class ExcelUtil<T>
* 填充excel数据
*
* @param index 序号
* @param row 单元格行
*/
@SuppressWarnings("unchecked")
public void fillExcelData(int index, Row row)
public void fillExcelData(int index)
{
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, list.size());
@@ -599,7 +600,7 @@ public class ExcelUtil<T>
for (int i = startNo; i < endNo; i++)
{
row = sheet.createRow(currentRowNum);
Row row = sheet.createRow(currentRowNum);
T vo = (T) list.get(i);
int column = 0;
int maxSubListSize = getCurrentMaxSubListSize(vo);
@@ -612,6 +613,7 @@ public class ExcelUtil<T>
try
{
Collection<?> subList = (Collection<?>) getTargetValue(vo, field, excel);
List<Field> currentSubFields = subFieldsMap.get(field.getName());
if (subList != null && !subList.isEmpty())
{
int subIndex = 0;
@@ -624,15 +626,15 @@ public class ExcelUtil<T>
}
int subColumn = column;
for (Field subField : subFields)
for (Field subField : currentSubFields)
{
Excel subExcel = subField.getAnnotation(Excel.class);
addCell(subExcel, subRow, (T) subVo, subField, subColumn++);
}
subIndex++;
}
column += subFields.size();
}
column += currentSubFields.size();
}
catch (Exception e)
{
@@ -724,6 +726,7 @@ public class ExcelUtil<T>
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setDataFormat(dataFormat.getFormat("######0.00"));
Font totalFont = wb.createFont();
totalFont.setFontName("Arial");
totalFont.setFontHeightInPoints((short) 10);
@@ -972,7 +975,8 @@ public class ExcelUtil<T>
/**
* 添加单元格
*/
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
@SuppressWarnings("deprecation")
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
{
Cell cell = null;
try
@@ -984,7 +988,7 @@ public class ExcelUtil<T>
{
// 创建cell
cell = row.createCell(column);
if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
if (isSubListValue(vo) && getListCellValue(vo) > 1 && attr.needMerge())
{
if (subMergedLastRowNum >= subMergedFirstRowNum)
{
@@ -1000,7 +1004,7 @@ public class ExcelUtil<T>
String separator = attr.separator();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
{
cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat));
cell.setCellStyle(createCellStyle(cell.getCellStyle(), dateFormat));
cell.setCellValue(parseDateToStr(dateFormat, value));
}
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
@@ -1030,6 +1034,21 @@ public class ExcelUtil<T>
return cell;
}
/**
* 使用自定义格式,同时避免样式污染
*
* @param cellStyle 从此样式复制
* @param format 格式匹配的字符串
* @return 格式化后CellStyle对象
*/
private CellStyle createCellStyle(CellStyle cellStyle, String format)
{
CellStyle style = wb.createCellStyle();
style.cloneStyleFrom(cellStyle);
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format));
return style;
}
/**
* 设置 POI XSSFSheet 单元格提示或选择框
*
@@ -1081,18 +1100,36 @@ public class ExcelUtil<T>
public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol)
{
String hideSheetName = "combo_" + firstCol + "_" + endCol;
Sheet hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
for (int i = 0; i < textlist.length; i++)
Sheet hideSheet = null;
String hideSheetDataName = hideSheetName + "_data";
Name name = wb.getName(hideSheetDataName);
if (name != null)
{
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
// 名称已存在尝试从名称的引用中找到sheet名称
String refersToFormula = name.getRefersToFormula();
if (StringUtils.isNotEmpty(refersToFormula) && refersToFormula.contains("!"))
{
String sheetNameFromFormula = refersToFormula.substring(0, refersToFormula.indexOf("!"));
hideSheet = wb.getSheet(sheetNameFromFormula);
}
}
// 创建名称,可被其他单元格引用
Name name = wb.createName();
name.setNameName(hideSheetName + "_data");
name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length);
if (hideSheet == null)
{
hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
for (int i = 0; i < textlist.length; i++)
{
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
}
// 创建名称,可被其他单元格引用
name = wb.createName();
name.setNameName(hideSheetDataName);
name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length);
}
DataValidationHelper helper = sheet.getDataValidationHelper();
// 加载下拉列表内容
DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetName + "_data");
DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetDataName);
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
// 数据有效性对象
@@ -1130,7 +1167,7 @@ public class ExcelUtil<T>
public static String convertByExp(String propertyValue, String converterExp, String separator)
{
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
String[] convertSource = converterExp.split(SEPARATOR);
for (String item : convertSource)
{
String[] itemArray = item.split("=");
@@ -1167,7 +1204,7 @@ public class ExcelUtil<T>
public static String reverseByExp(String propertyValue, String converterExp, String separator)
{
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
String[] convertSource = converterExp.split(SEPARATOR);
for (String item : convertSource)
{
String[] itemArray = item.split("=");
@@ -1204,7 +1241,7 @@ public class ExcelUtil<T>
{
try
{
Object instance = excel.handler().newInstance();
Object instance = excel.handler().getDeclaredConstructor().newInstance();
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class });
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
}
@@ -1255,7 +1292,7 @@ public class ExcelUtil<T>
{
cell = row.createCell(key);
cell.setCellStyle(styles.get("total"));
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
cell.setCellValue(statistics.get(key));
}
statistics.clear();
}
@@ -1330,6 +1367,8 @@ public class ExcelUtil<T>
{
List<Object[]> fields = new ArrayList<Object[]>();
List<Field> tempFields = new ArrayList<>();
subFieldsMap = new HashMap<>();
subMethods = new HashMap<>();
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
if (StringUtils.isNotEmpty(includeFields))
@@ -1377,10 +1416,11 @@ public class ExcelUtil<T>
}
if (Collection.class.isAssignableFrom(field.getType()))
{
subMethod = getSubMethod(field.getName(), clazz);
String fieldName = field.getName();
subMethods.put(fieldName, getSubMethod(fieldName, clazz));
ParameterizedType pt = (ParameterizedType) field.getGenericType();
Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0];
this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class);
subFieldsMap.put(fieldName, FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class));
}
}
@@ -1449,7 +1489,8 @@ public class ExcelUtil<T>
{
this.sheet = wb.createSheet();
this.createTitle();
wb.setSheetName(index, sheetName + index);
int actualIndex = wb.getSheetIndex(this.sheet);
wb.setSheetName(actualIndex, sheetName + index);
}
}
@@ -1574,7 +1615,7 @@ public class ExcelUtil<T>
*/
public boolean isSubList()
{
return StringUtils.isNotNull(subFields) && subFields.size() > 0;
return !StringUtils.isEmpty(subFieldsMap);
}
/**
@@ -1582,24 +1623,32 @@ public class ExcelUtil<T>
*/
public boolean isSubListValue(T vo)
{
return StringUtils.isNotNull(subFields) && subFields.size() > 0 && StringUtils.isNotNull(getListCellValue(vo)) && getListCellValue(vo).size() > 0;
return !StringUtils.isEmpty(subFieldsMap) && getListCellValue(vo) > 0;
}
/**
* 获取集合的值
*/
public Collection<?> getListCellValue(Object obj)
public int getListCellValue(Object obj)
{
Object value;
Collection<?> value;
int max = 0;
try
{
value = subMethod.invoke(obj, new Object[] {});
for (String s : subMethods.keySet())
{
value = (Collection<?>) subMethods.get(s).invoke(obj);
if (value.size() > max)
{
max = value.size();
}
}
}
catch (Exception e)
{
return new ArrayList<Object>();
return 0;
}
return (Collection<?>) value;
return max;
}
/**

View File

@@ -310,7 +310,8 @@ public class ReflectUtils
/**
* 改变private/protected的方法为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨。
*/
public static void makeAccessible(Method method)
@SuppressWarnings("deprecation")
public static void makeAccessible(Method method)
{
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
&& !method.isAccessible())
@@ -322,7 +323,8 @@ public class ReflectUtils
/**
* 改变private/protected的成员变量为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨。
*/
public static void makeAccessible(Field field)
@SuppressWarnings("deprecation")
public static void makeAccessible(Field field)
{
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible())

View File

@@ -343,25 +343,25 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
// time_low
builder.append(digits(mostSigBits >> 32, 8));
if (false == isSimple)
if (!isSimple)
{
builder.append('-');
}
// time_mid
builder.append(digits(mostSigBits >> 16, 4));
if (false == isSimple)
if (!isSimple)
{
builder.append('-');
}
// time_high_and_version
builder.append(digits(mostSigBits, 4));
if (false == isSimple)
if (!isSimple)
{
builder.append('-');
}
// variant_and_sequence
builder.append(digits(leastSigBits >> 48, 4));
if (false == isSimple)
if (!isSimple)
{
builder.append('-');
}

View File

@@ -1,7 +1,7 @@
package com.ruoyi.common.core.xss;
import javax.validation.Constraint;
import javax.validation.Payload;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@@ -2,8 +2,8 @@ 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 jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import com.ruoyi.common.core.utils.StringUtils;
/**

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -94,7 +94,7 @@ public class DataScopeAspect
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)))
if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && (StringUtils.isEmpty(permission) || StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))))
{
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
}
@@ -107,7 +107,7 @@ public class DataScopeAspect
{
continue;
}
if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
if (StringUtils.isNotEmpty(permission) && !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
{
continue;
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,14 +20,14 @@
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<artifactId>druid-spring-boot-3-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- Dynamic DataSource -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
<version>${dynamic-ds.version}</version>
</dependency>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -2,8 +2,8 @@ package com.ruoyi.common.log.aspect;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
@@ -48,6 +48,9 @@ public class LogAspect
/** 计算操作消耗时间 */
private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
/** 参数最大长度限制 */
private static final int PARAM_MAX_LENGTH = 2000;
@Autowired
private AsyncLogService asyncLogService;
@@ -166,16 +169,16 @@ public class LogAspect
*/
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception
{
Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
String requestMethod = operLog.getRequestMethod();
Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
if (StringUtils.isEmpty(paramsMap) && StringUtils.equalsAny(requestMethod, HttpMethod.PUT.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name()))
{
String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
operLog.setOperParam(StringUtils.substring(params, 0, 2000));
operLog.setOperParam(params);
}
else
{
operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, 2000));
operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, PARAM_MAX_LENGTH));
}
}
@@ -184,7 +187,7 @@ public class LogAspect
*/
private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames)
{
String params = "";
StringBuilder params = new StringBuilder();
if (paramsArray != null && paramsArray.length > 0)
{
for (Object o : paramsArray)
@@ -194,15 +197,20 @@ public class LogAspect
try
{
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
params += jsonObj.toString() + " ";
params.append(jsonObj).append(" ");
if (params.length() >= PARAM_MAX_LENGTH)
{
return StringUtils.substring(params.toString(), 0, PARAM_MAX_LENGTH);
}
}
catch (Exception e)
{
log.error("请求参数拼装异常 msg:{}, 参数:{}", e.getMessage(), paramsArray, e);
}
}
}
}
return params.trim();
return params.toString();
}
/**

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -18,6 +18,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
@EnableCaching
@AutoConfigureBefore(RedisAutoConfiguration.class)
@SuppressWarnings("deprecation")
public class RedisConfig extends CachingConfigurerSupport
{
@Bean

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

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

View File

@@ -56,16 +56,8 @@ public class PreAuthorizeAspect
// 注解鉴权
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
checkMethodAnnotation(signature.getMethod());
try
{
// 执行原有逻辑
Object obj = joinPoint.proceed();
return obj;
}
catch (Throwable e)
{
throw e;
}
// 执行原有逻辑
return joinPoint.proceed();
}
/**

View File

@@ -1,7 +1,7 @@
package com.ruoyi.common.security.feign;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.utils.ServletUtils;

View File

@@ -1,6 +1,6 @@
package com.ruoyi.common.security.handler;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;

View File

@@ -1,7 +1,7 @@
package com.ruoyi.common.security.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import com.ruoyi.common.core.constant.SecurityConstants;

View File

@@ -3,7 +3,7 @@ package com.ruoyi.common.security.service;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -1,13 +1,14 @@
package com.ruoyi.common.security.utils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.TokenConstants;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.model.LoginUser;
import jakarta.servlet.http.HttpServletRequest;
/**
* 权限获取工具类
@@ -79,6 +80,16 @@ public class SecurityUtils
return token;
}
/**
* 是否为管理员
*
* @return 结果
*/
public static boolean isAdmin()
{
return isAdmin(getUserId());
}
/**
* 是否为管理员
*
@@ -87,7 +98,7 @@ public class SecurityUtils
*/
public static boolean isAdmin(Long userId)
{
return userId != null && 1L == userId;
return UserConstants.isAdmin(userId);
}
/**

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -26,7 +26,7 @@
<!-- SpringDoc webmvc -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
</dependencies>

View File

@@ -2,6 +2,8 @@ package com.ruoyi.common.swagger.config;
import java.util.ArrayList;
import java.util.List;
import org.springdoc.core.configuration.SpringDocConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -19,6 +21,7 @@ import io.swagger.v3.oas.models.servers.Server;
*
* @author ruoyi
*/
@AutoConfiguration(before = SpringDocConfiguration.class)
@EnableConfigurationProperties(SpringDocProperties.class)
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
public class SpringDocAutoConfiguration

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -79,7 +79,7 @@
<!-- Springdoc -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>

View File

@@ -2,8 +2,8 @@ package com.ruoyi.gateway.config;
import java.util.Set;
import java.util.stream.Collectors;
import org.springdoc.core.AbstractSwaggerUiConfigProperties;
import org.springdoc.core.SwaggerUiConfigProperties;
import org.springdoc.core.properties.AbstractSwaggerUiConfigProperties;
import org.springdoc.core.properties.SwaggerUiConfigProperties;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

View File

@@ -1,87 +0,0 @@
package com.ruoyi.gateway.filter;
import java.util.Collections;
import java.util.List;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.OrderedGatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
* 获取body请求数据解决流不能重复读取问题
*
* @author ruoyi
*/
@Component
public class CacheRequestFilter extends AbstractGatewayFilterFactory<CacheRequestFilter.Config>
{
public CacheRequestFilter()
{
super(Config.class);
}
@Override
public String name()
{
return "CacheRequestFilter";
}
@Override
public GatewayFilter apply(Config config)
{
CacheRequestGatewayFilter cacheRequestGatewayFilter = new CacheRequestGatewayFilter();
Integer order = config.getOrder();
if (order == null)
{
return cacheRequestGatewayFilter;
}
return new OrderedGatewayFilter(cacheRequestGatewayFilter, order);
}
public static class CacheRequestGatewayFilter implements GatewayFilter
{
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain)
{
// GET DELETE 不过滤
HttpMethod method = exchange.getRequest().getMethod();
if (method == null || method == HttpMethod.GET || method == HttpMethod.DELETE)
{
return chain.filter(exchange);
}
return ServerWebExchangeUtils.cacheRequestBodyAndRequest(exchange, (serverHttpRequest) -> {
if (serverHttpRequest == exchange.getRequest())
{
return chain.filter(exchange);
}
return chain.filter(exchange.mutate().request(serverHttpRequest).build());
});
}
}
@Override
public List<String> shortcutFieldOrder()
{
return Collections.singletonList("order");
}
static class Config
{
private Integer order;
public Integer getOrder()
{
return order;
}
public void setOrder(Integer order)
{
this.order = order;
}
}
}

View File

@@ -64,6 +64,7 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
};
}
@SuppressWarnings("deprecation")
private String resolveBodyFromRequest(ServerHttpRequest serverHttpRequest)
{
// 获取请求体

View File

@@ -3,7 +3,7 @@ package com.ruoyi.gateway.service.impl;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import javax.imageio.ImageIO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@@ -1,37 +0,0 @@
# Tomcat
server:
port: 8080
# Spring
spring:
application:
# 应用名称
name: ${SERVER_NAME}
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
config:
# 配置中心地址
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- ${NACOS_SHARED_CONFIGS}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: ${NACOS_SERVER}:${NACOS_PORT}
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow

View File

@@ -9,7 +9,7 @@ spring:
name: ruoyi-gateway
profiles:
# 环境配置
active: ${SPRING_PROFILES_ACTIVE:dev}
active: dev
cloud:
nacos:
discovery:

View File

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

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -46,12 +46,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- FastDFS -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
</dependency>
<!-- Minio -->
<dependency>

View File

@@ -0,0 +1,46 @@
package com.ruoyi.file.config;
import java.util.HashMap;
import java.util.Map;
import jakarta.servlet.DispatcherType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.ruoyi.file.filter.RefererFilter;
/**
* Filter配置
*
* @author ruoyi
*/
@Configuration
public class FilterConfig
{
/**
* 资源映射路径 前缀
*/
@Value("${file.prefix}")
public String localFilePrefix;
@Value("${referer.allowed-domains}")
private String allowedDomains;
@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
@ConditionalOnProperty(value = "referer.enabled", havingValue = "true")
public FilterRegistrationBean refererFilterRegistration()
{
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setDispatcherTypes(DispatcherType.REQUEST);
registration.setFilter(new RefererFilter());
registration.addUrlPatterns(localFilePrefix + "/*");
registration.setName("refererFilter");
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
Map<String, String> initParameters = new HashMap<String, String>();
initParameters.put("allowedDomains", allowedDomains);
registration.setInitParameters(initParameters);
return registration;
}
}

View File

@@ -3,10 +3,12 @@ package com.ruoyi.file.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.file.FileUtils;
import com.ruoyi.file.service.ISysFileService;
import com.ruoyi.system.api.domain.SysFile;
@@ -45,4 +47,26 @@ public class SysFileController
return R.fail(e.getMessage());
}
}
}
/**
* 文件删除请求
*/
@DeleteMapping("delete")
public R<Boolean> delete(String fileUrl)
{
try
{
if (!FileUtils.validateFilePath(fileUrl))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许删除。 ", fileUrl));
}
sysFileService.deleteFile(fileUrl);
return R.ok();
}
catch (Exception e)
{
log.error("删除文件失败", e);
return R.fail(e.getMessage());
}
}
}

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