406 Commits

Author SHA1 Message Date
5041f3f92f 注解修改 2022-05-23 14:17:46 +08:00
f4caf10bd3 合并更新 2022-05-23 09:49:01 +08:00
bb6fb94038 Merge branch 'dev' of https://gitea.star-rising.cn/Song/xkrs_ms into dev
# Conflicts:1
#	ruoyi-system/src/main/java/com/ruoyi/system/domain_yada/VegetationCoverageVO.java
2022-05-23 09:48:47 +08:00
7cfae514ea 控制器修改 2022-05-23 09:42:20 +08:00
d262ec6b72 更新资源 2022-05-23 09:39:52 +08:00
a51c6872d8 飞机✈保佑 2022-05-20 16:59:45 +08:00
afa068f477 修改mapper 2022-05-20 15:17:51 +08:00
c6fa415356 优化目录 2022-05-20 14:42:13 +08:00
6006a9f18c 优化项目结构 2022-05-20 14:27:08 +08:00
1722abfae7 Merge branch 'master' of https://gitea.star-rising.cn/Song/xkrs_ms into dev 2022-05-20 14:20:17 +08:00
57db36e015 no message 2022-05-20 14:19:34 +08:00
43e3d8cfea 修改控制器 2022-05-20 14:19:25 +08:00
1c16fc1d4a 添加基类 2022-05-20 14:18:53 +08:00
598860d544 11 2022-05-20 11:56:55 +08:00
95542bf4c9 Merge branch 'master' into test 2022-05-20 09:00:37 +08:00
3598fafe66 Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue 2022-05-20 08:59:45 +08:00
de1dd3a808 功能迭代 2022-05-20 08:56:41 +08:00
9c3b53b701 用户管理左侧树型组件增加选中高亮保持 2022-05-13 15:02:16 +08:00
f2cb431c90 Merge branch 'master' of https://gitea.star-rising.cn/Song/xkrs_ms
# Conflicts:
#	ruoyi-admin/src/main/resources/application-druid.yml
#	ruoyi-admin/src/main/resources/application.yml
2022-05-11 17:27:34 +08:00
9facc1b682 Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue 2022-05-11 16:40:50 +08:00
93835778ad 修改配置 2022-05-11 16:40:13 +08:00
8020eabaa9 更新 2022-05-11 15:58:35 +08:00
5693bbe1f5 升级oshi到最新版本6.1.6 2022-05-11 09:58:25 +08:00
0055f479cb 修复字典数据显示不全问题(I55MR3) 2022-05-09 20:27:09 +08:00
1c41b701dd 优化excel创建表格样式 2022-05-09 17:37:33 +08:00
9476f7f616 升级spring-boot到最新版本2.5.13 2022-05-01 20:22:35 +08:00
cbe405f6ea ui code format 2022-05-01 20:22:25 +08:00
7414bc492e 修改代码生成树选择组件 2022-04-25 10:27:06 +08:00
6f14087a16 修改显示顺序orderNum类型为整型 2022-04-25 10:23:47 +08:00
328d4b916d Excel注解支持color字体颜色 2022-04-23 20:53:16 +08:00
b42a8176ca 设置分页参数默认值 2022-04-17 10:29:12 +08:00
2a9beec31d 检查定时任务bean所在包名是否为白名单配置 2022-04-16 22:06:25 +08:00
910fe6261b 新增获取不带后缀文件名称方法 2022-04-16 22:06:15 +08:00
0c820b96d8 !471 新增一个取文件名而不带后缀的整合方法,干净又卫生啊兄弟们
Merge pull request !471 from XCSDN/N/A
2022-04-16 13:53:10 +00:00
c3c49a05c2 新增一个取文件名而不带后缀的整合方法,干净又卫生啊兄弟们 2022-04-16 06:02:07 +00:00
68a616d7c7 升级element-ui到最新版本2.15.8 2022-04-15 09:32:21 +08:00
a0447de061 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线) 2022-04-15 09:31:51 +08:00
46db06a22b !465 update ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java.
Merge pull request !465 from XCSDN/N/A
2022-04-15 01:17:21 +00:00
de5ae4a05e 添加页签openPage支持传递参数 2022-04-08 15:42:10 +08:00
c0d430f4e5 update ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java.
字典类型必须以字母开头,且字典类型只能由小写字母或加下划线还有数字组成
防止由于字典类型不符合前端开发规范而报错
2022-04-07 04:57:56 +00:00
d910888181 代码生成树表新增(展开/折叠) 2022-04-07 10:56:40 +08:00
db2dfee6ae 用户缓存信息添加部门ancestors祖级列表 2022-04-07 09:50:42 +08:00
d311d56bbf 修复Excel注解prompt/combo同时使用不生效问题 2022-04-03 18:28:30 +08:00
3bc5ef38d3 升级spring-boot到最新版本2.5.12 防止RCE漏洞 2022-04-02 10:16:09 +08:00
bac3b3a0dc 降级jsencrypt版本兼容IE浏览器 2022-04-02 10:15:25 +08:00
07fded4da9 update readme 2022-04-02 10:13:58 +08:00
a854e0ca8e 若依 3.8.2 2022-04-01 08:30:48 +08:00
de1766abde 新增清理分页的线程变量方法 2022-03-31 11:48:27 +08:00
01a566c794 升级spring-boot到最新版本2.5.11 2022-03-30 10:40:07 +08:00
5362a633e6 升级fastjson到最新版1.2.80 2022-03-30 10:39:47 +08:00
b2c3f45141 update registry source 2022-03-30 10:39:09 +08:00
d5f9b5b74a topNav自定义隐藏侧边栏路由 2022-03-30 10:38:51 +08:00
2043d1f439 优化IP地址获取到多个的问题 2022-03-27 14:36:48 +08:00
61034d4dde 优化导出excel单元格验证,包含变更为开头.防止正常内容被替换 2022-03-27 14:36:31 +08:00
6605bf35a8 reset pr 452 2022-03-26 17:28:58 +08:00
b2b93e5060 !457 修改RedisCache方法形参命名
Merge pull request !457 from lu_ming/master
2022-03-26 09:25:05 +00:00
098286fcaf 修改RedisCache方法形参命名 2022-03-25 18:50:51 +08:00
eaa12de740 添加新群号:167385320 2022-03-22 16:47:56 +08:00
857054179c 优化固定Header后顶部导航栏样式问题(I4XDN5) 2022-03-17 09:42:39 +08:00
0a3fcfd9f4 !453 update ruoyi-ui/src/store/modules/user.js.
Merge pull request !453 from guxin0123/N/A
2022-03-16 05:19:33 +00:00
0271aa5414 update ruoyi-ui/src/store/modules/user.js.
修复数据库用户表 头像列为 null 时不显示默认头像问题
2022-03-16 04:52:33 +00:00
a0364f0758 优化菜单名称过长悬停显示标题 2022-03-15 14:24:52 +08:00
ed693e89c9 !452 跨域问题
Merge pull request !452 from younger007/master
2022-03-15 06:23:38 +00:00
526957e0ac !447 优化:解决导出数据时,LocalDateTime类型数据导出没数据问题
Merge pull request !447 from 黄严/dev
2022-03-15 06:23:24 +00:00
420a43cdd5 update ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java.
和文件下载那边一样,存在跨域问题
2022-03-14 02:52:29 +00:00
5e8ccda522 日期转换错误,issue地址:https://gitee.com/y_project/RuoYi-Vue/issues/I4X0U7 2022-03-09 14:39:19 +08:00
62fc38078c 修复遗漏的拼写错误 2022-03-09 10:05:39 +08:00
bc4f844cd8 !445 文件上传兼容Weblogic环境
Merge pull request !445 from yaoozu/master
2022-03-09 02:03:50 +00:00
f15f8e3295 文件上传兼容Weblogic环境 2022-03-07 10:44:01 +08:00
6130bebbb3 开启TopNav没有子菜单情况隐藏侧边栏 2022-03-06 09:03:44 +08:00
9f944c043f !444 修改提示
Merge pull request !444 from SG/N/A
2022-03-05 14:11:22 +00:00
092b3214c5 !443 修复代码错误,其他文件也修改下
Merge pull request !443 from SG/N/A
2022-03-05 14:11:17 +00:00
SG
07dfef48be 修改提示 2022-03-05 12:28:44 +00:00
e9571fc2e2 fix 2022-03-05 05:06:39 +00:00
22f7ccc11d 修复导入Excel时字典字段类型为Long转义为空问题 2022-03-05 08:39:52 +08:00
SG
4bd5009ec1 修复代码错误,其他文件也修改下 2022-03-04 14:38:57 +00:00
cb8f5de5af 修复表单清除元素位置未垂直居中问题(I4V27B) 2022-03-04 19:24:28 +08:00
ac030b7275 优化Excel格式化不同类型的日期对象 2022-02-26 09:54:52 +08:00
9370747479 升级spring-boot到最新版本2.5.10 2022-02-26 09:48:17 +08:00
45efd9290e !438 fix: 服务监控中运行参数显示条件错误
Merge pull request !438 from fuzui/fix_args_show_condition
2022-02-26 01:06:48 +00:00
96edba7eec fix: 服务监控中运行参数显示条件错误 2022-02-26 03:20:50 +08:00
927b05713a 组件fileUpload支持多文件同时选择上传 2022-02-25 11:51:29 +08:00
8f23ff7274 !437 解决通用下载接口跨域问题
Merge pull request !437 from 兮陌/master
2022-02-25 03:49:36 +00:00
158e883e47 fix: 修复文件下载跨域问题 2022-02-25 10:40:29 +08:00
e62e8e372c 组件ImageUpload支持多图同时选择上传 2022-02-25 09:08:56 +08:00
bb65cd1976 代码生成子表支持日期/字典配置 2022-02-24 09:28:51 +08:00
1086c00929 !436 优化部门管理页面email字段的表单验证多余的单引号
Merge pull request !436 from lu_ming/master
2022-02-23 12:46:09 +00:00
9aaa9ce8aa 优化部门管理页面email字段的表单验证多余的单引号 2022-02-23 20:00:47 +08:00
cb5a6d29e2 页面若未匹配到字典标签则返回原字典值 2022-02-23 16:55:09 +08:00
4d8bd8805b 优化个人中心页面email字段的表单验证多余的单引号 2022-02-23 16:54:59 +08:00
c8c57b545a 优化菜单关键字导致的插件报错问题 2022-02-22 19:10:34 +08:00
d0f7a317e4 定时任务默认保存到内存中执行 2022-02-22 19:10:21 +08:00
aa9ed2e863 修复分页组件请求两次问题 2022-02-21 15:21:16 +08:00
54c6c4e547 服务监控新增运行参数信息显示 2022-02-20 16:06:33 +08:00
986b48cf36 升级pagehelper到最新版1.4.1 2022-02-20 16:05:04 +08:00
3bb9b03add 升级spring-boot-mybatis到最新版2.2.2 2022-02-20 16:04:40 +08:00
f05aa674ab 升级oshi到最新版本6.1.2 2022-02-20 16:04:25 +08:00
965bdc9986 !431 修改登录超时刷新页面跳转登录页面还提示重新登录问题
Merge pull request !431 from 也曾为你、像超人/master
2022-02-19 09:08:50 +00:00
e793138031 修改登录超时刷新页面跳转登录页面还提示重新登录问题 2022-02-17 17:16:11 +08:00
d734bfc34f 修复分页组件请求两次问题(I4SQOR) 2022-02-17 11:56:11 +08:00
84fe0737de update 更新uuid去除默认值 漏改 2022-02-16 08:53:11 +00:00
81630a096f 代码生成同步保留必填/类型选项 2022-02-13 21:06:28 +08:00
21780d8106 优化代码 2022-02-13 21:06:18 +08:00
b7b4364db2 代码生成编辑修改打开新页签 2022-02-12 13:14:09 +08:00
d9859de756 代码优化 2022-02-12 13:13:04 +08:00
5e6fd0d1e1 !429 修复自定义组件file-upload无法显示第一个文件,列表显示的文件比实际文件少一个的问题
Merge pull request !429 from hjk2008/master
2022-02-12 03:56:02 +00:00
a91d7cdd72 !428 删除方法无返回值时,方法注释上的@return,StringBuilder append() 改为链式调用
Merge pull request !428 from 我的世界有我/master
2022-02-12 03:55:12 +00:00
d00dc3b03a !426 修正单词拼写错误
Merge pull request !426 from 稚屿/master
2022-02-12 03:54:13 +00:00
f5c69bae30 !425 优化默认值的问题,Model中不建议有默认值的逻辑
Merge pull request !425 from Yancey/default_value_optimization
2022-02-12 03:53:29 +00:00
89fe17f419 !424 update .gitignore.
Merge pull request !424 from oo0oo/N/A
2022-02-12 03:53:06 +00:00
sam
c491257359 修复自定义组件file-upload无法显示第一个文件,列表显示的文件比实际文件少一个的问题 2022-02-12 08:46:12 +08:00
dd5e514d92 StringBuilder append方法改为链式调用 2022-02-11 10:06:07 +08:00
2532e40f9c 删除方法无返回值时,方法注释上的@return 2022-02-11 10:05:01 +08:00
50236ae4e5 修复Xss注解字段值为空时的异常问题 2022-02-10 17:17:51 +08:00
c99eb98001 代码优化 2022-02-09 09:10:50 +08:00
a29201a248 修正单词拼写错误 2022-02-09 08:46:54 +08:00
6f0c59d7be 优化默认值的问题,Model中不建议有默认值的逻辑。 2022-02-09 00:27:51 +08:00
a6ed5667ab update .gitignore.
添加JRebel工具rebel.xml文件规则至gitignore
2022-02-01 02:24:49 +00:00
612c4293d1 用户访问控制时校验数据权限,防止越权 2022-01-27 12:05:04 +08:00
8007b22b85 导出Excel时屏蔽公式,防止CSV注入风险 2022-01-27 12:04:40 +08:00
35664d818d update ry.bat 2022-01-27 12:04:21 +08:00
1fe08f49c7 升级spring-boot到最新版本2.5.9 2022-01-23 10:56:41 +08:00
48b007543a fix css class name 2022-01-22 14:05:44 +00:00
dccb3ac6c6 修复选项卡点击右键刷新丢失参数问题 2022-01-18 11:29:31 +08:00
89cd2106ed !416 update ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java.
Merge pull request !416 from SG/N/A
2022-01-18 03:25:31 +00:00
74f991b8c5 !414 优化任务队列满时任务拒绝策略
Merge pull request !414 from root/master
2022-01-18 03:20:23 +00:00
SG
a966b95a5b update ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java.
修正文字
2022-01-14 09:24:15 +00:00
15f05b602f fix ruoyi-vue3下点击编辑,取消修改报错问题 2022-01-14 16:26:03 +08:00
9e51d3f250 优化任务队列满时任务拒绝策略 2022-01-14 11:54:46 +08:00
d7ca248bc8 update copyright 2022 2022-01-14 11:47:25 +08:00
3980b2f2ff 定时任务屏蔽违规的字符 2022-01-14 11:47:14 +08:00
bed9fcea46 优化加载字典缓存数据 2022-01-14 11:46:51 +08:00
b1b82857ba 优化字段更新未同步 2022-01-14 11:46:05 +08:00
869dcf73f8 Vue3前端代码生成模板同步到最新 2022-01-11 17:20:50 +08:00
96a34d1ad7 !409 翻页组件多了一个 :p 导致生成代码无法翻页
Merge pull request !409 from guxin0123/master
2022-01-11 09:17:31 +00:00
766361ac83 update ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm.
翻页组件多了一个 :p 导致生成代码无法翻页
2022-01-11 04:57:26 +00:00
9bd7509e87 添加新群号:264312783 2022-01-11 09:02:16 +08:00
9f7acd4cf9 优化部门修改缩放后出现的错位问题 2022-01-08 09:23:45 +08:00
eb11337f7d 添加遗漏的分页参数合理化属性 2022-01-07 13:09:58 +08:00
d2872539e3 修正文字错误 2022-01-07 13:08:51 +08:00
1a5b024df6 定时任务目标字符串验证包名白名单 2022-01-06 14:50:56 +08:00
578d65dfb4 定时任务目标字符串过滤特殊字符 2022-01-05 14:56:05 +08:00
db4c2d3dd5 代码生成列表图片支持预览 2022-01-04 20:27:08 +08:00
47842a1611 update donate 2022-01-04 20:26:49 +08:00
f4f4cd9b1f Create FUNDING.yml 2022-01-04 19:50:01 +08:00
b7452cc281 update README.md 2022-01-04 10:49:59 +08:00
8ba91fc9dd 优化查询用户详细信息 2022-01-04 09:10:49 +08:00
c8d9b3f8fc 前端支持设置是否需要防止数据重复提交 2022-01-02 10:37:09 +08:00
c9d19cbe56 空值不进行回显数据字典 2022-01-02 10:29:15 +08:00
10ae0bce65 用户修改减少一次角色列表关联查询 2022-01-01 09:50:35 +08:00
7bc15245aa 预览组件支持多图显示 2022-01-01 09:46:18 +08:00
cb6228800b 代码生成新增Java类型Boolean 2022-01-01 09:28:52 +08:00
6ef899d000 修复登录失效后多次请求提示多次弹窗问题 2021-12-31 10:03:54 +08:00
6353f4ff09 若依 3.8.1 2021-12-31 00:00:06 +08:00
bb1af390a7 升级log4j2到2.17.1,防止漏洞风险 2021-12-30 14:41:25 +08:00
f65cd6245d 防重复提交标识组合(key + url + header) 2021-12-30 14:14:40 +08:00
530b2a51d5 修改单词拼写错误 2021-12-30 14:13:38 +08:00
d51e7cbb51 用户管理部门查询选择节点后分页参数初始 2021-12-29 11:04:09 +08:00
f244fe1855 !395 fix https://gitee.com/y_project/RuoYi-Vue/issues/I4O5WD
Merge pull request !395 from 马小法/master
2021-12-29 02:14:26 +00:00
1294f68265 fix https://gitee.com/y_project/RuoYi-Vue/issues/I4O5WD 2021-12-27 15:33:22 +08:00
0e771a6c1b 升级spring-boot到最新版本2.5.8 2021-12-27 12:38:59 +08:00
e4df0c6da1 优化代码生成字典组重复问题 2021-12-24 14:51:33 +08:00
7b23b6db6f 升级oshi到最新版本v5.8.6 2021-12-24 12:00:29 +08:00
be412faf6c 升级fastjson到最新版1.2.79 2021-12-21 13:32:40 +08:00
fd3a699ad8 SQL工具类新增检查关键字方法 2021-12-21 13:32:28 +08:00
c28aa299bd 新增使用Gzip解压缩静态文件地址 2021-12-20 14:25:52 +08:00
a028b566ed 集成compression-webpack-plugin插件实现打包Gzip压缩 2021-12-20 09:46:17 +08:00
ca2405c104 升级log4j2到安全版本,防止漏洞风险 2021-12-19 19:56:53 +08:00
e5647793ce 路由支持单独配置菜单或角色权限 2021-12-18 16:48:31 +08:00
903b5aebca 新增图片预览组件 2021-12-18 12:23:59 +08:00
7492dcc9e6 请求分页方法设置成通用方便灵活调用 2021-12-18 12:22:41 +08:00
8978012f9d 修复打包后字体图标偶现的乱码问题 2021-12-17 11:36:15 +08:00
7cf4a5da87 !391 修改重置表单bug
Merge pull request !391 from 18297093310/jieoschina-master-patch-51652
2021-12-17 03:17:16 +00:00
47b67331d4 修改重置表单bug 2021-12-17 03:06:25 +00:00
6e14601c7c 修复版本差异导致的懒加载报错问题 2021-12-16 16:34:20 +08:00
fef7ead0d5 新增Vue3前端代码生成模板 2021-12-16 09:51:11 +08:00
06aef0587a 用户导入提示溢出则显示滚动条 2021-12-16 09:50:26 +08:00
bf7c259cdd !390 fix: cron组件中周回显bug
Merge pull request !390 from fuzui/fix_week_echo_in_cron_component
2021-12-16 01:45:14 +00:00
43d76e5990 fix: cron组件中周回显bug 2021-12-16 02:18:48 +08:00
d365a52cd6 自定义xss校验注解实现 2021-12-15 10:50:10 +08:00
e1c7115d8c 升级log4j2到安全版本,防止漏洞风险 2021-12-14 12:09:57 +08:00
bb4d75aff0 升级log4j2到安全版本,防止漏洞风险 2021-12-14 10:33:25 +08:00
2743785aaf 修复多参数逗号分隔的问题 2021-12-13 10:11:34 +08:00
2a235917dc 优化下载解析blob异常提示 2021-12-10 10:03:25 +08:00
44ce6774dc 代码生成预览支持复制内容 2021-12-09 09:57:02 +08:00
b911d7f78f 自定义文字复制剪贴指令 2021-12-09 09:56:11 +08:00
4644176e26 升级clipboard到最新版本2.0.8 2021-12-09 09:52:44 +08:00
850b98337b 修正用户分配角色属性错误 2021-12-06 20:58:10 +08:00
7f2921f26b !382 update 优化查询用户的角色组、岗位组代码
Merge pull request !382 from 疯狂的狮子Li/update
2021-12-06 12:35:59 +00:00
836017f2b9 !381 fix 修复主键溢出问题 将查询返回类型改为 Long
Merge pull request !381 from 疯狂的狮子Li/fix
2021-12-06 12:34:52 +00:00
4de4763baf update 优化查询用户的角色组、岗位组代码 2021-12-06 18:32:51 +08:00
965ebd0f03 fix 修复主键溢出问题 将查询返回类型改为 Long 2021-12-03 11:11:43 +08:00
2c3f1c28e5 tomcat update 2021-12-02 16:31:51 +08:00
6bfae2652f 若依 3.8.0 2021-12-01 08:53:11 +08:00
9bc730866f 🎉 RuoYi-Vue3(Vue3 Element Plus Vite)版本 2021-11-30 11:15:33 +08:00
a2d3f987c0 优化代码 2021-11-30 11:15:17 +08:00
bf4ac3ad7a !378 fix: crontab组件bug
Merge pull request !378 from fuzui/fix_cron_tool
2021-11-30 03:03:08 +00:00
f28a91969a fix: crontab组件中规范数据范围、冗余代码去除以及部分通配符说明 2021-11-30 02:08:08 +08:00
ca285f5e53 fix: crontab组件周显示及计算bug 2021-11-30 00:22:23 +08:00
34f2552cad fix: crontab组件互斥bug 2021-11-30 00:17:12 +08:00
89e7cb19b9 注册成功提示类型success 2021-11-26 18:11:57 +08:00
ea71c9b214 !376 camelCase中应该转换下划线,而不是横杠
Merge pull request !376 from khejing/master
2021-11-26 10:07:58 +00:00
e5fd1f76db camelCase中应该是下划线,而不是横杠 2021-11-26 08:26:45 +00:00
664192da0b 升级velocity到最新版本2.3(语法升级) 2021-11-25 15:18:02 +08:00
9fc3e220a7 防止修改用户个人信息接口修改用户名 2021-11-25 14:00:27 +08:00
64f6a69d9a 修复代码生成复选框字典遗漏问题 2021-11-25 13:54:49 +08:00
16734b1d88 升级velocity到最新版本2.3 2021-11-24 15:03:04 +08:00
31106c91fb 修复使用 this.$options.data 报错问题 2021-11-24 15:00:51 +08:00
026a427103 优化前端代码 2021-11-24 14:47:24 +08:00
bafb1372a7 !375 删除代码生成中冗余的导出方法
Merge pull request !375 from fuzui/delete_redundancy_gen_export_function
2021-11-24 00:39:07 +00:00
b4f032fab4 删除代码生成中冗余的导出方法 2021-11-24 02:48:35 +08:00
4f194aa101 升级js-cookie到最新版本3.0.1 2021-11-22 18:07:33 +08:00
ef4bfde4a8 优化提示信息 2021-11-22 18:06:44 +08:00
421593c0ba 添加新群号:101539465 2021-11-20 12:09:53 +08:00
91ad85aec1 添加新群号:264312783 2021-11-19 15:20:54 +08:00
d1eacc1d1c 新增tab对象简化页签操作 2021-11-19 14:53:40 +08:00
e41dd8a0f1 !370 fix 修复关闭 xss 功能导致可重复读 RepeatableFilter 失效
Merge pull request !370 from 疯狂的狮子Li/master
2021-11-19 06:53:16 +00:00
9a7bb81cd0 fix 修复关闭 xss 功能导致可重复读 RepeatableFilter 失效 2021-11-19 13:01:30 +08:00
fcf606acde 升级jsencrypt到最新版本3.2.1 2021-11-18 17:50:49 +08:00
084907eeca !369 代码生成模板缺少事务
Merge pull request !369 from lihy2021/N/A
2021-11-18 09:47:35 +00:00
8de93d35ed 代码生成模板缺少事务 2021-11-17 07:56:24 +00:00
cedd2d1daf 优化导出数据操作 2021-11-17 11:57:17 +08:00
2ab96587ef 任务参数忽略双引号中的逗号 2021-11-16 16:05:15 +08:00
cb9c0e79eb 升级core-js到最新版本3.19.1 2021-11-16 14:15:17 +08:00
96d2b2d6b8 !368 【轻量级 PR】: 统一全局配置文件
Merge pull request !368 from XTvLi/master
2021-11-16 05:43:07 +00:00
b00171366f 统一全局配置内容, 删除临时调用配置文件 2021-11-10 18:17:43 +08:00
4e817a1109 升级axios到最新版本0.24.0 2021-11-10 11:14:50 +08:00
d185d4e4cc 增加sendGet无参请求方法 2021-11-10 11:13:27 +08:00
bbbe83b737 添加新群号:101539465 2021-11-02 14:40:21 +08:00
cc4c52c998 任务屏蔽违规字符 2021-11-01 15:03:06 +08:00
bd09e5b11c 修复字符串无法被反转义问题 2021-11-01 15:02:47 +08:00
181f62c15e 回显数据字典键值修正 2021-11-01 14:40:00 +08:00
3ae5ec92a5 登录/验证码请求headers不设置token 2021-11-01 13:29:27 +08:00
2fe919b6ce !361 优化一些布尔判断语法
Merge pull request !361 from 清溪先生/master
2021-11-01 05:28:59 +00:00
13c770b6be 优化一些布尔判断语法 2021-10-27 19:03:29 +08:00
2eb55528ec 升级spring-boot到最新版本2.5.6 2021-10-27 16:23:35 +08:00
839f631d6b 添加Jaxb依赖,防止jdk8以上出现的兼容错误 2021-10-27 16:22:57 +08:00
8faae71157 !359 update ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java.
Merge pull request !359 from Remenber_Ray/N/A
2021-10-27 07:37:19 +00:00
b87e0fa124 !358 update ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java.
Merge pull request !358 from 雪丛/N/A
2021-10-27 07:34:47 +00:00
b6596d021b 替换自定义验证注解 2021-10-26 17:22:20 +08:00
0628dc9b2f update ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java. 2021-10-26 08:02:48 +00:00
790aa0d24b update ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java.
增加删除Hash中的数据
2021-10-26 01:42:12 +00:00
8a7dcf8a80 修正错别字 2021-10-25 10:26:00 +08:00
0c30ffa11f !354 update ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java.
Merge pull request !354 from Remenber_Ray/N/A
2021-10-25 01:55:51 +00:00
0904bf6446 !355 fix 跨域访问之后 下载无法获取 download-filename
Merge pull request !355 from 疯狂的狮子Li/master
2021-10-25 01:55:23 +00:00
4583787759 fix 跨域访问之后 下载无法获取 download-filename 2021-10-24 17:13:04 +08:00
17550a5f4b update ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java.
修复描述错误
2021-10-24 02:34:25 +00:00
a4558c32b2 解析blob响应是否登录失效 2021-10-23 10:23:32 +08:00
ef4fef3d56 update ry.sh. 2021-10-23 10:21:02 +08:00
3dbbc6a223 AjaxResult重写put方法,以方便链式调用 2021-10-22 16:23:08 +08:00
d3696f5223 !347 update ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java.
Merge pull request !347 from abbfun/N/A
2021-10-22 08:19:00 +00:00
2d7d137abd update ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java.
AjaxResult链式调用
2021-10-22 03:09:54 +00:00
c2a179e9dd 新增认证对象简化权限验证 2021-10-20 11:21:11 +08:00
519ea854d5 生产环境使用路由懒加载提升页面响应速度 2021-10-15 17:57:46 +08:00
e66d0e4f74 角色列表返回类型保持一致 2021-10-15 17:56:57 +08:00
e7afea4cb7 升级oshi到最新版本v5.8.2 2021-10-14 16:20:18 +08:00
6d6271d6c9 修复五级以上菜单404问题 2021-10-14 16:19:46 +08:00
eb4376b649 Excel导入支持@Excels注解 2021-10-10 14:30:08 +08:00
b1e5ebab8f 升级spring-boot-mybatis到最新版2.2.0 2021-10-10 11:26:50 +08:00
8bd6296721 升级pagehelper到最新版1.4.0 2021-10-10 11:25:37 +08:00
ae5c68368b 升级SpringBoot到最新版本2.5.5 2021-10-10 11:24:16 +08:00
4fdb0f48ec 同步element2.15.6表格样式 2021-10-10 11:23:04 +08:00
c4207f640b 使用JSONField忽略字段 2021-10-10 11:21:46 +08:00
f6e477b4f5 升级druid到最新版1.2.8 2021-10-10 09:44:14 +08:00
7ae47b50b8 导入模板添加默认参数 2021-10-09 12:22:55 +08:00
0b14155a75 增加 sendGet 无参判断 2021-10-09 12:22:54 +08:00
f1fed76273 升级element-ui到最新版本2.15.6 2021-10-09 12:22:48 +08:00
48813161f6 设置mybatis默认的执行器 2021-10-04 10:27:38 +08:00
a006904724 fix 2021-09-30 03:18:41 +00:00
5477ce3c39 修正swagger没有指定dataTypeClass导致启动出现warn日志 2021-09-29 19:51:48 +08:00
25f50d74c5 升级sass-loader到最新版本10.1.1 2021-09-27 18:54:43 +08:00
266f4d6806 升级dart-sass到版本1.32.13 2021-09-27 18:54:10 +08:00
ded99502ae 新增通用方法简化下载使用 2021-09-27 10:38:29 +08:00
02b95f95a8 升级file-saver到最新版本2.0.5 2021-09-27 10:36:43 +08:00
2a6d2d733e 升级dart-sass到最新版本1.42.1 2021-09-27 10:32:03 +08:00
30c89b33fe Excel注解支持导入导出标题信息 2021-09-26 09:03:01 +08:00
7479ff4b06 修复xss过滤后格式出现的异常 2021-09-25 17:12:37 +08:00
821f40882f !332 fix 自动生成代码漏掉 this.#[[$modal]]#.msgError
Merge pull request !332 from 疯狂的狮子Li/N/A
2021-09-24 06:50:50 +00:00
02ce9868a7 fix 自动生成代码漏掉 this.#[[$modal]]#.msgError 2021-09-24 05:41:55 +00:00
a8f2ff4531 !331 update 代码生成编辑页面 拼写错误修正
Merge pull request !331 from 疯狂的狮子Li/master
2021-09-24 02:07:44 +00:00
eaa3baab3c update 代码生成编辑页面 拼写错误修正 2021-09-24 10:06:23 +08:00
6480282826 升级fastjson到最新版1.2.78 2021-09-24 09:28:46 +08:00
6197ad5090 !330 优化 记录登录信息,移除不必要的修改
Merge pull request !330 from lihy2021/N/A
2021-09-24 01:27:57 +00:00
b477e40d3c 优化 记录登录信息,移除不必要的修改 2021-09-24 00:41:43 +00:00
f8cc7ce328 限流返回类型转换数值型的格式 2021-09-23 19:15:33 +08:00
1a5881b1d0 修正服务监控磁盘变量 2021-09-23 19:09:22 +08:00
fa124aeb8b 新增通用方法简化模态/缓存使用 2021-09-23 09:57:29 +08:00
258335cc65 新增通用方法简化模态/缓存使用 2021-09-23 09:38:16 +08:00
3b42abef44 Excel注解支持自定义数据处理器 2021-09-22 09:03:01 +08:00
26f0737c60 防重提交注解支持配置间隔时间/提示消息 2021-09-20 19:09:25 +08:00
ac94242875 reset dataSourceAspect 2021-09-20 19:08:50 +08:00
54bfa627f0 防止Excel导入图片可能出现的异常 2021-09-20 19:04:57 +08:00
36c058188a 防止记录日志转换出现的异常 2021-09-20 19:04:40 +08:00
a292cccb63 代码生成点击预览重置激活tab 2021-09-18 18:58:03 +08:00
5ccd9877b4 !325 update 优化aop语法 使用spring自动注入注解 基于注解拦截的aop注解不可能为空
Merge pull request !325 from 疯狂的狮子Li/master
2021-09-18 10:47:06 +00:00
7108ec41b5 !322 Cron表达式生成器关闭时销毁,避免再次打开时存在上一次修改的数据
Merge pull request !322 from muyi/master
2021-09-18 10:43:59 +00:00
5188d56b4a !321 修复 全局限流key会多出一个"-" 将其移动到IP后面 去除多余的空格
Merge pull request !321 from 疯狂的狮子Li/N/A
2021-09-18 10:41:03 +00:00
8f7ed66544 update 优化aop语法 使用spring自动注入注解 基于注解拦截的aop注解不可能为空 2021-09-18 18:20:21 +08:00
yjb
aaae404b2a Cron表达式生成器关闭时销毁,避免再次打开时存在上一次修改的数据 2021-09-17 19:14:41 +08:00
f3a8b4625f 修复 全局限流key会多出一个"-" 将其移动到IP后面 去除多余的空格 2021-09-17 09:32:43 +00:00
12ab8b03d9 使用vue-data-dict,简化数据字典使用 2021-09-17 15:36:54 +08:00
23270c60bc 日志注解新增是否保存响应参数 2021-09-16 16:03:49 +08:00
2cb6709323 !318 修复后端主子表代码模板方法名生成错误问题
Merge pull request !318 from 稚屿/N/A
2021-09-16 07:48:08 +00:00
917bc03a43 !316 禁用DictTag中el-tag渐变动画
Merge pull request !316 from 马小法/master
2021-09-16 07:34:34 +00:00
dbe3446b63 修复后端主子表代码模板方法名生成错误问题 2021-09-14 13:53:32 +00:00
b84e7013d2 禁用el-tag组件的渐变动画 2021-09-14 15:15:22 +08:00
db193a46e8 若依 3.7.0 2021-09-13 09:36:38 +08:00
04c340627d 修复多图组件验证失败被删除问题 2021-09-10 11:06:25 +08:00
15abd4d053 优化提示 2021-09-08 11:26:08 +08:00
a7376b36f8 !312 修复代码生成页面数据编辑保存之后总是跳转第一页的问题
Merge pull request !312 from 稚屿/master
2021-09-08 03:19:59 +00:00
d2b61762b7 修复代码生成页面数据编辑保存之后总是跳转第一页的问题 2021-09-08 11:18:35 +08:00
a5e38f6f99 菜单管理支持配置路由参数 2021-09-08 09:28:23 +08:00
4988b585f8 !309 修正单词拼写错误
Merge pull request !309 from 稚屿/master
2021-09-07 08:16:58 +00:00
b35f708c07 修正单词拼写错误 2021-09-05 21:36:33 +08:00
0e6150720c 页签新增关闭左侧 2021-09-05 13:27:58 +08:00
44adf03d2c 页签右键按钮添加图标 2021-09-05 13:26:45 +08:00
9ae5edaa74 菜单&部门新增展开/折叠功能 2021-09-04 12:10:33 +08:00
14c6c796e8 新增暗色菜单风格主题 2021-09-04 12:09:55 +08:00
5d72f9d224 修复保存配置主题颜色失效问题 2021-09-03 16:50:48 +08:00
e49f0cebf1 自定义弹层溢出滚动样式 2021-09-03 13:27:03 +08:00
6361e4efdc 定时任务支持在线生成cron表达式 2021-09-03 09:54:07 +08:00
cfa86bd4fe !308 代码生成: 导入表时查询 新创建表的优先排序在前面
Merge pull request !308 from xiaoshitou/N/A
2021-09-03 01:39:40 +00:00
a56bc47a81 代码生成: 导入表时查询 新创建表的优先排序在前面 2021-09-02 20:01:25 +00:00
a15bfdfb46 防止表格最后页最后项删除变成暂无数据 2021-09-02 10:55:10 +08:00
ee823b8326 防止表格最后页最后项删除变成暂无数据 2021-09-02 10:19:04 +08:00
57178e72a4 !304 修改数据字典样式回显
Merge pull request !304 from 马小法/master
2021-09-01 01:20:59 +00:00
b8317a562c !303 修改非管理员登录时,获取菜单报错sql
Merge pull request !303 from Gold_Fish/master
2021-08-30 08:59:55 +00:00
8040ad8c03 修改数据字典回显 2021-08-30 16:53:16 +08:00
c628aa5be8 修改代码生成字典回显样式 2021-08-30 16:49:30 +08:00
b036e78d85 修改根据userId获取菜单sql 2021-08-30 02:42:49 +00:00
4e8c6fb7c0 修复字典组件值为整形不显示问题 2021-08-29 15:57:01 +08:00
134835c870 验证码默认20s超时 2021-08-29 15:56:46 +08:00
5ade90debf !299 XssHttpServletRequestWrapper中增加available方法
Merge pull request !299 from Ming/master
2021-08-29 07:36:57 +00:00
bb0aeb39e3 !298 修复带utc日期格式 yyyy-MM-dd'T'HH:mm:ss.SSS 在safari浏览器中无法正确格式化的问题
Merge pull request !298 from wjtc8/N/A
2021-08-29 07:35:06 +00:00
098c650655 update ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java.
增加available方法于XssHttpServletRequestWrapper
2021-08-24 08:42:56 +00:00
e52092c6d4 修改时检查用户数据权限范围 2021-08-24 16:00:39 +08:00
89911e7caf 修复带utc日期格式 yyyy-MM-dd'T'HH:mm:ss.SSS 在safari浏览器中无法正确格式化的问题 2021-08-24 05:51:00 +00:00
0fc266fe80 定时任务对检查异常进行事务回滚 2021-08-24 11:12:11 +08:00
d1ef19f08a 自定义可拖动弹窗高度指令 2021-08-20 17:57:44 +08:00
e6e10308ff 自定义可拖动弹窗宽度指令 2021-08-20 17:45:25 +08:00
cb5ee9c8a1 补充定时任务表字段注释 2021-08-20 11:04:15 +08:00
1e37f0430b 定时任务屏蔽ldap远程调用 2021-08-19 15:26:22 +08:00
295173258c !295 update 优化 使用权限工具 获取用户信息
Merge pull request !295 from 疯狂的狮子Li/update
2021-08-19 06:55:13 +00:00
fec90d0487 !294 update ruoyi-ui/src/layout/index.vue.
Merge pull request !294 from aasdd/N/A
2021-08-19 06:49:06 +00:00
aead560227 update 优化 使用权限工具 获取用户信息 2021-08-19 11:13:59 +08:00
8133c60ab3 update ruoyi-ui/src/layout/index.vue.
删掉此处代码,使右边栏动画生效。现在是没有动画的
2021-08-18 09:29:22 +00:00
5c155f5f11 支持自定义注解实现接口限流 2021-08-17 14:08:18 +08:00
03cf98d3c9 优化异常信息 2021-08-16 16:25:25 +08:00
6f51f729ba !289 添加日期范围支持重复添加多组日期范围,请求参数中对象的属性为null、undefined不进行拼接
Merge pull request !289 from wangzhaoqiang/master
2021-08-16 08:23:27 +00:00
57b159eb98 添加日期范围支持重复添加多组日期范围,请求参数中对象的属性为null、undefined不进行拼接 2021-08-16 14:48:34 +08:00
08da6834a5 !288 修正方法名单词拼写错误
Merge pull request !288 from 稚屿/N/A
2021-08-16 02:36:36 +00:00
268468fb47 !287 更新到【默认首页使用keep-alive缓存】后报错
Merge pull request !287 from wangzhaoqiang/master
2021-08-16 02:36:29 +00:00
333e19339c 修正方法名单词拼写错误 2021-08-15 10:26:05 +00:00
7b6ccd9b22 解决登录后浏览器后台Breadcrumb组件报错 2021-08-14 20:16:48 +08:00
5d6f134609 多图上传组件移除多余的api地址 2021-08-13 15:15:35 +08:00
f02743bde5 代码生成主子表多选行数据 2021-08-13 14:50:35 +08:00
3003bb0f50 Excel注解图片导入兼容xls 2021-08-13 10:56:35 +08:00
5139265d32 默认首页使用keep-alive缓存 2021-08-13 10:10:29 +08:00
8a67af6c26 !285 修复角色分配用户页面接收参数与传递参数类型不一致导致的错误
Merge pull request !285 from 稚屿/N/A
2021-08-13 01:55:58 +00:00
8e4802505e !284 添加SysConfigservice,SysDictTypeService的实现方法遗漏的@Override注解
Merge pull request !284 from Old丶x/master
2021-08-13 01:55:52 +00:00
8ee641c1bc 修复角色分配用户页面接收参数与传递参数类型不一致导致的错误 2021-08-13 01:08:00 +00:00
779508989f 添加加载字典数据,清空字典数据,重置字典数据方法上遗漏的@Override注解 2021-08-12 17:30:31 +08:00
d9e805a6a5 添加获取验证码方法上遗漏的@Override注解 2021-08-12 17:19:56 +08:00
7be17ea89a Excel注解支持Image图片导入 2021-08-11 10:13:34 +08:00
1f07641d9b update bin 2021-08-11 10:11:13 +08:00
c0f4f805d0 !281 补全注册用户方法上遗漏的@Override注解
Merge pull request !281 from 稚屿/N/A
2021-08-11 02:08:58 +00:00
b84224d7ba 补全注册用户方法上遗漏的@Override注解 2021-08-08 14:08:52 +00:00
98a143f1fe 添加新群号:101456076 2021-08-08 19:50:50 +08:00
3243428009 优化用户不能删除自己 2021-08-08 19:12:52 +08:00
7736097f6b 提取通用方法到基类控制器 2021-08-08 19:12:12 +08:00
fc60c003c3 升级element-ui到最新版本2.15.5 2021-08-06 14:31:39 +08:00
68ae4df2dc 升级commons.io到最新版本v2.11.0 2021-07-31 17:52:06 +08:00
de33e6ecc8 优化代码生成模板 2021-07-30 22:18:20 +08:00
a1cc346aca 优化代码生成模板 2021-07-30 21:50:47 +08:00
5397e345ca 新增是否开启用户注册功能 2021-07-30 21:23:35 +08:00
8ed7916b61 定时任务屏蔽http(s)远程调用 2021-07-30 11:28:46 +08:00
2de5cc52d1 启用父部门状态排除顶级节点 2021-07-30 11:28:04 +08:00
f6bc28000e 防止错误token导致的解析异常 2021-07-29 17:32:55 +08:00
6b5dd4d2be 优化XSS跨站脚本过滤 2021-07-28 16:04:59 +08:00
e6becb9337 BLOB下载时清除URL对象引用 2021-07-28 13:13:28 +08:00
8da55fb72a 添加新群号:101456076 2021-07-28 09:51:19 +08:00
6a5c86541a 跳转路由高亮相对应的菜单栏 2021-07-27 11:54:20 +08:00
3803ac78e2 升级oshi到最新版本v5.8.0 2021-07-27 11:53:59 +08:00
4095a1b6ee !275 fix Issue #I42GRW 任意账户越权漏洞
Merge pull request !275 from lagXkjy/master
2021-07-27 02:08:04 +00:00
3347ca4d74 fix:Issue #I42GRW 修复任意账户越权漏洞 2021-07-27 09:33:12 +08:00
9b1883988b 升级element-ui到最新版本2.15.3 2021-07-26 09:50:58 +08:00
49c8a007cc 修复定时任务日志执行状态显示 2021-07-26 09:50:33 +08:00
64f6d28441 角色&菜单新增字段属性提示信息 2021-07-25 20:08:55 +08:00
c26d87c677 内链设置meta信息 2021-07-25 20:05:18 +08:00
97ae0eb7c7 密码框新增显示切换密码图标 2021-07-25 19:13:56 +08:00
6c1cccd031 导入用户样式调整 2021-07-25 19:08:00 +08:00
856d1ceba8 顶部菜单样式调整 2021-07-25 19:06:57 +08:00
60673b3b64 去除默认分页合理化参数 2021-07-25 10:35:37 +08:00
0a516e3001 更多操作按钮添加权限控制 2021-07-25 10:20:52 +08:00
bb87f35797 富文本新增上传文件大小限制 2021-07-25 08:57:01 +08:00
c43f9bc3c2 顶部菜单排除隐藏的默认路由 2021-07-24 18:20:55 +08:00
46b43b1bd9 !269 code=401时request方法没有返回Promise.reject 修复
Merge pull request !269 from 严俊东/N/A
2021-07-24 02:48:01 +00:00
8dbda47174 !268 修正方法名单词拼写错误
Merge pull request !268 from 稚屿/N/A
2021-07-23 11:34:30 +00:00
cdace51197 code=401时request方法没有返回Promise.reject 修复 2021-07-20 04:49:22 +00:00
c24fc4282c 修正方法名单词拼写错误 2021-07-20 00:54:50 +00:00
b616a2f2e7 定时任务新增更多操作 2021-07-15 17:35:33 +08:00
60abdf1dbc 升级oshi到最新版本v5.7.5 2021-07-14 09:53:26 +08:00
7b894da43c 参数管理支持配置验证码开关 2021-07-13 10:30:40 +08:00
c8b66f9b04 删除富文本video事件 2021-07-13 10:28:55 +08:00
25d9edd5c9 !259 图片上传 - 多图时无法删除相应图片修复
Merge pull request !259 from 严俊东/N/A
2021-07-13 02:26:10 +00:00
77a21d098f 图片上传 - 多图时无法删除相应图片修复 2021-07-12 03:01:50 +00:00
359 changed files with 21334 additions and 11890 deletions

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

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

3
.gitignore vendored
View File

@ -25,6 +25,9 @@ target/
*.iml *.iml
*.ipr *.ipr
### JRebel ###
rebel.xml
### NetBeans ### ### NetBeans ###
nbproject/private/ nbproject/private/
build/* build/*

View File

@ -1,3 +1,14 @@
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.2</h1>
<h4 align="center">基于SpringBoot+Vue前后端分离的Java快速开发框架</h4>
<p align="center">
<a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.2-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## 平台简介 ## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
@ -7,6 +18,7 @@
* 权限认证使用Jwt支持多终端认证系统。 * 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。 * 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。 * 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 * 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) * 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 特别鸣谢:[element](https://github.com/ElemeFE/element)[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://github.com/elunez/eladmin-web)。 * 特别鸣谢:[element](https://github.com/ElemeFE/element)[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://github.com/elunez/eladmin-web)。
@ -82,4 +94,4 @@
## 若依前后端分离交流群 ## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。 QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) 点击按钮入群。

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD> echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>target<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
echo. echo.
%~d0 %~d0

View File

@ -1,6 +1,6 @@
@echo off @echo off
echo. echo.
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̡<EFBFBD> echo [<5B><>Ϣ] ʹ<EFBFBD><EFBFBD>Jar<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Web<EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD>
echo. echo.
cd %~dp0 cd %~dp0

33
demo/.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

BIN
demo/.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

316
demo/mvnw vendored Normal file
View File

@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
demo/mvnw.cmd vendored Normal file
View File

@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

41
demo/pom.xml Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,13 @@
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}

47
pom.xml
View File

@ -6,32 +6,31 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.6.0</version> <version>3.8.2</version>
<name>ruoyi</name> <name>ruoyi</name>
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依管理系统</description> <description>若依管理系统</description>
<properties> <properties>
<ruoyi.version>3.6.0</ruoyi.version> <ruoyi.version>3.8.2</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>11</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.6</druid.version> <druid.version>1.2.8</druid.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version> <swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.2</kaptcha.version> <kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version> <mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<pagehelper.boot.version>1.3.1</pagehelper.boot.version> <pagehelper.boot.version>1.4.1</pagehelper.boot.version>
<fastjson.version>1.2.76</fastjson.version> <fastjson.version>1.2.80</fastjson.version>
<oshi.version>5.7.4</oshi.version> <oshi.version>6.1.6</oshi.version>
<jna.version>5.8.0</jna.version> <commons.io.version>2.11.0</commons.io.version>
<commons.io.version>2.10.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version> <commons.fileupload.version>1.4</commons.fileupload.version>
<commons.collections.version>3.2.2</commons.collections.version> <commons.collections.version>3.2.2</commons.collections.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<velocity.version>1.7</velocity.version> <velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
</properties> </properties>
@ -43,7 +42,7 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId> <artifactId>spring-boot-dependencies</artifactId>
<version>2.2.13.RELEASE</version> <version>2.5.13</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -83,18 +82,6 @@
<version>${oshi.version}</version> <version>${oshi.version}</version>
</dependency> </dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>${jna.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>${jna.version}</version>
</dependency>
<!-- Swagger3依赖 --> <!-- Swagger3依赖 -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
@ -132,14 +119,8 @@
<!-- velocity代码生成使用模板 --> <!-- velocity代码生成使用模板 -->
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId> <artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version> <version>${velocity.version}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- collections工具类 --> <!-- collections工具类 -->
@ -242,7 +223,7 @@
<repository> <repository>
<id>public</id> <id>public</id>
<name>aliyun nexus</name> <name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url> <url>https://maven.aliyun.com/repository/public</url>
<releases> <releases>
<enabled>true</enabled> <enabled>true</enabled>
</releases> </releases>
@ -253,7 +234,7 @@
<pluginRepository> <pluginRepository>
<id>public</id> <id>public</id>
<name>aliyun nexus</name> <name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url> <url>https://maven.aliyun.com/repository/public</url>
<releases> <releases>
<enabled>true</enabled> <enabled>true</enabled>
</releases> </releases>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<version>3.6.0</version> <version>3.8.2</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -1,5 +1,6 @@
package com.ruoyi; package com.ruoyi;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@ -10,17 +11,18 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@MapperScan("com.ruoyi.system.mapper_yada")
public class RuoYiApplication public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 我们一起学喵叫 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" + " | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" + " | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" + " |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" + " | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" + " | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" + " | | \\ `' /| `-' / \n" +

View File

@ -6,10 +6,13 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.FastByteArrayOutputStream; import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer; import com.google.code.kaptcha.Producer;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
@ -17,6 +20,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
/** /**
* 验证码操作处理 * 验证码操作处理
@ -32,19 +36,25 @@ public class CaptchaController
@Resource(name = "captchaProducerMath") @Resource(name = "captchaProducerMath")
private Producer captchaProducerMath; private Producer captchaProducerMath;
@Autowired @Resource
private RedisCache redisCache; private RedisCache redisCache;
// 验证码类型 @Resource
@Value("${ruoyi.captchaType}") private ISysConfigService configService;
private String captchaType;
/** /**
* 生成验证码 * 生成验证码
*/ */
@GetMapping("/captchaImage") @GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException public AjaxResult getCode(HttpServletResponse response) throws IOException
{ {
AjaxResult ajax = AjaxResult.success();
boolean captchaOnOff = configService.selectCaptchaOnOff();
ajax.put("captchaOnOff", captchaOnOff);
if (!captchaOnOff)
{
return ajax;
}
// 保存验证码信息 // 保存验证码信息
String uuid = IdUtils.simpleUUID(); String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
@ -53,6 +63,7 @@ public class CaptchaController
BufferedImage image = null; BufferedImage image = null;
// 生成验证码 // 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType)) if ("math".equals(captchaType))
{ {
String capText = captchaProducerMath.createText(); String capText = captchaProducerMath.createText();
@ -78,7 +89,6 @@ public class CaptchaController
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
AjaxResult ajax = AjaxResult.success();
ajax.put("uuid", uuid); ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray())); ajax.put("img", Base64.encode(os.toByteArray()));
return ajax; return ajax;

View File

@ -1,5 +1,7 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -8,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
@ -24,6 +27,7 @@ import com.ruoyi.framework.config.ServerConfig;
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/common")
public class CommonController public class CommonController
{ {
private static final Logger log = LoggerFactory.getLogger(CommonController.class); private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@ -31,13 +35,15 @@ public class CommonController
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/** /**
* 通用下载请求 * 通用下载请求
* *
* @param fileName 文件名称 * @param fileName 文件名称
* @param delete 是否删除 * @param delete 是否删除
*/ */
@GetMapping("common/download") @GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{ {
try try
@ -64,9 +70,9 @@ public class CommonController
} }
/** /**
* 通用上传请求 * 通用上传请求(单个)
*/ */
@PostMapping("/common/upload") @PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception public AjaxResult uploadFile(MultipartFile file) throws Exception
{ {
try try
@ -77,8 +83,47 @@ public class CommonController
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url); ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 通用上传请求(多个)
*/
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
urls.add(url);
fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax; return ajax;
} }
catch (Exception e) catch (Exception e)
@ -90,7 +135,7 @@ public class CommonController
/** /**
* 本地资源通用下载 * 本地资源通用下载
*/ */
@GetMapping("/common/download/resource") @GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception throws Exception
{ {

View File

@ -1,11 +1,13 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController
@Log(title = "登录日志", businessType = BusinessType.EXPORT) @Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysLogininfor logininfor) public void export(HttpServletResponse response, SysLogininfor logininfor)
{ {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志"); util.exportExcel(response, list, "登录日志");
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")

View File

@ -1,11 +1,13 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController
@Log(title = "操作日志", businessType = BusinessType.EXPORT) @Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')") @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysOperLog operLog) public void export(HttpServletResponse response, SysOperLog operLog)
{ {
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志"); util.exportExcel(response, list, "操作日志");
} }
@Log(title = "操作日志", businessType = BusinessType.DELETE) @Log(title = "操作日志", businessType = BusinessType.DELETE)

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -13,13 +14,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
@ -50,12 +49,12 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysConfig config) public void export(HttpServletResponse response, SysConfig config)
{ {
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据"); util.exportExcel(response, list, "参数数据");
} }
/** /**
@ -83,14 +82,13 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:add')") @PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config) public AjaxResult add(@Validated @RequestBody SysConfig config)
{ {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{ {
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setCreateBy(SecurityUtils.getUsername()); config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config)); return toAjax(configService.insertConfig(config));
} }
@ -106,7 +104,7 @@ public class SysConfigController extends BaseController
{ {
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setUpdateBy(SecurityUtils.getUsername()); config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config)); return toAjax(configService.updateConfig(config));
} }

View File

@ -20,7 +20,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
@ -75,6 +74,7 @@ public class SysDeptController extends BaseController
@GetMapping(value = "/{deptId}") @GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) public AjaxResult getInfo(@PathVariable Long deptId)
{ {
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId)); return AjaxResult.success(deptService.selectDeptById(deptId));
} }
@ -113,7 +113,7 @@ public class SysDeptController extends BaseController
{ {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
dept.setCreateBy(SecurityUtils.getUsername()); dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept)); return toAjax(deptService.insertDept(dept));
} }
@ -125,20 +125,21 @@ public class SysDeptController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept) public AjaxResult edit(@Validated @RequestBody SysDept dept)
{ {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{ {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
else if (dept.getParentId().equals(dept.getDeptId())) else if (dept.getParentId().equals(deptId))
{ {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} }
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{ {
return AjaxResult.error("该部门包含未停用的子部门!"); return AjaxResult.error("该部门包含未停用的子部门!");
} }
dept.setUpdateBy(SecurityUtils.getUsername()); dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept)); return toAjax(deptService.updateDept(dept));
} }
@ -158,6 +159,7 @@ public class SysDeptController extends BaseController
{ {
return AjaxResult.error("部门存在用户,不允许删除"); return AjaxResult.error("部门存在用户,不允许删除");
} }
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId)); return toAjax(deptService.deleteDeptById(deptId));
} }
} }

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -19,7 +20,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictDataService;
@ -51,12 +51,12 @@ public class SysDictDataController extends BaseController
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysDictData dictData) public void export(HttpServletResponse response, SysDictData dictData)
{ {
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据"); util.exportExcel(response, list, "字典数据");
} }
/** /**
@ -91,7 +91,7 @@ public class SysDictDataController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) public AjaxResult add(@Validated @RequestBody SysDictData dict)
{ {
dict.setCreateBy(SecurityUtils.getUsername()); dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
@ -103,7 +103,7 @@ public class SysDictDataController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict) public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{ {
dict.setUpdateBy(SecurityUtils.getUsername()); dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict)); return toAjax(dictDataService.updateDictData(dict));
} }

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -19,7 +20,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysDictTypeService;
@ -46,12 +46,12 @@ public class SysDictTypeController extends BaseController
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysDictType dictType) public void export(HttpServletResponse response, SysDictType dictType)
{ {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型"); util.exportExcel(response, list, "字典类型");
} }
/** /**
@ -76,7 +76,7 @@ public class SysDictTypeController extends BaseController
{ {
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setCreateBy(SecurityUtils.getUsername()); dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict)); return toAjax(dictTypeService.insertDictType(dict));
} }
@ -92,7 +92,7 @@ public class SysDictTypeController extends BaseController
{ {
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setUpdateBy(SecurityUtils.getUsername()); dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict)); return toAjax(dictTypeService.updateDictType(dict));
} }

View File

@ -12,11 +12,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
/** /**
@ -36,9 +34,6 @@ public class SysLoginController
@Autowired @Autowired
private SysPermissionService permissionService; private SysPermissionService permissionService;
@Autowired
private TokenService tokenService;
/** /**
* 登录方法 * 登录方法
* *
@ -64,8 +59,7 @@ public class SysLoginController
@GetMapping("getInfo") @GetMapping("getInfo")
public AjaxResult getInfo() public AjaxResult getInfo()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); SysUser user = SecurityUtils.getLoginUser().getUser();
SysUser user = loginUser.getUser();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
// 权限集合 // 权限集合
@ -85,10 +79,8 @@ public class SysLoginController
@GetMapping("getRouters") @GetMapping("getRouters")
public AjaxResult getRouters() public AjaxResult getRouters()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); Long userId = SecurityUtils.getUserId();
// 用户信息 List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
SysUser user = loginUser.getUser();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
return AjaxResult.success(menuService.buildMenus(menus)); return AjaxResult.success(menuService.buildMenus(menus));
} }
} }

View File

@ -17,12 +17,8 @@ import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
/** /**
@ -37,9 +33,6 @@ public class SysMenuController extends BaseController
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@Autowired
private TokenService tokenService;
/** /**
* 获取菜单列表 * 获取菜单列表
*/ */
@ -47,9 +40,7 @@ public class SysMenuController extends BaseController
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(SysMenu menu) public AjaxResult list(SysMenu menu)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menus); return AjaxResult.success(menus);
} }
@ -69,9 +60,7 @@ public class SysMenuController extends BaseController
@GetMapping("/treeselect") @GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu) public AjaxResult treeselect(SysMenu menu)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
} }
@ -81,8 +70,7 @@ public class SysMenuController extends BaseController
@GetMapping(value = "/roleMenuTreeselect/{roleId}") @GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); List<SysMenu> menus = menuService.selectMenuList(getUserId());
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus)); ajax.put("menus", menuService.buildMenuTreeSelect(menus));
@ -105,7 +93,7 @@ public class SysMenuController extends BaseController
{ {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头"); return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} }
menu.setCreateBy(SecurityUtils.getUsername()); menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu)); return toAjax(menuService.insertMenu(menu));
} }
@ -129,7 +117,7 @@ public class SysMenuController extends BaseController
{ {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
} }
menu.setUpdateBy(SecurityUtils.getUsername()); menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu)); return toAjax(menuService.updateMenu(menu));
} }

View File

@ -17,7 +17,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.system.service.ISysNoticeService;
@ -63,7 +62,7 @@ public class SysNoticeController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice) public AjaxResult add(@Validated @RequestBody SysNotice notice)
{ {
notice.setCreateBy(SecurityUtils.getUsername()); notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice)); return toAjax(noticeService.insertNotice(notice));
} }
@ -75,7 +74,7 @@ public class SysNoticeController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice) public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{ {
notice.setUpdateBy(SecurityUtils.getUsername()); notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice)); return toAjax(noticeService.updateNotice(notice));
} }

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -18,7 +19,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
@ -49,12 +49,12 @@ public class SysPostController extends BaseController
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')") @PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysPost post) public void export(HttpServletResponse response, SysPost post)
{ {
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据"); util.exportExcel(response, list, "岗位数据");
} }
/** /**
@ -83,7 +83,7 @@ public class SysPostController extends BaseController
{ {
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setCreateBy(SecurityUtils.getUsername()); post.setCreateBy(getUsername());
return toAjax(postService.insertPost(post)); return toAjax(postService.insertPost(post));
} }
@ -103,7 +103,7 @@ public class SysPostController extends BaseController
{ {
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setUpdateBy(SecurityUtils.getUsername()); post.setUpdateBy(getUsername());
return toAjax(postService.updatePost(post)); return toAjax(postService.updatePost(post));
} }

View File

@ -19,7 +19,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
@ -46,7 +45,7 @@ public class SysProfileController extends BaseController
@GetMapping @GetMapping
public AjaxResult profile() public AjaxResult profile()
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user); AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
@ -61,6 +60,9 @@ public class SysProfileController extends BaseController
@PutMapping @PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) public AjaxResult updateProfile(@RequestBody SysUser user)
{ {
LoginUser loginUser = getLoginUser();
SysUser sysUser = loginUser.getUser();
user.setUserName(sysUser.getUserName());
if (StringUtils.isNotEmpty(user.getPhonenumber()) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
@ -71,14 +73,15 @@ public class SysProfileController extends BaseController
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUserId(sysUser.getUserId());
user.setPassword(null);
if (userService.updateUserProfile(user) > 0) if (userService.updateUserProfile(user) > 0)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// 更新缓存用户信息 // 更新缓存用户信息
loginUser.getUser().setNickName(user.getNickName()); sysUser.setNickName(user.getNickName());
loginUser.getUser().setPhonenumber(user.getPhonenumber()); sysUser.setPhonenumber(user.getPhonenumber());
loginUser.getUser().setEmail(user.getEmail()); sysUser.setEmail(user.getEmail());
loginUser.getUser().setSex(user.getSex()); sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return AjaxResult.success(); return AjaxResult.success();
} }
@ -92,7 +95,7 @@ public class SysProfileController extends BaseController
@PutMapping("/updatePwd") @PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) public AjaxResult updatePwd(String oldPassword, String newPassword)
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername(); String userName = loginUser.getUsername();
String password = loginUser.getPassword(); String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) if (!SecurityUtils.matchesPassword(oldPassword, password))
@ -122,7 +125,7 @@ public class SysProfileController extends BaseController
{ {
if (!file.isEmpty()) if (!file.isEmpty())
{ {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{ {

View File

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

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -21,8 +22,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
@ -63,12 +62,12 @@ public class SysRoleController extends BaseController
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')") @PreAuthorize("@ss.hasPermi('system:role:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysRole role) public void export(HttpServletResponse response, SysRole role)
{ {
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
return util.exportExcel(list, "角色数据"); util.exportExcel(response, list, "角色数据");
} }
/** /**
@ -78,6 +77,7 @@ public class SysRoleController extends BaseController
@GetMapping(value = "/{roleId}") @GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId) public AjaxResult getInfo(@PathVariable Long roleId)
{ {
roleService.checkRoleDataScope(roleId);
return AjaxResult.success(roleService.selectRoleById(roleId)); return AjaxResult.success(roleService.selectRoleById(roleId));
} }
@ -97,7 +97,7 @@ public class SysRoleController extends BaseController
{ {
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setCreateBy(SecurityUtils.getUsername()); role.setCreateBy(getUsername());
return toAjax(roleService.insertRole(role)); return toAjax(roleService.insertRole(role));
} }
@ -111,6 +111,7 @@ public class SysRoleController extends BaseController
public AjaxResult edit(@Validated @RequestBody SysRole role) public AjaxResult edit(@Validated @RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{ {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
@ -119,12 +120,12 @@ public class SysRoleController extends BaseController
{ {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setUpdateBy(SecurityUtils.getUsername()); role.setUpdateBy(getUsername());
if (roleService.updateRole(role) > 0) if (roleService.updateRole(role) > 0)
{ {
// 更新缓存用户权限 // 更新缓存用户权限
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = getLoginUser();
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
{ {
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
@ -145,6 +146,7 @@ public class SysRoleController extends BaseController
public AjaxResult dataScope(@RequestBody SysRole role) public AjaxResult dataScope(@RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role)); return toAjax(roleService.authDataScope(role));
} }
@ -157,7 +159,8 @@ public class SysRoleController extends BaseController
public AjaxResult changeStatus(@RequestBody SysRole role) public AjaxResult changeStatus(@RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
role.setUpdateBy(SecurityUtils.getUsername()); roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUsername());
return toAjax(roleService.updateRoleStatus(role)); return toAjax(roleService.updateRoleStatus(role));
} }
@ -236,6 +239,7 @@ public class SysRoleController extends BaseController
@PutMapping("/authUser/selectAll") @PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{ {
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds)); return toAjax(roleService.insertAuthUsers(roleId, userIds));
} }
} }

View File

@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -20,14 +22,11 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
@ -50,9 +49,6 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@Autowired
private TokenService tokenService;
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@ -67,12 +63,12 @@ public class SysUserController extends BaseController
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')") @PreAuthorize("@ss.hasPermi('system:user:export')")
@GetMapping("/export") @PostMapping("/export")
public AjaxResult export(SysUser user) public void export(HttpServletResponse response, SysUser user)
{ {
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.exportExcel(list, "用户数据"); util.exportExcel(response, list, "用户数据");
} }
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@ -82,17 +78,16 @@ public class SysUserController extends BaseController
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream()); List<SysUser> userList = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); String operName = getUsername();
String operName = loginUser.getUsername();
String message = userService.importUser(userList, updateSupport, operName); String message = userService.importUser(userList, updateSupport, operName);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
@GetMapping("/importTemplate") @PostMapping("/importTemplate")
public AjaxResult importTemplate() public void importTemplate(HttpServletResponse response)
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.importTemplateExcel("用户数据"); util.importTemplateExcel(response, "用户数据");
} }
/** /**
@ -102,15 +97,17 @@ public class SysUserController extends BaseController
@GetMapping(value = { "/", "/{userId}" }) @GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{ {
userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
} }
return ajax; return ajax;
} }
@ -137,7 +134,7 @@ public class SysUserController extends BaseController
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setCreateBy(SecurityUtils.getUsername()); user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user)); return toAjax(userService.insertUser(user));
} }
@ -151,6 +148,7 @@ public class SysUserController extends BaseController
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (StringUtils.isNotEmpty(user.getPhonenumber()) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
@ -161,7 +159,7 @@ public class SysUserController extends BaseController
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(getUsername());
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
} }
@ -173,6 +171,10 @@ public class SysUserController extends BaseController
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds)
{ {
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds)); return toAjax(userService.deleteUserByIds(userIds));
} }
@ -185,8 +187,9 @@ public class SysUserController extends BaseController
public AjaxResult resetPwd(@RequestBody SysUser user) public AjaxResult resetPwd(@RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(getUsername());
return toAjax(userService.resetPwd(user)); return toAjax(userService.resetPwd(user));
} }
@ -199,7 +202,8 @@ public class SysUserController extends BaseController
public AjaxResult changeStatus(@RequestBody SysUser user) public AjaxResult changeStatus(@RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
user.setUpdateBy(SecurityUtils.getUsername()); userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUsername());
return toAjax(userService.updateUserStatus(user)); return toAjax(userService.updateUserStatus(user));
} }
@ -226,6 +230,7 @@ public class SysUserController extends BaseController
@PutMapping("/authRole") @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{ {
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
return success(); return success();
} }

View File

@ -47,7 +47,7 @@ public class TestController extends BaseController
} }
@ApiOperation("获取用户详细") @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}") @GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId) public AjaxResult getUser(@PathVariable Integer userId)
{ {
@ -63,10 +63,10 @@ public class TestController extends BaseController
@ApiOperation("新增用户") @ApiOperation("新增用户")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"), @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"), @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String") @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
}) })
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(UserEntity user) public AjaxResult save(UserEntity user)
@ -95,7 +95,7 @@ public class TestController extends BaseController
} }
@ApiOperation("删除用户信息") @ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}") @DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId) public AjaxResult delete(@PathVariable Integer userId)
{ {

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AorestCoverageVO;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.service_yada.IAorestCoverageService;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 森林覆盖率
* @Author: JinSheng Song
* @Date: 2022/5/11 9:08
*/
@RestController
@RequestMapping(value = "/business-service/api/Aorest", produces = "application/json;charset=UTF-8")
public class AorestCoverageController {
@Resource
private IAorestCoverageService service;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectAorestCoverage",method = {RequestMethod.POST})
public AjaxResult selectAorestCoverage(HttpServletResponse response, HttpServletRequest request)
{
List<AorestCoverageVO> eastVOSList= service.selectAorestCoverage();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelAorestCoverage",method = {RequestMethod.POST})
public AjaxResult DelAorestCoverage(@Param("ID") String ID)
{
int NUM = service.DelAorestCoverage(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoAorestCoverage",method = {RequestMethod.POST})
public AjaxResult IntoAorestCoverage(AorestCoverageVO eastVOS)
{
int NUM = service.IntoAorestCoverage(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,74 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 澳大利亚中东部地区
* @Author: JinSheng Song
* @Date: 2022/5/11 9:08
*/
@RestController
@RequestMapping(value = "/business-service/api/Australia", produces = "application/json;charset=UTF-8")
public class AustraliaMiddleEastController
{
@Resource
private IAustraliaMiddleEastService australiaMiddleEastService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/SelectAustralia",method = {RequestMethod.POST})
public AjaxResult SelectAustralia(HttpServletResponse response, HttpServletRequest request)
{
List<AustraliaMiddleEastVO> eastVOSList= australiaMiddleEastService.selectAustralia();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelAustralia",method = {RequestMethod.POST})
public AjaxResult DelAustralia(@Param("ID") String ID)
{
int NUM = australiaMiddleEastService.DelAustralia(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoAustralia",method = {RequestMethod.POST})
public AjaxResult IntoAustralia(AustraliaMiddleEastVO eastVOS)
{
int NUM = australiaMiddleEastService.IntoAustralia(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,76 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.domain_yada.GlobalTypeVO;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.service_yada.IGlobalTypeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
*全球各类型占比
* @Author: JinSheng Song
* @Date: 2022/5/11 9:05
*/
@RestController
@RequestMapping("/monitor/clobal")
public class GlobalTypeController {
@Resource
private IGlobalTypeService typeService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectGlobalType",method = {RequestMethod.POST})
public AjaxResult selectGlobalType(HttpServletResponse response, HttpServletRequest request)
{
List<GlobalTypeVO> eastVOSList= typeService.selectGlobalType();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelGlobalType",method = {RequestMethod.POST})
public AjaxResult DelGlobalType(@Param("ID") String ID)
{
int NUM = typeService.DelGlobalType(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoGlobalType",method = {RequestMethod.POST})
public AjaxResult IntoGlobalType(GlobalTypeVO eastVOS)
{
int NUM = typeService.IntoGlobalType(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.domain_yada.OceanTemperatureVO;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.service_yada.IOceanTemperatureService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 海洋表面温度监测
* @Author: JinSheng Song
* @Date: 2022/5/11 9:13
*/
@RestController
@RequestMapping(value = "/business-service/api/Ocean", produces = "application/json;charset=UTF-8")
public class OceanTemperatureController {
@Resource
private IOceanTemperatureService temperatureService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectOcean",method = {RequestMethod.POST})
public AjaxResult selectOcean(HttpServletResponse response, HttpServletRequest request)
{
List<OceanTemperatureVO> eastVOSList= temperatureService.selectOcean();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelOcean",method = {RequestMethod.POST})
public AjaxResult DelOcean(@Param("ID") String ID)
{
int NUM = temperatureService.DelOcean(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoAustralia",method = {RequestMethod.POST})
public AjaxResult IntoOcean(OceanTemperatureVO eastVOS)
{
int NUM = temperatureService.IntoOcean(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,74 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service_yada.IRegionVGIService;
import com.ruoyi.system.domain_yada.RegionVGIVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 各区域VGI
* @Author: JinSheng Song
* @Date: 2022/5/11 9:08
*/
@RestController
@RequestMapping(value = "/business-service/api/orderMng", produces = "application/json;charset=UTF-8")
public class RegionVGIController
{
@Resource
private IRegionVGIService regionVGIService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/SelectRegion",method = {RequestMethod.POST})
public AjaxResult SelectRegion(HttpServletResponse response, HttpServletRequest request)
{
List<RegionVGIVO> vgivost= regionVGIService.selectRegion();
return AjaxResult.success(vgivost);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelRegion",method = {RequestMethod.POST})
public AjaxResult DelRegion(@Param("ID") String ID)
{
int NUM = regionVGIService.DelRegion(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param vgivo
* @return
*/
@RequestMapping(value = "/IntoRegion",method = {RequestMethod.POST})
public AjaxResult IntoRegion(RegionVGIVO vgivo)
{
int NUM = regionVGIService.IntoRegion(vgivo);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,76 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.domain_yada.RegionVGIVO;
import com.ruoyi.system.domain_yada.RegionalSystemVO;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.service_yada.IRegionalSystemService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 区域生态系统
* @Author: JinSheng Song
* @Date: 2022/5/11 9:12
*/
@RestController
@RequestMapping(value = "/business-service/api/Regional", produces = "application/json;charset=UTF-8")
public class RegionalSystemController {
@Resource
private IRegionalSystemService systemService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectRegional",method = {RequestMethod.POST})
public AjaxResult selectRegional(HttpServletResponse response, HttpServletRequest request)
{
List<RegionalSystemVO> eastVOSList= systemService.selectRegional();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelRegional",method = {RequestMethod.POST})
public AjaxResult DelRegional(@Param("ID") String ID)
{
int NUM = systemService.DelRegional(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoRegional",method = {RequestMethod.POST})
public AjaxResult IntoRegional(RegionalSystemVO eastVOS)
{
int NUM = systemService.IntoRegional(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,9 @@
package com.ruoyi.web.controller.yada;
/**
* 专题报告
* @Author: JinSheng Song
* @Date: 2022/5/11 11:10
*/
public class SpecialReportController {
}

View File

@ -0,0 +1,70 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.ThematicMapDomain;
import com.ruoyi.system.service_yada.ThematicMapService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 中国城市监测
* @Author: JinSheng Song
* @Date: 2022/5/11 10:55
*/
@RestController
@RequestMapping(value = "/thematic-map")
public class ThematicMapController {
@Resource
private ThematicMapService thematicMapService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/get/all",method = {RequestMethod.GET})
public AjaxResult selectAllThematicMap(HttpServletResponse response, HttpServletRequest request)
{
List<ThematicMapDomain> res= thematicMapService.selectAll();
return AjaxResult.success(res);
}
/**
* 删除方法
* @param id
* @return
*/
@RequestMapping(value = "/delete",method = {RequestMethod.DELETE})
public AjaxResult deleteThematicMap(@Param("id") Long id)
{
int num = thematicMapService.deleteById(id);
if (num>0) {
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param thematicMapDomain
* @return
*/
@RequestMapping(value = "/add",method = {RequestMethod.POST})
public AjaxResult saveThematicMap(ThematicMapDomain thematicMapDomain)
{
int num = thematicMapService.save(thematicMapDomain);
if (num>0) {
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.domain_yada.UrbanVO;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.service_yada.IUrbanService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 中国城市监测
* @Author: JinSheng Song
* @Date: 2022/5/11 10:55
*/
@RestController
@RequestMapping(value = "/business-service/api/Urban", produces = "application/json;charset=UTF-8")
public class UrbanController {
@Resource
private IUrbanService urbanService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectUrban",method = {RequestMethod.POST})
public AjaxResult selectUrban(HttpServletResponse response, HttpServletRequest request)
{
List<UrbanVO> eastVOSList= urbanService.selectUrban();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelUrban",method = {RequestMethod.POST})
public AjaxResult DelUrban(@Param("ID") String ID)
{
int NUM = urbanService.DelUrban(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoUrban",method = {RequestMethod.POST})
public AjaxResult IntoUrban(UrbanVO eastVOS)
{
int NUM = urbanService.IntoUrban(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.AustraliaMiddleEastVO;
import com.ruoyi.system.domain_yada.VegetationCoverageVO;
import com.ruoyi.system.service_yada.IAustraliaMiddleEastService;
import com.ruoyi.system.service_yada.IVegetationCoverageService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 平均植被覆盖度和净初级生产力
* @Author: JinSheng Song
* @Date: 2022/5/11 10:56
*/
@RestController
@RequestMapping(value = "/business-service/api/Vegetation", produces = "application/json;charset=UTF-8")
public class VegetationCoverageController {
@Resource
private IVegetationCoverageService coverageService;
/**
* 查询方法
* @param response
* @param request
* @return
*/
@RequestMapping(value = "/selectVegetation",method = {RequestMethod.POST})
public AjaxResult selectVegetation(HttpServletResponse response, HttpServletRequest request)
{
List<VegetationCoverageVO> eastVOSList= coverageService.selectVegetation();
return AjaxResult.success(eastVOSList);
}
/**
* 删除方法
* @param ID
* @return
*/
@RequestMapping(value = "/DelVegetation",method = {RequestMethod.POST})
public AjaxResult DelVegetation(@Param("ID") String ID)
{
int NUM = coverageService.DelVegetation(ID);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
/**
* 新增方法
* @param eastVOS
* @return
*/
@RequestMapping(value = "/IntoVegetation",method = {RequestMethod.POST})
public AjaxResult IntoVegetation(VegetationCoverageVO eastVOS)
{
int NUM = coverageService.IntoVegetation(eastVOS);
if (NUM>0)
{
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -6,9 +6,9 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.2.9:3306/nuoyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: saas
password: password password: XKrs123.
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -3,9 +3,9 @@ ruoyi:
# 名称 # 名称
name: RuoYi name: RuoYi
# 版本 # 版本
version: 3.6.0 version: 3.8.2
# 版权年份 # 版权年份
copyrightYear: 2021 copyrightYear: 2022
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
@ -25,10 +25,13 @@ server:
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200 # tomcat最大线程数默认为200
max-threads: 800 max: 800
# Tomcat启动初始化的线程数默认值25 # Tomcat启动初始化的线程数默认值10
min-spare-threads: 30 min-spare: 100
# 日志配置 # 日志配置
logging: logging:
@ -38,12 +41,15 @@ logging:
# Spring配置 # Spring配置
spring: spring:
# config:
# activate:
# on-profile: druid
profiles:
active: druid
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles:
active: druid
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
@ -63,9 +69,9 @@ spring:
# 端口默认为6379 # 端口默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 3
# 密码 # 密码
password: password: sdust2020
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
@ -91,16 +97,15 @@ token:
# MyBatis配置 # MyBatis配置
mybatis: mybatis:
# 搜索指定包别名 # 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain typeAliasesPackage: com.ruoyi.**.domain,com.ruoyi.**.domain_yada
# 配置mapper的扫描找到所有的mapper.xml映射文件 # 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml mapperLocations: classpath*:mapper/**/*Mapper.xml,classpath*:mapper_yada/*Mapper.xml
# 加载全局的配置文件 # 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql
reasonable: true
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
@ -111,11 +116,12 @@ swagger:
# 请求前缀 # 请求前缀
pathMapping: /dev-api pathMapping: /dev-api
# 防止XSS攻击 # 防止XSS攻击
xss: xss:
# 过滤开关 # 过滤开关
enabled: true enabled: true
# 排除链接(多个用逗号分隔) # 排除链接(多个用逗号分隔)
excludes: /system/notice/* excludes: /system/notice
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -2,7 +2,7 @@ Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version} Spring Boot Version: ${spring-boot.version}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// _ooOoo_ // // _ooOoo_ //
// o8888888o // // o6666666o //
// 88" . "88 // // 88" . "88 //
// (| ^_^ |) // // (| ^_^ |) //
// O\ = /O // // O\ = /O //

View File

@ -19,6 +19,7 @@ user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误 user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误 user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功 user.login.success=登录成功
user.register.success=注册成功
user.notfound=请重新登录 user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录 user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录 user.unknown.error=未知错误,请重新登录

View File

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

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<version>3.6.0</version> <version>3.8.2</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -43,8 +43,8 @@
<!-- 自定义验证注解 --> <!-- 自定义验证注解 -->
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>validation-api</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
</dependency> </dependency>
<!--常用工具类 --> <!--常用工具类 -->
@ -95,6 +95,12 @@
<artifactId>jjwt</artifactId> <artifactId>jjwt</artifactId>
</dependency> </dependency>
<!-- Jaxb -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- redis 缓存操作 --> <!-- redis 缓存操作 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -5,6 +5,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
/** /**
* 自定义导出Excel数据注解 * 自定义导出Excel数据注解
@ -55,11 +58,6 @@ public @interface Excel
*/ */
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
* 导出类型0数字 1字符串
*/
public ColumnType cellType() default ColumnType.STRING;
/** /**
* 导出时在excel中每个列的高度 单位为字符 * 导出时在excel中每个列的高度 单位为字符
*/ */
@ -106,9 +104,29 @@ public @interface Excel
public boolean isStatistics() default false; public boolean isStatistics() default false;
/** /**
* 导出字段对齐方式0默认1靠左2居中3靠右 * 导出类型0数字 1字符串
*/ */
Align align() default Align.AUTO; public ColumnType cellType() default ColumnType.STRING;
/**
* 导出字体颜色
*/
public IndexedColors color() default IndexedColors.BLACK;
/**
* 导出字段对齐方式
*/
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/**
* 自定义数据处理器
*/
public Class<?> handler() default ExcelHandlerAdapter.class;
/**
* 自定义数据处理器参数
*/
public String[] args() default {};
public enum Align public enum Align
{ {

View File

@ -14,5 +14,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Excels public @interface Excels
{ {
Excel[] value(); public Excel[] value();
} }

View File

@ -38,4 +38,9 @@ public @interface Log
* 是否保存请求的参数 * 是否保存请求的参数
*/ */
public boolean isSaveRequestData() default true; public boolean isSaveRequestData() default true;
/**
* 是否保存响应的参数
*/
public boolean isSaveResponseData() default true;
} }

View File

@ -0,0 +1,40 @@
package com.ruoyi.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.enums.LimitType;
/**
* 限流注解
*
* @author ruoyi
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter
{
/**
* 限流key
*/
public String key() default Constants.RATE_LIMIT_KEY;
/**
* 限流时间,单位秒
*/
public int time() default 60;
/**
* 限流次数
*/
public int count() default 100;
/**
* 限流类型
*/
public LimitType limitType() default LimitType.DEFAULT;
}

View File

@ -19,5 +19,13 @@ import java.lang.annotation.Target;
@Documented @Documented
public @interface RepeatSubmit public @interface RepeatSubmit
{ {
/**
* 间隔时间(ms),小于此时间视为重复提交
*/
public int interval() default 5000;
/**
* 提示消息
*/
public String message() default "不允许重复提交,请稍候再试";
} }

View File

@ -30,6 +30,9 @@ public class RuoYiConfig
/** 获取地址开关 */ /** 获取地址开关 */
private static boolean addressEnabled; private static boolean addressEnabled;
/** 验证码类型 */
private static String captchaType;
public String getName() public String getName()
{ {
return name; return name;
@ -90,6 +93,22 @@ public class RuoYiConfig
RuoYiConfig.addressEnabled = addressEnabled; RuoYiConfig.addressEnabled = addressEnabled;
} }
public static String getCaptchaType() {
return captchaType;
}
public void setCaptchaType(String captchaType) {
RuoYiConfig.captchaType = captchaType;
}
/**
* 获取导入上传路径
*/
public static String getImportPath()
{
return getProfile() + "/import";
}
/** /**
* 获取头像上传路径 * 获取头像上传路径
*/ */

View File

@ -1,5 +1,7 @@
package com.ruoyi.common.constant; package com.ruoyi.common.constant;
import io.jsonwebtoken.Claims;
/** /**
* 通用常量信息 * 通用常量信息
* *
@ -47,6 +49,11 @@ public class Constants
*/ */
public static final String LOGOUT = "Logout"; public static final String LOGOUT = "Logout";
/**
* 注册
*/
public static final String REGISTER = "Register";
/** /**
* 登录失败 * 登录失败
*/ */
@ -67,6 +74,11 @@ public class Constants
*/ */
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
/**
* 限流 redis key
*/
public static final String RATE_LIMIT_KEY = "rate_limit:";
/** /**
* 验证码有效期(分钟) * 验证码有效期(分钟)
*/ */
@ -95,7 +107,7 @@ public class Constants
/** /**
* 用户名称 * 用户名称
*/ */
public static final String JWT_USERNAME = "sub"; public static final String JWT_USERNAME = Claims.SUBJECT;
/** /**
* 用户头像 * 用户头像
@ -130,5 +142,26 @@ public class Constants
/** /**
* RMI 远程方法调用 * RMI 远程方法调用
*/ */
public static final String LOOKUP_RMI = "rmi://"; public static final String LOOKUP_RMI = "rmi:";
/**
* LDAP 远程方法调用
*/
public static final String LOOKUP_LDAP = "ldap:";
/**
* LDAPS 远程方法调用
*/
public static final String LOOKUP_LDAPS = "ldaps:";
/**
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
*/
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
/**
* 定时任务违规的字符
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.utils.file" };
} }

View File

@ -109,6 +109,9 @@ public class GenConstants
/** 模糊查询 */ /** 模糊查询 */
public static final String QUERY_LIKE = "LIKE"; public static final String QUERY_LIKE = "LIKE";
/** 相等查询 */
public static final String QUERY_EQ = "EQ";
/** 需要 */ /** 需要 */
public static final String REQUIRE = "1"; public static final String REQUIRE = "1";
} }

View File

@ -63,4 +63,16 @@ public class UserConstants
/** 校验返回结果码 */ /** 校验返回结果码 */
public final static String UNIQUE = "0"; public final static String UNIQUE = "0";
public final static String NOT_UNIQUE = "1"; public final static String NOT_UNIQUE = "1";
/**
* 用户名长度限制
*/
public static final int USERNAME_MIN_LENGTH = 2;
public static final int USERNAME_MAX_LENGTH = 20;
/**
* 密码长度限制
*/
public static final int PASSWORD_MIN_LENGTH = 5;
public static final int PASSWORD_MAX_LENGTH = 20;
} }

View File

@ -11,10 +11,13 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.common.utils.sql.SqlUtil;
@ -49,14 +52,7 @@ public class BaseController
*/ */
protected void startPage() protected void startPage()
{ {
PageDomain pageDomain = TableSupport.buildPageRequest(); PageUtils.startPage();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
} }
/** /**
@ -72,6 +68,14 @@ public class BaseController
} }
} }
/**
* 清理分页的线程变量
*/
protected void clearPage()
{
PageUtils.clearPage();
}
/** /**
* 响应请求分页数据 * 响应请求分页数据
*/ */
@ -86,28 +90,6 @@ public class BaseController
return rspData; return rspData;
} }
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/** /**
* 返回成功 * 返回成功
*/ */
@ -140,6 +122,28 @@ public class BaseController
return AjaxResult.error(message); return AjaxResult.error(message);
} }
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/** /**
* 页面跳转 * 页面跳转
*/ */
@ -147,4 +151,36 @@ public class BaseController
{ {
return StringUtils.format("redirect:{}", url); return StringUtils.format("redirect:{}", url);
} }
/**
* 获取用户缓存信息
*/
public LoginUser getLoginUser()
{
return SecurityUtils.getLoginUser();
}
/**
* 获取登录用户id
*/
public Long getUserId()
{
return getLoginUser().getUserId();
}
/**
* 获取登录部门id
*/
public Long getDeptId()
{
return getLoginUser().getDeptId();
}
/**
* 获取登录用户名
*/
public String getUsername()
{
return getLoginUser().getUsername();
}
} }

View File

@ -145,4 +145,18 @@ public class AjaxResult extends HashMap<String, Object>
{ {
return new AjaxResult(code, msg, null); return new AjaxResult(code, msg, null);
} }
/**
* 方便链式调用
*
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
} }

View File

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

View File

@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -57,6 +58,7 @@ public class SysDictType extends BaseEntity
@NotBlank(message = "字典类型不能为空") @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType() public String getDictType()
{ {
return dictType; return dictType;

View File

@ -3,6 +3,7 @@ package com.ruoyi.common.core.domain.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -30,7 +31,7 @@ public class SysMenu extends BaseEntity
private Long parentId; private Long parentId;
/** 显示顺序 */ /** 显示顺序 */
private String orderNum; private Integer orderNum;
/** 路由地址 */ /** 路由地址 */
private String path; private String path;
@ -38,6 +39,9 @@ public class SysMenu extends BaseEntity
/** 组件路径 */ /** 组件路径 */
private String component; private String component;
/** 路由参数 */
private String query;
/** 是否为外链0是 1否 */ /** 是否为外链0是 1否 */
private String isFrame; private String isFrame;
@ -104,13 +108,13 @@ public class SysMenu extends BaseEntity
this.parentId = parentId; this.parentId = parentId;
} }
@NotBlank(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")
public String getOrderNum() public Integer getOrderNum()
{ {
return orderNum; return orderNum;
} }
public void setOrderNum(String orderNum) public void setOrderNum(Integer orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
@ -137,6 +141,16 @@ public class SysMenu extends BaseEntity
this.component = component; this.component = component;
} }
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getIsFrame() public String getIsFrame()
{ {
return isFrame; return isFrame;

View File

@ -2,9 +2,7 @@ package com.ruoyi.common.core.domain.entity;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
@ -14,6 +12,7 @@ import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type; import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels; import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
/** /**
* 用户对象 sys_user * 用户对象 sys_user
@ -135,6 +134,7 @@ public class SysUser extends BaseEntity
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName()
{ {
@ -146,6 +146,7 @@ public class SysUser extends BaseEntity
this.nickName = nickName; this.nickName = nickName;
} }
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空") @NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() public String getUserName()

View File

@ -25,7 +25,7 @@ public class LoginBody
/** /**
* 唯一标识 * 唯一标识
*/ */
private String uuid = ""; private String uuid;
public String getUsername() public String getUsername()
{ {

View File

@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.Set; import java.util.Set;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.alibaba.fastjson.annotation.JSONField;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
/** /**
@ -16,6 +16,16 @@ public class LoginUser implements UserDetails
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 部门ID
*/
private Long deptId;
/** /**
* 用户唯一标识 * 用户唯一标识
*/ */
@ -61,6 +71,26 @@ public class LoginUser implements UserDetails
*/ */
private SysUser user; private SysUser user;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public String getToken() public String getToken()
{ {
return token; return token;
@ -81,7 +111,15 @@ public class LoginUser implements UserDetails
this.permissions = permissions; this.permissions = permissions;
} }
@JsonIgnore public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
{
this.userId = userId;
this.deptId = deptId;
this.user = user;
this.permissions = permissions;
}
@JSONField(serialize = false)
@Override @Override
public String getPassword() public String getPassword()
{ {
@ -97,7 +135,7 @@ public class LoginUser implements UserDetails
/** /**
* 账户是否未过期,过期无法验证 * 账户是否未过期,过期无法验证
*/ */
@JsonIgnore @JSONField(serialize = false)
@Override @Override
public boolean isAccountNonExpired() public boolean isAccountNonExpired()
{ {
@ -109,7 +147,7 @@ public class LoginUser implements UserDetails
* *
* @return * @return
*/ */
@JsonIgnore @JSONField(serialize = false)
@Override @Override
public boolean isAccountNonLocked() public boolean isAccountNonLocked()
{ {
@ -121,7 +159,7 @@ public class LoginUser implements UserDetails
* *
* @return * @return
*/ */
@JsonIgnore @JSONField(serialize = false)
@Override @Override
public boolean isCredentialsNonExpired() public boolean isCredentialsNonExpired()
{ {
@ -133,7 +171,7 @@ public class LoginUser implements UserDetails
* *
* @return * @return
*/ */
@JsonIgnore @JSONField(serialize = false)
@Override @Override
public boolean isEnabled() public boolean isEnabled()
{ {

View File

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

View File

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

View File

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

View File

@ -209,6 +209,18 @@ public class RedisCache
return opsForHash.get(key, hKey); return opsForHash.get(key, hKey);
} }
/**
* 删除Hash中的数据
*
* @param key
* @param hKey
*/
public void delCacheMapValue(final String key, final String hKey)
{
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.delete(key, hKey);
}
/** /**
* 获取多个Hash中的数据 * 获取多个Hash中的数据
* *

View File

@ -0,0 +1,20 @@
package com.ruoyi.common.enums;
/**
* 限流类型
*
* @author ruoyi
*/
public enum LimitType
{
/**
* 默认策略全局限流
*/
DEFAULT,
/**
* 根据请求者IP进行限流
*/
IP
}

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
package com.ruoyi.common.exception; package com.ruoyi.common.exception.base;
import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;

View File

@ -1,6 +1,6 @@
package com.ruoyi.common.exception.file; package com.ruoyi.common.exception.file;
import com.ruoyi.common.exception.BaseException; import com.ruoyi.common.exception.base.BaseException;
/** /**
* 文件信息异常类 * 文件信息异常类

View File

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

View File

@ -3,8 +3,6 @@ package com.ruoyi.common.filter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
@ -27,16 +25,10 @@ public class XssFilter implements Filter
*/ */
public List<String> excludes = new ArrayList<>(); public List<String> excludes = new ArrayList<>();
/**
* xss过滤开关
*/
public boolean enabled = false;
@Override @Override
public void init(FilterConfig filterConfig) throws ServletException public void init(FilterConfig filterConfig) throws ServletException
{ {
String tempExcludes = filterConfig.getInitParameter("excludes"); String tempExcludes = filterConfig.getInitParameter("excludes");
String tempEnabled = filterConfig.getInitParameter("enabled");
if (StringUtils.isNotEmpty(tempExcludes)) if (StringUtils.isNotEmpty(tempExcludes))
{ {
String[] url = tempExcludes.split(","); String[] url = tempExcludes.split(",");
@ -45,10 +37,6 @@ public class XssFilter implements Filter
excludes.add(url[i]); excludes.add(url[i]);
} }
} }
if (StringUtils.isNotEmpty(tempEnabled))
{
enabled = Boolean.valueOf(tempEnabled);
}
} }
@Override @Override
@ -68,25 +56,14 @@ public class XssFilter implements Filter
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response)
{ {
if (!enabled)
{
return true;
}
if (excludes == null || excludes.isEmpty())
{
return false;
}
String url = request.getServletPath(); String url = request.getServletPath();
for (String pattern : excludes) String method = request.getMethod();
{ // GET DELETE 不过滤
Pattern p = Pattern.compile("^" + pattern); if (method == null || method.matches("GET") || method.matches("DELETE"))
Matcher m = p.matcher(url);
if (m.find())
{ {
return true; return true;
} }
} return StringUtils.matches(url, excludes);
return false;
} }
@Override @Override

View File

@ -63,7 +63,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
// xss过滤 // xss过滤
json = EscapeUtil.clean(json).trim(); json = EscapeUtil.clean(json).trim();
final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8")); byte[] jsonBytes = json.getBytes("utf-8");
final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes);
return new ServletInputStream() return new ServletInputStream()
{ {
@Override @Override
@ -78,6 +79,12 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
return true; return true;
} }
@Override
public int available() throws IOException
{
return jsonBytes.length;
}
@Override @Override
public void setReadListener(ReadListener readListener) public void setReadListener(ReadListener readListener)
{ {

View File

@ -3,6 +3,11 @@ package com.ruoyi.common.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
@ -131,6 +136,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return new Date(time); return new Date(time);
} }
/**
* 计算相差天数
*/
public static int differentDaysByMillisecond(Date date1, Date date2)
{
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
/** /**
* 计算两个时间差 * 计算两个时间差
*/ */
@ -152,4 +165,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
// long sec = diff % nd % nh % nm / ns; // long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟"; return day + "" + hour + "小时" + min + "分钟";
} }
/**
* 增加 LocalDateTime ==> Date
*/
public static Date toDate(LocalDateTime temporalAccessor)
{
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
/**
* 增加 LocalDate ==> Date
*/
public static Date toDate(LocalDate temporalAccessor)
{
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
} }

View File

@ -41,8 +41,7 @@ public class DictUtils
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj)) if (StringUtils.isNotNull(cacheObj))
{ {
List<SysDictData> dictDatas = StringUtils.cast(cacheObj); return StringUtils.cast(cacheObj);
return dictDatas;
} }
return null; return null;
} }
@ -92,7 +91,7 @@ public class DictUtils
{ {
if (value.equals(dict.getDictValue())) if (value.equals(dict.getDictValue()))
{ {
propertyString.append(dict.getDictLabel() + separator); propertyString.append(dict.getDictLabel()).append(separator);
break; break;
} }
} }
@ -132,7 +131,7 @@ public class DictUtils
{ {
if (label.equals(dict.getDictLabel())) if (label.equals(dict.getDictLabel()))
{ {
propertyString.append(dict.getDictValue() + separator); propertyString.append(dict.getDictValue()).append(separator);
break; break;
} }
} }

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.exception.ServiceException;
/** /**
* 安全服务工具类 * 安全服务工具类
@ -14,6 +14,36 @@ import com.ruoyi.common.exception.CustomException;
*/ */
public class SecurityUtils public class SecurityUtils
{ {
/**
* 用户ID
**/
public static Long getUserId()
{
try
{
return getLoginUser().getUserId();
}
catch (Exception e)
{
throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED);
}
}
/**
* 获取部门ID
**/
public static Long getDeptId()
{
try
{
return getLoginUser().getDeptId();
}
catch (Exception e)
{
throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED);
}
}
/** /**
* 获取用户账户 * 获取用户账户
**/ **/
@ -25,7 +55,7 @@ public class SecurityUtils
} }
catch (Exception e) catch (Exception e)
{ {
throw new CustomException("获取用户账户异常", HttpStatus.UNAUTHORIZED); throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
} }
} }
@ -40,7 +70,7 @@ public class SecurityUtils
} }
catch (Exception e) catch (Exception e)
{ {
throw new CustomException("获取用户信息异常", HttpStatus.UNAUTHORIZED); throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED);
} }
} }

View File

@ -48,6 +48,22 @@ public class ServletUtils
return Convert.toInt(getRequest().getParameter(name), defaultValue); return Convert.toInt(getRequest().getParameter(name), defaultValue);
} }
/**
* 获取Boolean参数
*/
public static Boolean getParameterToBool(String name)
{
return Convert.toBool(getRequest().getParameter(name));
}
/**
* 获取Boolean参数
*/
public static Boolean getParameterToBool(String name, Boolean defaultValue)
{
return Convert.toBool(getRequest().getParameter(name), defaultValue);
}
/** /**
* 获取request * 获取request
*/ */
@ -83,9 +99,8 @@ public class ServletUtils
* *
* @param response 渲染对象 * @param response 渲染对象
* @param string 待渲染的字符串 * @param string 待渲染的字符串
* @return null
*/ */
public static String renderString(HttpServletResponse response, String string) public static void renderString(HttpServletResponse response, String string)
{ {
try try
{ {
@ -98,7 +113,6 @@ public class ServletUtils
{ {
e.printStackTrace(); e.printStackTrace();
} }
return null;
} }
/** /**
@ -109,13 +123,13 @@ public class ServletUtils
public static boolean isAjaxRequest(HttpServletRequest request) public static boolean isAjaxRequest(HttpServletRequest request)
{ {
String accept = request.getHeader("accept"); String accept = request.getHeader("accept");
if (accept != null && accept.indexOf("application/json") != -1) if (accept != null && accept.contains("application/json"))
{ {
return true; return true;
} }
String xRequestedWith = request.getHeader("X-Requested-With"); String xRequestedWith = request.getHeader("X-Requested-With");
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest"))
{ {
return true; return true;
} }
@ -127,10 +141,6 @@ public class ServletUtils
} }
String ajax = request.getParameter("__ajax"); String ajax = request.getParameter("__ajax");
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) return StringUtils.inStringIgnoreCase(ajax, "json", "xml");
{
return true;
}
return false;
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.util.AntPathMatcher;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.text.StrFormatter; import com.ruoyi.common.core.text.StrFormatter;
@ -323,6 +324,29 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return list; return list;
} }
/**
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
*
* @param cs 指定字符串
* @param searchCharSequences 需要检查的字符串数组
* @return 是否包含任意一个字符串
*/
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences)
{
if (isEmpty(cs) || isEmpty(searchCharSequences))
{
return false;
}
for (CharSequence testStr : searchCharSequences)
{
if (containsIgnoreCase(cs, testStr))
{
return true;
}
}
return false;
}
/** /**
* 驼峰转下划线命名 * 驼峰转下划线命名
*/ */
@ -463,9 +487,97 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return sb.toString(); return sb.toString();
} }
/**
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
*
* @param str 指定字符串
* @param strs 需要检查的字符串数组
* @return 是否匹配
*/
public static boolean matches(String str, List<String> strs)
{
if (isEmpty(str) || isEmpty(strs))
{
return false;
}
for (String pattern : strs)
{
if (isMatch(pattern, str))
{
return true;
}
}
return false;
}
/**
* 判断url是否与规则配置:
* ? 表示单个字符;
* * 表示一层路径内的任意字符串,不可跨层级;
* ** 表示任意层路径;
*
* @param pattern 匹配规则
* @param url 需要匹配的url
* @return
*/
public static boolean isMatch(String pattern, String url)
{
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T cast(Object obj) public static <T> T cast(Object obj)
{ {
return (T) obj; return (T) obj;
} }
/**
* 数字左边补齐0使之达到指定长度。注意如果数字转换为字符串后长度大于size则只保留 最后size个字符。
*
* @param num 数字对象
* @param size 字符串指定长度
* @return 返回数字的字符串格式,该字符串为指定长度。
*/
public static final String padl(final Number num, final int size)
{
return padl(num.toString(), size, '0');
}
/**
* 字符串左补齐。如果原始字符串s长度大于size则只保留最后size个字符。
*
* @param s 原始字符串
* @param size 字符串指定长度
* @param c 用于补齐的字符
* @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
*/
public static final String padl(final String s, final int size, final char c)
{
final StringBuilder sb = new StringBuilder(size);
if (s != null)
{
final int len = s.length();
if (s.length() <= size)
{
for (int i = size - len; i > 0; i--)
{
sb.append(c);
}
sb.append(s);
}
else
{
return s.substring(len - size, len);
}
}
else
{
for (int i = size; i > 0; i--)
{
sb.append(c);
}
}
return sb.toString();
}
} }

View File

@ -36,7 +36,7 @@ public class Threads
* 停止线程池 * 停止线程池
* 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务.
* 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数.
* 如果仍超時,則強制退出. * 如果仍超時,則強制退出.
* 另对在shutdown时线程本身被调用中断做了处理. * 另对在shutdown时线程本身被调用中断做了处理.
*/ */
public static void shutdownAndAwaitTermination(ExecutorService pool) public static void shutdownAndAwaitTermination(ExecutorService pool)

View File

@ -1,228 +0,0 @@
package com.ruoyi.common.utils;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import javax.imageio.ImageIO;
/**
* 验证码工具类
*
* @author ruoyi
*/
public class VerifyCodeUtils
{
// 使用到Algerian字体系统里没有的话需要安装字体字体只显示大写去掉了1,0,i,o几个容易混淆的字符
public static final String VERIFY_CODES = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
private static Random random = new SecureRandom();
/**
* 使用系统默认字符源生成验证码
*
* @param verifySize 验证码长度
* @return
*/
public static String generateVerifyCode(int verifySize)
{
return generateVerifyCode(verifySize, VERIFY_CODES);
}
/**
* 使用指定源生成验证码
*
* @param verifySize 验证码长度
* @param sources 验证码字符源
* @return
*/
public static String generateVerifyCode(int verifySize, String sources)
{
if (sources == null || sources.length() == 0)
{
sources = VERIFY_CODES;
}
int codesLen = sources.length();
Random rand = new Random(System.currentTimeMillis());
StringBuilder verifyCode = new StringBuilder(verifySize);
for (int i = 0; i < verifySize; i++)
{
verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1)));
}
return verifyCode.toString();
}
/**
* 输出指定验证码图片流
*
* @param w
* @param h
* @param os
* @param code
* @throws IOException
*/
public static void outputImage(int w, int h, OutputStream os, String code) throws IOException
{
int verifySize = code.length();
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Random rand = new Random();
Graphics2D g2 = image.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color[] colors = new Color[5];
Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA,
Color.ORANGE, Color.PINK, Color.YELLOW };
float[] fractions = new float[colors.length];
for (int i = 0; i < colors.length; i++)
{
colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)];
fractions[i] = rand.nextFloat();
}
Arrays.sort(fractions);
g2.setColor(Color.GRAY);// 设置边框色
g2.fillRect(0, 0, w, h);
Color c = getRandColor(200, 250);
g2.setColor(c);// 设置背景色
g2.fillRect(0, 2, w, h - 4);
// 绘制干扰线
Random random = new Random();
g2.setColor(getRandColor(160, 200));// 设置线条的颜色
for (int i = 0; i < 20; i++)
{
int x = random.nextInt(w - 1);
int y = random.nextInt(h - 1);
int xl = random.nextInt(6) + 1;
int yl = random.nextInt(12) + 1;
g2.drawLine(x, y, x + xl + 40, y + yl + 20);
}
// 添加噪点
float yawpRate = 0.05f;// 噪声率
int area = (int) (yawpRate * w * h);
for (int i = 0; i < area; i++)
{
int x = random.nextInt(w);
int y = random.nextInt(h);
int rgb = getRandomIntColor();
image.setRGB(x, y, rgb);
}
shear(g2, w, h, c);// 使图片扭曲
g2.setColor(getRandColor(100, 160));
int fontSize = h - 4;
Font font = new Font("Algerian", Font.ITALIC, fontSize);
g2.setFont(font);
char[] chars = code.toCharArray();
for (int i = 0; i < verifySize; i++)
{
AffineTransform affine = new AffineTransform();
affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1),
(w / verifySize) * i + fontSize / 2, h / 2);
g2.setTransform(affine);
g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10);
}
g2.dispose();
ImageIO.write(image, "jpg", os);
}
private static Color getRandColor(int fc, int bc)
{
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
private static int getRandomIntColor()
{
int[] rgb = getRandomRgb();
int color = 0;
for (int c : rgb)
{
color = color << 8;
color = color | c;
}
return color;
}
private static int[] getRandomRgb()
{
int[] rgb = new int[3];
for (int i = 0; i < 3; i++)
{
rgb[i] = random.nextInt(255);
}
return rgb;
}
private static void shear(Graphics g, int w1, int h1, Color color)
{
shearX(g, w1, h1, color);
shearY(g, w1, h1, color);
}
private static void shearX(Graphics g, int w1, int h1, Color color)
{
int period = random.nextInt(2);
boolean borderGap = true;
int frames = 1;
int phase = random.nextInt(2);
for (int i = 0; i < h1; i++)
{
double d = (double) (period >> 1)
* Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(0, i, w1, 1, (int) d, 0);
if (borderGap)
{
g.setColor(color);
g.drawLine((int) d, i, 0, i);
g.drawLine((int) d + w1, i, w1, i);
}
}
}
private static void shearY(Graphics g, int w1, int h1, Color color)
{
int period = random.nextInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++)
{
double d = (double) (period >> 1)
* Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap)
{
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
}
}

View File

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

View File

@ -2,6 +2,8 @@ package com.ruoyi.common.utils.file;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths;
import java.util.Objects;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
@ -11,7 +13,7 @@ import com.ruoyi.common.exception.file.FileSizeLimitExceededException;
import com.ruoyi.common.exception.file.InvalidExtensionException; import com.ruoyi.common.exception.file.InvalidExtensionException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.Seq;
/** /**
* 文件上传工具类 * 文件上传工具类
@ -100,7 +102,7 @@ public class FileUploadUtils
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException InvalidExtensionException
{ {
int fileNamelength = file.getOriginalFilename().length(); int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
{ {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
@ -110,10 +112,9 @@ public class FileUploadUtils
String fileName = extractFilename(file); String fileName = extractFilename(file);
File desc = getAbsoluteFile(baseDir, fileName); String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
file.transferTo(desc); file.transferTo(Paths.get(absPath));
String pathFileName = getPathFileName(baseDir, fileName); return getPathFileName(baseDir, fileName);
return pathFileName;
} }
/** /**
@ -121,13 +122,11 @@ public class FileUploadUtils
*/ */
public static final String extractFilename(MultipartFile file) public static final String extractFilename(MultipartFile file)
{ {
String fileName = file.getOriginalFilename(); return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
String extension = getExtension(file); FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
return fileName;
} }
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{ {
File desc = new File(uploadDir + File.separator + fileName); File desc = new File(uploadDir + File.separator + fileName);
@ -141,12 +140,11 @@ public class FileUploadUtils
return desc; return desc;
} }
private static final String getPathFileName(String uploadDir, String fileName) throws IOException public static final String getPathFileName(String uploadDir, String fileName) throws IOException
{ {
int dirLastIndex = RuoYiConfig.getProfile().length() + 1; int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex); String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
return pathFileName;
} }
/** /**
@ -161,7 +159,7 @@ public class FileUploadUtils
throws FileSizeLimitExceededException, InvalidExtensionException throws FileSizeLimitExceededException, InvalidExtensionException
{ {
long size = file.getSize(); long size = file.getSize();
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) if (size > DEFAULT_MAX_SIZE)
{ {
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
} }
@ -228,7 +226,7 @@ public class FileUploadUtils
String extension = FilenameUtils.getExtension(file.getOriginalFilename()); String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension)) if (StringUtils.isEmpty(extension))
{ {
extension = MimeTypeUtils.getExtension(file.getContentType()); extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
} }
return extension; return extension;
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.common.utils.file;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -10,8 +11,13 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.apache.commons.io.FilenameUtils;
/** /**
* 文件处理工具类 * 文件处理工具类
@ -53,29 +59,48 @@ public class FileUtils
} }
finally finally
{ {
if (os != null) IOUtils.close(os);
IOUtils.close(fis);
}
}
/**
* 写数据到文件中
*
* @param data 数据
* @return 目标文件
* @throws IOException IO异常
*/
public static String writeImportBytes(byte[] data) throws IOException
{ {
return writeBytes(data, RuoYiConfig.getImportPath());
}
/**
* 写数据到文件中
*
* @param data 数据
* @param uploadDir 目标文件
* @return 目标文件
* @throws IOException IO异常
*/
public static String writeBytes(byte[] data, String uploadDir) throws IOException
{
FileOutputStream fos = null;
String pathName = "";
try try
{ {
os.close(); String extension = getFileExtendName(data);
pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
fos = new FileOutputStream(file);
fos.write(data);
} }
catch (IOException e1) finally
{ {
e1.printStackTrace(); IOUtils.close(fos);
}
}
if (fis != null)
{
try
{
fis.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
} }
return FileUploadUtils.getPathFileName(uploadDir, pathName);
} }
/** /**
@ -172,7 +197,6 @@ public class FileUtils
* *
* @param response 响应对象 * @param response 响应对象
* @param realFileName 真实文件名 * @param realFileName 真实文件名
* @return
*/ */
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException
{ {
@ -186,7 +210,9 @@ public class FileUtils
.append("utf-8''") .append("utf-8''")
.append(percentEncodedFileName); .append(percentEncodedFileName);
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
response.setHeader("Content-disposition", contentDispositionValue.toString()); response.setHeader("Content-disposition", contentDispositionValue.toString());
response.setHeader("download-filename", percentEncodedFileName);
} }
/** /**
@ -200,4 +226,68 @@ public class FileUtils
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20"); return encode.replaceAll("\\+", "%20");
} }
/**
* 获取图像后缀
*
* @param photoByte 图像数据
* @return 后缀名
*/
public static String getFileExtendName(byte[] photoByte)
{
String strFileExtendName = "jpg";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97))
{
strFileExtendName = "gif";
}
else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70))
{
strFileExtendName = "jpg";
}
else if ((photoByte[0] == 66) && (photoByte[1] == 77))
{
strFileExtendName = "bmp";
}
else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71))
{
strFileExtendName = "png";
}
return strFileExtendName;
}
/**
* 获取文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
*
* @param fileName 路径名称
* @return 没有文件路径的名称
*/
public static String getName(String fileName)
{
if (fileName == null)
{
return null;
}
int lastUnixPos = fileName.lastIndexOf('/');
int lastWindowsPos = fileName.lastIndexOf('\\');
int index = Math.max(lastUnixPos, lastWindowsPos);
return fileName.substring(index + 1);
}
/**
* 获取不带后缀文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi
*
* @param fileName 路径名称
* @return 没有文件路径和后缀的名称
*/
public static String getNameNotSuffix(String fileName)
{
if (fileName == null)
{
return null;
}
String baseName = FilenameUtils.getBaseName(fileName);
return baseName;
}
} }

View File

@ -1,7 +1,6 @@
package com.ruoyi.common.utils.file; package com.ruoyi.common.utils.file;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
@ -59,13 +58,12 @@ public class ImageUtils
/** /**
* 读取文件为字节数据 * 读取文件为字节数据
* *
* @param key 地址 * @param url 地址
* @return 字节数据 * @return 字节数据
*/ */
public static byte[] readFile(String url) public static byte[] readFile(String url)
{ {
InputStream in = null; InputStream in = null;
ByteArrayOutputStream baos = null;
try try
{ {
if (url.startsWith("http")) if (url.startsWith("http"))
@ -95,7 +93,6 @@ public class ImageUtils
finally finally
{ {
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
IOUtils.closeQuietly(baos);
} }
} }
} }

View File

@ -69,26 +69,37 @@ public class EscapeUtil
*/ */
private static String encode(String text) private static String encode(String text)
{ {
int len; if (StringUtils.isEmpty(text))
if ((text == null) || ((len = text.length()) == 0))
{ {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
StringBuilder buffer = new StringBuilder(len + (len >> 2));
final StringBuilder tmp = new StringBuilder(text.length() * 6);
char c; char c;
for (int i = 0; i < len; i++) for (int i = 0; i < text.length(); i++)
{ {
c = text.charAt(i); c = text.charAt(i);
if (c < 64) if (c < 256)
{ {
buffer.append(TEXT[c]); tmp.append("%");
if (c < 16)
{
tmp.append("0");
}
tmp.append(Integer.toString(c, 16));
} }
else else
{ {
buffer.append(c); tmp.append("%u");
if (c <= 0xfff)
{
// issue#I49JU8@Gitee
tmp.append("0");
}
tmp.append(Integer.toString(c, 16));
} }
} }
return buffer.toString(); return tmp.toString();
} }
/** /**
@ -145,11 +156,12 @@ public class EscapeUtil
public static void main(String[] args) public static void main(String[] args)
{ {
String html = "<script>alert(1);</script>"; String html = "<script>alert(1);</script>";
String escape = EscapeUtil.escape(html);
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
// String html = "<123"; // String html = "<123";
// String html = "123>"; // String html = "123>";
System.out.println(EscapeUtil.clean(html)); System.out.println("clean: " + EscapeUtil.clean(html));
System.out.println(EscapeUtil.escape(html)); System.out.println("escape: " + escape);
System.out.println(EscapeUtil.unescape(html)); System.out.println("unescape: " + EscapeUtil.unescape(escape));
} }
} }

View File

@ -332,7 +332,7 @@ public final class HTMLFilter
final String name = m.group(1).toLowerCase(); final String name = m.group(1).toLowerCase();
if (allowed(name)) if (allowed(name))
{ {
if (false == inArray(name, vSelfClosingTags)) if (!inArray(name, vSelfClosingTags))
{ {
if (vTagCounts.containsKey(name)) if (vTagCounts.containsKey(name))
{ {
@ -387,7 +387,7 @@ public final class HTMLFilter
{ {
paramValue = processParamProtocol(paramValue); paramValue = processParamProtocol(paramValue);
} }
params.append(' ').append(paramName).append("=\"").append(paramValue).append("\""); params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\"");
} }
} }

View File

@ -4,7 +4,7 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -25,7 +25,7 @@ public class HttpHelper
BufferedReader reader = null; BufferedReader reader = null;
try (InputStream inputStream = request.getInputStream()) try (InputStream inputStream = request.getInputStream())
{ {
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
String line = ""; String line = "";
while ((line = reader.readLine()) != null) while ((line = reader.readLine()) != null)
{ {

View File

@ -9,6 +9,7 @@ import java.net.ConnectException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
@ -19,6 +20,7 @@ import javax.net.ssl.X509TrustManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
/** /**
* 通用http发送方法 * 通用http发送方法
@ -29,6 +31,17 @@ public class HttpUtils
{ {
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
/**
* 向指定 URL 发送GET方法的请求
*
* @param url 发送请求的 URL
* @return 所代表远程资源的响应结果
*/
public static String sendGet(String url)
{
return sendGet(url, StringUtils.EMPTY);
}
/** /**
* 向指定 URL 发送GET方法的请求 * 向指定 URL 发送GET方法的请求
* *
@ -55,7 +68,7 @@ public class HttpUtils
BufferedReader in = null; BufferedReader in = null;
try try
{ {
String urlNameString = url + "?" + param; String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url;
log.info("sendGet - {}", urlNameString); log.info("sendGet - {}", urlNameString);
URL realUrl = new URL(urlNameString); URL realUrl = new URL(urlNameString);
URLConnection connection = realUrl.openConnection(); URLConnection connection = realUrl.openConnection();
@ -118,9 +131,8 @@ public class HttpUtils
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
try try
{ {
String urlNameString = url; log.info("sendPost - {}", url);
log.info("sendPost - {}", urlNameString); URL realUrl = new URL(url);
URL realUrl = new URL(urlNameString);
URLConnection conn = realUrl.openConnection(); URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("connection", "Keep-Alive");
@ -132,7 +144,7 @@ public class HttpUtils
out = new PrintWriter(conn.getOutputStream()); out = new PrintWriter(conn.getOutputStream());
out.print(param); out.print(param);
out.flush(); out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
String line; String line;
while ((line = in.readLine()) != null) while ((line = in.readLine()) != null)
{ {
@ -206,7 +218,7 @@ public class HttpUtils
{ {
if (ret != null && !"".equals(ret.trim())) if (ret != null && !"".equals(ret.trim()))
{ {
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
} }
} }
log.info("recv - {}", result); log.info("recv - {}", result);

View File

@ -25,7 +25,6 @@ public class AddressUtils
public static String getRealAddressByIP(String ip) public static String getRealAddressByIP(String ip)
{ {
String address = UNKNOWN;
// 内网不查询 // 内网不查询
if (IpUtils.internalIp(ip)) if (IpUtils.internalIp(ip))
{ {
@ -51,6 +50,6 @@ public class AddressUtils
log.error("获取地理位置异常 {}", ip); log.error("获取地理位置异常 {}", ip);
} }
} }
return address; return UNKNOWN;
} }
} }

View File

@ -4,7 +4,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.html.EscapeUtil;
/** /**
* 获取IP方法 * 获取IP方法
@ -13,6 +12,12 @@ import com.ruoyi.common.utils.html.EscapeUtil;
*/ */
public class IpUtils public class IpUtils
{ {
/**
* 获取客户端IP
*
* @param request 请求对象
* @return IP地址
*/
public static String getIpAddr(HttpServletRequest request) public static String getIpAddr(HttpServletRequest request)
{ {
if (request == null) if (request == null)
@ -41,15 +46,28 @@ public class IpUtils
{ {
ip = request.getRemoteAddr(); ip = request.getRemoteAddr();
} }
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip);
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
} }
/**
* 检查是否为内部IP地址
*
* @param ip IP地址
* @return 结果
*/
public static boolean internalIp(String ip) public static boolean internalIp(String ip)
{ {
byte[] addr = textToNumericFormatV4(ip); byte[] addr = textToNumericFormatV4(ip);
return internalIp(addr) || "127.0.0.1".equals(ip); return internalIp(addr) || "127.0.0.1".equals(ip);
} }
/**
* 检查是否为内部IP地址
*
* @param addr byte地址
* @return 结果
*/
private static boolean internalIp(byte[] addr) private static boolean internalIp(byte[] addr)
{ {
if (StringUtils.isNull(addr) || addr.length < 2) if (StringUtils.isNull(addr) || addr.length < 2)
@ -110,7 +128,8 @@ public class IpUtils
{ {
case 1: case 1:
l = Long.parseLong(elements[0]); l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)) { if ((l < 0L) || (l > 4294967295L))
{
return null; return null;
} }
bytes[0] = (byte) (int) (l >> 24 & 0xFF); bytes[0] = (byte) (int) (l >> 24 & 0xFF);
@ -120,12 +139,14 @@ public class IpUtils
break; break;
case 2: case 2:
l = Integer.parseInt(elements[0]); l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[0] = (byte) (int) (l & 0xFF); bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]); l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) { if ((l < 0L) || (l > 16777215L))
{
return null; return null;
} }
bytes[1] = (byte) (int) (l >> 16 & 0xFF); bytes[1] = (byte) (int) (l >> 16 & 0xFF);
@ -136,13 +157,15 @@ public class IpUtils
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
} }
l = Integer.parseInt(elements[2]); l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) { if ((l < 0L) || (l > 65535L))
{
return null; return null;
} }
bytes[2] = (byte) (int) (l >> 8 & 0xFF); bytes[2] = (byte) (int) (l >> 8 & 0xFF);
@ -152,7 +175,8 @@ public class IpUtils
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
{ {
l = Integer.parseInt(elements[i]); l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L))
{
return null; return null;
} }
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
@ -169,6 +193,11 @@ public class IpUtils
return bytes; return bytes;
} }
/**
* 获取IP地址
*
* @return 本地IP地址
*/
public static String getHostIp() public static String getHostIp()
{ {
try try
@ -181,6 +210,11 @@ public class IpUtils
return "127.0.0.1"; return "127.0.0.1";
} }
/**
* 获取主机名
*
* @return 本地主机名
*/
public static String getHostName() public static String getHostName()
{ {
try try
@ -192,4 +226,39 @@ public class IpUtils
} }
return "未知"; return "未知";
} }
/**
* 从多级反向代理中获得第一个非unknown IP地址
*
* @param ip 获得的IP地址
* @return 第一个非unknown IP地址
*/
public static String getMultistageReverseProxyIp(String ip)
{
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0)
{
final String[] ips = ip.trim().split(",");
for (String subIp : ips)
{
if (false == isUnknown(subIp))
{
ip = subIp;
break;
}
}
}
return ip;
}
/**
* 检测给定字符串是否为未知多用于检测HTTP请求相关
*
* @param checkString 被检测的字符串
* @return 是否未知
*/
public static boolean isUnknown(String checkString)
{
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
}
} }

View File

@ -0,0 +1,19 @@
package com.ruoyi.common.utils.poi;
/**
* Excel数据格式处理适配器
*
* @author ruoyi
*/
public interface ExcelHandlerAdapter
{
/**
* 格式化
*
* @param value 单元格数据值
* @param args excel注解args参数组
*
* @return 处理后的值
*/
Object format(Object value, String[] args);
}

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