mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-10-31 06:13:44 +08:00 
			
		
		
		
	Compare commits
	
		
			27 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d6894c89ed | ||
|  | ebf780617a | ||
|  | 0208fa14af | ||
|  | 8f34644692 | ||
|  | d2774d3706 | ||
|  | 0788bcfcb0 | ||
|  | e4fff795b8 | ||
|  | fd7dc204de | ||
|  | 4e807455e0 | ||
|  | 67e20711d4 | ||
|  | 138842e9ba | ||
|  | 1a8e2b3e63 | ||
|  | 6f83ed3285 | ||
|  | 369e4be31c | ||
|  | 5c9fe22780 | ||
|  | b2a927cc5e | ||
|  | 23cbed3aac | ||
|  | 8acce4a7fc | ||
|  | bf362b9aba | ||
|  | 9b57c67d3e | ||
|  | 0700c60636 | ||
|  | 95a2c74462 | ||
|  | ca085b9aaa | ||
|  | 329c070e05 | ||
|  | f3a4104fd0 | ||
|  | 82e8ab2385 | ||
|  | c9260c4966 | 
							
								
								
									
										13
									
								
								.gitee/ISSUE_TEMPLATE.zh-CN.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.gitee/ISSUE_TEMPLATE.zh-CN.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | ### 使用版本(未按照模板填写直接删除) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### 问题描述 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### 希望结果 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### 重现步骤 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### 报错信息(截图为主 请勿发混乱格式) | ||||||
| @@ -1,51 +0,0 @@ | |||||||
| name: Bug 反馈 |  | ||||||
| description: 当你使用过程中发现了一个 Bug,导致应用崩溃或抛出异常,或者有一个组件存在问题,或者某些地方看起来不对劲,请在这里反馈。 |  | ||||||
| title: "[Bug]: " |  | ||||||
| labels: ["bug"] |  | ||||||
| body: |  | ||||||
|   - type: textarea |  | ||||||
|     id: version |  | ||||||
|     attributes: |  | ||||||
|       label: 版本 |  | ||||||
|       description: 你当前正在使用我们软件的哪个版本(pom文件内的版本号)? |  | ||||||
|       value: | |  | ||||||
|         注意: 未填写版本号不予处理直接关闭或删除 |  | ||||||
|         jdk版本(带上尾号): |  | ||||||
|         框架版本(项目启动时输出的版本号): |  | ||||||
|         其他依赖版本(你觉得有必要的): |  | ||||||
|     validations: |  | ||||||
|       required: true |  | ||||||
|   - type: checkboxes |  | ||||||
|     attributes: |  | ||||||
|       label: 功能不好用不会用是否已经看过项目文档? |  | ||||||
|       options: |  | ||||||
|         - label: https://plus-doc.dromara.org |  | ||||||
|           required: true |  | ||||||
|   - type: checkboxes |  | ||||||
|     attributes: |  | ||||||
|       label: 这个问题是否已经存在? |  | ||||||
|       options: |  | ||||||
|         - label: 我已经搜索过现有的问题 (https://gitee.com/dromara/RuoYi-Vue-Plus/issues) |  | ||||||
|           required: true |  | ||||||
|   - type: textarea |  | ||||||
|     attributes: |  | ||||||
|       label: 希望结果 |  | ||||||
|       description: 想知道你觉得怎么样是正常或者合理的。 |  | ||||||
|     validations: |  | ||||||
|       required: true |  | ||||||
|   - type: markdown |  | ||||||
|     attributes: |  | ||||||
|       label: 如何复现 |  | ||||||
|       description: 请详细告诉我们如何复现你遇到的问题。 |  | ||||||
|       value: | |  | ||||||
|         如涉及代码,可提供一个最小代码示例,并使用```附上它,或者截图均可,越详细越好。<br> |  | ||||||
|         大多数问题都是:代码编写错误问题,逻辑问题,或者用法错误等问题。 |  | ||||||
|     validations: |  | ||||||
|       required: true |  | ||||||
|   - type: textarea |  | ||||||
|     attributes: |  | ||||||
|       label: 相关代码与报错信息(请勿发混乱格式) |  | ||||||
|       description: 如果可以的话,上传任何关于 bug 的截图。 |  | ||||||
|       value: | |  | ||||||
|         [在这里上传图片] |  | ||||||
|  |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| blank_issues_enabled: false |  | ||||||
| contact_links: |  | ||||||
|   - name: RuoYi-Vue-Plus 文档中心 |  | ||||||
|     url: https://plus-doc.dromara.org |  | ||||||
|     about: 提供 RuoYi-Vue-Plus 搭建使用指南、平台基本开发使用方式、介绍、基础知识和常见问题解答 |  | ||||||
| @@ -1,43 +0,0 @@ | |||||||
| name: 功能建议 |  | ||||||
| description: 对本项目提出一个功能建议。 |  | ||||||
| title: "[功能建议]: " |  | ||||||
| labels: ["enhancement"] |  | ||||||
| body: |  | ||||||
|   - type: markdown |  | ||||||
|     attributes: |  | ||||||
|       value: | |  | ||||||
|         感谢提出功能建议,我们将仔细考虑!请持续关注该issues,在加入计划后我们会有贡献者设置为负责人,同时状态成为进行中。 |  | ||||||
|   - type: textarea |  | ||||||
|     id: related-problem |  | ||||||
|     attributes: |  | ||||||
|       label: 你的功能建议是否和某个问题相关? |  | ||||||
|       description: 清晰并简洁地描述问题是什么,例如,当我...时,我总是感到困扰。 |  | ||||||
|     validations: |  | ||||||
|       required: false |  | ||||||
|   - type: textarea |  | ||||||
|     id: desired-solution |  | ||||||
|     attributes: |  | ||||||
|       label: 你希望看到什么解决方案? |  | ||||||
|       description: 清晰并简洁地描述你希望发生的事情。 |  | ||||||
|     validations: |  | ||||||
|       required: true |  | ||||||
|   - type: textarea |  | ||||||
|     id: alternatives |  | ||||||
|     attributes: |  | ||||||
|       label: 你考虑过哪些替代方案? |  | ||||||
|       description: 清晰并简洁地描述你考虑过的任何替代解决方案或功能。 |  | ||||||
|     validations: |  | ||||||
|       required: false |  | ||||||
|   - type: textarea |  | ||||||
|     id: additional-context |  | ||||||
|     attributes: |  | ||||||
|       label: 你有其他上下文或截图吗? |  | ||||||
|       description: 在此处添加有关功能请求的任何其他上下文或截图。 |  | ||||||
|     validations: |  | ||||||
|       required: false |  | ||||||
|   - type: checkboxes |  | ||||||
|     attributes: |  | ||||||
|       label: 意向参与贡献 |  | ||||||
|       options: |  | ||||||
|         - label: 我有意向参与具体功能的开发实现并将代码贡献回到上游社区。 |  | ||||||
|           required: false |  | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| ### 更改目的 解决了什么问题(请提交到dev分支) | ### 更改目的 解决了什么问题(请提交到dev分支) | ||||||
|  |  | ||||||
|  |  | ||||||
| ### 改动逻辑 这么写的思路(让作者更好的理解你的意图) | ### 描述 做了哪些改动 | ||||||
|  |  | ||||||
|  |  | ||||||
| ### 测试 都做了哪些测试(未经过测试不采纳) | ### 测试 都做了哪些测试(未经过测试不采纳) | ||||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -44,5 +44,3 @@ nbdist/ | |||||||
| !*/build/*.java | !*/build/*.java | ||||||
| !*/build/*.html | !*/build/*.html | ||||||
| !*/build/*.xml | !*/build/*.xml | ||||||
|  |  | ||||||
| .flattened-pom.xml |  | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   <configuration default="false" name="ruoyi-monitor-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |   <configuration default="false" name="ruoyi-monitor-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> | ||||||
|     <deployment type="dockerfile"> |     <deployment type="dockerfile"> | ||||||
|       <settings> |       <settings> | ||||||
|         <option name="imageTag" value="ruoyi/ruoyi-monitor-admin:5.2.3" /> |         <option name="imageTag" value="ruoyi/ruoyi-monitor-admin:4.4.0" /> | ||||||
|         <option name="buildOnly" value="true" /> |         <option name="buildOnly" value="true" /> | ||||||
|         <option name="sourceFilePath" value="ruoyi-extend/ruoyi-monitor-admin/Dockerfile" /> |         <option name="sourceFilePath" value="ruoyi-extend/ruoyi-monitor-admin/Dockerfile" /> | ||||||
|       </settings> |       </settings> | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| <component name="ProjectRunConfigurationManager"> | <component name="ProjectRunConfigurationManager"> | ||||||
|   <configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="演示机"> |   <configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> | ||||||
|     <deployment type="dockerfile"> |     <deployment type="dockerfile"> | ||||||
|       <settings> |       <settings> | ||||||
|         <option name="imageTag" value="ruoyi/ruoyi-server:5.2.3" /> |         <option name="imageTag" value="ruoyi/ruoyi-server:4.4.0" /> | ||||||
|         <option name="buildOnly" value="true" /> |         <option name="buildOnly" value="true" /> | ||||||
|         <option name="sourceFilePath" value="ruoyi-admin/Dockerfile" /> |         <option name="sourceFilePath" value="ruoyi-admin/Dockerfile" /> | ||||||
|       </settings> |       </settings> | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| <component name="ProjectRunConfigurationManager"> | <component name="ProjectRunConfigurationManager"> | ||||||
|   <configuration default="false" name="ruoyi-snailjob-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |   <configuration default="false" name="ruoyi-xxl-job-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> | ||||||
|     <deployment type="dockerfile"> |     <deployment type="dockerfile"> | ||||||
|       <settings> |       <settings> | ||||||
|         <option name="imageTag" value="ruoyi/ruoyi-snailjob-server:5.2.3" /> |         <option name="imageTag" value="ruoyi/ruoyi-xxl-job-admin:4.4.0" /> | ||||||
|         <option name="buildOnly" value="true" /> |         <option name="buildOnly" value="true" /> | ||||||
|         <option name="sourceFilePath" value="ruoyi-extend/ruoyi-snailjob-server/Dockerfile" /> |         <option name="sourceFilePath" value="ruoyi-extend/ruoyi-xxl-job-admin/Dockerfile" /> | ||||||
|       </settings> |       </settings> | ||||||
|     </deployment> |     </deployment> | ||||||
|     <method v="2" /> |     <method v="2" /> | ||||||
							
								
								
									
										289
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										289
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,182 +1,163 @@ | |||||||
| <img src="https://foruda.gitee.com/images/1679673773341074847/178e8451_1766278.png" width="50%" height="50%"> |  | ||||||
| <div style="height: 10px; clear: both;"></div> |  | ||||||
|  |  | ||||||
| - - - |  | ||||||
| ## 平台简介 | ## 平台简介 | ||||||
|  | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | ||||||
| [](https://gitee.com/dromara/RuoYi-Vue-Plus) | [](https://github.com/JavaLionLi/RuoYi-Vue-Plus) | ||||||
| [](https://github.com/dromara/RuoYi-Vue-Plus) | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) | ||||||
| [](https://gitee.com/dromara/RuoYi-Vue-Plus/blob/master/LICENSE) |  | ||||||
| [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) | [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) | ||||||
| <br> | <br> | ||||||
| [](https://gitee.com/dromara/RuoYi-Vue-Plus) | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | ||||||
| []() | []() | ||||||
| []() | []() | ||||||
| []() | []() | ||||||
|  |  | ||||||
| > RuoYi-Vue-Plus 是重写 RuoYi-Vue 针对 `分布式集群与多租户` 场景全方位升级(不兼容原框架) | > RuoYi-Vue-Plus 是重写 RuoYi-Vue 针对 `分布式集群` 场景全方位升级(不兼容原框架) | ||||||
|  |  | ||||||
| > 项目代码、文档 均开源免费可商用 遵循开源协议在项目中保留开源协议文件即可<br> | > 项目代码、文档 均开源免费可商用 遵循开源协议在项目中保留开源协议文件即可<br> | ||||||
| 活到老写到老 为兴趣而开源 为学习而开源 为让大家真正可以学到技术而开源 | 活到老写到老 为兴趣而开源 为学习而开源 为让大家真正可以学到技术而开源 | ||||||
|  |  | ||||||
| > 系统演示: [传送门](https://plus-doc.dromara.org/#/common/demo_system) | > 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4836388&doc_id=1469725) | ||||||
|  |  | ||||||
| > 前端项目地址: [plus-ui](https://gitee.com/JavaLionLi/plus-ui) | | 功能介绍     | 使用技术                | 文档地址                                                                                              | 特性注意事项                     | | ||||||
|  | |----------|---------------------|---------------------------------------------------------------------------------------------------|----------------------------| | ||||||
| > 文档地址: [plus-doc](https://plus-doc.dromara.org) | | 当前框架     | RuoYi-Vue-Plus      | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages)                       | 重写RuoYi-Vue全方位升级(不兼容原框架)   | | ||||||
|  | | 微服务分支    | RuoYi-Cloud-Plus    | [微服务分支地址](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus)                                          | 重写RuoYi-Cloud全方位升级(不兼容原框架) | | ||||||
| ## 赞助商 | | 单体分支     | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/)                                | 单体应用结构                     | | ||||||
|  | | Vue3分支   | RuoYi-Vue-Plus-UI   | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus-UI)                                            | 由于组件还未完善 仅供学习              | | ||||||
| MaxKey 业界领先单点登录产品 - https://gitee.com/dromara/MaxKey <br> | | 原框架      | RuoYi-Vue           | [RuoYi-Vue官网](http://ruoyi.vip/)                                                                  | 定期同步需要的功能                  | | ||||||
| CCFlow 驰聘低代码-流程-表单 - https://gitee.com/opencc/RuoYi-JFlow <br> | | 前端开发框架   | Vue、Element UI      | [Element UI官网](https://element.eleme.cn/#/zh-CN)                                                  |                            | | ||||||
| 数舵科技 软件定制开发APP小程序等 - http://www.shuduokeji.com/ <br> | | 后端开发框架   | SpringBoot          | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn)                                     |                            | | ||||||
| 引迈信息 软件开发平台 - https://www.jnpfsoft.com/index.html?from=plus-doc <br> | | 容器框架     | Undertow            | [Undertow官网](https://undertow.io/)                                                                | 基于 XNIO 的高性能容器             | | ||||||
| [如何成为赞助商 加群联系作者详谈](https://plus-doc.dromara.org/#/common/add_group) | | 权限认证框架   | Sa-Token、Jwt        | [Sa-Token官网](https://sa-token.dev33.cn/)                                                          | 强解耦、强扩展                    | | ||||||
|  | | 关系数据库    | MySQL               | [MySQL官网](https://dev.mysql.com/)                                                                 | 适配 8.X 最低 5.7              | | ||||||
| # 本框架与RuoYi的功能差异 | | 关系数据库    | Oracle              | [Oracle官网](https://www.oracle.com/cn/database/)                                                   | 适配 11g 12c                 | | ||||||
|  | | 关系数据库    | PostgreSQL          | [PostgreSQL官网](https://www.postgresql.org/)                                                       | 适配 13 14                   | | ||||||
| | 功能          | 本框架                                                                                                               | RuoYi                                                                              | | | 关系数据库    | SQLServer           | [SQLServer官网](https://docs.microsoft.com/zh-cn/sql/sql-server)                                    | 适配 2017 2019               | | ||||||
| |-------------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------| | | 缓存数据库    | Redis               | [Redis官网](https://redis.io/)                                                                      | 适配 6.X 最低 4.X              | | ||||||
| | 前端项目        | 采用 Vue3 + TS + ElementPlus 重写                                                                                     | 基于Vue2/Vue3 + JS                                                                   |  | | 数据库框架    | Mybatis-Plus        | [Mybatis-Plus文档](https://baomidou.com/guide/)                                                     | 快速 CRUD 增加开发效率             | | ||||||
| | 后端项目结构      | 采用插件化 + 扩展包形式 结构解耦 易于扩展                                                                                           | 模块相互注入耦合严重难以扩展                                                                     |  | | 数据库框架    | p6spy               | [p6spy官网](https://p6spy.readthedocs.io/)                                                          | 更强劲的 SQL 分析                | | ||||||
| | 后端代码风格      | 严格遵守Alibaba规范与项目统一配置的代码格式化                                                                                        | 代码书写与常规结构不同阅读障碍大                                                                   | | | 多数据源框架   | dynamic-datasource  | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content)                      | 支持主从与多种类数据库异构              | | ||||||
| | Web容器       | 采用 Undertow 基于 XNIO 的高性能容器                                                                                        | 采用 Tomcat                                                                          | | | 序列化框架    | Jackson             | [Jackson官网](https://github.com/FasterXML/jackson)                                                 | 统一使用 jackson 高效可靠          | | ||||||
| | 权限认证        | 采用 Sa-Token、Jwt 静态使用功能齐全 低耦合 高扩展                                                                                  | Spring Security 配置繁琐扩展性极差                                                          | | | Redis客户端 | Redisson            | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95)                        | 支持单机、集群配置                  | | ||||||
| | 权限注解        | 采用 Sa-Token 支持注解 登录校验、角色校验、权限校验、二级认证校验、HttpBasic校验、忽略校验<br/>角色与权限校验支持多种条件 如 `AND` `OR` 或 `权限 OR 角色` 等复杂表达式        | 只支持是否存在匹配                                                                          | | | 分布式限流    | Redisson            | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95)                        | 全局、请求IP、集群ID 多种限流          | | ||||||
| | 三方鉴权        | 采用 JustAuth 第三方登录组件 支持微信、钉钉等数十种三方认证                                                                               | 无                                                                                  | | | 分布式队列    | Redisson            | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95)                        | 普通队列、延迟队列、优先队列 等           | | ||||||
| | 关系数据库支持     | 原生支持 MySQL、Oracle、PostgreSQL、SQLServer<br/>可同时使用异构切换(支持其他 mybatis-plus 支持的所有数据库 只需要增加jdbc依赖即可使用 达梦金仓等均有成功案例)      | 支持 Mysql、Oracle 不支持同时使用、不支持异构切换                                                    | | | 分布式锁     | Lock4j              | [Lock4j官网](https://gitee.com/baomidou/lock4j)                                                     | 注解锁、工具锁 多种多样               | | ||||||
| | 缓存数据库       | 支持 Redis 5-7 支持大部分新功能特性 如 分布式限流、分布式队列                                                                             | Redis 简单 get set 支持                                                                | | | 分布式幂等    | Redisson            | [Lock4j文档](https://gitee.com/baomidou/lock4j)                                                     | 拦截重复提交                     | | ||||||
| | Redis客户端    | 采用 Redisson Redis官方推荐 基于Netty的客户端工具<br/>支持Redis 90%以上的命令 底层优化规避很多不正确的用法 例如: keys被转换为scan<br/>支持单机、哨兵、单主集群、多主集群等模式 | Lettuce + RedisTemplate 支持模式少 工具使用繁琐<br/>连接池采用 common-pool Bug多经常性出问题              | | | 分布式链路追踪  | Apache SkyWalking   | [Apache SkyWalking文档](https://skywalking.apache.org/docs/)                                        | 链路追踪、网格分析、度量聚合、可视化         | | ||||||
| | 缓存注解        | 采用 Spring-Cache 注解 对其扩展了实现支持了更多功能<br/>例如 过期时间 最大空闲时间 组最大长度等 只需一个注解即可完成数据自动缓存                                      | 需手动编写Redis代码逻辑                                                                     | | | 分布式任务调度  | Xxl-Job             | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/)                                                     | 高性能 高可靠 易扩展                | | ||||||
| | ORM框架       | 采用 Mybatis-Plus 基于对象几乎不用写SQL全java操作 功能强大插件众多<br/>例如多租户插件 分页插件 乐观锁插件等等                                             | 采用 Mybatis 基于XML需要手写SQL                                                            | | | 文件存储     | Minio               | [Minio文档](https://docs.min.io/)                                                                   | 本地存储                       | | ||||||
| | SQL监控       | 采用 p6spy 可输出完整SQL与执行时间监控                                                                                          | log输出 需手动拼接sql与参数无法快速查看调试问题                                                        | | | 文件存储     | 七牛、阿里、腾讯            | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储                        | | ||||||
| | 数据分页        | 采用 Mybatis-Plus 分页插件<br/>框架对其进行了扩展 对象化分页对象 支持多种方式传参 支持前端多排序 复杂排序                                                  | 采用 PageHelper 仅支持单查询分页 参数只能从param传 只能单排序 功能扩展性差 体验不好                               | | | 短信模块     | 阿里、腾讯               | [短信使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5578491&doc_id=1469725)  | 短信发送                       | | ||||||
| | 数据权限        | 采用 Mybatis-Plus 插件 自行分析拼接SQL 无感式过滤<br/>只需为Mapper设置好注解条件 支持多种自定义 不限于部门角色                                           | 采用 注解+aop 实现 基于部门角色 生成的sql兼容性差 不支持其他业务扩展<br/>生成sql后需手动拼接到具体业务sql上 对于多个Mapper查询不起作用 | | | 监控框架     | SpringBoot-Admin    | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/)                    | 全方位服务监控                    | | ||||||
| | 数据脱敏        | 采用 注解 + jackson 序列化期间脱敏 支持不同模块不同的脱敏条件<br/>支持多种策略 如身份证、手机号、地址、邮箱、银行卡等 可自行扩展                                        | 无                                                                                  | | | 校验框架     | Validation          | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/)    | 增强接口安全性、严谨性 支持国际化          | | ||||||
| | 数据加解密       | 采用 注解 + mybatis 拦截器 对存取数据期间自动加解密<br/>支持多种策略 如BASE64、AES、RSA、SM2、SM4等                                              | 无                                                                                  | | | Excel框架  | Alibaba EasyExcel   | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel)                                      | 性能优异 扩展性强                  | | ||||||
| | 接口传输加密      | 采用 动态 AES + RSA 加密请求 body 每一次请求秘钥都不同大幅度降低可破解性                                                                     | 无                                                                                  | | | 文档框架     | SpringDoc、javadoc   | [接口文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5805266&doc_id=1469725)    | 无注解零入侵基于java注释             | | ||||||
| | 数据翻译        | 采用 注解 + jackson 序列化期间动态修改数据 数据进行翻译<br/>支持多种模式: `映射翻译` `直接翻译` `其他扩展条件翻译` 接口化两步即可完成自定义扩展 内置多种翻译实现                   | 无                                                                                  | | | 工具类框架    | Hutool、Lombok       | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 减少代码冗余 增加安全性               | | ||||||
| | 多数据源框架      | 采用 dynamic-datasource 支持市面大部分数据库<br/>通过yml配置即可动态管理异构不同种类的数据库 也可通过前端页面添加数据源<br/>支持spel表达式从请求头参数等条件切换数据源            | 基于 druid 手动编写代码配置数据源 配置繁琐 支持性差                                                     | | | 代码生成器    | 适配MP、SpringDoc规范化代码 | [代码生成文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5522329&doc_id=1469725)  | 一键生成前后端代码                  | | ||||||
| | 多数据源事务      | 采用 dynamic-datasource 支持多数据源不同种类的数据库事务回滚                                                                          | 不支持                                                                                | | | 部署方式     | Docker              | [Docker文档](https://docs.docker.com/)                                                              | 容器编排 一键部署业务集群              | | ||||||
| | 数据库连接池      | 采用 HikariCP Spring官方内置连接池 配置简单 以性能与稳定性闻名天下                                                                        | 采用 druid bug众多 社区维护差 活跃度低 配置众多繁琐性能一般                                               | | | 国际化      | SpringMessage       | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc)   | Spring标准国际化方案              | | ||||||
| | 数据库主键       | 采用 雪花ID 基于时间戳的 有序增长 唯一ID 再也不用为分库分表 数据合并主键冲突重复而发愁                                                                  | 采用 数据库自增ID 支持数据量有限 不支持多数据源主键唯一                                                     | |  | ||||||
| | WebSocket协议 | 基于 Spring 封装的 WebSocket 协议 扩展了Token鉴权与分布式会话同步 不再只是基于单机的废物                                                         | 无                                                                                  | |  | ||||||
| | SSE推送       | 采用 Spring SSE 实现 扩展了Token鉴权与分布式会话同步                                                                               | 无                                                                                  | |  | ||||||
| | 序列化         | 采用 Jackson Spring官方内置序列化 靠谱!!!                                                                                    | 采用 fastjson bugjson 远近闻名                                                           |  |  | ||||||
| | 分布式幂等       | 参考美团GTIS防重系统简化实现(细节可看文档)                                                                                          | 手动编写注解基于aop实现                                                                      | |  | ||||||
| | 分布式锁        | 采用 Lock4j 底层基于 Redisson                                                                                           | 无                                                                                  | |  | ||||||
| | 分布式任务调度     | 采用 SnailJob 天生支持分布式 统一的管理中心 支持多种数据库 支持分片重试DAG任务流等                                                                 | 采用 Quartz 基于数据库锁性能差 集群需要做很多配置与改造                                                   |  |  | ||||||
| | 文件存储        | 采用 Minio 分布式文件存储 天生支持多机、多硬盘、多分片、多副本存储<br/>支持权限管理 安全可靠 文件可加密存储                                                     | 采用 本机文件存储 文件裸漏 易丢失泄漏 不支持集群有单点效应                                                    | |  | ||||||
| | 云存储         | 采用 AWS S3 协议客户端 支持 七牛、阿里、腾讯 等一切支持S3协议的厂家                                                                          | 不支持                                                                                | |  | ||||||
| | 短信          | 采用 sms4j 短信融合包 支持数十种短信厂家 只需在yml配置好厂家密钥即可使用 可多厂家共用                                                                 | 不支持                                                                                | |  | ||||||
| | 邮件          | 采用 mail-api 通用协议支持大部分邮件厂商                                                                                         | 不支持                                                                                | |  | ||||||
| | 接口文档        | 采用 SpringDoc、javadoc 无注解零入侵基于java注释<br/>只需把注释写好 无需再写一大堆的文档注解了                                                     | 采用 Springfox 已停止维护 需要编写大量的注解来支持文档生成                                                |  |  | ||||||
| | 校验框架        | 采用 Validation 支持注解与工具类校验 注解支持国际化                                                                                  | 仅支持注解 且注解不支持国际化                                                                    | |  | ||||||
| | Excel框架     | 采用 Alibaba EasyExcel 基于插件化<br/>框架对其增加了很多功能 例如 自动合并相同内容 自动排列布局 字典翻译等                                               | 基于 POI 手写实现 功能有限 复杂 扩展性差                                                           | |  | ||||||
| | 工作流支持       | 支持各种复杂审批 转办 委派 加减签 会签 或签 票签 等功能                                                                                   | 无                                                                                  | |  | ||||||
| | 工具类框架       | 采用 Hutool、Lombok 上百种工具覆盖90%的使用需求 基于注解自动生成 get set 等简化框架大量代码                                                       | 手写工具稳定性差易出问题 工具数量有限 代码臃肿需自己手写 get set 等                                            |  |  | ||||||
| | 监控框架        | 采用 SpringBoot-Admin 基于SpringBoot官方 actuator 探针机制<br/>实时监控服务状态 框架还为其扩展了在线日志查看监控                                    | 无                                                                                  |  |  | ||||||
| | 链路追踪        | 采用 Apache SkyWalking 还在为请求不知道去哪了 到哪出了问题而烦恼吗<br/>用了它即可实时查看请求经过的每一处每一个节点                                            | 无                                                                                  | |  | ||||||
| | 代码生成器       | 只需设计好表结构 一键生成所有crud代码与页面<br/>降低80%的开发量 把精力都投入到业务设计上<br/>框架为其适配MP、SpringDoc规范化代码 同时支持动态多数据源代码生成                    | 代码生成原生结构 只支持单数据源生成                                                                 | |  | ||||||
| | 部署方式        | 支持 Docker 编排 一键搭建所有环境 让开发人员从此不再为搭建环境而烦恼                                                                           | 原生jar部署 其他环境需手动下载安装 自行搭建                                                           |  |  | ||||||
| | 项目路径修改      | 提供详细的修改方案文档 并为其做了一些改动 非常简单即可修改成自己想要的                                                                              | 需要做很多改造 文档说明有限                                                                     | |  | ||||||
| | 国际化         | 基于请求头动态返回不同语种的文本内容 开发难度低 有对应的工具类 支持大部分注解内容国际化                                                                     | 只提供基础功能 其他需自行编写扩展                                                                  | |  | ||||||
| | 代码单例测试      | 提供单例测试 使用方式编写方法与maven多环境单测插件                                                                                      | 只提供基础功能 其他需自行编写扩展                                                                  | |  | ||||||
| | Demo案例      | 提供框架功能的实际使用案例 单独一个模块提供了很多很全                                                                                       | 无                                                                                  | |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ## 本框架与RuoYi的业务差异 |  | ||||||
|  |  | ||||||
| | 业务     | 功能说明                                                                 | 本框架 | RuoYi            | |  | ||||||
| |--------|----------------------------------------------------------------------|-----|------------------| |  | ||||||
| | 租户管理   | 系统内租户的管理 如:租户套餐、过期时间、用户数量、企业信息等                                      | 支持  | 无                | |  | ||||||
| | 租户套餐管理 | 系统内租户所能使用的套餐管理 如:套餐内所包含的菜单等                                          | 支持  | 无                | |  | ||||||
| | 客户端管理  | 系统内对接的所有客户端管理 如: pc端、小程序端等<br>支持动态授权登录方式 如: 短信登录、密码登录等 支持动态控制token时效 | 支持  | 无                | |  | ||||||
| | 用户管理   | 用户的管理配置 如:新增用户、分配用户所属部门、角色、岗位等                                       | 支持  | 支持               | |  | ||||||
| | 部门管理   | 配置系统组织机构(公司、部门、小组) 树结构展现支持数据权限                                       | 支持  | 支持               | |  | ||||||
| | 岗位管理   | 配置系统用户所属担任职务                                                         | 支持  | 支持               | |  | ||||||
| | 菜单管理   | 配置系统菜单、操作权限、按钮权限标识等                                                  | 支持  | 支持               | |  | ||||||
| | 角色管理   | 角色菜单权限分配、设置角色按机构进行数据范围权限划分                                           | 支持  | 支持               | |  | ||||||
| | 字典管理   | 对系统中经常使用的一些较为固定的数据进行维护                                               | 支持  | 支持               | |  | ||||||
| | 参数管理   | 对系统动态配置常用参数                                                          | 支持  | 支持               | |  | ||||||
| | 通知公告   | 系统通知公告信息发布维护                                                         | 支持  | 支持               | |  | ||||||
| | 操作日志   | 系统正常操作日志记录和查询 系统异常信息日志记录和查询                                          | 支持  | 支持               | |  | ||||||
| | 登录日志   | 系统登录日志记录查询包含登录异常                                                     | 支持  | 支持               | |  | ||||||
| | 文件管理   | 系统文件展示、上传、下载、删除等管理                                                   | 支持  | 无                | |  | ||||||
| | 文件配置管理 | 系统文件上传、下载所需要的配置信息动态添加、修改、删除等管理                                       | 支持  | 无                | |  | ||||||
| | 在线用户管理 | 已登录系统的在线用户信息监控与强制踢出操作                                                | 支持  | 支持               | |  | ||||||
| | 定时任务   | 运行报表、任务管理(添加、修改、删除)、日志管理、执行器管理等                                      | 支持  | 仅支持任务与日志管理       | |  | ||||||
| | 代码生成   | 多数据源前后端代码的生成(java、html、xml、sql)支持CRUD下载                              | 支持  | 仅支持单数据源          | |  | ||||||
| | 系统接口   | 根据业务代码自动生成相关的api接口文档                                                 | 支持  | 支持               | |  | ||||||
| | 服务监控   | 监视集群系统CPU、内存、磁盘、堆栈、在线日志、Spring相关配置等                                  | 支持  | 仅支持单机CPU、内存、磁盘监控 | |  | ||||||
| | 缓存监控   | 对系统的缓存信息查询,命令统计等。                                                    | 支持  | 支持               | |  | ||||||
| | 在线构建器  | 拖动表单元素生成相应的HTML代码。                                                   | 支持  | 支持               | |  | ||||||
| | 使用案例   | 系统的一些功能案例                                                            | 支持  | 不支持              | |  | ||||||
|  |  | ||||||
| ## 参考文档 | ## 参考文档 | ||||||
|  |  | ||||||
| 使用框架前请仔细阅读文档重点注意事项 | 使用框架前请仔细阅读文档重点注意事项 | ||||||
| <br> | <br> | ||||||
| >[初始化项目 必看](https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/init) | >[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) | ||||||
| >>[https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/init](https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/init) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) | ||||||
| > | > | ||||||
| >[专栏与视频 入门必看](https://plus-doc.dromara.org/#/common/column) | >[专栏与视频 入门必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) | ||||||
| >>[https://plus-doc.dromara.org/#/common/column](https://plus-doc.dromara.org/#/common/column) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) | ||||||
| > | > | ||||||
| >[部署项目 必看](https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/deploy) | >[部署项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) | ||||||
| >>[https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/deploy](https://plus-doc.dromara.org/#/ruoyi-vue-plus/quickstart/deploy) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) | ||||||
| >  | >  | ||||||
| >[如何加群](https://plus-doc.dromara.org/#/common/add_group) | >[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | ||||||
| >>[https://plus-doc.dromara.org/#/common/add_group](https://plus-doc.dromara.org/#/common/add_group) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | ||||||
| > |  | ||||||
| >[参考文档 Wiki](https://plus-doc.dromara.org) |  | ||||||
| >>[https://plus-doc.dromara.org](https://plus-doc.dromara.org) |  | ||||||
|  |  | ||||||
| ## 软件架构图 | ## 软件架构图 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## 贡献代码 | ||||||
|  |  | ||||||
| ## 如何参与贡献 | 欢迎各路英雄豪杰 `PR` 代码 请提交到 `dev` 开发分支 统一测试发版 | ||||||
|  |  | ||||||
| [参与贡献的方式 https://plus-doc.dromara.org/#/common/contribution](https://plus-doc.dromara.org/#/common/contribution) | 框架定位为 `通用后台管理系统(分布式集群强化)` 原则上不接受业务 `PR` | ||||||
|  |  | ||||||
|  | ### 其他 | ||||||
|  |  | ||||||
|  | * 同步升级 RuoYi-Vue | ||||||
|  | * GitHub 地址 [RuoYi-Vue-Plus-github](https://github.com/JavaLionLi/RuoYi-Vue-Plus) | ||||||
|  | * 单模块 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | ||||||
|  | * 微服务 分支 [RuoYi-Cloud-Plus](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus) | ||||||
|  | * 用户扩展项目 [扩展项目列表](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4478302&doc_id=1469725) | ||||||
|  |  | ||||||
|  | ## 加群与捐献 | ||||||
|  | >[加群与捐献](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/加群与捐献?sort_id=4104598) | ||||||
|  | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/加群与捐献?sort_id=4104598](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/加群与捐献?sort_id=4104598) | ||||||
|  |  | ||||||
| ## 捐献作者 | ## 捐献作者 | ||||||
| 作者为兼职做开源,平时还需要工作,如果帮到了您可以请作者吃个盒饭   | 作者为兼职做开源,平时还需要工作,如果帮到了您可以请作者吃个盒饭   | ||||||
| <img src="https://foruda.gitee.com/images/1678975784848381069/d8661ed9_1766278.png" width="300px" height="450px" /> | <img src="https://images.gitee.com/uploads/images/2022/0218/213734_b1b8197f_1766278.jpeg" width="300px" height="450px" /> | ||||||
| <img src="https://foruda.gitee.com/images/1678975801230205215/6f96229d_1766278.png" width="300px" height="450px" /> | <img src="https://images.gitee.com/uploads/images/2021/0525/101713_3d18b119_1766278.jpeg" width="300px" height="450px" /> | ||||||
|  |  | ||||||
|  | ## 业务功能 | ||||||
|  |  | ||||||
|  | | 功能 | 介绍 | | ||||||
|  | |---|---| | ||||||
|  | | 用户管理 | 用户是系统操作者,该功能主要完成系统用户配置。 | | ||||||
|  | | 部门管理 | 配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 | | ||||||
|  | | 岗位管理 | 配置系统用户所属担任职务。 | | ||||||
|  | | 菜单管理 | 配置系统菜单,操作权限,按钮权限标识等。 | | ||||||
|  | | 角色管理 | 角色菜单权限分配、设置角色按机构进行数据范围权限划分。 | | ||||||
|  | | 字典管理 | 对系统中经常使用的一些较为固定的数据进行维护。 | | ||||||
|  | | 参数管理 | 对系统动态配置常用参数。 | | ||||||
|  | | 通知公告 | 系统通知公告信息发布维护。 | | ||||||
|  | | 操作日志 | 系统正常操作日志记录和查询;系统异常信息日志记录和查询。 | | ||||||
|  | | 登录日志 | 系统登录日志记录查询包含登录异常。 | | ||||||
|  | | 文件管理 | 系统文件上传、下载等管理。 | | ||||||
|  | | 定时任务 | 在线(添加、修改、删除)任务调度包含执行结果日志。 | | ||||||
|  | | 代码生成 | 前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 | | ||||||
|  | | 系统接口 | 根据业务代码自动生成相关的api接口文档。 | | ||||||
|  | | 服务监控 | 监视集群系统CPU、内存、磁盘、堆栈、在线日志、Spring相关配置等。 | | ||||||
|  | | 缓存监控 | 对系统的缓存信息查询,命令统计等。 | | ||||||
|  | | 在线构建器 | 拖动表单元素生成相应的HTML代码。 | | ||||||
|  | | 连接池监视 | 监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 | | ||||||
|  | | 使用案例 | 系统的一些功能案例 | | ||||||
|  |  | ||||||
| ## 演示图例 | ## 演示图例 | ||||||
|  |  | ||||||
| |                                                                                            |                                                                                            | | <table border="1" cellpadding="1" cellspacing="1" style="width:500px"> | ||||||
| |--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| |     <tbody> | ||||||
| |  |  | |         <tr> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-972235bcbe3518dedd351ff0e2ee7d1031c.png" width="1920" /></td> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-5e0097702fa91e2e36391de8127676a7fa1.png" width="1920" /></td> | ||||||
| |  |  | |         </tr> | ||||||
| |  |  | |         <tr> | ||||||
| |  |  | |             <td> | ||||||
| |  |  | |             <p><img src="https://oscimg.oschina.net/oscnet/up-e56e3828f48cd9886d88731766f06d5f3c1.png" width="1920" /></p> | ||||||
| |  |  | |             </td> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-0715990ea1a9f254ec2138fcd063c1f556a.png" width="1920" /></td> | ||||||
| |  |  | |         </tr> | ||||||
| |  |  | |         <tr> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-eaf5417ccf921bb64abb959e3d8e290467f.png" width="1920" /></td> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-fc285cf33095ebf8318de6999af0f473861.png" width="1920" /></td> | ||||||
| |  |  | |         </tr> | ||||||
| |  |  | |         <tr> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-60c83fd8bd61c29df6dbf47c88355e9c272.png" width="1920" /></td> | ||||||
| |  |  | |             <td><img src="https://oscimg.oschina.net/oscnet/up-7f731948c8b73c7d90f67f9e1c7a534d5c3.png" width="1920" /></td> | ||||||
| |  |  | |         </tr> | ||||||
| |  |  | |         <tr> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-e4de89b5e2d20c52d3c3a47f9eb88eb8526.png" width="1920" /></td> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-8791d823a508eb90e67c604f36f57491a67.png" width="1920" /></td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-4589afd99982ead331785299b894174feb6.png" width="1920" /></td> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-8ea177cdacaea20995daf2f596b15232561.png" width="1920" /></td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-32d1d04c55c11f74c9129fbbc58399728c4.png" width="1920" /></td> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-04fa118f7631b7ae6fd72299ca0a1430a63.png" width="1920" /></td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-fe7e85b65827802bfaadf3acd42568b58c7.png" width="1920" /></td> | ||||||
|  |             <td><img src="https://oscimg.oschina.net/oscnet/up-eff2b02a54f8188022d8498cfe6af6fcc06.png" width="1920" /></td> | ||||||
|  |         </tr> | ||||||
|  |     </tbody> | ||||||
|  | </table> | ||||||
|   | |||||||
							
								
								
									
										407
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										407
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -4,98 +4,51 @@ | |||||||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
|     <groupId>org.dromara</groupId> |     <groupId>com.ruoyi</groupId> | ||||||
|     <artifactId>ruoyi-vue-plus</artifactId> |     <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|     <version>${revision}</version> |     <version>4.4.0</version> | ||||||
|  |  | ||||||
|     <name>RuoYi-Vue-Plus</name> |     <name>RuoYi-Vue-Plus</name> | ||||||
|     <url>https://gitee.com/dromara/RuoYi-Vue-Plus</url> |     <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url> | ||||||
|     <description>RuoYi-Vue-Plus多租户管理系统</description> |     <description>RuoYi-Vue-Plus后台管理系统</description> | ||||||
|  |  | ||||||
|     <properties> |     <properties> | ||||||
|         <revision>5.2.3</revision> |         <ruoyi-vue-plus.version>4.4.0</ruoyi-vue-plus.version> | ||||||
|         <spring-boot.version>3.2.11</spring-boot.version> |         <spring-boot.version>2.7.6</spring-boot.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>17</java.version> |         <java.version>1.8</java.version> | ||||||
|         <mybatis.version>3.5.16</mybatis.version> |         <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> | ||||||
|         <springdoc.version>2.6.0</springdoc.version> |         <spring-boot.mybatis>2.2.2</spring-boot.mybatis> | ||||||
|         <therapi-javadoc.version>0.15.0</therapi-javadoc.version> |         <springdoc.version>1.6.13</springdoc.version> | ||||||
|         <easyexcel.version>4.0.3</easyexcel.version> |         <poi.version>5.2.3</poi.version> | ||||||
|  |         <easyexcel.version>3.1.3</easyexcel.version> | ||||||
|         <velocity.version>2.3</velocity.version> |         <velocity.version>2.3</velocity.version> | ||||||
|         <satoken.version>1.39.0</satoken.version> |         <satoken.version>1.33.0</satoken.version> | ||||||
|         <mybatis-plus.version>3.5.8</mybatis-plus.version> |         <mybatis-plus.version>3.5.2</mybatis-plus.version> | ||||||
|         <p6spy.version>3.9.1</p6spy.version> |         <p6spy.version>3.9.1</p6spy.version> | ||||||
|         <hutool.version>5.8.31</hutool.version> |         <hutool.version>5.8.10</hutool.version> | ||||||
|         <spring-boot-admin.version>3.2.3</spring-boot-admin.version> |         <okhttp.version>4.10.0</okhttp.version> | ||||||
|         <redisson.version>3.37.0</redisson.version> |         <spring-boot-admin.version>2.7.7</spring-boot-admin.version> | ||||||
|         <lock4j.version>2.2.7</lock4j.version> |         <redisson.version>3.18.0</redisson.version> | ||||||
|         <dynamic-ds.version>4.3.1</dynamic-ds.version> |         <lock4j.version>2.2.3</lock4j.version> | ||||||
|         <snailjob.version>1.1.2</snailjob.version> |         <dynamic-ds.version>3.5.2</dynamic-ds.version> | ||||||
|         <mapstruct-plus.version>1.4.5</mapstruct-plus.version> |         <alibaba-ttl.version>2.14.2</alibaba-ttl.version> | ||||||
|         <mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version> |         <xxl-job.version>2.3.1</xxl-job.version> | ||||||
|         <lombok.version>1.18.34</lombok.version> |         <lombok.version>1.18.24</lombok.version> | ||||||
|         <bouncycastle.version>1.76</bouncycastle.version> |  | ||||||
|         <justauth.version>1.16.6</justauth.version> |         <!-- 统一 guava 版本 解决隐式漏洞问题 --> | ||||||
|         <!-- 离线IP地址定位库 --> |         <guava.version>31.1-jre</guava.version> | ||||||
|         <ip2region.version>2.7.0</ip2region.version> |         <!-- 临时修复 snakeyaml 漏洞 --> | ||||||
|  |         <snakeyaml.version>1.32</snakeyaml.version> | ||||||
|  |  | ||||||
|         <!-- OSS 配置 --> |         <!-- OSS 配置 --> | ||||||
|         <aws.sdk.version>2.28.22</aws.sdk.version> |         <aws-java-sdk-s3.version>1.12.349</aws-java-sdk-s3.version> | ||||||
|         <aws.crt.version>0.31.3</aws.crt.version> |  | ||||||
|         <!-- SMS 配置 --> |         <!-- SMS 配置 --> | ||||||
|         <sms4j.version>3.3.3</sms4j.version> |         <aliyun.sms.version>2.0.22</aliyun.sms.version> | ||||||
|         <!-- 限制框架中的fastjson版本 --> |         <tencent.sms.version>3.1.635</tencent.sms.version> | ||||||
|         <fastjson.version>1.2.83</fastjson.version> |  | ||||||
|         <!-- 面向运行时的D-ORM依赖 --> |  | ||||||
|         <anyline.version>8.7.2-20241022</anyline.version> |  | ||||||
|         <!--工作流配置--> |  | ||||||
|         <flowable.version>7.0.1</flowable.version> |  | ||||||
|  |  | ||||||
|         <!-- 插件版本 --> |  | ||||||
|         <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> |  | ||||||
|         <maven-war-plugin.version>3.2.2</maven-war-plugin.version> |  | ||||||
|         <maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison> |  | ||||||
|         <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version> |  | ||||||
|         <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version> |  | ||||||
|     </properties> |     </properties> | ||||||
|  |  | ||||||
|     <profiles> |  | ||||||
|         <profile> |  | ||||||
|             <id>local</id> |  | ||||||
|             <properties> |  | ||||||
|                 <!-- 环境标识,需要与配置文件的名称相对应 --> |  | ||||||
|                 <profiles.active>local</profiles.active> |  | ||||||
|                 <logging.level>info</logging.level> |  | ||||||
|                 <monitor.username>ruoyi</monitor.username> |  | ||||||
|                 <monitor.password>123456</monitor.password> |  | ||||||
|             </properties> |  | ||||||
|         </profile> |  | ||||||
|         <profile> |  | ||||||
|             <id>dev</id> |  | ||||||
|             <properties> |  | ||||||
|                 <!-- 环境标识,需要与配置文件的名称相对应 --> |  | ||||||
|                 <profiles.active>dev</profiles.active> |  | ||||||
|                 <logging.level>info</logging.level> |  | ||||||
|                 <monitor.username>ruoyi</monitor.username> |  | ||||||
|                 <monitor.password>123456</monitor.password> |  | ||||||
|             </properties> |  | ||||||
|             <activation> |  | ||||||
|                 <!-- 默认环境 --> |  | ||||||
|                 <activeByDefault>true</activeByDefault> |  | ||||||
|             </activation> |  | ||||||
|         </profile> |  | ||||||
|         <profile> |  | ||||||
|             <id>prod</id> |  | ||||||
|             <properties> |  | ||||||
|                 <profiles.active>prod</profiles.active> |  | ||||||
|                 <logging.level>warn</logging.level> |  | ||||||
|                 <monitor.username>ruoyi</monitor.username> |  | ||||||
|                 <monitor.password>123456</monitor.password> |  | ||||||
|             </properties> |  | ||||||
|         </profile> |  | ||||||
|     </profiles> |  | ||||||
|  |  | ||||||
|     <!-- 依赖声明 --> |     <!-- 依赖声明 --> | ||||||
|     <dependencyManagement> |     <dependencyManagement> | ||||||
|         <dependencies> |         <dependencies> | ||||||
| @@ -118,40 +71,16 @@ | |||||||
|                 <scope>import</scope> |                 <scope>import</scope> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.flowable</groupId> |  | ||||||
|                 <artifactId>flowable-bom</artifactId> |  | ||||||
|                 <version>${flowable.version}</version> |  | ||||||
|                 <type>pom</type> |  | ||||||
|                 <scope>import</scope> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- JustAuth 的依赖配置--> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>me.zhyd.oauth</groupId> |  | ||||||
|                 <artifactId>JustAuth</artifactId> |  | ||||||
|                 <version>${justauth.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- common 的依赖配置--> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-bom</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|                 <type>pom</type> |  | ||||||
|                 <scope>import</scope> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.springdoc</groupId> |                 <groupId>org.springdoc</groupId> | ||||||
|                 <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |                 <artifactId>springdoc-openapi-webmvc-core</artifactId> | ||||||
|                 <version>${springdoc.version}</version> |                 <version>${springdoc.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.github.therapi</groupId> |                 <groupId>org.springdoc</groupId> | ||||||
|                 <artifactId>therapi-runtime-javadoc</artifactId> |                 <artifactId>springdoc-openapi-javadoc</artifactId> | ||||||
|                 <version>${therapi-javadoc.version}</version> |                 <version>${springdoc.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
| @@ -160,10 +89,26 @@ | |||||||
|                 <version>${lombok.version}</version> |                 <version>${lombok.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>org.apache.poi</groupId> | ||||||
|  |                 <artifactId>poi</artifactId> | ||||||
|  |                 <version>${poi.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>org.apache.poi</groupId> | ||||||
|  |                 <artifactId>poi-ooxml</artifactId> | ||||||
|  |                 <version>${poi.version}</version> | ||||||
|  |             </dependency> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.alibaba</groupId> |                 <groupId>com.alibaba</groupId> | ||||||
|                 <artifactId>easyexcel</artifactId> |                 <artifactId>easyexcel</artifactId> | ||||||
|                 <version>${easyexcel.version}</version> |                 <version>${easyexcel.version}</version> | ||||||
|  |                 <exclusions> | ||||||
|  |                     <exclusion> | ||||||
|  |                         <groupId>org.apache.poi</groupId> | ||||||
|  |                         <artifactId>poi-ooxml-schemas</artifactId> | ||||||
|  |                     </exclusion> | ||||||
|  |                 </exclusions> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <!-- velocity代码生成使用模板 --> |             <!-- velocity代码生成使用模板 --> | ||||||
| @@ -176,7 +121,7 @@ | |||||||
|             <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ --> |             <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ --> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>cn.dev33</groupId> |                 <groupId>cn.dev33</groupId> | ||||||
|                 <artifactId>sa-token-spring-boot3-starter</artifactId> |                 <artifactId>sa-token-spring-boot-starter</artifactId> | ||||||
|                 <version>${satoken.version}</version> |                 <version>${satoken.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|             <!-- Sa-Token 整合 jwt --> |             <!-- Sa-Token 整合 jwt --> | ||||||
| @@ -191,37 +136,24 @@ | |||||||
|                     </exclusion> |                     </exclusion> | ||||||
|                 </exclusions> |                 </exclusions> | ||||||
|             </dependency> |             </dependency> | ||||||
|             <dependency> |  | ||||||
|                 <groupId>cn.dev33</groupId> |  | ||||||
|                 <artifactId>sa-token-core</artifactId> |  | ||||||
|                 <version>${satoken.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- dynamic-datasource 多数据源--> |             <!-- dynamic-datasource 多数据源--> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.baomidou</groupId> |                 <groupId>com.baomidou</groupId> | ||||||
|                 <artifactId>dynamic-datasource-spring-boot3-starter</artifactId> |                 <artifactId>dynamic-datasource-spring-boot-starter</artifactId> | ||||||
|                 <version>${dynamic-ds.version}</version> |                 <version>${dynamic-ds.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.mybatis</groupId> |  | ||||||
|                 <artifactId>mybatis</artifactId> |  | ||||||
|                 <version>${mybatis.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.baomidou</groupId> |                 <groupId>com.baomidou</groupId> | ||||||
|                 <artifactId>mybatis-plus-spring-boot3-starter</artifactId> |                 <artifactId>mybatis-plus-boot-starter</artifactId> | ||||||
|                 <version>${mybatis-plus.version}</version> |                 <version>${mybatis-plus.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.baomidou</groupId> |                 <groupId>com.baomidou</groupId> | ||||||
|                 <artifactId>mybatis-plus-annotation</artifactId> |                 <artifactId>mybatis-plus-extension</artifactId> | ||||||
|                 <version>${mybatis-plus.version}</version> |                 <version>${mybatis-plus.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <!-- sql性能分析插件 --> |             <!-- sql性能分析插件 --> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>p6spy</groupId> |                 <groupId>p6spy</groupId> | ||||||
| @@ -229,29 +161,28 @@ | |||||||
|                 <version>${p6spy.version}</version> |                 <version>${p6spy.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <!--  AWS SDK for Java 2.x  --> |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>software.amazon.awssdk</groupId> |                 <groupId>com.squareup.okhttp3</groupId> | ||||||
|                 <artifactId>s3</artifactId> |                 <artifactId>okhttp</artifactId> | ||||||
|                 <version>${aws.sdk.version}</version> |                 <version>${okhttp.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|             <!-- 使用AWS基于 CRT 的 S3 客户端 --> |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>software.amazon.awssdk.crt</groupId> |                 <groupId>com.amazonaws</groupId> | ||||||
|                 <artifactId>aws-crt</artifactId> |                 <artifactId>aws-java-sdk-s3</artifactId> | ||||||
|                 <version>${aws.crt.version}</version> |                 <version>${aws-java-sdk-s3.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|             <!-- 基于 AWS CRT 的 S3 客户端的性能增强的 S3 传输管理器 --> |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>software.amazon.awssdk</groupId> |                 <groupId>com.aliyun</groupId> | ||||||
|                 <artifactId>s3-transfer-manager</artifactId> |                 <artifactId>dysmsapi20170525</artifactId> | ||||||
|                 <version>${aws.sdk.version}</version> |                 <version>${aliyun.sms.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|             <!--短信sms4j--> |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.dromara.sms4j</groupId> |                 <groupId>com.tencentcloudapi</groupId> | ||||||
|                 <artifactId>sms4j-spring-boot-starter</artifactId> |                 <artifactId>tencentcloud-sdk-java-sms</artifactId> | ||||||
|                 <version>${sms4j.version}</version> |                 <version>${tencent.sms.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
| @@ -271,86 +202,93 @@ | |||||||
|                 <artifactId>redisson-spring-boot-starter</artifactId> |                 <artifactId>redisson-spring-boot-starter</artifactId> | ||||||
|                 <version>${redisson.version}</version> |                 <version>${redisson.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.baomidou</groupId> |                 <groupId>com.baomidou</groupId> | ||||||
|                 <artifactId>lock4j-redisson-spring-boot-starter</artifactId> |                 <artifactId>lock4j-redisson-spring-boot-starter</artifactId> | ||||||
|                 <version>${lock4j.version}</version> |                 <version>${lock4j.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <!-- SnailJob Client --> |             <!-- xxl-job-core --> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.aizuda</groupId> |                 <groupId>com.xuxueli</groupId> | ||||||
|                 <artifactId>snail-job-client-starter</artifactId> |                 <artifactId>xxl-job-core</artifactId> | ||||||
|                 <version>${snailjob.version}</version> |                 <version>${xxl-job.version}</version> | ||||||
|             </dependency> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>com.aizuda</groupId> |  | ||||||
|                 <artifactId>snail-job-client-job-core</artifactId> |  | ||||||
|                 <version>${snailjob.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 加密包引入 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.bouncycastle</groupId> |  | ||||||
|                 <artifactId>bcprov-jdk15to18</artifactId> |  | ||||||
|                 <version>${bouncycastle.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>io.github.linpeilie</groupId> |  | ||||||
|                 <artifactId>mapstruct-plus-spring-boot-starter</artifactId> |  | ||||||
|                 <version>${mapstruct-plus.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 离线IP地址定位库 ip2region --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.lionsoul</groupId> |  | ||||||
|                 <artifactId>ip2region</artifactId> |  | ||||||
|                 <version>${ip2region.version}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>commons-io</groupId> |  | ||||||
|                 <artifactId>commons-io</artifactId> |  | ||||||
|                 <version>2.15.0</version> |  | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.alibaba</groupId> |                 <groupId>com.alibaba</groupId> | ||||||
|                 <artifactId>fastjson</artifactId> |                 <artifactId>transmittable-thread-local</artifactId> | ||||||
|                 <version>${fastjson.version}</version> |                 <version>${alibaba-ttl.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 统一 guava 版本 解决隐式漏洞问题 --> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.dromara</groupId> |                 <groupId>com.google.guava</groupId> | ||||||
|                 <artifactId>ruoyi-system</artifactId> |                 <artifactId>guava</artifactId> | ||||||
|                 <version>${revision}</version> |                 <version>${guava.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 临时修复 snakeyaml 漏洞 --> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.dromara</groupId> |                 <groupId>org.yaml</groupId> | ||||||
|  |                 <artifactId>snakeyaml</artifactId> | ||||||
|  |                 <version>${snakeyaml.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 定时任务 --> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|                 <artifactId>ruoyi-job</artifactId> |                 <artifactId>ruoyi-job</artifactId> | ||||||
|                 <version>${revision}</version> |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 代码生成--> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.dromara</groupId> |                 <groupId>com.ruoyi</groupId> | ||||||
|                 <artifactId>ruoyi-generator</artifactId> |                 <artifactId>ruoyi-generator</artifactId> | ||||||
|                 <version>${revision}</version> |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 核心模块--> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.dromara</groupId> |                 <groupId>com.ruoyi</groupId> | ||||||
|  |                 <artifactId>ruoyi-framework</artifactId> | ||||||
|  |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 系统模块--> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|  |                 <artifactId>ruoyi-system</artifactId> | ||||||
|  |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- 通用工具--> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|  |                 <artifactId>ruoyi-common</artifactId> | ||||||
|  |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- OSS对象存储模块 --> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|  |                 <artifactId>ruoyi-oss</artifactId> | ||||||
|  |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- SMS短信模块 --> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|  |                 <artifactId>ruoyi-sms</artifactId> | ||||||
|  |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <!-- demo模块 --> | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>com.ruoyi</groupId> | ||||||
|                 <artifactId>ruoyi-demo</artifactId> |                 <artifactId>ruoyi-demo</artifactId> | ||||||
|                 <version>${revision}</version> |                 <version>${ruoyi-vue-plus.version}</version> | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!--  工作流模块  --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-workflow</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|         </dependencies> |         </dependencies> | ||||||
| @@ -358,9 +296,15 @@ | |||||||
|  |  | ||||||
|     <modules> |     <modules> | ||||||
|         <module>ruoyi-admin</module> |         <module>ruoyi-admin</module> | ||||||
|  |         <module>ruoyi-framework</module> | ||||||
|  |         <module>ruoyi-system</module> | ||||||
|  |         <module>ruoyi-job</module> | ||||||
|  |         <module>ruoyi-generator</module> | ||||||
|         <module>ruoyi-common</module> |         <module>ruoyi-common</module> | ||||||
|  |         <module>ruoyi-demo</module> | ||||||
|         <module>ruoyi-extend</module> |         <module>ruoyi-extend</module> | ||||||
|         <module>ruoyi-modules</module> |         <module>ruoyi-oss</module> | ||||||
|  |         <module>ruoyi-sms</module> | ||||||
|     </modules> |     </modules> | ||||||
|     <packaging>pom</packaging> |     <packaging>pom</packaging> | ||||||
|  |  | ||||||
| @@ -369,7 +313,7 @@ | |||||||
|             <plugin> |             <plugin> | ||||||
|                 <groupId>org.apache.maven.plugins</groupId> |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|                 <artifactId>maven-compiler-plugin</artifactId> |                 <artifactId>maven-compiler-plugin</artifactId> | ||||||
|                 <version>${maven-compiler-plugin.verison}</version> |                 <version>3.9.0</version> | ||||||
|                 <configuration> |                 <configuration> | ||||||
|                     <source>${java.version}</source> |                     <source>${java.version}</source> | ||||||
|                     <target>${java.version}</target> |                     <target>${java.version}</target> | ||||||
| @@ -378,7 +322,7 @@ | |||||||
|                         <path> |                         <path> | ||||||
|                             <groupId>com.github.therapi</groupId> |                             <groupId>com.github.therapi</groupId> | ||||||
|                             <artifactId>therapi-runtime-javadoc-scribe</artifactId> |                             <artifactId>therapi-runtime-javadoc-scribe</artifactId> | ||||||
|                             <version>${therapi-javadoc.version}</version> |                             <version>0.15.0</version> | ||||||
|                         </path> |                         </path> | ||||||
|                         <path> |                         <path> | ||||||
|                             <groupId>org.projectlombok</groupId> |                             <groupId>org.projectlombok</groupId> | ||||||
| @@ -390,27 +334,14 @@ | |||||||
|                             <artifactId>spring-boot-configuration-processor</artifactId> |                             <artifactId>spring-boot-configuration-processor</artifactId> | ||||||
|                             <version>${spring-boot.version}</version> |                             <version>${spring-boot.version}</version> | ||||||
|                         </path> |                         </path> | ||||||
|                         <path> |  | ||||||
|                             <groupId>io.github.linpeilie</groupId> |  | ||||||
|                             <artifactId>mapstruct-plus-processor</artifactId> |  | ||||||
|                             <version>${mapstruct-plus.version}</version> |  | ||||||
|                         </path> |  | ||||||
|                         <path> |  | ||||||
|                             <groupId>org.projectlombok</groupId> |  | ||||||
|                             <artifactId>lombok-mapstruct-binding</artifactId> |  | ||||||
|                             <version>${mapstruct-plus.lombok.version}</version> |  | ||||||
|                         </path> |  | ||||||
|                     </annotationProcessorPaths> |                     </annotationProcessorPaths> | ||||||
|                     <compilerArgs> |  | ||||||
|                         <arg>-parameters</arg> |  | ||||||
|                     </compilerArgs> |  | ||||||
|                 </configuration> |                 </configuration> | ||||||
|             </plugin> |             </plugin> | ||||||
|             <!-- 单元测试使用 --> |             <!-- 单元测试使用 --> | ||||||
|             <plugin> |             <plugin> | ||||||
|                 <groupId>org.apache.maven.plugins</groupId> |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|                 <artifactId>maven-surefire-plugin</artifactId> |                 <artifactId>maven-surefire-plugin</artifactId> | ||||||
|                 <version>${maven-surefire-plugin.version}</version> |                 <version>2.22.2</version> | ||||||
|                 <configuration> |                 <configuration> | ||||||
|                     <argLine>-Dfile.encoding=UTF-8</argLine> |                     <argLine>-Dfile.encoding=UTF-8</argLine> | ||||||
|                     <!-- 根据打包环境执行对应的@Tag测试方法 --> |                     <!-- 根据打包环境执行对应的@Tag测试方法 --> | ||||||
| @@ -419,32 +350,6 @@ | |||||||
|                     <excludedGroups>exclude</excludedGroups> |                     <excludedGroups>exclude</excludedGroups> | ||||||
|                 </configuration> |                 </configuration> | ||||||
|             </plugin> |             </plugin> | ||||||
|             <!-- 统一版本号管理 --> |  | ||||||
|             <plugin> |  | ||||||
|                 <groupId>org.codehaus.mojo</groupId> |  | ||||||
|                 <artifactId>flatten-maven-plugin</artifactId> |  | ||||||
|                 <version>${flatten-maven-plugin.version}</version> |  | ||||||
|                 <configuration> |  | ||||||
|                     <updatePomFile>true</updatePomFile> |  | ||||||
|                     <flattenMode>resolveCiFriendliesOnly</flattenMode> |  | ||||||
|                 </configuration> |  | ||||||
|                 <executions> |  | ||||||
|                     <execution> |  | ||||||
|                         <id>flatten</id> |  | ||||||
|                         <phase>process-resources</phase> |  | ||||||
|                         <goals> |  | ||||||
|                             <goal>flatten</goal> |  | ||||||
|                         </goals> |  | ||||||
|                     </execution> |  | ||||||
|                     <execution> |  | ||||||
|                         <id>flatten.clean</id> |  | ||||||
|                         <phase>clean</phase> |  | ||||||
|                         <goals> |  | ||||||
|                             <goal>clean</goal> |  | ||||||
|                         </goals> |  | ||||||
|                     </execution> |  | ||||||
|                 </executions> |  | ||||||
|             </plugin> |  | ||||||
|         </plugins> |         </plugins> | ||||||
|         <resources> |         <resources> | ||||||
|             <resource> |             <resource> | ||||||
| @@ -491,6 +396,36 @@ | |||||||
|         </pluginRepository> |         </pluginRepository> | ||||||
|     </pluginRepositories> |     </pluginRepositories> | ||||||
|  |  | ||||||
|  |     <profiles> | ||||||
|  |         <profile> | ||||||
|  |             <id>local</id> | ||||||
|  |             <properties> | ||||||
|  |                 <!-- 环境标识,需要与配置文件的名称相对应 --> | ||||||
|  |                 <profiles.active>local</profiles.active> | ||||||
|  |                 <logging.level>debug</logging.level> | ||||||
|  |             </properties> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>dev</id> | ||||||
|  |             <properties> | ||||||
|  |                 <!-- 环境标识,需要与配置文件的名称相对应 --> | ||||||
|  |                 <profiles.active>dev</profiles.active> | ||||||
|  |                 <logging.level>debug</logging.level> | ||||||
|  |             </properties> | ||||||
|  |             <activation> | ||||||
|  |                 <!-- 默认环境 --> | ||||||
|  |                 <activeByDefault>true</activeByDefault> | ||||||
|  |             </activation> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>prod</id> | ||||||
|  |             <properties> | ||||||
|  |                 <profiles.active>prod</profiles.active> | ||||||
|  |                 <logging.level>warn</logging.level> | ||||||
|  |             </properties> | ||||||
|  |         </profile> | ||||||
|  |     </profiles> | ||||||
|  |  | ||||||
| </project> | </project> | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,9 +1,6 @@ | |||||||
| # 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/ | FROM anapsix/alpine-java:8_server-jre_unlimited | ||||||
| FROM bellsoft/liberica-openjdk-debian:17.0.11-cds |  | ||||||
| #FROM bellsoft/liberica-openjdk-debian:21.0.3-cds |  | ||||||
| #FROM findepi/graalvm:java17-native |  | ||||||
|  |  | ||||||
| LABEL maintainer="Lion Li" | MAINTAINER Lion Li | ||||||
|  |  | ||||||
| RUN mkdir -p /ruoyi/server/logs \ | RUN mkdir -p /ruoyi/server/logs \ | ||||||
|     /ruoyi/server/temp \ |     /ruoyi/server/temp \ | ||||||
| @@ -11,16 +8,16 @@ RUN mkdir -p /ruoyi/server/logs \ | |||||||
|  |  | ||||||
| WORKDIR /ruoyi/server | WORKDIR /ruoyi/server | ||||||
|  |  | ||||||
| ENV SERVER_PORT=8080 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="" | ENV SERVER_PORT=8080 | ||||||
|  |  | ||||||
| EXPOSE ${SERVER_PORT} | EXPOSE ${SERVER_PORT} | ||||||
|  |  | ||||||
| ADD ./target/ruoyi-admin.jar ./app.jar | ADD ./target/ruoyi-admin.jar ./app.jar | ||||||
|  |  | ||||||
| ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \ | ENTRYPOINT ["java", \ | ||||||
|  |             "-Djava.security.egd=file:/dev/./urandom", \ | ||||||
|  |             "-Dserver.port=${SERVER_PORT}", \ | ||||||
|             # 应用名称 如果想区分集群节点监控 改成不同的名称即可 |             # 应用名称 如果想区分集群节点监控 改成不同的名称即可 | ||||||
|            #-Dskywalking.agent.service_name=ruoyi-server \ | #            "-Dskywalking.agent.service_name=ruoyi-server", \ | ||||||
|            #-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar \ | #            "-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \ | ||||||
|            -XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \ |             "-jar", "app.jar"] | ||||||
|            -jar app.jar |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ | |||||||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>org.dromara</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>${revision}</version> |         <version>4.4.0</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|     <packaging>jar</packaging> |     <packaging>jar</packaging> | ||||||
| @@ -17,87 +17,67 @@ | |||||||
|  |  | ||||||
|     <dependencies> |     <dependencies> | ||||||
|  |  | ||||||
|  |         <!-- spring-boot-devtools --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-devtools</artifactId> | ||||||
|  |             <optional>true</optional> <!-- 表示依赖不会传递 --> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|         <!-- Mysql驱动包 --> |         <!-- Mysql驱动包 --> | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>com.mysql</groupId> |             <groupId>com.mysql</groupId> | ||||||
|             <artifactId>mysql-connector-j</artifactId> |             <artifactId>mysql-connector-j</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |         <!-- Oracle --> | ||||||
| <!--        <!– mp支持的数据库均支持 只需要增加对应的jdbc依赖即可 –>--> |  | ||||||
| <!--        <!– Oracle –>--> |  | ||||||
| <!--        <dependency>--> |  | ||||||
| <!--            <groupId>com.oracle.database.jdbc</groupId>--> |  | ||||||
| <!--            <artifactId>ojdbc8</artifactId>--> |  | ||||||
| <!--        </dependency>--> |  | ||||||
| <!--        <!– 兼容oracle低版本 –>--> |  | ||||||
| <!--        <dependency>--> |  | ||||||
| <!--            <groupId>com.oracle.database.nls</groupId>--> |  | ||||||
| <!--            <artifactId>orai18n</artifactId>--> |  | ||||||
| <!--        </dependency>--> |  | ||||||
| <!--        <!– PostgreSql –>--> |  | ||||||
| <!--        <dependency>--> |  | ||||||
| <!--            <groupId>org.postgresql</groupId>--> |  | ||||||
| <!--            <artifactId>postgresql</artifactId>--> |  | ||||||
| <!--        </dependency>--> |  | ||||||
| <!--        <!– SqlServer –>--> |  | ||||||
| <!--        <dependency>--> |  | ||||||
| <!--            <groupId>com.microsoft.sqlserver</groupId>--> |  | ||||||
| <!--            <artifactId>mssql-jdbc</artifactId>--> |  | ||||||
| <!--        </dependency>--> |  | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.dromara</groupId> |             <groupId>com.oracle.database.jdbc</groupId> | ||||||
|             <artifactId>ruoyi-common-doc</artifactId> |             <artifactId>ojdbc8</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- PostgreSql --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.postgresql</groupId> | ||||||
|  |             <artifactId>postgresql</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- SqlServer --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.microsoft.sqlserver</groupId> | ||||||
|  |             <artifactId>mssql-jdbc</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- 核心模块--> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.ruoyi</groupId> | ||||||
|  |             <artifactId>ruoyi-framework</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.dromara</groupId> |             <groupId>com.ruoyi</groupId> | ||||||
|             <artifactId>ruoyi-common-social</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.dromara</groupId> |  | ||||||
|             <artifactId>ruoyi-common-ratelimiter</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.dromara</groupId> |  | ||||||
|             <artifactId>ruoyi-common-mail</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.dromara</groupId> |  | ||||||
|             <artifactId>ruoyi-system</artifactId> |             <artifactId>ruoyi-system</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.dromara</groupId> |             <groupId>com.ruoyi</groupId> | ||||||
|             <artifactId>ruoyi-job</artifactId> |             <artifactId>ruoyi-job</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.ruoyi</groupId> | ||||||
|  |             <artifactId>ruoyi-oss</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|         <!-- 代码生成--> |         <!-- 代码生成--> | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.dromara</groupId> |             <groupId>com.ruoyi</groupId> | ||||||
|             <artifactId>ruoyi-generator</artifactId> |             <artifactId>ruoyi-generator</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <!--  demo模块  --> |         <!--  demo模块  --> | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.dromara</groupId> |             <groupId>com.ruoyi</groupId> | ||||||
|             <artifactId>ruoyi-demo</artifactId> |             <artifactId>ruoyi-demo</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <!--  工作流模块  --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.dromara</groupId> |  | ||||||
|             <artifactId>ruoyi-workflow</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>de.codecentric</groupId> |  | ||||||
|             <artifactId>spring-boot-admin-starter-client</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.springframework.boot</groupId> |             <groupId>org.springframework.boot</groupId> | ||||||
|             <artifactId>spring-boot-starter-test</artifactId> |             <artifactId>spring-boot-starter-test</artifactId> | ||||||
| @@ -125,6 +105,9 @@ | |||||||
|                 <groupId>org.springframework.boot</groupId> |                 <groupId>org.springframework.boot</groupId> | ||||||
|                 <artifactId>spring-boot-maven-plugin</artifactId> |                 <artifactId>spring-boot-maven-plugin</artifactId> | ||||||
|                 <version>${spring-boot.version}</version> |                 <version>${spring-boot.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> | ||||||
|  |                 </configuration> | ||||||
|                 <executions> |                 <executions> | ||||||
|                     <execution> |                     <execution> | ||||||
|                         <goals> |                         <goals> | ||||||
| @@ -133,15 +116,10 @@ | |||||||
|                     </execution> |                     </execution> | ||||||
|                 </executions> |                 </executions> | ||||||
|             </plugin> |             </plugin> | ||||||
|             <plugin> |  | ||||||
|                 <groupId>org.apache.maven.plugins</groupId> |  | ||||||
|                 <artifactId>maven-jar-plugin</artifactId> |  | ||||||
|                 <version>${maven-jar-plugin.version}</version> |  | ||||||
|             </plugin> |  | ||||||
|             <plugin> |             <plugin> | ||||||
|                 <groupId>org.apache.maven.plugins</groupId> |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|                 <artifactId>maven-war-plugin</artifactId> |                 <artifactId>maven-war-plugin</artifactId> | ||||||
|                 <version>${maven-war-plugin.version}</version> |                 <version>3.2.2</version> | ||||||
|                 <configuration> |                 <configuration> | ||||||
|                     <failOnMissingWebXml>false</failOnMissingWebXml> |                     <failOnMissingWebXml>false</failOnMissingWebXml> | ||||||
|                     <warName>${project.artifactId}</warName> |                     <warName>${project.artifactId}</warName> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| package org.dromara; | package com.ruoyi; | ||||||
| 
 | 
 | ||||||
| import org.springframework.boot.SpringApplication; | import org.springframework.boot.SpringApplication; | ||||||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | import org.springframework.boot.autoconfigure.SpringBootApplication; | ||||||
| @@ -7,14 +7,15 @@ import org.springframework.boot.context.metrics.buffering.BufferingApplicationSt | |||||||
| /** | /** | ||||||
|  * 启动程序 |  * 启动程序 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author ruoyi | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| @SpringBootApplication | @SpringBootApplication | ||||||
| public class DromaraApplication { | public class RuoYiApplication { | ||||||
| 
 | 
 | ||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
|         SpringApplication application = new SpringApplication(DromaraApplication.class); |         System.setProperty("spring.devtools.restart.enabled", "false"); | ||||||
|  |         SpringApplication application = new SpringApplication(RuoYiApplication.class); | ||||||
|         application.setApplicationStartup(new BufferingApplicationStartup(2048)); |         application.setApplicationStartup(new BufferingApplicationStartup(2048)); | ||||||
|         application.run(args); |         application.run(args); | ||||||
|         System.out.println("(♥◠‿◠)ノ゙  RuoYi-Vue-Plus启动成功   ლ(´ڡ`ლ)゙"); |         System.out.println("(♥◠‿◠)ノ゙  RuoYi-Vue-Plus启动成功   ლ(´ڡ`ლ)゙"); | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| package org.dromara; | package com.ruoyi; | ||||||
| 
 | 
 | ||||||
| import org.springframework.boot.builder.SpringApplicationBuilder; | import org.springframework.boot.builder.SpringApplicationBuilder; | ||||||
| import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||||||
| @@ -6,13 +6,13 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer | |||||||
| /** | /** | ||||||
|  * web容器中进行部署 |  * web容器中进行部署 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author ruoyi | ||||||
|  */ |  */ | ||||||
| public class DromaraServletInitializer extends SpringBootServletInitializer { | public class RuoYiServletInitializer extends SpringBootServletInitializer { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |     protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||||||
|         return application.sources(DromaraApplication.class); |         return application.sources(RuoYiApplication.class); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @@ -0,0 +1,122 @@ | |||||||
|  | package com.ruoyi.web.controller.common; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaIgnore; | ||||||
|  | import cn.hutool.captcha.AbstractCaptcha; | ||||||
|  | import cn.hutool.captcha.generator.CodeGenerator; | ||||||
|  | import cn.hutool.core.convert.Convert; | ||||||
|  | import cn.hutool.core.util.IdUtil; | ||||||
|  | import cn.hutool.core.util.RandomUtil; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.constant.Constants; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.enums.CaptchaType; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
|  | import com.ruoyi.common.utils.reflect.ReflectUtils; | ||||||
|  | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
|  | import com.ruoyi.framework.config.properties.CaptchaProperties; | ||||||
|  | import com.ruoyi.sms.config.properties.SmsProperties; | ||||||
|  | import com.ruoyi.sms.core.SmsTemplate; | ||||||
|  | import com.ruoyi.sms.entity.SmsResult; | ||||||
|  | import com.ruoyi.system.service.ISysConfigService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  |  | ||||||
|  | import javax.validation.constraints.NotBlank; | ||||||
|  | import java.time.Duration; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 验证码操作处理 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @SaIgnore | ||||||
|  | @Slf4j | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | public class CaptchaController { | ||||||
|  |  | ||||||
|  |     private final CaptchaProperties captchaProperties; | ||||||
|  |     private final SmsProperties smsProperties; | ||||||
|  |     private final ISysConfigService configService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 短信验证码 | ||||||
|  |      * | ||||||
|  |      * @param phonenumber 用户手机号 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/captchaSms") | ||||||
|  |     public R<Void> smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") | ||||||
|  |                               String phonenumber) { | ||||||
|  |         if (!smsProperties.getEnabled()) { | ||||||
|  |             return R.fail("当前系统没有开启短信功能!"); | ||||||
|  |         } | ||||||
|  |         String key = CacheConstants.CAPTCHA_CODE_KEY + phonenumber; | ||||||
|  |         String code = RandomUtil.randomNumbers(4); | ||||||
|  |         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); | ||||||
|  |         // 验证码模板id 自行处理 (查数据库或写死均可) | ||||||
|  |         String templateId = ""; | ||||||
|  |         Map<String, String> map = new HashMap<>(1); | ||||||
|  |         map.put("code", code); | ||||||
|  |         SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class); | ||||||
|  |         SmsResult result = smsTemplate.send(phonenumber, templateId, map); | ||||||
|  |         if (!result.isSuccess()) { | ||||||
|  |             log.error("验证码短信发送异常 => {}", result); | ||||||
|  |             return R.fail(result.getMessage()); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 生成验证码 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/captchaImage") | ||||||
|  |     public R<Map<String, Object>> getCode() { | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         boolean captchaEnabled = configService.selectCaptchaEnabled(); | ||||||
|  |         ajax.put("captchaEnabled", captchaEnabled); | ||||||
|  |         if (!captchaEnabled) { | ||||||
|  |             return R.ok(ajax); | ||||||
|  |         } | ||||||
|  |         // 保存验证码信息 | ||||||
|  |         String uuid = IdUtil.simpleUUID(); | ||||||
|  |         String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; | ||||||
|  |         // 生成验证码 | ||||||
|  |         CaptchaType captchaType = captchaProperties.getType(); | ||||||
|  |         boolean isMath = CaptchaType.MATH == captchaType; | ||||||
|  |         Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); | ||||||
|  |         CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); | ||||||
|  |         AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); | ||||||
|  |         captcha.setGenerator(codeGenerator); | ||||||
|  |         captcha.createCode(); | ||||||
|  |         String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode(); | ||||||
|  |         RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); | ||||||
|  |         ajax.put("uuid", uuid); | ||||||
|  |         ajax.put("img", captcha.getImageBase64()); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private String getCodeResult(String capStr) { | ||||||
|  |         int numberLength = captchaProperties.getNumberLength(); | ||||||
|  |         int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim()); | ||||||
|  |         char operator = capStr.charAt(numberLength); | ||||||
|  |         int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); | ||||||
|  |         switch (operator) { | ||||||
|  |             case '*': | ||||||
|  |                 return Convert.toStr(a * b); | ||||||
|  |             case '+': | ||||||
|  |                 return Convert.toStr(a + b); | ||||||
|  |             case '-': | ||||||
|  |                 return Convert.toStr(a - b); | ||||||
|  |             default: | ||||||
|  |                 return StringUtils.EMPTY; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -0,0 +1,169 @@ | |||||||
|  | package com.ruoyi.web.controller.monitor; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import cn.hutool.core.collection.CollUtil; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.constant.CacheNames; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.utils.JsonUtils; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.utils.redis.CacheUtils; | ||||||
|  | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
|  | import com.ruoyi.system.domain.SysCache; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.redisson.spring.data.connection.RedissonConnectionFactory; | ||||||
|  | import org.springframework.data.redis.connection.RedisConnection; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
|  | import java.util.*; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 缓存监控 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/monitor/cache") | ||||||
|  | public class CacheController { | ||||||
|  |  | ||||||
|  |     private final RedissonConnectionFactory connectionFactory; | ||||||
|  |  | ||||||
|  |     private final static List<SysCache> CACHES = new ArrayList<>(); | ||||||
|  |  | ||||||
|  |     static { | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.ONLINE_TOKEN_KEY, "在线用户")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_CONFIG, "配置信息")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_DICT, "数据字典")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_OSS_CONFIG, "OSS配置")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping() | ||||||
|  |     public R<Map<String, Object>> getInfo() throws Exception { | ||||||
|  |         RedisConnection connection = connectionFactory.getConnection(); | ||||||
|  |         Properties info = connection.info(); | ||||||
|  |         Properties commandStats = connection.info("commandstats"); | ||||||
|  |         Long dbSize = connection.dbSize(); | ||||||
|  |  | ||||||
|  |         Map<String, Object> result = new HashMap<>(3); | ||||||
|  |         result.put("info", info); | ||||||
|  |         result.put("dbSize", dbSize); | ||||||
|  |  | ||||||
|  |         List<Map<String, String>> pieList = new ArrayList<>(); | ||||||
|  |         if (commandStats != null) { | ||||||
|  |             commandStats.stringPropertyNames().forEach(key -> { | ||||||
|  |                 Map<String, String> data = new HashMap<>(2); | ||||||
|  |                 String property = commandStats.getProperty(key); | ||||||
|  |                 data.put("name", StringUtils.removeStart(key, "cmdstat_")); | ||||||
|  |                 data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); | ||||||
|  |                 pieList.add(data); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  |         result.put("commandStats", pieList); | ||||||
|  |         return R.ok(result); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控缓存名列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getNames") | ||||||
|  |     public R<List<SysCache>> cache() { | ||||||
|  |         return R.ok(CACHES); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控Key列表 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getKeys/{cacheName}") | ||||||
|  |     public R<Collection<String>> getCacheKeys(@PathVariable String cacheName) { | ||||||
|  |         Collection<String> cacheKeys = new HashSet<>(0); | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             Set<Object> keys = CacheUtils.keys(cacheName); | ||||||
|  |             if (CollUtil.isNotEmpty(keys)) { | ||||||
|  |                 cacheKeys = keys.stream().map(Object::toString).collect(Collectors.toList()); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             cacheKeys = RedisUtils.keys(cacheName + "*"); | ||||||
|  |         } | ||||||
|  |         return R.ok(cacheKeys); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控缓存值详情 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      * @param cacheKey  缓存key | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getValue/{cacheName}/{cacheKey}") | ||||||
|  |     public R<SysCache> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { | ||||||
|  |         Object cacheValue; | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             cacheValue = CacheUtils.get(cacheName, cacheKey); | ||||||
|  |         } else { | ||||||
|  |             cacheValue = RedisUtils.getCacheObject(cacheKey); | ||||||
|  |         } | ||||||
|  |         SysCache sysCache = new SysCache(cacheName, cacheKey, JsonUtils.toJsonString(cacheValue)); | ||||||
|  |         return R.ok(sysCache); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理缓存监控缓存名 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheName/{cacheName}") | ||||||
|  |     public R<Void> clearCacheName(@PathVariable String cacheName) { | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             CacheUtils.clear(cacheName); | ||||||
|  |         } else { | ||||||
|  |             RedisUtils.deleteKeys(cacheName + "*"); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理缓存监控Key | ||||||
|  |      * | ||||||
|  |      * @param cacheKey key名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheKey/{cacheName}/{cacheKey}") | ||||||
|  |     public R<Void> clearCacheKey(@PathVariable String cacheName, @PathVariable String cacheKey) { | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             CacheUtils.evict(cacheName, cacheKey); | ||||||
|  |         } else { | ||||||
|  |             RedisUtils.deleteObject(cacheKey); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理全部缓存监控 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheAll") | ||||||
|  |     public R<Void> clearCacheAll() { | ||||||
|  |         RedisUtils.deleteKeys("*"); | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private boolean isCacheNames(String cacheName) { | ||||||
|  |         return !StringUtils.contains(cacheName, ":"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,23 +1,22 @@ | |||||||
| package org.dromara.system.controller.monitor; | package com.ruoyi.web.controller.monitor; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
|  | import com.ruoyi.system.domain.SysLogininfor; | ||||||
|  | import com.ruoyi.system.service.ISysLogininforService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.constant.CacheConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; |  | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.bo.SysLogininforBo; |  | ||||||
| import org.dromara.system.domain.vo.SysLogininforVo; |  | ||||||
| import org.dromara.system.service.ISysLogininforService; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @@ -38,7 +37,7 @@ public class SysLogininforController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("monitor:logininfor:list") |     @SaCheckPermission("monitor:logininfor:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysLogininforVo> list(SysLogininforBo logininfor, PageQuery pageQuery) { |     public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor, PageQuery pageQuery) { | ||||||
|         return logininforService.selectPageLogininforList(logininfor, pageQuery); |         return logininforService.selectPageLogininforList(logininfor, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -48,9 +47,9 @@ public class SysLogininforController extends BaseController { | |||||||
|     @Log(title = "登录日志", businessType = BusinessType.EXPORT) |     @Log(title = "登录日志", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("monitor:logininfor:export") |     @SaCheckPermission("monitor:logininfor:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysLogininforBo logininfor, HttpServletResponse response) { |     public void export(SysLogininfor logininfor, HttpServletResponse response) { | ||||||
|         List<SysLogininforVo> list = logininforService.selectLogininforList(logininfor); |         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); | ||||||
|         ExcelUtil.exportExcel(list, "登录日志", SysLogininforVo.class, response); |         ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -1,21 +1,20 @@ | |||||||
| package org.dromara.system.controller.monitor; | package com.ruoyi.web.controller.monitor; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import org.dromara.system.domain.bo.SysOperLogBo; | import com.ruoyi.system.domain.SysOperLog; | ||||||
| import org.dromara.system.domain.vo.SysOperLogVo; | import com.ruoyi.system.service.ISysOperLogService; | ||||||
| import org.dromara.system.service.ISysOperLogService; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @@ -36,7 +35,7 @@ public class SysOperlogController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("monitor:operlog:list") |     @SaCheckPermission("monitor:operlog:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOperLogVo> list(SysOperLogBo operLog, PageQuery pageQuery) { |     public TableDataInfo<SysOperLog> list(SysOperLog operLog, PageQuery pageQuery) { | ||||||
|         return operLogService.selectPageOperLogList(operLog, pageQuery); |         return operLogService.selectPageOperLogList(operLog, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -46,9 +45,9 @@ public class SysOperlogController extends BaseController { | |||||||
|     @Log(title = "操作日志", businessType = BusinessType.EXPORT) |     @Log(title = "操作日志", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("monitor:operlog:export") |     @SaCheckPermission("monitor:operlog:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysOperLogBo operLog, HttpServletResponse response) { |     public void export(SysOperLog operLog, HttpServletResponse response) { | ||||||
|         List<SysOperLogVo> list = operLogService.selectOperLogList(operLog); |         List<SysOperLog> list = operLogService.selectOperLogList(operLog); | ||||||
|         ExcelUtil.exportExcel(list, "操作日志", SysOperLogVo.class, response); |         ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -1,27 +1,26 @@ | |||||||
| package org.dromara.system.controller.monitor; | package com.ruoyi.web.controller.monitor; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import cn.dev33.satoken.exception.NotLoginException; | import cn.dev33.satoken.exception.NotLoginException; | ||||||
| import cn.dev33.satoken.stp.StpUtil; | import cn.dev33.satoken.stp.StpUtil; | ||||||
| import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.dto.UserOnlineDTO; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.StreamUtils; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
|  | import com.ruoyi.system.domain.SysUserOnline; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.constant.CacheConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.core.domain.dto.UserOnlineDTO; |  | ||||||
| import org.dromara.common.core.utils.StreamUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.SysUserOnline; |  | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.stream.Collectors; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 在线用户监控 |  * 在线用户监控 | ||||||
| @@ -46,9 +45,9 @@ public class SysUserOnlineController extends BaseController { | |||||||
|         List<String> keys = StpUtil.searchTokenValue("", 0, -1, false); |         List<String> keys = StpUtil.searchTokenValue("", 0, -1, false); | ||||||
|         List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>(); |         List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>(); | ||||||
|         for (String key : keys) { |         for (String key : keys) { | ||||||
|             String token = StringUtils.substringAfterLast(key, ":"); |             String token = key.replace(CacheConstants.LOGIN_TOKEN_KEY, ""); | ||||||
|             // 如果已经过期则跳过 |             // 如果已经过期则跳过 | ||||||
|             if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) { |             if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < -1) { | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|             userOnlineDTOList.add(RedisUtils.getCacheObject(CacheConstants.ONLINE_TOKEN_KEY + token)); |             userOnlineDTOList.add(RedisUtils.getCacheObject(CacheConstants.ONLINE_TOKEN_KEY + token)); | ||||||
| @@ -88,43 +87,4 @@ public class SysUserOnlineController extends BaseController { | |||||||
|         } |         } | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 获取当前用户登录在线设备 |  | ||||||
|      */ |  | ||||||
|     @GetMapping() |  | ||||||
|     public TableDataInfo<SysUserOnline> getInfo() { |  | ||||||
|         // 获取指定账号 id 的 token 集合 |  | ||||||
|         List<String> tokenIds = StpUtil.getTokenValueListByLoginId(StpUtil.getLoginIdAsString()); |  | ||||||
|         List<UserOnlineDTO> userOnlineDTOList = tokenIds.stream() |  | ||||||
|             .filter(token -> StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) >= -1) |  | ||||||
|             .map(token -> (UserOnlineDTO) RedisUtils.getCacheObject(CacheConstants.ONLINE_TOKEN_KEY + token)) |  | ||||||
|             .collect(Collectors.toList()); |  | ||||||
|         //复制和处理 SysUserOnline 对象列表 |  | ||||||
|         Collections.reverse(userOnlineDTOList); |  | ||||||
|         userOnlineDTOList.removeAll(Collections.singleton(null)); |  | ||||||
|         List<SysUserOnline> userOnlineList = BeanUtil.copyToList(userOnlineDTOList, SysUserOnline.class); |  | ||||||
|         return TableDataInfo.build(userOnlineList); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 强退当前在线设备 |  | ||||||
|      * |  | ||||||
|      * @param tokenId token值 |  | ||||||
|      */ |  | ||||||
|     @Log(title = "在线设备", businessType = BusinessType.FORCE) |  | ||||||
|     @PostMapping("/{tokenId}") |  | ||||||
|     public R<Void> remove(@PathVariable("tokenId") String tokenId) { |  | ||||||
|         try { |  | ||||||
|             // 获取指定账号 id 的 token 集合 |  | ||||||
|             List<String> keys = StpUtil.getTokenValueListByLoginId(StpUtil.getLoginIdAsString()); |  | ||||||
|             keys.stream() |  | ||||||
|                 .filter(key -> key.equals(tokenId)) |  | ||||||
|                 .findFirst() |  | ||||||
|                 .ifPresent(key -> StpUtil.kickoutByTokenValue(tokenId)); |  | ||||||
|         } catch (NotLoginException ignored) { |  | ||||||
|         } |  | ||||||
|         return R.ok(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @@ -1,21 +1,21 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import org.dromara.common.core.domain.R; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.system.domain.bo.SysConfigBo; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import org.dromara.system.domain.vo.SysConfigVo; | import com.ruoyi.system.domain.SysConfig; | ||||||
| import org.dromara.system.service.ISysConfigService; | import com.ruoyi.system.service.ISysConfigService; | ||||||
| import jakarta.servlet.http.HttpServletResponse; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @@ -36,7 +36,7 @@ public class SysConfigController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:config:list") |     @SaCheckPermission("system:config:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysConfigVo> list(SysConfigBo config, PageQuery pageQuery) { |     public TableDataInfo<SysConfig> list(SysConfig config, PageQuery pageQuery) { | ||||||
|         return configService.selectPageConfigList(config, pageQuery); |         return configService.selectPageConfigList(config, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -46,9 +46,9 @@ public class SysConfigController extends BaseController { | |||||||
|     @Log(title = "参数管理", businessType = BusinessType.EXPORT) |     @Log(title = "参数管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:config:export") |     @SaCheckPermission("system:config:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysConfigBo config, HttpServletResponse response) { |     public void export(SysConfig config, HttpServletResponse response) { | ||||||
|         List<SysConfigVo> list = configService.selectConfigList(config); |         List<SysConfig> list = configService.selectConfigList(config); | ||||||
|         ExcelUtil.exportExcel(list, "参数数据", SysConfigVo.class, response); |         ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -58,7 +58,7 @@ public class SysConfigController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:config:query") |     @SaCheckPermission("system:config:query") | ||||||
|     @GetMapping(value = "/{configId}") |     @GetMapping(value = "/{configId}") | ||||||
|     public R<SysConfigVo> getInfo(@PathVariable Long configId) { |     public R<SysConfig> getInfo(@PathVariable Long configId) { | ||||||
|         return R.ok(configService.selectConfigById(configId)); |         return R.ok(configService.selectConfigById(configId)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -68,8 +68,8 @@ public class SysConfigController extends BaseController { | |||||||
|      * @param configKey 参数Key |      * @param configKey 参数Key | ||||||
|      */ |      */ | ||||||
|     @GetMapping(value = "/configKey/{configKey}") |     @GetMapping(value = "/configKey/{configKey}") | ||||||
|     public R<String> getConfigKey(@PathVariable String configKey) { |     public R<Void> getConfigKey(@PathVariable String configKey) { | ||||||
|         return R.ok("操作成功", configService.selectConfigByKey(configKey)); |         return R.ok(configService.selectConfigByKey(configKey)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -78,8 +78,8 @@ public class SysConfigController extends BaseController { | |||||||
|     @SaCheckPermission("system:config:add") |     @SaCheckPermission("system:config:add") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.INSERT) |     @Log(title = "参数管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysConfigBo config) { |     public R<Void> add(@Validated @RequestBody SysConfig config) { | ||||||
|         if (!configService.checkConfigKeyUnique(config)) { |         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { | ||||||
|             return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |             return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); | ||||||
|         } |         } | ||||||
|         configService.insertConfig(config); |         configService.insertConfig(config); | ||||||
| @@ -92,8 +92,8 @@ public class SysConfigController extends BaseController { | |||||||
|     @SaCheckPermission("system:config:edit") |     @SaCheckPermission("system:config:edit") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.UPDATE) |     @Log(title = "参数管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysConfigBo config) { |     public R<Void> edit(@Validated @RequestBody SysConfig config) { | ||||||
|         if (!configService.checkConfigKeyUnique(config)) { |         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { | ||||||
|             return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |             return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); | ||||||
|         } |         } | ||||||
|         configService.updateConfig(config); |         configService.updateConfig(config); | ||||||
| @@ -106,7 +106,7 @@ public class SysConfigController extends BaseController { | |||||||
|     @SaCheckPermission("system:config:edit") |     @SaCheckPermission("system:config:edit") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.UPDATE) |     @Log(title = "参数管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/updateByKey") |     @PutMapping("/updateByKey") | ||||||
|     public R<Void> updateByKey(@RequestBody SysConfigBo config) { |     public R<Void> updateByKey(@RequestBody SysConfig config) { | ||||||
|         configService.updateConfig(config); |         configService.updateConfig(config); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| @@ -1,18 +1,16 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import cn.hutool.core.convert.Convert; | import cn.hutool.core.util.ArrayUtil; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysDept; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.system.service.ISysDeptService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.constant.UserConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.bo.SysDeptBo; |  | ||||||
| import org.dromara.system.domain.vo.SysDeptVo; |  | ||||||
| import org.dromara.system.service.ISysDeptService; |  | ||||||
| import org.dromara.system.service.ISysPostService; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| @@ -30,15 +28,14 @@ import java.util.List; | |||||||
| public class SysDeptController extends BaseController { | public class SysDeptController extends BaseController { | ||||||
| 
 | 
 | ||||||
|     private final ISysDeptService deptService; |     private final ISysDeptService deptService; | ||||||
|     private final ISysPostService postService; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 获取部门列表 |      * 获取部门列表 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dept:list") |     @SaCheckPermission("system:dept:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public R<List<SysDeptVo>> list(SysDeptBo dept) { |     public R<List<SysDept>> list(SysDept dept) { | ||||||
|         List<SysDeptVo> depts = deptService.selectDeptList(dept); |         List<SysDept> depts = deptService.selectDeptList(dept); | ||||||
|         return R.ok(depts); |         return R.ok(depts); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -49,10 +46,10 @@ public class SysDeptController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dept:list") |     @SaCheckPermission("system:dept:list") | ||||||
|     @GetMapping("/list/exclude/{deptId}") |     @GetMapping("/list/exclude/{deptId}") | ||||||
|     public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { |     public R<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { | ||||||
|         List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo()); |         List<SysDept> depts = deptService.selectDeptList(new SysDept()); | ||||||
|         depts.removeIf(d -> d.getDeptId().equals(deptId) |         depts.removeIf(d -> d.getDeptId().equals(deptId) | ||||||
|             || StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId))); |             || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); | ||||||
|         return R.ok(depts); |         return R.ok(depts); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -63,7 +60,7 @@ public class SysDeptController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dept:query") |     @SaCheckPermission("system:dept:query") | ||||||
|     @GetMapping(value = "/{deptId}") |     @GetMapping(value = "/{deptId}") | ||||||
|     public R<SysDeptVo> getInfo(@PathVariable Long deptId) { |     public R<SysDept> getInfo(@PathVariable Long deptId) { | ||||||
|         deptService.checkDeptDataScope(deptId); |         deptService.checkDeptDataScope(deptId); | ||||||
|         return R.ok(deptService.selectDeptById(deptId)); |         return R.ok(deptService.selectDeptById(deptId)); | ||||||
|     } |     } | ||||||
| @@ -74,8 +71,8 @@ public class SysDeptController extends BaseController { | |||||||
|     @SaCheckPermission("system:dept:add") |     @SaCheckPermission("system:dept:add") | ||||||
|     @Log(title = "部门管理", businessType = BusinessType.INSERT) |     @Log(title = "部门管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysDeptBo dept) { |     public R<Void> add(@Validated @RequestBody SysDept dept) { | ||||||
|         if (!deptService.checkDeptNameUnique(dept)) { |         if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { | ||||||
|             return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |             return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(deptService.insertDept(dept)); |         return toAjax(deptService.insertDept(dept)); | ||||||
| @@ -87,19 +84,16 @@ public class SysDeptController extends BaseController { | |||||||
|     @SaCheckPermission("system:dept:edit") |     @SaCheckPermission("system:dept:edit") | ||||||
|     @Log(title = "部门管理", businessType = BusinessType.UPDATE) |     @Log(title = "部门管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysDeptBo dept) { |     public R<Void> edit(@Validated @RequestBody SysDept dept) { | ||||||
|         Long deptId = dept.getDeptId(); |         Long deptId = dept.getDeptId(); | ||||||
|         deptService.checkDeptDataScope(deptId); |         deptService.checkDeptDataScope(deptId); | ||||||
|         if (!deptService.checkDeptNameUnique(dept)) { |         if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { | ||||||
|             return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |             return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); | ||||||
|         } else if (dept.getParentId().equals(deptId)) { |         } else if (dept.getParentId().equals(deptId)) { | ||||||
|             return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |             return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); | ||||||
|         } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) { |         } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) | ||||||
|             if (deptService.selectNormalChildrenDeptById(deptId) > 0) { |             && deptService.selectNormalChildrenDeptById(deptId) > 0) { | ||||||
|                 return R.fail("该部门包含未停用的子部门!"); |             return R.fail("该部门包含未停用的子部门!"); | ||||||
|             } else if (deptService.checkDeptExistUser(deptId)) { |  | ||||||
|                 return R.fail("该部门下存在已分配用户,不能禁用!"); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|         return toAjax(deptService.updateDept(dept)); |         return toAjax(deptService.updateDept(dept)); | ||||||
|     } |     } | ||||||
| @@ -119,22 +113,7 @@ public class SysDeptController extends BaseController { | |||||||
|         if (deptService.checkDeptExistUser(deptId)) { |         if (deptService.checkDeptExistUser(deptId)) { | ||||||
|             return R.warn("部门存在用户,不允许删除"); |             return R.warn("部门存在用户,不允许删除"); | ||||||
|         } |         } | ||||||
|         if (postService.countPostByDeptId(deptId) > 0) { |  | ||||||
|             return R.warn("部门存在岗位,不允许删除"); |  | ||||||
|         } |  | ||||||
|         deptService.checkDeptDataScope(deptId); |         deptService.checkDeptDataScope(deptId); | ||||||
|         return toAjax(deptService.deleteDeptById(deptId)); |         return toAjax(deptService.deleteDeptById(deptId)); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 获取部门选择框列表 |  | ||||||
|      * |  | ||||||
|      * @param deptIds 部门ID串 |  | ||||||
|      */ |  | ||||||
|     @SaCheckPermission("system:dept:query") |  | ||||||
|     @GetMapping("/optionselect") |  | ||||||
|     public R<List<SysDeptVo>> optionselect(@RequestParam(required = false) Long[] deptIds) { |  | ||||||
|         return R.ok(deptService.selectDeptByIds(deptIds == null ? null : List.of(deptIds))); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @@ -1,23 +1,22 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.core.domain.entity.SysDictData; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.system.domain.bo.SysDictDataBo; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import org.dromara.system.domain.vo.SysDictDataVo; | import com.ruoyi.system.service.ISysDictDataService; | ||||||
| import org.dromara.system.service.ISysDictDataService; | import com.ruoyi.system.service.ISysDictTypeService; | ||||||
| import org.dromara.system.service.ISysDictTypeService; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @@ -40,7 +39,7 @@ public class SysDictDataController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dict:list") |     @SaCheckPermission("system:dict:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysDictDataVo> list(SysDictDataBo dictData, PageQuery pageQuery) { |     public TableDataInfo<SysDictData> list(SysDictData dictData, PageQuery pageQuery) { | ||||||
|         return dictDataService.selectPageDictDataList(dictData, pageQuery); |         return dictDataService.selectPageDictDataList(dictData, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -50,9 +49,9 @@ public class SysDictDataController extends BaseController { | |||||||
|     @Log(title = "字典数据", businessType = BusinessType.EXPORT) |     @Log(title = "字典数据", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:dict:export") |     @SaCheckPermission("system:dict:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysDictDataBo dictData, HttpServletResponse response) { |     public void export(SysDictData dictData, HttpServletResponse response) { | ||||||
|         List<SysDictDataVo> list = dictDataService.selectDictDataList(dictData); |         List<SysDictData> list = dictDataService.selectDictDataList(dictData); | ||||||
|         ExcelUtil.exportExcel(list, "字典数据", SysDictDataVo.class, response); |         ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -62,7 +61,7 @@ public class SysDictDataController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dict:query") |     @SaCheckPermission("system:dict:query") | ||||||
|     @GetMapping(value = "/{dictCode}") |     @GetMapping(value = "/{dictCode}") | ||||||
|     public R<SysDictDataVo> getInfo(@PathVariable Long dictCode) { |     public R<SysDictData> getInfo(@PathVariable Long dictCode) { | ||||||
|         return R.ok(dictDataService.selectDictDataById(dictCode)); |         return R.ok(dictDataService.selectDictDataById(dictCode)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -72,8 +71,8 @@ public class SysDictDataController extends BaseController { | |||||||
|      * @param dictType 字典类型 |      * @param dictType 字典类型 | ||||||
|      */ |      */ | ||||||
|     @GetMapping(value = "/type/{dictType}") |     @GetMapping(value = "/type/{dictType}") | ||||||
|     public R<List<SysDictDataVo>> dictType(@PathVariable String dictType) { |     public R<List<SysDictData>> dictType(@PathVariable String dictType) { | ||||||
|         List<SysDictDataVo> data = dictTypeService.selectDictDataByType(dictType); |         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); | ||||||
|         if (ObjectUtil.isNull(data)) { |         if (ObjectUtil.isNull(data)) { | ||||||
|             data = new ArrayList<>(); |             data = new ArrayList<>(); | ||||||
|         } |         } | ||||||
| @@ -86,10 +85,7 @@ public class SysDictDataController extends BaseController { | |||||||
|     @SaCheckPermission("system:dict:add") |     @SaCheckPermission("system:dict:add") | ||||||
|     @Log(title = "字典数据", businessType = BusinessType.INSERT) |     @Log(title = "字典数据", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysDictDataBo dict) { |     public R<Void> add(@Validated @RequestBody SysDictData dict) { | ||||||
|         if (!dictDataService.checkDictDataUnique(dict)) { |  | ||||||
|             return R.fail("新增字典数据'" + dict.getDictValue() + "'失败,字典键值已存在"); |  | ||||||
|         } |  | ||||||
|         dictDataService.insertDictData(dict); |         dictDataService.insertDictData(dict); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| @@ -100,10 +96,7 @@ public class SysDictDataController extends BaseController { | |||||||
|     @SaCheckPermission("system:dict:edit") |     @SaCheckPermission("system:dict:edit") | ||||||
|     @Log(title = "字典数据", businessType = BusinessType.UPDATE) |     @Log(title = "字典数据", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysDictDataBo dict) { |     public R<Void> edit(@Validated @RequestBody SysDictData dict) { | ||||||
|         if (!dictDataService.checkDictDataUnique(dict)) { |  | ||||||
|             return R.fail("修改字典数据'" + dict.getDictValue() + "'失败,字典键值已存在"); |  | ||||||
|         } |  | ||||||
|         dictDataService.updateDictData(dict); |         dictDataService.updateDictData(dict); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| @@ -1,21 +1,21 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import org.dromara.common.core.domain.R; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.core.domain.entity.SysDictType; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.system.domain.bo.SysDictTypeBo; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.system.domain.vo.SysDictTypeVo; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import org.dromara.system.service.ISysDictTypeService; | import com.ruoyi.system.service.ISysDictTypeService; | ||||||
| import jakarta.servlet.http.HttpServletResponse; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @@ -36,7 +36,7 @@ public class SysDictTypeController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dict:list") |     @SaCheckPermission("system:dict:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysDictTypeVo> list(SysDictTypeBo dictType, PageQuery pageQuery) { |     public TableDataInfo<SysDictType> list(SysDictType dictType, PageQuery pageQuery) { | ||||||
|         return dictTypeService.selectPageDictTypeList(dictType, pageQuery); |         return dictTypeService.selectPageDictTypeList(dictType, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -46,9 +46,9 @@ public class SysDictTypeController extends BaseController { | |||||||
|     @Log(title = "字典类型", businessType = BusinessType.EXPORT) |     @Log(title = "字典类型", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:dict:export") |     @SaCheckPermission("system:dict:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysDictTypeBo dictType, HttpServletResponse response) { |     public void export(SysDictType dictType, HttpServletResponse response) { | ||||||
|         List<SysDictTypeVo> list = dictTypeService.selectDictTypeList(dictType); |         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); | ||||||
|         ExcelUtil.exportExcel(list, "字典类型", SysDictTypeVo.class, response); |         ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -58,7 +58,7 @@ public class SysDictTypeController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:dict:query") |     @SaCheckPermission("system:dict:query") | ||||||
|     @GetMapping(value = "/{dictId}") |     @GetMapping(value = "/{dictId}") | ||||||
|     public R<SysDictTypeVo> getInfo(@PathVariable Long dictId) { |     public R<SysDictType> getInfo(@PathVariable Long dictId) { | ||||||
|         return R.ok(dictTypeService.selectDictTypeById(dictId)); |         return R.ok(dictTypeService.selectDictTypeById(dictId)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -68,8 +68,8 @@ public class SysDictTypeController extends BaseController { | |||||||
|     @SaCheckPermission("system:dict:add") |     @SaCheckPermission("system:dict:add") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.INSERT) |     @Log(title = "字典类型", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysDictTypeBo dict) { |     public R<Void> add(@Validated @RequestBody SysDictType dict) { | ||||||
|         if (!dictTypeService.checkDictTypeUnique(dict)) { |         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { | ||||||
|             return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |             return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); | ||||||
|         } |         } | ||||||
|         dictTypeService.insertDictType(dict); |         dictTypeService.insertDictType(dict); | ||||||
| @@ -82,8 +82,8 @@ public class SysDictTypeController extends BaseController { | |||||||
|     @SaCheckPermission("system:dict:edit") |     @SaCheckPermission("system:dict:edit") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.UPDATE) |     @Log(title = "字典类型", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysDictTypeBo dict) { |     public R<Void> edit(@Validated @RequestBody SysDictType dict) { | ||||||
|         if (!dictTypeService.checkDictTypeUnique(dict)) { |         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { | ||||||
|             return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |             return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); | ||||||
|         } |         } | ||||||
|         dictTypeService.updateDictType(dict); |         dictTypeService.updateDictType(dict); | ||||||
| @@ -118,8 +118,8 @@ public class SysDictTypeController extends BaseController { | |||||||
|      * 获取字典选择框列表 |      * 获取字典选择框列表 | ||||||
|      */ |      */ | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysDictTypeVo>> optionselect() { |     public R<List<SysDictType>> optionselect() { | ||||||
|         List<SysDictTypeVo> dictTypes = dictTypeService.selectDictTypeAll(); |         List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); | ||||||
|         return R.ok(dictTypes); |         return R.ok(dictTypes); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| package org.dromara.web.controller; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaIgnore; | import cn.dev33.satoken.annotation.SaIgnore; | ||||||
| import org.dromara.common.core.config.RuoYiConfig; | import com.ruoyi.common.config.RuoYiConfig; | ||||||
| import org.dromara.common.core.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||||
| @@ -12,10 +12,9 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @SaIgnore |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| public class IndexController { | public class SysIndexController { | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 系统基础配置 |      * 系统基础配置 | ||||||
| @@ -25,6 +24,7 @@ public class IndexController { | |||||||
|     /** |     /** | ||||||
|      * 访问首页,提示语 |      * 访问首页,提示语 | ||||||
|      */ |      */ | ||||||
|  |     @SaIgnore | ||||||
|     @GetMapping("/") |     @GetMapping("/") | ||||||
|     public String index() { |     public String index() { | ||||||
|         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); | ||||||
| @@ -0,0 +1,130 @@ | |||||||
|  | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaIgnore; | ||||||
|  | import com.ruoyi.common.constant.Constants; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysMenu; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysUser; | ||||||
|  | import com.ruoyi.common.core.domain.model.LoginBody; | ||||||
|  | import com.ruoyi.common.core.domain.model.LoginUser; | ||||||
|  | import com.ruoyi.common.core.domain.model.SmsLoginBody; | ||||||
|  | import com.ruoyi.common.helper.LoginHelper; | ||||||
|  | import com.ruoyi.system.domain.vo.RouterVo; | ||||||
|  | import com.ruoyi.system.service.ISysMenuService; | ||||||
|  | import com.ruoyi.system.service.ISysUserService; | ||||||
|  | import com.ruoyi.system.service.SysLoginService; | ||||||
|  | import com.ruoyi.system.service.SysPermissionService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PostMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RequestBody; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  |  | ||||||
|  | import javax.validation.constraints.NotBlank; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 登录验证 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | public class SysLoginController { | ||||||
|  |  | ||||||
|  |     private final SysLoginService loginService; | ||||||
|  |     private final ISysMenuService menuService; | ||||||
|  |     private final ISysUserService userService; | ||||||
|  |     private final SysPermissionService permissionService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 登录方法 | ||||||
|  |      * | ||||||
|  |      * @param loginBody 登录信息 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @SaIgnore | ||||||
|  |     @PostMapping("/login") | ||||||
|  |     public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) { | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         // 生成令牌 | ||||||
|  |         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), | ||||||
|  |             loginBody.getUuid()); | ||||||
|  |         ajax.put(Constants.TOKEN, token); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 短信登录(示例) | ||||||
|  |      * | ||||||
|  |      * @param smsLoginBody 登录信息 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @SaIgnore | ||||||
|  |     @PostMapping("/smsLogin") | ||||||
|  |     public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) { | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         // 生成令牌 | ||||||
|  |         String token = loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode()); | ||||||
|  |         ajax.put(Constants.TOKEN, token); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 小程序登录(示例) | ||||||
|  |      * | ||||||
|  |      * @param xcxCode 小程序code | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @SaIgnore | ||||||
|  |     @PostMapping("/xcxLogin") | ||||||
|  |     public R<Map<String, Object>> xcxLogin(@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) { | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         // 生成令牌 | ||||||
|  |         String token = loginService.xcxLogin(xcxCode); | ||||||
|  |         ajax.put(Constants.TOKEN, token); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 退出登录 | ||||||
|  |      */ | ||||||
|  |     @SaIgnore | ||||||
|  |     @PostMapping("/logout") | ||||||
|  |     public R<Void> logout() { | ||||||
|  |         loginService.logout(); | ||||||
|  |         return R.ok("退出成功"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取用户信息 | ||||||
|  |      * | ||||||
|  |      * @return 用户信息 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("getInfo") | ||||||
|  |     public R<Map<String, Object>> getInfo() { | ||||||
|  |         LoginUser loginUser = LoginHelper.getLoginUser(); | ||||||
|  |         SysUser user = userService.selectUserById(loginUser.getUserId()); | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         ajax.put("user", user); | ||||||
|  |         ajax.put("roles", loginUser.getRolePermission()); | ||||||
|  |         ajax.put("permissions", loginUser.getMenuPermission()); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取路由信息 | ||||||
|  |      * | ||||||
|  |      * @return 路由信息 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("getRouters") | ||||||
|  |     public R<List<RouterVo>> getRouters() { | ||||||
|  |         Long userId = LoginHelper.getUserId(); | ||||||
|  |         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); | ||||||
|  |         return R.ok(menuService.buildMenus(menus)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,127 @@ | |||||||
|  | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import cn.hutool.core.lang.tree.Tree; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysMenu; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.system.service.ISysMenuService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 菜单信息 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/system/menu") | ||||||
|  | public class SysMenuController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final ISysMenuService menuService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取菜单列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:menu:list") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public R<List<SysMenu>> list(SysMenu menu) { | ||||||
|  |         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); | ||||||
|  |         return R.ok(menus); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 根据菜单编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param menuId 菜单ID | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:menu:query") | ||||||
|  |     @GetMapping(value = "/{menuId}") | ||||||
|  |     public R<SysMenu> getInfo(@PathVariable Long menuId) { | ||||||
|  |         return R.ok(menuService.selectMenuById(menuId)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取菜单下拉树列表 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/treeselect") | ||||||
|  |     public R<List<Tree<Long>>> treeselect(SysMenu menu) { | ||||||
|  |         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); | ||||||
|  |         return R.ok(menuService.buildMenuTreeSelect(menus)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 加载对应角色菜单列表树 | ||||||
|  |      * | ||||||
|  |      * @param roleId 角色ID | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/roleMenuTreeselect/{roleId}") | ||||||
|  |     public R<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { | ||||||
|  |         List<SysMenu> menus = menuService.selectMenuList(getUserId()); | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); | ||||||
|  |         ajax.put("menus", menuService.buildMenuTreeSelect(menus)); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增菜单 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:menu:add") | ||||||
|  |     @Log(title = "菜单管理", businessType = BusinessType.INSERT) | ||||||
|  |     @PostMapping | ||||||
|  |     public R<Void> add(@Validated @RequestBody SysMenu menu) { | ||||||
|  |         if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { | ||||||
|  |             return R.fail("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); | ||||||
|  |         } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { | ||||||
|  |             return R.fail("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); | ||||||
|  |         } | ||||||
|  |         return toAjax(menuService.insertMenu(menu)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改菜单 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:menu:edit") | ||||||
|  |     @Log(title = "菜单管理", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping | ||||||
|  |     public R<Void> edit(@Validated @RequestBody SysMenu menu) { | ||||||
|  |         if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { | ||||||
|  |             return R.fail("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); | ||||||
|  |         } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { | ||||||
|  |             return R.fail("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); | ||||||
|  |         } else if (menu.getMenuId().equals(menu.getParentId())) { | ||||||
|  |             return R.fail("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); | ||||||
|  |         } | ||||||
|  |         return toAjax(menuService.updateMenu(menu)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除菜单 | ||||||
|  |      * | ||||||
|  |      * @param menuId 菜单ID | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:menu:remove") | ||||||
|  |     @Log(title = "菜单管理", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{menuId}") | ||||||
|  |     public R<Void> remove(@PathVariable("menuId") Long menuId) { | ||||||
|  |         if (menuService.hasChildByMenuId(menuId)) { | ||||||
|  |             return R.warn("存在子菜单,不允许删除"); | ||||||
|  |         } | ||||||
|  |         if (menuService.checkMenuExistRole(menuId)) { | ||||||
|  |             return R.warn("菜单已分配,不允许删除"); | ||||||
|  |         } | ||||||
|  |         return toAjax(menuService.deleteMenuById(menuId)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,18 +1,15 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.system.domain.SysNotice; | ||||||
|  | import com.ruoyi.system.service.ISysNoticeService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.core.service.DictService; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; |  | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; |  | ||||||
| import org.dromara.common.sse.utils.SseMessageUtils; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.bo.SysNoticeBo; |  | ||||||
| import org.dromara.system.domain.vo.SysNoticeVo; |  | ||||||
| import org.dromara.system.service.ISysNoticeService; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| @@ -28,14 +25,13 @@ import org.springframework.web.bind.annotation.*; | |||||||
| public class SysNoticeController extends BaseController { | public class SysNoticeController extends BaseController { | ||||||
| 
 | 
 | ||||||
|     private final ISysNoticeService noticeService; |     private final ISysNoticeService noticeService; | ||||||
|     private final DictService dictService; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 获取通知公告列表 |      * 获取通知公告列表 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:notice:list") |     @SaCheckPermission("system:notice:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysNoticeVo> list(SysNoticeBo notice, PageQuery pageQuery) { |     public TableDataInfo<SysNotice> list(SysNotice notice, PageQuery pageQuery) { | ||||||
|         return noticeService.selectPageNoticeList(notice, pageQuery); |         return noticeService.selectPageNoticeList(notice, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -46,7 +42,7 @@ public class SysNoticeController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:notice:query") |     @SaCheckPermission("system:notice:query") | ||||||
|     @GetMapping(value = "/{noticeId}") |     @GetMapping(value = "/{noticeId}") | ||||||
|     public R<SysNoticeVo> getInfo(@PathVariable Long noticeId) { |     public R<SysNotice> getInfo(@PathVariable Long noticeId) { | ||||||
|         return R.ok(noticeService.selectNoticeById(noticeId)); |         return R.ok(noticeService.selectNoticeById(noticeId)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -56,14 +52,8 @@ public class SysNoticeController extends BaseController { | |||||||
|     @SaCheckPermission("system:notice:add") |     @SaCheckPermission("system:notice:add") | ||||||
|     @Log(title = "通知公告", businessType = BusinessType.INSERT) |     @Log(title = "通知公告", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysNoticeBo notice) { |     public R<Void> add(@Validated @RequestBody SysNotice notice) { | ||||||
|         int rows = noticeService.insertNotice(notice); |         return toAjax(noticeService.insertNotice(notice)); | ||||||
|         if (rows <= 0) { |  | ||||||
|             return R.fail(); |  | ||||||
|         } |  | ||||||
|         String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType()); |  | ||||||
|         SseMessageUtils.publishAll("[" + type + "] " + notice.getNoticeTitle()); |  | ||||||
|         return R.ok(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -72,7 +62,7 @@ public class SysNoticeController extends BaseController { | |||||||
|     @SaCheckPermission("system:notice:edit") |     @SaCheckPermission("system:notice:edit") | ||||||
|     @Log(title = "通知公告", businessType = BusinessType.UPDATE) |     @Log(title = "通知公告", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysNoticeBo notice) { |     public R<Void> edit(@Validated @RequestBody SysNotice notice) { | ||||||
|         return toAjax(noticeService.updateNotice(notice)); |         return toAjax(noticeService.updateNotice(notice)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -1,26 +1,26 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import org.dromara.common.core.domain.R; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.core.validate.AddGroup; | import com.ruoyi.common.annotation.RepeatSubmit; | ||||||
| import org.dromara.common.core.validate.EditGroup; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.core.validate.QueryGroup; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.idempotent.annotation.RepeatSubmit; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.core.validate.AddGroup; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.core.validate.EditGroup; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.validate.QueryGroup; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.system.domain.bo.SysOssConfigBo; | import com.ruoyi.system.domain.bo.SysOssConfigBo; | ||||||
| import org.dromara.system.domain.vo.SysOssConfigVo; | import com.ruoyi.system.domain.vo.SysOssConfigVo; | ||||||
| import org.dromara.system.service.ISysOssConfigService; | import com.ruoyi.system.service.ISysOssConfigService; | ||||||
| import jakarta.validation.constraints.NotEmpty; |  | ||||||
| import jakarta.validation.constraints.NotNull; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| import java.util.List; | import javax.validation.constraints.NotEmpty; | ||||||
|  | import javax.validation.constraints.NotNull; | ||||||
|  | import java.util.Arrays; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 对象存储配置 |  * 对象存储配置 | ||||||
| @@ -32,18 +32,18 @@ import java.util.List; | |||||||
| @Validated | @Validated | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/resource/oss/config") | @RequestMapping("/system/oss/config") | ||||||
| public class SysOssConfigController extends BaseController { | public class SysOssConfigController extends BaseController { | ||||||
| 
 | 
 | ||||||
|     private final ISysOssConfigService ossConfigService; |     private final ISysOssConfigService iSysOssConfigService; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 查询对象存储配置列表 |      * 查询对象存储配置列表 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:list") |     @SaCheckPermission("system:oss:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo, PageQuery pageQuery) { |     public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo, PageQuery pageQuery) { | ||||||
|         return ossConfigService.queryPageList(bo, pageQuery); |         return iSysOssConfigService.queryPageList(bo, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -51,33 +51,33 @@ public class SysOssConfigController extends BaseController { | |||||||
|      * |      * | ||||||
|      * @param ossConfigId OSS配置ID |      * @param ossConfigId OSS配置ID | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:list") |     @SaCheckPermission("system:oss:query") | ||||||
|     @GetMapping("/{ossConfigId}") |     @GetMapping("/{ossConfigId}") | ||||||
|     public R<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") |     public R<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|                                      @PathVariable Long ossConfigId) { |                                      @PathVariable Long ossConfigId) { | ||||||
|         return R.ok(ossConfigService.queryById(ossConfigId)); |         return R.ok(iSysOssConfigService.queryById(ossConfigId)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 新增对象存储配置 |      * 新增对象存储配置 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:add") |     @SaCheckPermission("system:oss:add") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.INSERT) |     @Log(title = "对象存储配置", businessType = BusinessType.INSERT) | ||||||
|     @RepeatSubmit() |     @RepeatSubmit() | ||||||
|     @PostMapping() |     @PostMapping() | ||||||
|     public R<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { |     public R<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { | ||||||
|         return toAjax(ossConfigService.insertByBo(bo)); |         return toAjax(iSysOssConfigService.insertByBo(bo)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 修改对象存储配置 |      * 修改对象存储配置 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:edit") |     @SaCheckPermission("system:oss:edit") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) |     @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) | ||||||
|     @RepeatSubmit() |     @RepeatSubmit() | ||||||
|     @PutMapping() |     @PutMapping() | ||||||
|     public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { |     public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { | ||||||
|         return toAjax(ossConfigService.updateByBo(bo)); |         return toAjax(iSysOssConfigService.updateByBo(bo)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -85,21 +85,21 @@ public class SysOssConfigController extends BaseController { | |||||||
|      * |      * | ||||||
|      * @param ossConfigIds OSS配置ID串 |      * @param ossConfigIds OSS配置ID串 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:remove") |     @SaCheckPermission("system:oss:remove") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.DELETE) |     @Log(title = "对象存储配置", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{ossConfigIds}") |     @DeleteMapping("/{ossConfigIds}") | ||||||
|     public R<Void> remove(@NotEmpty(message = "主键不能为空") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                           @PathVariable Long[] ossConfigIds) { |                           @PathVariable Long[] ossConfigIds) { | ||||||
|         return toAjax(ossConfigService.deleteWithValidByIds(List.of(ossConfigIds), true)); |         return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 状态修改 |      * 状态修改 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:ossConfig:edit") |     @SaCheckPermission("system:oss:edit") | ||||||
|     @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) |     @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/changeStatus") |     @PutMapping("/changeStatus") | ||||||
|     public R<Void> changeStatus(@RequestBody SysOssConfigBo bo) { |     public R<Void> changeStatus(@RequestBody SysOssConfigBo bo) { | ||||||
|         return toAjax(ossConfigService.updateOssConfigStatus(bo)); |         return toAjax(iSysOssConfigService.updateOssConfigStatus(bo)); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,30 +1,39 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import cn.hutool.core.convert.Convert; | ||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import org.dromara.common.core.domain.R; | import cn.hutool.http.HttpException; | ||||||
| import org.dromara.common.core.validate.QueryGroup; | import cn.hutool.http.HttpUtil; | ||||||
| import org.dromara.common.web.core.BaseController; | import com.ruoyi.common.annotation.Log; | ||||||
| import org.dromara.common.log.annotation.Log; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import org.dromara.common.log.enums.BusinessType; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import com.ruoyi.common.core.domain.R; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import org.dromara.system.domain.bo.SysOssBo; | import com.ruoyi.common.core.validate.QueryGroup; | ||||||
| import org.dromara.system.domain.vo.SysOssUploadVo; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import org.dromara.system.domain.vo.SysOssVo; | import com.ruoyi.common.exception.ServiceException; | ||||||
| import org.dromara.system.service.ISysOssService; | import com.ruoyi.common.utils.file.FileUtils; | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import com.ruoyi.oss.core.OssClient; | ||||||
| import jakarta.validation.constraints.NotEmpty; | import com.ruoyi.oss.factory.OssFactory; | ||||||
|  | import com.ruoyi.system.domain.SysOss; | ||||||
|  | import com.ruoyi.system.domain.bo.SysOssBo; | ||||||
|  | import com.ruoyi.system.domain.vo.SysOssVo; | ||||||
|  | import com.ruoyi.system.service.ISysOssService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.http.MediaType; | import org.springframework.http.MediaType; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
| 
 | 
 | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
|  | import javax.validation.constraints.NotEmpty; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
|  | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 文件上传 控制层 |  * 文件上传 控制层 | ||||||
| @@ -34,10 +43,10 @@ import java.util.List; | |||||||
| @Validated | @Validated | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/resource/oss") | @RequestMapping("/system/oss") | ||||||
| public class SysOssController extends BaseController { | public class SysOssController extends BaseController { | ||||||
| 
 | 
 | ||||||
|     private final ISysOssService ossService; |     private final ISysOssService iSysOssService; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 查询OSS对象存储列表 |      * 查询OSS对象存储列表 | ||||||
| @@ -45,7 +54,7 @@ public class SysOssController extends BaseController { | |||||||
|     @SaCheckPermission("system:oss:list") |     @SaCheckPermission("system:oss:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) { |     public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) { | ||||||
|         return ossService.queryPageList(bo, pageQuery); |         return iSysOssService.queryPageList(bo, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -57,7 +66,7 @@ public class SysOssController extends BaseController { | |||||||
|     @GetMapping("/listByIds/{ossIds}") |     @GetMapping("/listByIds/{ossIds}") | ||||||
|     public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空") |     public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空") | ||||||
|                                        @PathVariable Long[] ossIds) { |                                        @PathVariable Long[] ossIds) { | ||||||
|         List<SysOssVo> list = ossService.listByIds(Arrays.asList(ossIds)); |         List<SysOssVo> list = iSysOssService.listByIds(Arrays.asList(ossIds)); | ||||||
|         return R.ok(list); |         return R.ok(list); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -69,16 +78,16 @@ public class SysOssController extends BaseController { | |||||||
|     @SaCheckPermission("system:oss:upload") |     @SaCheckPermission("system:oss:upload") | ||||||
|     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) |     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) { |     public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { | ||||||
|         if (ObjectUtil.isNull(file)) { |         if (ObjectUtil.isNull(file)) { | ||||||
|             return R.fail("上传文件不能为空"); |             throw new ServiceException("上传文件不能为空"); | ||||||
|         } |         } | ||||||
|         SysOssVo oss = ossService.upload(file); |         SysOssVo oss = iSysOssService.upload(file); | ||||||
|         SysOssUploadVo uploadVo = new SysOssUploadVo(); |         Map<String, String> map = new HashMap<>(2); | ||||||
|         uploadVo.setUrl(oss.getUrl()); |         map.put("url", oss.getUrl()); | ||||||
|         uploadVo.setFileName(oss.getOriginalName()); |         map.put("fileName", oss.getOriginalName()); | ||||||
|         uploadVo.setOssId(oss.getOssId().toString()); |         map.put("ossId", oss.getOssId().toString()); | ||||||
|         return R.ok(uploadVo); |         return R.ok(map); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -89,7 +98,7 @@ public class SysOssController extends BaseController { | |||||||
|     @SaCheckPermission("system:oss:download") |     @SaCheckPermission("system:oss:download") | ||||||
|     @GetMapping("/download/{ossId}") |     @GetMapping("/download/{ossId}") | ||||||
|     public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |     public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { | ||||||
|         ossService.download(ossId, response); |         iSysOssService.download(ossId,response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -102,7 +111,7 @@ public class SysOssController extends BaseController { | |||||||
|     @DeleteMapping("/{ossIds}") |     @DeleteMapping("/{ossIds}") | ||||||
|     public R<Void> remove(@NotEmpty(message = "主键不能为空") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                           @PathVariable Long[] ossIds) { |                           @PathVariable Long[] ossIds) { | ||||||
|         return toAjax(ossService.deleteWithValidByIds(List.of(ossIds), true)); |         return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @@ -1,24 +1,21 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import cn.hutool.core.util.ObjectUtil; | import com.ruoyi.common.annotation.Log; | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | import com.ruoyi.system.domain.SysPost; | ||||||
|  | import com.ruoyi.system.service.ISysPostService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.constant.UserConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; |  | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.bo.SysPostBo; |  | ||||||
| import org.dromara.system.domain.vo.SysPostVo; |  | ||||||
| import org.dromara.system.service.ISysPostService; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @@ -39,7 +36,7 @@ public class SysPostController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:post:list") |     @SaCheckPermission("system:post:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysPostVo> list(SysPostBo post, PageQuery pageQuery) { |     public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) { | ||||||
|         return postService.selectPagePostList(post, pageQuery); |         return postService.selectPagePostList(post, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -49,9 +46,9 @@ public class SysPostController extends BaseController { | |||||||
|     @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |     @Log(title = "岗位管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:post:export") |     @SaCheckPermission("system:post:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysPostBo post, HttpServletResponse response) { |     public void export(SysPost post, HttpServletResponse response) { | ||||||
|         List<SysPostVo> list = postService.selectPostList(post); |         List<SysPost> list = postService.selectPostList(post); | ||||||
|         ExcelUtil.exportExcel(list, "岗位数据", SysPostVo.class, response); |         ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -61,7 +58,7 @@ public class SysPostController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:post:query") |     @SaCheckPermission("system:post:query") | ||||||
|     @GetMapping(value = "/{postId}") |     @GetMapping(value = "/{postId}") | ||||||
|     public R<SysPostVo> getInfo(@PathVariable Long postId) { |     public R<SysPost> getInfo(@PathVariable Long postId) { | ||||||
|         return R.ok(postService.selectPostById(postId)); |         return R.ok(postService.selectPostById(postId)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -71,10 +68,10 @@ public class SysPostController extends BaseController { | |||||||
|     @SaCheckPermission("system:post:add") |     @SaCheckPermission("system:post:add") | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.INSERT) |     @Log(title = "岗位管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysPostBo post) { |     public R<Void> add(@Validated @RequestBody SysPost post) { | ||||||
|         if (!postService.checkPostNameUnique(post)) { |         if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { | ||||||
|             return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |             return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); | ||||||
|         } else if (!postService.checkPostCodeUnique(post)) { |         } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { | ||||||
|             return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |             return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(postService.insertPost(post)); |         return toAjax(postService.insertPost(post)); | ||||||
| @@ -86,14 +83,11 @@ public class SysPostController extends BaseController { | |||||||
|     @SaCheckPermission("system:post:edit") |     @SaCheckPermission("system:post:edit") | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |     @Log(title = "岗位管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysPostBo post) { |     public R<Void> edit(@Validated @RequestBody SysPost post) { | ||||||
|         if (!postService.checkPostNameUnique(post)) { |         if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { | ||||||
|             return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |             return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); | ||||||
|         } else if (!postService.checkPostCodeUnique(post)) { |         } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { | ||||||
|             return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |             return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); | ||||||
|         } else if (UserConstants.POST_DISABLE.equals(post.getStatus()) |  | ||||||
|             && postService.countUserPostById(post.getPostId()) > 0) { |  | ||||||
|             return R.fail("该岗位下存在已分配用户,不能禁用!"); |  | ||||||
|         } |         } | ||||||
|         return toAjax(postService.updatePost(post)); |         return toAjax(postService.updatePost(post)); | ||||||
|     } |     } | ||||||
| @@ -112,22 +106,10 @@ public class SysPostController extends BaseController { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 获取岗位选择框列表 |      * 获取岗位选择框列表 | ||||||
|      * |  | ||||||
|      * @param postIds 岗位ID串 |  | ||||||
|      * @param deptId  部门id |  | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:post:query") |  | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds, @RequestParam(required = false) Long deptId) { |     public R<List<SysPost>> optionselect() { | ||||||
|         List<SysPostVo> list = new ArrayList<>(); |         List<SysPost> posts = postService.selectPostAll(); | ||||||
|         if (ObjectUtil.isNotNull(deptId)) { |         return R.ok(posts); | ||||||
|             SysPostBo post = new SysPostBo(); |  | ||||||
|             post.setDeptId(deptId); |  | ||||||
|             list = postService.selectPostList(post); |  | ||||||
|         } else if (postIds != null) { |  | ||||||
|             list = postService.selectPostByIds(List.of(postIds)); |  | ||||||
|     } |     } | ||||||
|         return R.ok(list); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @@ -0,0 +1,128 @@ | |||||||
|  | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.secure.BCrypt; | ||||||
|  | import cn.hutool.core.io.FileUtil; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysUser; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.helper.LoginHelper; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.utils.file.MimeTypeUtils; | ||||||
|  | import com.ruoyi.system.domain.SysOss; | ||||||
|  | import com.ruoyi.system.domain.vo.SysOssVo; | ||||||
|  | import com.ruoyi.system.service.ISysOssService; | ||||||
|  | import com.ruoyi.system.service.ISysUserService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
|  | import java.util.Arrays; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 个人信息 业务处理 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/system/user/profile") | ||||||
|  | public class SysProfileController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final ISysUserService userService; | ||||||
|  |     private final ISysOssService iSysOssService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 个人信息 | ||||||
|  |      */ | ||||||
|  |     @GetMapping | ||||||
|  |     public R<Map<String, Object>> profile() { | ||||||
|  |         SysUser user = userService.selectUserById(getUserId()); | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         ajax.put("user", user); | ||||||
|  |         ajax.put("roleGroup", userService.selectUserRoleGroup(user.getUserName())); | ||||||
|  |         ajax.put("postGroup", userService.selectUserPostGroup(user.getUserName())); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改用户 | ||||||
|  |      */ | ||||||
|  |     @Log(title = "个人信息", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping | ||||||
|  |     public R<Void> updateProfile(@RequestBody SysUser user) { | ||||||
|  |         if (StringUtils.isNotEmpty(user.getPhonenumber()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { | ||||||
|  |             return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); | ||||||
|  |         } | ||||||
|  |         if (StringUtils.isNotEmpty(user.getEmail()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { | ||||||
|  |             return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); | ||||||
|  |         } | ||||||
|  |         user.setUserId(getUserId()); | ||||||
|  |         user.setUserName(null); | ||||||
|  |         user.setPassword(null); | ||||||
|  |         user.setAvatar(null); | ||||||
|  |         user.setDeptId(null); | ||||||
|  |         if (userService.updateUserProfile(user) > 0) { | ||||||
|  |             return R.ok(); | ||||||
|  |         } | ||||||
|  |         return R.fail("修改个人信息异常,请联系管理员"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 重置密码 | ||||||
|  |      * | ||||||
|  |      * @param newPassword 旧密码 | ||||||
|  |      * @param oldPassword 新密码 | ||||||
|  |      */ | ||||||
|  |     @Log(title = "个人信息", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping("/updatePwd") | ||||||
|  |     public R<Void> updatePwd(String oldPassword, String newPassword) { | ||||||
|  |         SysUser user = userService.selectUserById(LoginHelper.getUserId()); | ||||||
|  |         String userName = user.getUserName(); | ||||||
|  |         String password = user.getPassword(); | ||||||
|  |         if (!BCrypt.checkpw(oldPassword, password)) { | ||||||
|  |             return R.fail("修改密码失败,旧密码错误"); | ||||||
|  |         } | ||||||
|  |         if (BCrypt.checkpw(newPassword, password)) { | ||||||
|  |             return R.fail("新密码不能与旧密码相同"); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (userService.resetUserPwd(userName, BCrypt.hashpw(newPassword)) > 0) { | ||||||
|  |             return R.ok(); | ||||||
|  |         } | ||||||
|  |         return R.fail("修改密码异常,请联系管理员"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 头像上传 | ||||||
|  |      * | ||||||
|  |      * @param avatarfile 用户头像 | ||||||
|  |      */ | ||||||
|  |     @Log(title = "用户头像", businessType = BusinessType.UPDATE) | ||||||
|  |     @PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|  |     public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) { | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         if (!avatarfile.isEmpty()) { | ||||||
|  |             String extension = FileUtil.extName(avatarfile.getOriginalFilename()); | ||||||
|  |             if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { | ||||||
|  |                 return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); | ||||||
|  |             } | ||||||
|  |             SysOssVo oss = iSysOssService.upload(avatarfile); | ||||||
|  |             String avatar = oss.getUrl(); | ||||||
|  |             if (userService.updateUserAvatar(getUsername(), avatar)) { | ||||||
|  |                 ajax.put("imgUrl", avatar); | ||||||
|  |                 return R.ok(ajax); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return R.fail("上传图片异常,请联系管理员"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,40 @@ | |||||||
|  | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaIgnore; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.model.RegisterBody; | ||||||
|  | import com.ruoyi.system.service.ISysConfigService; | ||||||
|  | import com.ruoyi.system.service.SysRegisterService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.PostMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RequestBody; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 注册验证 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | public class SysRegisterController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final SysRegisterService registerService; | ||||||
|  |     private final ISysConfigService configService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户注册 | ||||||
|  |      */ | ||||||
|  |     @SaIgnore | ||||||
|  |     @PostMapping("/register") | ||||||
|  |     public R<Void> register(@Validated @RequestBody RegisterBody user) { | ||||||
|  |         if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { | ||||||
|  |             return R.fail("当前系统没有开启注册功能!"); | ||||||
|  |         } | ||||||
|  |         registerService.register(user); | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,29 +1,33 @@ | |||||||
| package org.dromara.system.controller.system; | package com.ruoyi.web.controller.system; | ||||||
| 
 | 
 | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import cn.hutool.core.util.ObjectUtil; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysDept; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysRole; | ||||||
|  | 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.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.helper.LoginHelper; | ||||||
|  | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | import com.ruoyi.system.domain.SysUserRole; | ||||||
|  | import com.ruoyi.system.service.ISysDeptService; | ||||||
|  | import com.ruoyi.system.service.ISysRoleService; | ||||||
|  | import com.ruoyi.system.service.ISysUserService; | ||||||
|  | import com.ruoyi.system.service.SysPermissionService; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.excel.utils.ExcelUtil; |  | ||||||
| import org.dromara.common.log.annotation.Log; |  | ||||||
| import org.dromara.common.log.enums.BusinessType; |  | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; |  | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; |  | ||||||
| import org.dromara.common.web.core.BaseController; |  | ||||||
| import org.dromara.system.domain.SysUserRole; |  | ||||||
| import org.dromara.system.domain.bo.SysDeptBo; |  | ||||||
| import org.dromara.system.domain.bo.SysRoleBo; |  | ||||||
| import org.dromara.system.domain.bo.SysUserBo; |  | ||||||
| import org.dromara.system.domain.vo.DeptTreeSelectVo; |  | ||||||
| import org.dromara.system.domain.vo.SysRoleVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.system.service.ISysDeptService; |  | ||||||
| import org.dromara.system.service.ISysRoleService; |  | ||||||
| import org.dromara.system.service.ISysUserService; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| 
 | 
 | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
|  | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 角色信息 |  * 角色信息 | ||||||
| @@ -39,13 +43,14 @@ public class SysRoleController extends BaseController { | |||||||
|     private final ISysRoleService roleService; |     private final ISysRoleService roleService; | ||||||
|     private final ISysUserService userService; |     private final ISysUserService userService; | ||||||
|     private final ISysDeptService deptService; |     private final ISysDeptService deptService; | ||||||
|  |     private final SysPermissionService permissionService; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 获取角色信息列表 |      * 获取角色信息列表 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysRoleVo> list(SysRoleBo role, PageQuery pageQuery) { |     public TableDataInfo<SysRole> list(SysRole role, PageQuery pageQuery) { | ||||||
|         return roleService.selectPageRoleList(role, pageQuery); |         return roleService.selectPageRoleList(role, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -55,9 +60,9 @@ public class SysRoleController extends BaseController { | |||||||
|     @Log(title = "角色管理", businessType = BusinessType.EXPORT) |     @Log(title = "角色管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:role:export") |     @SaCheckPermission("system:role:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
|     public void export(SysRoleBo role, HttpServletResponse response) { |     public void export(SysRole role, HttpServletResponse response) { | ||||||
|         List<SysRoleVo> list = roleService.selectRoleList(role); |         List<SysRole> list = roleService.selectRoleList(role); | ||||||
|         ExcelUtil.exportExcel(list, "角色数据", SysRoleVo.class, response); |         ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -67,7 +72,7 @@ public class SysRoleController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:query") |     @SaCheckPermission("system:role:query") | ||||||
|     @GetMapping(value = "/{roleId}") |     @GetMapping(value = "/{roleId}") | ||||||
|     public R<SysRoleVo> getInfo(@PathVariable Long roleId) { |     public R<SysRole> getInfo(@PathVariable Long roleId) { | ||||||
|         roleService.checkRoleDataScope(roleId); |         roleService.checkRoleDataScope(roleId); | ||||||
|         return R.ok(roleService.selectRoleById(roleId)); |         return R.ok(roleService.selectRoleById(roleId)); | ||||||
|     } |     } | ||||||
| @@ -78,11 +83,10 @@ public class SysRoleController extends BaseController { | |||||||
|     @SaCheckPermission("system:role:add") |     @SaCheckPermission("system:role:add") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.INSERT) |     @Log(title = "角色管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysRoleBo role) { |     public R<Void> add(@Validated @RequestBody SysRole role) { | ||||||
|         roleService.checkRoleAllowed(role); |         if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { | ||||||
|         if (!roleService.checkRoleNameUnique(role)) { |  | ||||||
|             return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |             return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); | ||||||
|         } else if (!roleService.checkRoleKeyUnique(role)) { |         } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { | ||||||
|             return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |             return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(roleService.insertRole(role)); |         return toAjax(roleService.insertRole(role)); | ||||||
| @@ -95,17 +99,23 @@ public class SysRoleController extends BaseController { | |||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysRoleBo role) { |     public R<Void> edit(@Validated @RequestBody SysRole role) { | ||||||
|         roleService.checkRoleAllowed(role); |         roleService.checkRoleAllowed(role); | ||||||
|         roleService.checkRoleDataScope(role.getRoleId()); |         roleService.checkRoleDataScope(role.getRoleId()); | ||||||
|         if (!roleService.checkRoleNameUnique(role)) { |         if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { | ||||||
|             return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |             return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); | ||||||
|         } else if (!roleService.checkRoleKeyUnique(role)) { |         } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { | ||||||
|             return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |             return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (roleService.updateRole(role) > 0) { |         if (roleService.updateRole(role) > 0) { | ||||||
|             roleService.cleanOnlineUserByRole(role.getRoleId()); |             // 更新缓存用户权限 | ||||||
|  |             LoginUser loginUser = getLoginUser(); | ||||||
|  |             SysUser sysUser = userService.selectUserById(loginUser.getUserId()); | ||||||
|  |             if (ObjectUtil.isNotNull(sysUser) && !sysUser.isAdmin()) { | ||||||
|  |                 loginUser.setMenuPermission(permissionService.getMenuPermission(sysUser)); | ||||||
|  |                 LoginHelper.setLoginUser(loginUser); | ||||||
|  |             } | ||||||
|             return R.ok(); |             return R.ok(); | ||||||
|         } |         } | ||||||
|         return R.fail("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); |         return R.fail("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); | ||||||
| @@ -117,7 +127,7 @@ public class SysRoleController extends BaseController { | |||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/dataScope") |     @PutMapping("/dataScope") | ||||||
|     public R<Void> dataScope(@RequestBody SysRoleBo role) { |     public R<Void> dataScope(@RequestBody SysRole role) { | ||||||
|         roleService.checkRoleAllowed(role); |         roleService.checkRoleAllowed(role); | ||||||
|         roleService.checkRoleDataScope(role.getRoleId()); |         roleService.checkRoleDataScope(role.getRoleId()); | ||||||
|         return toAjax(roleService.authDataScope(role)); |         return toAjax(roleService.authDataScope(role)); | ||||||
| @@ -129,10 +139,10 @@ public class SysRoleController extends BaseController { | |||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/changeStatus") |     @PutMapping("/changeStatus") | ||||||
|     public R<Void> changeStatus(@RequestBody SysRoleBo role) { |     public R<Void> changeStatus(@RequestBody SysRole role) { | ||||||
|         roleService.checkRoleAllowed(role); |         roleService.checkRoleAllowed(role); | ||||||
|         roleService.checkRoleDataScope(role.getRoleId()); |         roleService.checkRoleDataScope(role.getRoleId()); | ||||||
|         return toAjax(roleService.updateRoleStatus(role.getRoleId(), role.getStatus())); |         return toAjax(roleService.updateRoleStatus(role)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -149,13 +159,11 @@ public class SysRoleController extends BaseController { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 获取角色选择框列表 |      * 获取角色选择框列表 | ||||||
|      * |  | ||||||
|      * @param roleIds 角色ID串 |  | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:query") |     @SaCheckPermission("system:role:query") | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysRoleVo>> optionselect(@RequestParam(required = false) Long[] roleIds) { |     public R<List<SysRole>> optionselect() { | ||||||
|         return R.ok(roleService.selectRoleByIds(roleIds == null ? null : List.of(roleIds))); |         return R.ok(roleService.selectRoleAll()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -163,7 +171,7 @@ public class SysRoleController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/authUser/allocatedList") |     @GetMapping("/authUser/allocatedList") | ||||||
|     public TableDataInfo<SysUserVo> allocatedList(SysUserBo user, PageQuery pageQuery) { |     public TableDataInfo<SysUser> allocatedList(SysUser user, PageQuery pageQuery) { | ||||||
|         return userService.selectAllocatedList(user, pageQuery); |         return userService.selectAllocatedList(user, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -172,7 +180,7 @@ public class SysRoleController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/authUser/unallocatedList") |     @GetMapping("/authUser/unallocatedList") | ||||||
|     public TableDataInfo<SysUserVo> unallocatedList(SysUserBo user, PageQuery pageQuery) { |     public TableDataInfo<SysUser> unallocatedList(SysUser user, PageQuery pageQuery) { | ||||||
|         return userService.selectUnallocatedList(user, pageQuery); |         return userService.selectUnallocatedList(user, pageQuery); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @@ -220,10 +228,10 @@ public class SysRoleController extends BaseController { | |||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping(value = "/deptTree/{roleId}") |     @GetMapping(value = "/deptTree/{roleId}") | ||||||
|     public R<DeptTreeSelectVo> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { |     public R<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { | ||||||
|         DeptTreeSelectVo selectVo = new DeptTreeSelectVo(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         selectVo.setCheckedKeys(deptService.selectDeptListByRoleId(roleId)); |         ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); | ||||||
|         selectVo.setDepts(deptService.selectDeptTreeList(new SysDeptBo())); |         ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); | ||||||
|         return R.ok(selectVo); |         return R.ok(ajax); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -0,0 +1,253 @@ | |||||||
|  | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import cn.dev33.satoken.secure.BCrypt; | ||||||
|  | import cn.hutool.core.bean.BeanUtil; | ||||||
|  | import cn.hutool.core.lang.tree.Tree; | ||||||
|  | import cn.hutool.core.util.ArrayUtil; | ||||||
|  | import cn.hutool.core.util.ObjectUtil; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.UserConstants; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysDept; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysRole; | ||||||
|  | import com.ruoyi.common.core.domain.entity.SysUser; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.excel.ExcelResult; | ||||||
|  | import com.ruoyi.common.helper.LoginHelper; | ||||||
|  | import com.ruoyi.common.utils.StreamUtils; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | import com.ruoyi.system.domain.vo.SysUserExportVo; | ||||||
|  | import com.ruoyi.system.domain.vo.SysUserImportVo; | ||||||
|  | import com.ruoyi.system.listener.SysUserImportListener; | ||||||
|  | import com.ruoyi.system.service.ISysDeptService; | ||||||
|  | import com.ruoyi.system.service.ISysPostService; | ||||||
|  | import com.ruoyi.system.service.ISysRoleService; | ||||||
|  | import com.ruoyi.system.service.ISysUserService; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 用户信息 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/system/user") | ||||||
|  | public class SysUserController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final ISysUserService userService; | ||||||
|  |     private final ISysRoleService roleService; | ||||||
|  |     private final ISysPostService postService; | ||||||
|  |     private final ISysDeptService deptService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取用户列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:list") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo<SysUser> list(SysUser user, PageQuery pageQuery) { | ||||||
|  |         return userService.selectPageUserList(user, pageQuery); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导出用户列表 | ||||||
|  |      */ | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.EXPORT) | ||||||
|  |     @SaCheckPermission("system:user:export") | ||||||
|  |     @PostMapping("/export") | ||||||
|  |     public void export(SysUser user, HttpServletResponse response) { | ||||||
|  |         List<SysUser> list = userService.selectUserList(user); | ||||||
|  |         List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); | ||||||
|  |         for (int i = 0; i < list.size(); i++) { | ||||||
|  |             SysDept dept = list.get(i).getDept(); | ||||||
|  |             SysUserExportVo vo = listVo.get(i); | ||||||
|  |             if (ObjectUtil.isNotEmpty(dept)) { | ||||||
|  |                 vo.setDeptName(dept.getDeptName()); | ||||||
|  |                 vo.setLeader(dept.getLeader()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导入数据 | ||||||
|  |      * | ||||||
|  |      * @param file          导入文件 | ||||||
|  |      * @param updateSupport 是否更新已存在数据 | ||||||
|  |      */ | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.IMPORT) | ||||||
|  |     @SaCheckPermission("system:user:import") | ||||||
|  |     @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|  |     public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { | ||||||
|  |         ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport)); | ||||||
|  |         return R.ok(result.getAnalysis()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取导入模板 | ||||||
|  |      */ | ||||||
|  |     @PostMapping("/importTemplate") | ||||||
|  |     public void importTemplate(HttpServletResponse response) { | ||||||
|  |         ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 根据用户编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param userId 用户ID | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:query") | ||||||
|  |     @GetMapping(value = {"/", "/{userId}"}) | ||||||
|  |     public R<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) { | ||||||
|  |         userService.checkUserDataScope(userId); | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         List<SysRole> roles = roleService.selectRoleAll(); | ||||||
|  |         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isAdmin())); | ||||||
|  |         ajax.put("posts", postService.selectPostAll()); | ||||||
|  |         if (ObjectUtil.isNotNull(userId)) { | ||||||
|  |             SysUser sysUser = userService.selectUserById(userId); | ||||||
|  |             ajax.put("user", sysUser); | ||||||
|  |             ajax.put("postIds", postService.selectPostListByUserId(userId)); | ||||||
|  |             ajax.put("roleIds", StreamUtils.toList(sysUser.getRoles(), SysRole::getRoleId)); | ||||||
|  |         } | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增用户 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:add") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.INSERT) | ||||||
|  |     @PostMapping | ||||||
|  |     public R<Void> add(@Validated @RequestBody SysUser user) { | ||||||
|  |         if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) { | ||||||
|  |             return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); | ||||||
|  |         } else if (StringUtils.isNotEmpty(user.getPhonenumber()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { | ||||||
|  |             return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); | ||||||
|  |         } else if (StringUtils.isNotEmpty(user.getEmail()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { | ||||||
|  |             return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); | ||||||
|  |         } | ||||||
|  |         user.setPassword(BCrypt.hashpw(user.getPassword())); | ||||||
|  |         return toAjax(userService.insertUser(user)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改用户 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:edit") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping | ||||||
|  |     public R<Void> edit(@Validated @RequestBody SysUser user) { | ||||||
|  |         userService.checkUserAllowed(user); | ||||||
|  |         userService.checkUserDataScope(user.getUserId()); | ||||||
|  |         if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) { | ||||||
|  |             return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); | ||||||
|  |         } else if (StringUtils.isNotEmpty(user.getPhonenumber()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { | ||||||
|  |             return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); | ||||||
|  |         } else if (StringUtils.isNotEmpty(user.getEmail()) | ||||||
|  |             && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { | ||||||
|  |             return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); | ||||||
|  |         } | ||||||
|  |         return toAjax(userService.updateUser(user)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除用户 | ||||||
|  |      * | ||||||
|  |      * @param userIds 角色ID串 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:remove") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{userIds}") | ||||||
|  |     public R<Void> remove(@PathVariable Long[] userIds) { | ||||||
|  |         if (ArrayUtil.contains(userIds, getUserId())) { | ||||||
|  |             return R.fail("当前用户不能删除"); | ||||||
|  |         } | ||||||
|  |         return toAjax(userService.deleteUserByIds(userIds)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 重置密码 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:resetPwd") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping("/resetPwd") | ||||||
|  |     public R<Void> resetPwd(@RequestBody SysUser user) { | ||||||
|  |         userService.checkUserAllowed(user); | ||||||
|  |         userService.checkUserDataScope(user.getUserId()); | ||||||
|  |         user.setPassword(BCrypt.hashpw(user.getPassword())); | ||||||
|  |         return toAjax(userService.resetPwd(user)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 状态修改 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:edit") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping("/changeStatus") | ||||||
|  |     public R<Void> changeStatus(@RequestBody SysUser user) { | ||||||
|  |         userService.checkUserAllowed(user); | ||||||
|  |         userService.checkUserDataScope(user.getUserId()); | ||||||
|  |         return toAjax(userService.updateUserStatus(user)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 根据用户编号获取授权角色 | ||||||
|  |      * | ||||||
|  |      * @param userId 用户ID | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:query") | ||||||
|  |     @GetMapping("/authRole/{userId}") | ||||||
|  |     public R<Map<String, Object>> authRole(@PathVariable Long userId) { | ||||||
|  |         SysUser user = userService.selectUserById(userId); | ||||||
|  |         List<SysRole> roles = roleService.selectRolesByUserId(userId); | ||||||
|  |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|  |         ajax.put("user", user); | ||||||
|  |         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isAdmin())); | ||||||
|  |         return R.ok(ajax); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户授权角色 | ||||||
|  |      * | ||||||
|  |      * @param userId  用户Id | ||||||
|  |      * @param roleIds 角色ID串 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:edit") | ||||||
|  |     @Log(title = "用户管理", businessType = BusinessType.GRANT) | ||||||
|  |     @PutMapping("/authRole") | ||||||
|  |     public R<Void> insertAuthRole(Long userId, Long[] roleIds) { | ||||||
|  |         userService.checkUserDataScope(userId); | ||||||
|  |         userService.insertUserAuth(userId, roleIds); | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取部门树列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("system:user:list") | ||||||
|  |     @GetMapping("/deptTree") | ||||||
|  |     public R<List<Tree<Long>>> deptTree(SysDept dept) { | ||||||
|  |         return R.ok(deptService.selectDeptTreeList(dept)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -1,234 +0,0 @@ | |||||||
| package org.dromara.web.controller; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.annotation.SaIgnore; |  | ||||||
| import cn.dev33.satoken.exception.NotLoginException; |  | ||||||
| import cn.hutool.core.codec.Base64; |  | ||||||
| import cn.hutool.core.collection.CollUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import jakarta.servlet.http.HttpServletRequest; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import me.zhyd.oauth.model.AuthResponse; |  | ||||||
| import me.zhyd.oauth.model.AuthUser; |  | ||||||
| import me.zhyd.oauth.request.AuthRequest; |  | ||||||
| import me.zhyd.oauth.utils.AuthStateUtils; |  | ||||||
| import org.dromara.common.core.constant.UserConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.core.domain.model.LoginBody; |  | ||||||
| import org.dromara.common.core.domain.model.RegisterBody; |  | ||||||
| import org.dromara.common.core.domain.model.SocialLoginBody; |  | ||||||
| import org.dromara.common.core.utils.*; |  | ||||||
| import org.dromara.common.encrypt.annotation.ApiEncrypt; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.social.config.properties.SocialLoginConfigProperties; |  | ||||||
| import org.dromara.common.social.config.properties.SocialProperties; |  | ||||||
| import org.dromara.common.social.utils.SocialUtils; |  | ||||||
| import org.dromara.common.sse.dto.SseMessageDto; |  | ||||||
| import org.dromara.common.sse.utils.SseMessageUtils; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.system.domain.bo.SysTenantBo; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysTenantVo; |  | ||||||
| import org.dromara.system.service.ISysClientService; |  | ||||||
| import org.dromara.system.service.ISysConfigService; |  | ||||||
| import org.dromara.system.service.ISysSocialService; |  | ||||||
| import org.dromara.system.service.ISysTenantService; |  | ||||||
| import org.dromara.web.domain.vo.LoginTenantVo; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.domain.vo.TenantListVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.dromara.web.service.SysRegisterService; |  | ||||||
| import org.springframework.validation.annotation.Validated; |  | ||||||
| import org.springframework.web.bind.annotation.*; |  | ||||||
|  |  | ||||||
| import java.net.URL; |  | ||||||
| import java.nio.charset.StandardCharsets; |  | ||||||
| import java.util.HashMap; |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
| import java.util.concurrent.ScheduledExecutorService; |  | ||||||
| import java.util.concurrent.TimeUnit; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 认证 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @SaIgnore |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| @RestController |  | ||||||
| @RequestMapping("/auth") |  | ||||||
| public class AuthController { |  | ||||||
|  |  | ||||||
|     private final SocialProperties socialProperties; |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|     private final SysRegisterService registerService; |  | ||||||
|     private final ISysConfigService configService; |  | ||||||
|     private final ISysTenantService tenantService; |  | ||||||
|     private final ISysSocialService socialUserService; |  | ||||||
|     private final ISysClientService clientService; |  | ||||||
|     private final ScheduledExecutorService scheduledExecutorService; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录方法 |  | ||||||
|      * |  | ||||||
|      * @param body 登录信息 |  | ||||||
|      * @return 结果 |  | ||||||
|      */ |  | ||||||
|     @ApiEncrypt |  | ||||||
|     @PostMapping("/login") |  | ||||||
|     public R<LoginVo> login(@RequestBody String body) { |  | ||||||
|         LoginBody loginBody = JsonUtils.parseObject(body, LoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         // 授权类型和客户端id |  | ||||||
|         String clientId = loginBody.getClientId(); |  | ||||||
|         String grantType = loginBody.getGrantType(); |  | ||||||
|         SysClientVo client = clientService.queryByClientId(clientId); |  | ||||||
|         // 查询不到 client 或 client 内不包含 grantType |  | ||||||
|         if (ObjectUtil.isNull(client) || !StringUtils.contains(client.getGrantType(), grantType)) { |  | ||||||
|             log.info("客户端id: {} 认证类型:{} 异常!.", clientId, grantType); |  | ||||||
|             return R.fail(MessageUtils.message("auth.grant.type.error")); |  | ||||||
|         } else if (!UserConstants.NORMAL.equals(client.getStatus())) { |  | ||||||
|             return R.fail(MessageUtils.message("auth.grant.type.blocked")); |  | ||||||
|         } |  | ||||||
|         // 校验租户 |  | ||||||
|         loginService.checkTenant(loginBody.getTenantId()); |  | ||||||
|         // 登录 |  | ||||||
|         LoginVo loginVo = IAuthStrategy.login(body, client, grantType); |  | ||||||
|  |  | ||||||
|         Long userId = LoginHelper.getUserId(); |  | ||||||
|         scheduledExecutorService.schedule(() -> { |  | ||||||
|             SseMessageDto dto = new SseMessageDto(); |  | ||||||
|             dto.setMessage("欢迎登录RuoYi-Vue-Plus后台管理系统"); |  | ||||||
|             dto.setUserIds(List.of(userId)); |  | ||||||
|             SseMessageUtils.publishMessage(dto); |  | ||||||
|         }, 5, TimeUnit.SECONDS); |  | ||||||
|         return R.ok(loginVo); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 第三方登录请求 |  | ||||||
|      * |  | ||||||
|      * @param source 登录来源 |  | ||||||
|      * @return 结果 |  | ||||||
|      */ |  | ||||||
|     @GetMapping("/binding/{source}") |  | ||||||
|     public R<String> authBinding(@PathVariable("source") String source, |  | ||||||
|                                  @RequestParam String tenantId, @RequestParam String domain) { |  | ||||||
|         SocialLoginConfigProperties obj = socialProperties.getType().get(source); |  | ||||||
|         if (ObjectUtil.isNull(obj)) { |  | ||||||
|             return R.fail(source + "平台账号暂不支持"); |  | ||||||
|         } |  | ||||||
|         AuthRequest authRequest = SocialUtils.getAuthRequest(source, socialProperties); |  | ||||||
|         Map<String, String> map = new HashMap<>(); |  | ||||||
|         map.put("tenantId", tenantId); |  | ||||||
|         map.put("domain", domain); |  | ||||||
|         map.put("state", AuthStateUtils.createState()); |  | ||||||
|         String authorizeUrl = authRequest.authorize(Base64.encode(JsonUtils.toJsonString(map), StandardCharsets.UTF_8)); |  | ||||||
|         return R.ok("操作成功", authorizeUrl); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 第三方登录回调业务处理 绑定授权 |  | ||||||
|      * |  | ||||||
|      * @param loginBody 请求体 |  | ||||||
|      * @return 结果 |  | ||||||
|      */ |  | ||||||
|     @PostMapping("/social/callback") |  | ||||||
|     public R<Void> socialCallback(@RequestBody SocialLoginBody loginBody) { |  | ||||||
|         // 获取第三方登录信息 |  | ||||||
|         AuthResponse<AuthUser> response = SocialUtils.loginAuth( |  | ||||||
|                 loginBody.getSource(), loginBody.getSocialCode(), |  | ||||||
|                 loginBody.getSocialState(), socialProperties); |  | ||||||
|         AuthUser authUserData = response.getData(); |  | ||||||
|         // 判断授权响应是否成功 |  | ||||||
|         if (!response.ok()) { |  | ||||||
|             return R.fail(response.getMsg()); |  | ||||||
|         } |  | ||||||
|         loginService.socialRegister(authUserData); |  | ||||||
|         return R.ok(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 取消授权 |  | ||||||
|      * |  | ||||||
|      * @param socialId socialId |  | ||||||
|      */ |  | ||||||
|     @DeleteMapping(value = "/unlock/{socialId}") |  | ||||||
|     public R<Void> unlockSocial(@PathVariable Long socialId) { |  | ||||||
|         Boolean rows = socialUserService.deleteWithValidById(socialId); |  | ||||||
|         return rows ? R.ok() : R.fail("取消授权失败"); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 退出登录 |  | ||||||
|      */ |  | ||||||
|     @PostMapping("/logout") |  | ||||||
|     public R<Void> logout() { |  | ||||||
|         loginService.logout(); |  | ||||||
|         return R.ok("退出成功"); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户注册 |  | ||||||
|      */ |  | ||||||
|     @ApiEncrypt |  | ||||||
|     @PostMapping("/register") |  | ||||||
|     public R<Void> register(@Validated @RequestBody RegisterBody user) { |  | ||||||
|         if (!configService.selectRegisterEnabled(user.getTenantId())) { |  | ||||||
|             return R.fail("当前系统没有开启注册功能!"); |  | ||||||
|         } |  | ||||||
|         registerService.register(user); |  | ||||||
|         return R.ok(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录页面租户下拉框 |  | ||||||
|      * |  | ||||||
|      * @return 租户列表 |  | ||||||
|      */ |  | ||||||
|     @GetMapping("/tenant/list") |  | ||||||
|     public R<LoginTenantVo> tenantList(HttpServletRequest request) throws Exception { |  | ||||||
|         // 返回对象 |  | ||||||
|         LoginTenantVo result = new LoginTenantVo(); |  | ||||||
|         boolean enable = TenantHelper.isEnable(); |  | ||||||
|         result.setTenantEnabled(enable); |  | ||||||
|         // 如果未开启租户这直接返回 |  | ||||||
|         if (!enable) { |  | ||||||
|             return R.ok(result); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         List<SysTenantVo> tenantList = tenantService.queryList(new SysTenantBo()); |  | ||||||
|         List<TenantListVo> voList = MapstructUtils.convert(tenantList, TenantListVo.class); |  | ||||||
|         try { |  | ||||||
|             // 如果只超管返回所有租户 |  | ||||||
|             if (LoginHelper.isSuperAdmin()) { |  | ||||||
|                 result.setVoList(voList); |  | ||||||
|                 return R.ok(result); |  | ||||||
|             } |  | ||||||
|         } catch (NotLoginException ignored) { |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // 获取域名 |  | ||||||
|         String host; |  | ||||||
|         String referer = request.getHeader("referer"); |  | ||||||
|         if (StringUtils.isNotBlank(referer)) { |  | ||||||
|             // 这里从referer中取值是为了本地使用hosts添加虚拟域名,方便本地环境调试 |  | ||||||
|             host = referer.split("//")[1].split("/")[0]; |  | ||||||
|         } else { |  | ||||||
|             host = new URL(request.getRequestURL().toString()).getHost(); |  | ||||||
|         } |  | ||||||
|         // 根据域名进行筛选 |  | ||||||
|         List<TenantListVo> list = StreamUtils.filter(voList, vo -> |  | ||||||
|                 StringUtils.equals(vo.getDomain(), host)); |  | ||||||
|         result.setVoList(CollUtil.isNotEmpty(list) ? list : voList); |  | ||||||
|         return R.ok(result); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,136 +0,0 @@ | |||||||
| package org.dromara.web.controller; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.annotation.SaIgnore; |  | ||||||
| import cn.hutool.captcha.AbstractCaptcha; |  | ||||||
| import cn.hutool.captcha.generator.CodeGenerator; |  | ||||||
| import cn.hutool.core.util.IdUtil; |  | ||||||
| import cn.hutool.core.util.RandomUtil; |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.GlobalConstants; |  | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.common.core.utils.SpringUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.core.utils.reflect.ReflectUtils; |  | ||||||
| import org.dromara.common.mail.config.properties.MailProperties; |  | ||||||
| import org.dromara.common.mail.utils.MailUtils; |  | ||||||
| import org.dromara.common.ratelimiter.annotation.RateLimiter; |  | ||||||
| import org.dromara.common.ratelimiter.enums.LimitType; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.web.config.properties.CaptchaProperties; |  | ||||||
| import org.dromara.common.web.enums.CaptchaType; |  | ||||||
| import org.dromara.sms4j.api.SmsBlend; |  | ||||||
| import org.dromara.sms4j.api.entity.SmsResponse; |  | ||||||
| import org.dromara.sms4j.core.factory.SmsFactory; |  | ||||||
| import org.dromara.web.domain.vo.CaptchaVo; |  | ||||||
| import org.springframework.expression.Expression; |  | ||||||
| import org.springframework.expression.ExpressionParser; |  | ||||||
| import org.springframework.expression.spel.standard.SpelExpressionParser; |  | ||||||
| import org.springframework.validation.annotation.Validated; |  | ||||||
| import org.springframework.web.bind.annotation.GetMapping; |  | ||||||
| import org.springframework.web.bind.annotation.RestController; |  | ||||||
|  |  | ||||||
| import java.time.Duration; |  | ||||||
| import java.util.LinkedHashMap; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 验证码操作处理 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @SaIgnore |  | ||||||
| @Slf4j |  | ||||||
| @Validated |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| @RestController |  | ||||||
| public class CaptchaController { |  | ||||||
|  |  | ||||||
|     private final CaptchaProperties captchaProperties; |  | ||||||
|     private final MailProperties mailProperties; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 短信验证码 |  | ||||||
|      * |  | ||||||
|      * @param phonenumber 用户手机号 |  | ||||||
|      */ |  | ||||||
|     @RateLimiter(key = "#phonenumber", time = 60, count = 1) |  | ||||||
|     @GetMapping("/resource/sms/code") |  | ||||||
|     public R<Void> smsCode(@NotBlank(message = "{user.phonenumber.not.blank}") String phonenumber) { |  | ||||||
|         String key = GlobalConstants.CAPTCHA_CODE_KEY + phonenumber; |  | ||||||
|         String code = RandomUtil.randomNumbers(4); |  | ||||||
|         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); |  | ||||||
|         // 验证码模板id 自行处理 (查数据库或写死均可) |  | ||||||
|         String templateId = ""; |  | ||||||
|         LinkedHashMap<String, String> map = new LinkedHashMap<>(1); |  | ||||||
|         map.put("code", code); |  | ||||||
|         SmsBlend smsBlend = SmsFactory.getSmsBlend("config1"); |  | ||||||
|         SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map); |  | ||||||
|         if (!smsResponse.isSuccess()) { |  | ||||||
|             log.error("验证码短信发送异常 => {}", smsResponse); |  | ||||||
|             return R.fail(smsResponse.getData().toString()); |  | ||||||
|         } |  | ||||||
|         return R.ok(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮箱验证码 |  | ||||||
|      * |  | ||||||
|      * @param email 邮箱 |  | ||||||
|      */ |  | ||||||
|     @RateLimiter(key = "#email", time = 60, count = 1) |  | ||||||
|     @GetMapping("/resource/email/code") |  | ||||||
|     public R<Void> emailCode(@NotBlank(message = "{user.email.not.blank}") String email) { |  | ||||||
|         if (!mailProperties.getEnabled()) { |  | ||||||
|             return R.fail("当前系统没有开启邮箱功能!"); |  | ||||||
|         } |  | ||||||
|         String key = GlobalConstants.CAPTCHA_CODE_KEY + email; |  | ||||||
|         String code = RandomUtil.randomNumbers(4); |  | ||||||
|         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); |  | ||||||
|         try { |  | ||||||
|             MailUtils.sendText(email, "登录验证码", "您本次验证码为:" + code + ",有效性为" + Constants.CAPTCHA_EXPIRATION + "分钟,请尽快填写。"); |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             log.error("验证码短信发送异常 => {}", e.getMessage()); |  | ||||||
|             return R.fail(e.getMessage()); |  | ||||||
|         } |  | ||||||
|         return R.ok(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 生成验证码 |  | ||||||
|      */ |  | ||||||
|     @RateLimiter(time = 60, count = 10, limitType = LimitType.IP) |  | ||||||
|     @GetMapping("/auth/code") |  | ||||||
|     public R<CaptchaVo> getCode() { |  | ||||||
|         CaptchaVo captchaVo = new CaptchaVo(); |  | ||||||
|         boolean captchaEnabled = captchaProperties.getEnable(); |  | ||||||
|         if (!captchaEnabled) { |  | ||||||
|             captchaVo.setCaptchaEnabled(false); |  | ||||||
|             return R.ok(captchaVo); |  | ||||||
|         } |  | ||||||
|         // 保存验证码信息 |  | ||||||
|         String uuid = IdUtil.simpleUUID(); |  | ||||||
|         String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + uuid; |  | ||||||
|         // 生成验证码 |  | ||||||
|         CaptchaType captchaType = captchaProperties.getType(); |  | ||||||
|         boolean isMath = CaptchaType.MATH == captchaType; |  | ||||||
|         Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); |  | ||||||
|         CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); |  | ||||||
|         AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); |  | ||||||
|         captcha.setGenerator(codeGenerator); |  | ||||||
|         captcha.createCode(); |  | ||||||
|         // 如果是数学验证码,使用SpEL表达式处理验证码结果 |  | ||||||
|         String code = captcha.getCode(); |  | ||||||
|         if (isMath) { |  | ||||||
|             ExpressionParser parser = new SpelExpressionParser(); |  | ||||||
|             Expression exp = parser.parseExpression(StringUtils.remove(code, "=")); |  | ||||||
|             code = exp.getValue(String.class); |  | ||||||
|         } |  | ||||||
|         RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); |  | ||||||
|         captchaVo.setUuid(uuid); |  | ||||||
|         captchaVo.setImg(captcha.getImageBase64()); |  | ||||||
|         return R.ok(captchaVo); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| package org.dromara.web.domain.vo; |  | ||||||
|  |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 验证码信息 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| public class CaptchaVo { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 是否开启验证码 |  | ||||||
|      */ |  | ||||||
|     private Boolean captchaEnabled = true; |  | ||||||
|  |  | ||||||
|     private String uuid; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证码图片 |  | ||||||
|      */ |  | ||||||
|     private String img; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| package org.dromara.web.domain.vo; |  | ||||||
|  |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 登录租户对象 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| public class LoginTenantVo { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户开关 |  | ||||||
|      */ |  | ||||||
|     private Boolean tenantEnabled; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户对象列表 |  | ||||||
|      */ |  | ||||||
|     private List<TenantListVo> voList; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,54 +0,0 @@ | |||||||
| package org.dromara.web.domain.vo; |  | ||||||
|  |  | ||||||
| import com.fasterxml.jackson.annotation.JsonProperty; |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 登录验证信息 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| public class LoginVo { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 授权令牌 |  | ||||||
|      */ |  | ||||||
|     @JsonProperty("access_token") |  | ||||||
|     private String accessToken; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 刷新令牌 |  | ||||||
|      */ |  | ||||||
|     @JsonProperty("refresh_token") |  | ||||||
|     private String refreshToken; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 授权令牌 access_token 的有效期 |  | ||||||
|      */ |  | ||||||
|     @JsonProperty("expire_in") |  | ||||||
|     private Long expireIn; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 刷新令牌 refresh_token 的有效期 |  | ||||||
|      */ |  | ||||||
|     @JsonProperty("refresh_expire_in") |  | ||||||
|     private Long refreshExpireIn; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 应用id |  | ||||||
|      */ |  | ||||||
|     @JsonProperty("client_id") |  | ||||||
|     private String clientId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 令牌权限 |  | ||||||
|      */ |  | ||||||
|     private String scope; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户 openid |  | ||||||
|      */ |  | ||||||
|     private String openid; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| package org.dromara.web.domain.vo; |  | ||||||
|  |  | ||||||
| import org.dromara.system.domain.vo.SysTenantVo; |  | ||||||
| import io.github.linpeilie.annotations.AutoMapper; |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 租户列表 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @AutoMapper(target = SysTenantVo.class) |  | ||||||
| public class TenantListVo { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户编号 |  | ||||||
|      */ |  | ||||||
|     private String tenantId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 企业名称 |  | ||||||
|      */ |  | ||||||
|     private String companyName; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 域名 |  | ||||||
|      */ |  | ||||||
|     private String domain; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,165 +0,0 @@ | |||||||
| package org.dromara.web.listener; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.config.SaTokenConfig; |  | ||||||
| import cn.dev33.satoken.listener.SaTokenListener; |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.convert.Convert; |  | ||||||
| import cn.hutool.http.useragent.UserAgent; |  | ||||||
| import cn.hutool.http.useragent.UserAgentUtil; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.constant.CacheConstants; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.domain.dto.UserOnlineDTO; |  | ||||||
| import org.dromara.common.core.utils.MessageUtils; |  | ||||||
| import org.dromara.common.core.utils.ServletUtils; |  | ||||||
| import org.dromara.common.core.utils.SpringUtils; |  | ||||||
| import org.dromara.common.core.utils.ip.AddressUtils; |  | ||||||
| import org.dromara.common.log.event.LogininforEvent; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Component; |  | ||||||
|  |  | ||||||
| import java.time.Duration; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户行为 侦听器的实现 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| @Component |  | ||||||
| @Slf4j |  | ||||||
| public class UserActionListener implements SaTokenListener { |  | ||||||
|  |  | ||||||
|     private final SaTokenConfig tokenConfig; |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次登录时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) { |  | ||||||
|         UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent")); |  | ||||||
|         String ip = ServletUtils.getClientIP(); |  | ||||||
|         UserOnlineDTO dto = new UserOnlineDTO(); |  | ||||||
|         dto.setIpaddr(ip); |  | ||||||
|         dto.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); |  | ||||||
|         dto.setBrowser(userAgent.getBrowser().getName()); |  | ||||||
|         dto.setOs(userAgent.getOs().getName()); |  | ||||||
|         dto.setLoginTime(System.currentTimeMillis()); |  | ||||||
|         dto.setTokenId(tokenValue); |  | ||||||
|         String username = (String) loginModel.getExtra(LoginHelper.USER_NAME_KEY); |  | ||||||
|         String tenantId = (String) loginModel.getExtra(LoginHelper.TENANT_KEY); |  | ||||||
|         dto.setUserName(username); |  | ||||||
|         dto.setClientKey((String) loginModel.getExtra(LoginHelper.CLIENT_KEY)); |  | ||||||
|         dto.setDeviceType(loginModel.getDevice()); |  | ||||||
|         dto.setDeptName((String) loginModel.getExtra(LoginHelper.DEPT_NAME_KEY)); |  | ||||||
|         TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             if(tokenConfig.getTimeout() == -1) { |  | ||||||
|                 RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto); |  | ||||||
|             } else { |  | ||||||
|                 RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto, Duration.ofSeconds(tokenConfig.getTimeout())); |  | ||||||
|             } |  | ||||||
|         }); |  | ||||||
|         // 记录登录日志 |  | ||||||
|         LogininforEvent logininforEvent = new LogininforEvent(); |  | ||||||
|         logininforEvent.setTenantId(tenantId); |  | ||||||
|         logininforEvent.setUsername(username); |  | ||||||
|         logininforEvent.setStatus(Constants.LOGIN_SUCCESS); |  | ||||||
|         logininforEvent.setMessage(MessageUtils.message("user.login.success")); |  | ||||||
|         logininforEvent.setRequest(ServletUtils.getRequest()); |  | ||||||
|         SpringUtils.context().publishEvent(logininforEvent); |  | ||||||
|         // 更新登录信息 |  | ||||||
|         loginService.recordLoginInfo((Long) loginModel.getExtra(LoginHelper.USER_KEY), ip); |  | ||||||
|         log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次注销时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doLogout(String loginType, Object loginId, String tokenValue) { |  | ||||||
|         String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY)); |  | ||||||
|         TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue); |  | ||||||
|         }); |  | ||||||
|         log.info("user doLogout, userId:{}, token:{}", loginId, tokenValue); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次被踢下线时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doKickout(String loginType, Object loginId, String tokenValue) { |  | ||||||
|         String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY)); |  | ||||||
|         TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue); |  | ||||||
|         }); |  | ||||||
|         log.info("user doKickout, userId:{}, token:{}", loginId, tokenValue); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次被顶下线时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doReplaced(String loginType, Object loginId, String tokenValue) { |  | ||||||
|         String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY)); |  | ||||||
|         TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue); |  | ||||||
|         }); |  | ||||||
|         log.info("user doReplaced, userId:{}, token:{}", loginId, tokenValue); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次被封禁时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doDisable(String loginType, Object loginId, String service, int level, long disableTime) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次被解封时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doUntieDisable(String loginType, Object loginId, String service) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次打开二级认证时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doOpenSafe(String loginType, String tokenValue, String service, long safeTime) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次创建Session时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doCloseSafe(String loginType, String tokenValue, String service) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次创建Session时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doCreateSession(String id) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次注销Session时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doLogoutSession(String id) { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每次Token续期时触发 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public void doRenewTimeout(String tokenValue, Object loginId, long timeout) { |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,46 +0,0 @@ | |||||||
| package org.dromara.web.service; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import org.dromara.common.core.exception.ServiceException; |  | ||||||
| import org.dromara.common.core.utils.SpringUtils; |  | ||||||
| import org.dromara.system.domain.SysClient; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 授权策略 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| public interface IAuthStrategy { |  | ||||||
|  |  | ||||||
|     String BASE_NAME = "AuthStrategy"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录 |  | ||||||
|      * |  | ||||||
|      * @param body      登录对象 |  | ||||||
|      * @param client    授权管理视图对象 |  | ||||||
|      * @param grantType 授权类型 |  | ||||||
|      * @return 登录验证信息 |  | ||||||
|      */ |  | ||||||
|     static LoginVo login(String body, SysClientVo client, String grantType) { |  | ||||||
|         // 授权类型和客户端id |  | ||||||
|         String beanName = grantType + BASE_NAME; |  | ||||||
|         if (!SpringUtils.containsBean(beanName)) { |  | ||||||
|             throw new ServiceException("授权类型不正确!"); |  | ||||||
|         } |  | ||||||
|         IAuthStrategy instance = SpringUtils.getBean(beanName); |  | ||||||
|         return instance.login(body, client); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录 |  | ||||||
|      * |  | ||||||
|      * @param body   登录对象 |  | ||||||
|      * @param client 授权管理视图对象 |  | ||||||
|      * @return 登录验证信息 |  | ||||||
|      */ |  | ||||||
|     LoginVo login(String body, SysClientVo client); |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,246 +0,0 @@ | |||||||
| package org.dromara.web.service; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.exception.NotLoginException; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.bean.BeanUtil; |  | ||||||
| import cn.hutool.core.collection.CollUtil; |  | ||||||
| import cn.hutool.core.lang.Opt; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import com.baomidou.lock.annotation.Lock4j; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import me.zhyd.oauth.model.AuthUser; |  | ||||||
| import org.dromara.common.core.constant.CacheConstants; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.TenantConstants; |  | ||||||
| import org.dromara.common.core.domain.dto.RoleDTO; |  | ||||||
| import org.dromara.common.core.domain.model.LoginUser; |  | ||||||
| import org.dromara.common.core.enums.LoginType; |  | ||||||
| import org.dromara.common.core.enums.TenantStatus; |  | ||||||
| import org.dromara.common.core.exception.ServiceException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.*; |  | ||||||
| import org.dromara.common.log.event.LogininforEvent; |  | ||||||
| import org.dromara.common.mybatis.helper.DataPermissionHelper; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.tenant.exception.TenantException; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.system.domain.SysUser; |  | ||||||
| import org.dromara.system.domain.bo.SysSocialBo; |  | ||||||
| import org.dromara.system.domain.vo.*; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.system.service.*; |  | ||||||
| import org.springframework.beans.factory.annotation.Value; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.time.Duration; |  | ||||||
| import java.util.Date; |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.function.Supplier; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 登录校验方法 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| @Slf4j |  | ||||||
| @Service |  | ||||||
| public class SysLoginService { |  | ||||||
|  |  | ||||||
|     @Value("${user.password.maxRetryCount}") |  | ||||||
|     private Integer maxRetryCount; |  | ||||||
|  |  | ||||||
|     @Value("${user.password.lockTime}") |  | ||||||
|     private Integer lockTime; |  | ||||||
|  |  | ||||||
|     private final ISysTenantService tenantService; |  | ||||||
|     private final ISysPermissionService permissionService; |  | ||||||
|     private final ISysSocialService sysSocialService; |  | ||||||
|     private final ISysRoleService roleService; |  | ||||||
|     private final ISysDeptService deptService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 绑定第三方用户 |  | ||||||
|      * |  | ||||||
|      * @param authUserData 授权响应实体 |  | ||||||
|      */ |  | ||||||
|     @Lock4j |  | ||||||
|     public void socialRegister(AuthUser authUserData) { |  | ||||||
|         String authId = authUserData.getSource() + authUserData.getUuid(); |  | ||||||
|         // 第三方用户信息 |  | ||||||
|         SysSocialBo bo = BeanUtil.toBean(authUserData, SysSocialBo.class); |  | ||||||
|         BeanUtil.copyProperties(authUserData.getToken(), bo); |  | ||||||
|         Long userId = LoginHelper.getUserId(); |  | ||||||
|         bo.setUserId(userId); |  | ||||||
|         bo.setAuthId(authId); |  | ||||||
|         bo.setOpenId(authUserData.getUuid()); |  | ||||||
|         bo.setUserName(authUserData.getUsername()); |  | ||||||
|         bo.setNickName(authUserData.getNickname()); |  | ||||||
|         List<SysSocialVo> checkList = sysSocialService.selectByAuthId(authId); |  | ||||||
|         if (CollUtil.isNotEmpty(checkList)) { |  | ||||||
|             throw new ServiceException("此三方账号已经被绑定!"); |  | ||||||
|         } |  | ||||||
|         // 查询是否已经绑定用户 |  | ||||||
|         SysSocialBo params = new SysSocialBo(); |  | ||||||
|         params.setUserId(userId); |  | ||||||
|         params.setSource(bo.getSource()); |  | ||||||
|         List<SysSocialVo> list = sysSocialService.queryList(params); |  | ||||||
|         if (CollUtil.isEmpty(list)) { |  | ||||||
|             // 没有绑定用户, 新增用户信息 |  | ||||||
|             sysSocialService.insertByBo(bo); |  | ||||||
|         } else { |  | ||||||
|             // 更新用户信息 |  | ||||||
|             bo.setId(list.get(0).getId()); |  | ||||||
|             sysSocialService.updateByBo(bo); |  | ||||||
|             // 如果要绑定的平台账号已经被绑定过了 是否抛异常自行决断 |  | ||||||
|             // throw new ServiceException("此平台账号已经被绑定!"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 退出登录 |  | ||||||
|      */ |  | ||||||
|     public void logout() { |  | ||||||
|         try { |  | ||||||
|             LoginUser loginUser = LoginHelper.getLoginUser(); |  | ||||||
|             if (ObjectUtil.isNull(loginUser)) { |  | ||||||
|                 return; |  | ||||||
|             } |  | ||||||
|             if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) { |  | ||||||
|                 // 超级管理员 登出清除动态租户 |  | ||||||
|                 TenantHelper.clearDynamic(); |  | ||||||
|             } |  | ||||||
|             recordLogininfor(loginUser.getTenantId(), loginUser.getUsername(), Constants.LOGOUT, MessageUtils.message("user.logout.success")); |  | ||||||
|         } catch (NotLoginException ignored) { |  | ||||||
|         } finally { |  | ||||||
|             try { |  | ||||||
|                 StpUtil.logout(); |  | ||||||
|             } catch (NotLoginException ignored) { |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 记录登录信息 |  | ||||||
|      * |  | ||||||
|      * @param tenantId 租户ID |  | ||||||
|      * @param username 用户名 |  | ||||||
|      * @param status   状态 |  | ||||||
|      * @param message  消息内容 |  | ||||||
|      */ |  | ||||||
|     public void recordLogininfor(String tenantId, String username, String status, String message) { |  | ||||||
|         LogininforEvent logininforEvent = new LogininforEvent(); |  | ||||||
|         logininforEvent.setTenantId(tenantId); |  | ||||||
|         logininforEvent.setUsername(username); |  | ||||||
|         logininforEvent.setStatus(status); |  | ||||||
|         logininforEvent.setMessage(message); |  | ||||||
|         logininforEvent.setRequest(ServletUtils.getRequest()); |  | ||||||
|         SpringUtils.context().publishEvent(logininforEvent); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 构建登录用户 |  | ||||||
|      */ |  | ||||||
|     public LoginUser buildLoginUser(SysUserVo user) { |  | ||||||
|         LoginUser loginUser = new LoginUser(); |  | ||||||
|         loginUser.setTenantId(user.getTenantId()); |  | ||||||
|         loginUser.setUserId(user.getUserId()); |  | ||||||
|         loginUser.setDeptId(user.getDeptId()); |  | ||||||
|         loginUser.setUsername(user.getUserName()); |  | ||||||
|         loginUser.setNickname(user.getNickName()); |  | ||||||
|         loginUser.setUserType(user.getUserType()); |  | ||||||
|         loginUser.setMenuPermission(permissionService.getMenuPermission(user.getUserId())); |  | ||||||
|         loginUser.setRolePermission(permissionService.getRolePermission(user.getUserId())); |  | ||||||
|         if (ObjectUtil.isNotNull(user.getDeptId())) { |  | ||||||
|             Opt<SysDeptVo> deptOpt = Opt.of(user.getDeptId()).map(deptService::selectDeptById); |  | ||||||
|             loginUser.setDeptName(deptOpt.map(SysDeptVo::getDeptName).orElse(StringUtils.EMPTY)); |  | ||||||
|             loginUser.setDeptCategory(deptOpt.map(SysDeptVo::getDeptCategory).orElse(StringUtils.EMPTY)); |  | ||||||
|         } |  | ||||||
|         List<SysRoleVo> roles = roleService.selectRolesByUserId(user.getUserId()); |  | ||||||
|         loginUser.setRoles(BeanUtil.copyToList(roles, RoleDTO.class)); |  | ||||||
|         return loginUser; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 记录登录信息 |  | ||||||
|      * |  | ||||||
|      * @param userId 用户ID |  | ||||||
|      */ |  | ||||||
|     public void recordLoginInfo(Long userId, String ip) { |  | ||||||
|         SysUser sysUser = new SysUser(); |  | ||||||
|         sysUser.setUserId(userId); |  | ||||||
|         sysUser.setLoginIp(ip); |  | ||||||
|         sysUser.setLoginDate(DateUtils.getNowDate()); |  | ||||||
|         sysUser.setUpdateBy(userId); |  | ||||||
|         DataPermissionHelper.ignore(() -> userMapper.updateById(sysUser)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录校验 |  | ||||||
|      */ |  | ||||||
|     public void checkLogin(LoginType loginType, String tenantId, String username, Supplier<Boolean> supplier) { |  | ||||||
|         String errorKey = CacheConstants.PWD_ERR_CNT_KEY + username; |  | ||||||
|         String loginFail = Constants.LOGIN_FAIL; |  | ||||||
|  |  | ||||||
|         // 获取用户登录错误次数,默认为0 (可自定义限制策略 例如: key + username + ip) |  | ||||||
|         int errorNumber = ObjectUtil.defaultIfNull(RedisUtils.getCacheObject(errorKey), 0); |  | ||||||
|         // 锁定时间内登录 则踢出 |  | ||||||
|         if (errorNumber >= maxRetryCount) { |  | ||||||
|             recordLogininfor(tenantId, username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), maxRetryCount, lockTime)); |  | ||||||
|             throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (supplier.get()) { |  | ||||||
|             // 错误次数递增 |  | ||||||
|             errorNumber++; |  | ||||||
|             RedisUtils.setCacheObject(errorKey, errorNumber, Duration.ofMinutes(lockTime)); |  | ||||||
|             // 达到规定错误次数 则锁定登录 |  | ||||||
|             if (errorNumber >= maxRetryCount) { |  | ||||||
|                 recordLogininfor(tenantId, username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), maxRetryCount, lockTime)); |  | ||||||
|                 throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime); |  | ||||||
|             } else { |  | ||||||
|                 // 未达到规定错误次数 |  | ||||||
|                 recordLogininfor(tenantId, username, loginFail, MessageUtils.message(loginType.getRetryLimitCount(), errorNumber)); |  | ||||||
|                 throw new UserException(loginType.getRetryLimitCount(), errorNumber); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // 登录成功 清空错误次数 |  | ||||||
|         RedisUtils.deleteObject(errorKey); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 校验租户 |  | ||||||
|      * |  | ||||||
|      * @param tenantId 租户ID |  | ||||||
|      */ |  | ||||||
|     public void checkTenant(String tenantId) { |  | ||||||
|         if (!TenantHelper.isEnable()) { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if (StringUtils.isBlank(tenantId)) { |  | ||||||
|             throw new TenantException("tenant.number.not.blank"); |  | ||||||
|         } |  | ||||||
|         SysTenantVo tenant = tenantService.queryByTenantId(tenantId); |  | ||||||
|         if (ObjectUtil.isNull(tenant)) { |  | ||||||
|             log.info("登录租户:{} 不存在.", tenantId); |  | ||||||
|             throw new TenantException("tenant.not.exists"); |  | ||||||
|         } else if (TenantStatus.DISABLE.getCode().equals(tenant.getStatus())) { |  | ||||||
|             log.info("登录租户:{} 已被停用.", tenantId); |  | ||||||
|             throw new TenantException("tenant.blocked"); |  | ||||||
|         } else if (ObjectUtil.isNotNull(tenant.getExpireTime()) |  | ||||||
|             && new Date().after(tenant.getExpireTime())) { |  | ||||||
|             log.info("登录租户:{} 已超过有效期.", tenantId); |  | ||||||
|             throw new TenantException("tenant.expired"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,115 +0,0 @@ | |||||||
| package org.dromara.web.service; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.secure.BCrypt; |  | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.GlobalConstants; |  | ||||||
| import org.dromara.common.core.domain.model.RegisterBody; |  | ||||||
| import org.dromara.common.core.enums.UserType; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaException; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaExpireException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.MessageUtils; |  | ||||||
| import org.dromara.common.core.utils.ServletUtils; |  | ||||||
| import org.dromara.common.core.utils.SpringUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.log.event.LogininforEvent; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.common.web.config.properties.CaptchaProperties; |  | ||||||
| import org.dromara.system.domain.SysUser; |  | ||||||
| import org.dromara.system.domain.bo.SysUserBo; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.system.service.ISysUserService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 注册校验方法 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| @Service |  | ||||||
| public class SysRegisterService { |  | ||||||
|  |  | ||||||
|     private final ISysUserService userService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|     private final CaptchaProperties captchaProperties; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 注册 |  | ||||||
|      */ |  | ||||||
|     public void register(RegisterBody registerBody) { |  | ||||||
|         String tenantId = registerBody.getTenantId(); |  | ||||||
|         String username = registerBody.getUsername(); |  | ||||||
|         String password = registerBody.getPassword(); |  | ||||||
|         // 校验用户类型是否存在 |  | ||||||
|         String userType = UserType.getUserType(registerBody.getUserType()).getUserType(); |  | ||||||
|  |  | ||||||
|         boolean captchaEnabled = captchaProperties.getEnable(); |  | ||||||
|         // 验证码开关 |  | ||||||
|         if (captchaEnabled) { |  | ||||||
|             validateCaptcha(tenantId, username, registerBody.getCode(), registerBody.getUuid()); |  | ||||||
|         } |  | ||||||
|         SysUserBo sysUser = new SysUserBo(); |  | ||||||
|         sysUser.setUserName(username); |  | ||||||
|         sysUser.setNickName(username); |  | ||||||
|         sysUser.setPassword(BCrypt.hashpw(password)); |  | ||||||
|         sysUser.setUserType(userType); |  | ||||||
|  |  | ||||||
|         boolean exist = TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             return userMapper.exists(new LambdaQueryWrapper<SysUser>() |  | ||||||
|                 .eq(SysUser::getUserName, sysUser.getUserName())); |  | ||||||
|         }); |  | ||||||
|         if (exist) { |  | ||||||
|             throw new UserException("user.register.save.error", username); |  | ||||||
|         } |  | ||||||
|         boolean regFlag = userService.registerUser(sysUser, tenantId); |  | ||||||
|         if (!regFlag) { |  | ||||||
|             throw new UserException("user.register.error"); |  | ||||||
|         } |  | ||||||
|         recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success")); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 校验验证码 |  | ||||||
|      * |  | ||||||
|      * @param username 用户名 |  | ||||||
|      * @param code     验证码 |  | ||||||
|      * @param uuid     唯一标识 |  | ||||||
|      */ |  | ||||||
|     public void validateCaptcha(String tenantId, String username, String code, String uuid) { |  | ||||||
|         String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.blankToDefault(uuid, ""); |  | ||||||
|         String captcha = RedisUtils.getCacheObject(verifyKey); |  | ||||||
|         RedisUtils.deleteObject(verifyKey); |  | ||||||
|         if (captcha == null) { |  | ||||||
|             recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.jcaptcha.expire")); |  | ||||||
|             throw new CaptchaExpireException(); |  | ||||||
|         } |  | ||||||
|         if (!code.equalsIgnoreCase(captcha)) { |  | ||||||
|             recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.jcaptcha.error")); |  | ||||||
|             throw new CaptchaException(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 记录登录信息 |  | ||||||
|      * |  | ||||||
|      * @param tenantId 租户ID |  | ||||||
|      * @param username 用户名 |  | ||||||
|      * @param status   状态 |  | ||||||
|      * @param message  消息内容 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     private void recordLogininfor(String tenantId, String username, String status, String message) { |  | ||||||
|         LogininforEvent logininforEvent = new LogininforEvent(); |  | ||||||
|         logininforEvent.setTenantId(tenantId); |  | ||||||
|         logininforEvent.setUsername(username); |  | ||||||
|         logininforEvent.setStatus(status); |  | ||||||
|         logininforEvent.setMessage(message); |  | ||||||
|         logininforEvent.setRequest(ServletUtils.getRequest()); |  | ||||||
|         SpringUtils.context().publishEvent(logininforEvent); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,102 +0,0 @@ | |||||||
| package org.dromara.web.service.impl; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.GlobalConstants; |  | ||||||
| import org.dromara.common.core.domain.model.EmailLoginBody; |  | ||||||
| import org.dromara.common.core.domain.model.LoginUser; |  | ||||||
| import org.dromara.common.core.enums.LoginType; |  | ||||||
| import org.dromara.common.core.enums.UserStatus; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaExpireException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.MessageUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.core.utils.ValidatorUtils; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.system.domain.SysUser; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 邮件认证策略 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @Service("email" + IAuthStrategy.BASE_NAME) |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| public class EmailAuthStrategy implements IAuthStrategy { |  | ||||||
|  |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public LoginVo login(String body, SysClientVo client) { |  | ||||||
|         EmailLoginBody loginBody = JsonUtils.parseObject(body, EmailLoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         String tenantId = loginBody.getTenantId(); |  | ||||||
|         String email = loginBody.getEmail(); |  | ||||||
|         String emailCode = loginBody.getEmailCode(); |  | ||||||
|         LoginUser loginUser = TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             SysUserVo user = loadUserByEmail(email); |  | ||||||
|             loginService.checkLogin(LoginType.EMAIL, tenantId, user.getUserName(), () -> !validateEmailCode(tenantId, email, emailCode)); |  | ||||||
|             // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 |  | ||||||
|             return loginService.buildLoginUser(user); |  | ||||||
|         }); |  | ||||||
|         loginUser.setClientKey(client.getClientKey()); |  | ||||||
|         loginUser.setDeviceType(client.getDeviceType()); |  | ||||||
|         SaLoginModel model = new SaLoginModel(); |  | ||||||
|         model.setDevice(client.getDeviceType()); |  | ||||||
|         // 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置 |  | ||||||
|         // 例如: 后台用户30分钟过期 app用户1天过期 |  | ||||||
|         model.setTimeout(client.getTimeout()); |  | ||||||
|         model.setActiveTimeout(client.getActiveTimeout()); |  | ||||||
|         model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId()); |  | ||||||
|         // 生成token |  | ||||||
|         LoginHelper.login(loginUser, model); |  | ||||||
|  |  | ||||||
|         LoginVo loginVo = new LoginVo(); |  | ||||||
|         loginVo.setAccessToken(StpUtil.getTokenValue()); |  | ||||||
|         loginVo.setExpireIn(StpUtil.getTokenTimeout()); |  | ||||||
|         loginVo.setClientId(client.getClientId()); |  | ||||||
|         return loginVo; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 校验邮箱验证码 |  | ||||||
|      */ |  | ||||||
|     private boolean validateEmailCode(String tenantId, String email, String emailCode) { |  | ||||||
|         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + email); |  | ||||||
|         if (StringUtils.isBlank(code)) { |  | ||||||
|             loginService.recordLogininfor(tenantId, email, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); |  | ||||||
|             throw new CaptchaExpireException(); |  | ||||||
|         } |  | ||||||
|         return code.equals(emailCode); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private SysUserVo loadUserByEmail(String email) { |  | ||||||
|         SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getEmail, email)); |  | ||||||
|         if (ObjectUtil.isNull(user)) { |  | ||||||
|             log.info("登录用户:{} 不存在.", email); |  | ||||||
|             throw new UserException("user.not.exists", email); |  | ||||||
|         } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |  | ||||||
|             log.info("登录用户:{} 已被停用.", email); |  | ||||||
|             throw new UserException("user.blocked", email); |  | ||||||
|         } |  | ||||||
|         return user; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,123 +0,0 @@ | |||||||
| package org.dromara.web.service.impl; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.secure.BCrypt; |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.GlobalConstants; |  | ||||||
| import org.dromara.common.core.domain.model.LoginUser; |  | ||||||
| import org.dromara.common.core.domain.model.PasswordLoginBody; |  | ||||||
| import org.dromara.common.core.enums.LoginType; |  | ||||||
| import org.dromara.common.core.enums.UserStatus; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaException; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaExpireException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.MessageUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.core.utils.ValidatorUtils; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.common.web.config.properties.CaptchaProperties; |  | ||||||
| import org.dromara.system.domain.SysUser; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 密码认证策略 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @Service("password" + IAuthStrategy.BASE_NAME) |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| public class PasswordAuthStrategy implements IAuthStrategy { |  | ||||||
|  |  | ||||||
|     private final CaptchaProperties captchaProperties; |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public LoginVo login(String body, SysClientVo client) { |  | ||||||
|         PasswordLoginBody loginBody = JsonUtils.parseObject(body, PasswordLoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         String tenantId = loginBody.getTenantId(); |  | ||||||
|         String username = loginBody.getUsername(); |  | ||||||
|         String password = loginBody.getPassword(); |  | ||||||
|         String code = loginBody.getCode(); |  | ||||||
|         String uuid = loginBody.getUuid(); |  | ||||||
|  |  | ||||||
|         boolean captchaEnabled = captchaProperties.getEnable(); |  | ||||||
|         // 验证码开关 |  | ||||||
|         if (captchaEnabled) { |  | ||||||
|             validateCaptcha(tenantId, username, code, uuid); |  | ||||||
|         } |  | ||||||
|         LoginUser loginUser = TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             SysUserVo user = loadUserByUsername(username); |  | ||||||
|             loginService.checkLogin(LoginType.PASSWORD, tenantId, username, () -> !BCrypt.checkpw(password, user.getPassword())); |  | ||||||
|             // 此处可根据登录用户的数据不同 自行创建 loginUser |  | ||||||
|             return loginService.buildLoginUser(user); |  | ||||||
|         }); |  | ||||||
|         loginUser.setClientKey(client.getClientKey()); |  | ||||||
|         loginUser.setDeviceType(client.getDeviceType()); |  | ||||||
|         SaLoginModel model = new SaLoginModel(); |  | ||||||
|         model.setDevice(client.getDeviceType()); |  | ||||||
|         // 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置 |  | ||||||
|         // 例如: 后台用户30分钟过期 app用户1天过期 |  | ||||||
|         model.setTimeout(client.getTimeout()); |  | ||||||
|         model.setActiveTimeout(client.getActiveTimeout()); |  | ||||||
|         model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId()); |  | ||||||
|         // 生成token |  | ||||||
|         LoginHelper.login(loginUser, model); |  | ||||||
|  |  | ||||||
|         LoginVo loginVo = new LoginVo(); |  | ||||||
|         loginVo.setAccessToken(StpUtil.getTokenValue()); |  | ||||||
|         loginVo.setExpireIn(StpUtil.getTokenTimeout()); |  | ||||||
|         loginVo.setClientId(client.getClientId()); |  | ||||||
|         return loginVo; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 校验验证码 |  | ||||||
|      * |  | ||||||
|      * @param username 用户名 |  | ||||||
|      * @param code     验证码 |  | ||||||
|      * @param uuid     唯一标识 |  | ||||||
|      */ |  | ||||||
|     private void validateCaptcha(String tenantId, String username, String code, String uuid) { |  | ||||||
|         String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.blankToDefault(uuid, ""); |  | ||||||
|         String captcha = RedisUtils.getCacheObject(verifyKey); |  | ||||||
|         RedisUtils.deleteObject(verifyKey); |  | ||||||
|         if (captcha == null) { |  | ||||||
|             loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); |  | ||||||
|             throw new CaptchaExpireException(); |  | ||||||
|         } |  | ||||||
|         if (!code.equalsIgnoreCase(captcha)) { |  | ||||||
|             loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")); |  | ||||||
|             throw new CaptchaException(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private SysUserVo loadUserByUsername(String username) { |  | ||||||
|         SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username)); |  | ||||||
|         if (ObjectUtil.isNull(user)) { |  | ||||||
|             log.info("登录用户:{} 不存在.", username); |  | ||||||
|             throw new UserException("user.not.exists", username); |  | ||||||
|         } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |  | ||||||
|             log.info("登录用户:{} 已被停用.", username); |  | ||||||
|             throw new UserException("user.blocked", username); |  | ||||||
|         } |  | ||||||
|         return user; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,102 +0,0 @@ | |||||||
| package org.dromara.web.service.impl; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.constant.Constants; |  | ||||||
| import org.dromara.common.core.constant.GlobalConstants; |  | ||||||
| import org.dromara.common.core.domain.model.LoginUser; |  | ||||||
| import org.dromara.common.core.domain.model.SmsLoginBody; |  | ||||||
| import org.dromara.common.core.enums.LoginType; |  | ||||||
| import org.dromara.common.core.enums.UserStatus; |  | ||||||
| import org.dromara.common.core.exception.user.CaptchaExpireException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.MessageUtils; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.dromara.common.core.utils.ValidatorUtils; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.redis.utils.RedisUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.system.domain.SysUser; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 短信认证策略 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @Service("sms" + IAuthStrategy.BASE_NAME) |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| public class SmsAuthStrategy implements IAuthStrategy { |  | ||||||
|  |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public LoginVo login(String body, SysClientVo client) { |  | ||||||
|         SmsLoginBody loginBody = JsonUtils.parseObject(body, SmsLoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         String tenantId = loginBody.getTenantId(); |  | ||||||
|         String phonenumber = loginBody.getPhonenumber(); |  | ||||||
|         String smsCode = loginBody.getSmsCode(); |  | ||||||
|         LoginUser loginUser = TenantHelper.dynamic(tenantId, () -> { |  | ||||||
|             SysUserVo user = loadUserByPhonenumber(phonenumber); |  | ||||||
|             loginService.checkLogin(LoginType.SMS, tenantId, user.getUserName(), () -> !validateSmsCode(tenantId, phonenumber, smsCode)); |  | ||||||
|             // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 |  | ||||||
|             return loginService.buildLoginUser(user); |  | ||||||
|         }); |  | ||||||
|         loginUser.setClientKey(client.getClientKey()); |  | ||||||
|         loginUser.setDeviceType(client.getDeviceType()); |  | ||||||
|         SaLoginModel model = new SaLoginModel(); |  | ||||||
|         model.setDevice(client.getDeviceType()); |  | ||||||
|         // 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置 |  | ||||||
|         // 例如: 后台用户30分钟过期 app用户1天过期 |  | ||||||
|         model.setTimeout(client.getTimeout()); |  | ||||||
|         model.setActiveTimeout(client.getActiveTimeout()); |  | ||||||
|         model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId()); |  | ||||||
|         // 生成token |  | ||||||
|         LoginHelper.login(loginUser, model); |  | ||||||
|  |  | ||||||
|         LoginVo loginVo = new LoginVo(); |  | ||||||
|         loginVo.setAccessToken(StpUtil.getTokenValue()); |  | ||||||
|         loginVo.setExpireIn(StpUtil.getTokenTimeout()); |  | ||||||
|         loginVo.setClientId(client.getClientId()); |  | ||||||
|         return loginVo; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 校验短信验证码 |  | ||||||
|      */ |  | ||||||
|     private boolean validateSmsCode(String tenantId, String phonenumber, String smsCode) { |  | ||||||
|         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + phonenumber); |  | ||||||
|         if (StringUtils.isBlank(code)) { |  | ||||||
|             loginService.recordLogininfor(tenantId, phonenumber, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); |  | ||||||
|             throw new CaptchaExpireException(); |  | ||||||
|         } |  | ||||||
|         return code.equals(smsCode); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private SysUserVo loadUserByPhonenumber(String phonenumber) { |  | ||||||
|         SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhonenumber, phonenumber)); |  | ||||||
|         if (ObjectUtil.isNull(user)) { |  | ||||||
|             log.info("登录用户:{} 不存在.", phonenumber); |  | ||||||
|             throw new UserException("user.not.exists", phonenumber); |  | ||||||
|         } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |  | ||||||
|             log.info("登录用户:{} 已被停用.", phonenumber); |  | ||||||
|             throw new UserException("user.blocked", phonenumber); |  | ||||||
|         } |  | ||||||
|         return user; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,131 +0,0 @@ | |||||||
| package org.dromara.web.service.impl; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.collection.CollUtil; |  | ||||||
| import cn.hutool.core.map.MapUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import cn.hutool.http.HttpUtil; |  | ||||||
| import cn.hutool.http.Method; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import me.zhyd.oauth.model.AuthResponse; |  | ||||||
| import me.zhyd.oauth.model.AuthUser; |  | ||||||
| import org.dromara.common.core.domain.model.LoginUser; |  | ||||||
| import org.dromara.common.core.domain.model.SocialLoginBody; |  | ||||||
| import org.dromara.common.core.enums.UserStatus; |  | ||||||
| import org.dromara.common.core.exception.ServiceException; |  | ||||||
| import org.dromara.common.core.exception.user.UserException; |  | ||||||
| import org.dromara.common.core.utils.StreamUtils; |  | ||||||
| import org.dromara.common.core.utils.ValidatorUtils; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.common.social.config.properties.SocialProperties; |  | ||||||
| import org.dromara.common.social.utils.SocialUtils; |  | ||||||
| import org.dromara.common.tenant.helper.TenantHelper; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysSocialVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.system.mapper.SysUserMapper; |  | ||||||
| import org.dromara.system.service.ISysSocialService; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Optional; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 第三方授权策略 |  | ||||||
|  * |  | ||||||
|  * @author thiszhc is 三三 |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @Service("social" + IAuthStrategy.BASE_NAME) |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| public class SocialAuthStrategy implements IAuthStrategy { |  | ||||||
|  |  | ||||||
|     private final SocialProperties socialProperties; |  | ||||||
|     private final ISysSocialService sysSocialService; |  | ||||||
|     private final SysUserMapper userMapper; |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录-第三方授权登录 |  | ||||||
|      * |  | ||||||
|      * @param body     登录信息 |  | ||||||
|      * @param client   客户端信息 |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public LoginVo login(String body, SysClientVo client) { |  | ||||||
|         SocialLoginBody loginBody = JsonUtils.parseObject(body, SocialLoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         AuthResponse<AuthUser> response = SocialUtils.loginAuth( |  | ||||||
|                 loginBody.getSource(), loginBody.getSocialCode(), |  | ||||||
|                 loginBody.getSocialState(), socialProperties); |  | ||||||
|         if (!response.ok()) { |  | ||||||
|             throw new ServiceException(response.getMsg()); |  | ||||||
|         } |  | ||||||
|         AuthUser authUserData = response.getData(); |  | ||||||
|         if ("GITEE".equals(authUserData.getSource())) { |  | ||||||
|             // 如用户使用 gitee 登录顺手 star 给作者一点支持 拒绝白嫖 |  | ||||||
|             HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Vue-Plus") |  | ||||||
|                     .formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken())) |  | ||||||
|                     .executeAsync(); |  | ||||||
|             HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Cloud-Plus") |  | ||||||
|                     .formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken())) |  | ||||||
|                     .executeAsync(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         List<SysSocialVo> list = sysSocialService.selectByAuthId(authUserData.getSource() + authUserData.getUuid()); |  | ||||||
|         if (CollUtil.isEmpty(list)) { |  | ||||||
|             throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!"); |  | ||||||
|         } |  | ||||||
|         SysSocialVo social; |  | ||||||
|         if (TenantHelper.isEnable()) { |  | ||||||
|             Optional<SysSocialVo> opt = StreamUtils.findAny(list, x -> x.getTenantId().equals(loginBody.getTenantId())); |  | ||||||
|             if (opt.isEmpty()) { |  | ||||||
|                 throw new ServiceException("对不起,你没有权限登录当前租户!"); |  | ||||||
|             } |  | ||||||
|             social = opt.get(); |  | ||||||
|         } else { |  | ||||||
|             social = list.get(0); |  | ||||||
|         } |  | ||||||
|         LoginUser loginUser = TenantHelper.dynamic(social.getTenantId(), () -> { |  | ||||||
|             SysUserVo user = loadUser(social.getUserId()); |  | ||||||
|             // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 |  | ||||||
|             return loginService.buildLoginUser(user); |  | ||||||
|         }); |  | ||||||
|         loginUser.setClientKey(client.getClientKey()); |  | ||||||
|         loginUser.setDeviceType(client.getDeviceType()); |  | ||||||
|         SaLoginModel model = new SaLoginModel(); |  | ||||||
|         model.setDevice(client.getDeviceType()); |  | ||||||
|         // 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置 |  | ||||||
|         // 例如: 后台用户30分钟过期 app用户1天过期 |  | ||||||
|         model.setTimeout(client.getTimeout()); |  | ||||||
|         model.setActiveTimeout(client.getActiveTimeout()); |  | ||||||
|         model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId()); |  | ||||||
|         // 生成token |  | ||||||
|         LoginHelper.login(loginUser, model); |  | ||||||
|  |  | ||||||
|         LoginVo loginVo = new LoginVo(); |  | ||||||
|         loginVo.setAccessToken(StpUtil.getTokenValue()); |  | ||||||
|         loginVo.setExpireIn(StpUtil.getTokenTimeout()); |  | ||||||
|         loginVo.setClientId(client.getClientId()); |  | ||||||
|         return loginVo; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private SysUserVo loadUser(Long userId) { |  | ||||||
|         SysUserVo user = userMapper.selectVoById(userId); |  | ||||||
|         if (ObjectUtil.isNull(user)) { |  | ||||||
|             log.info("登录用户:{} 不存在.", ""); |  | ||||||
|             throw new UserException("user.not.exists", ""); |  | ||||||
|         } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |  | ||||||
|             log.info("登录用户:{} 已被停用.", ""); |  | ||||||
|             throw new UserException("user.blocked", ""); |  | ||||||
|         } |  | ||||||
|         return user; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,92 +0,0 @@ | |||||||
| package org.dromara.web.service.impl; |  | ||||||
|  |  | ||||||
| import cn.dev33.satoken.stp.SaLoginModel; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import lombok.RequiredArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.dromara.common.core.domain.model.XcxLoginBody; |  | ||||||
| import org.dromara.common.core.domain.model.XcxLoginUser; |  | ||||||
| import org.dromara.common.core.enums.UserStatus; |  | ||||||
| import org.dromara.common.core.utils.ValidatorUtils; |  | ||||||
| import org.dromara.common.json.utils.JsonUtils; |  | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; |  | ||||||
| import org.dromara.system.domain.SysClient; |  | ||||||
| import org.dromara.system.domain.vo.SysClientVo; |  | ||||||
| import org.dromara.system.domain.vo.SysUserVo; |  | ||||||
| import org.dromara.web.domain.vo.LoginVo; |  | ||||||
| import org.dromara.web.service.IAuthStrategy; |  | ||||||
| import org.dromara.web.service.SysLoginService; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 小程序认证策略 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @Service("xcx" + IAuthStrategy.BASE_NAME) |  | ||||||
| @RequiredArgsConstructor |  | ||||||
| public class XcxAuthStrategy implements IAuthStrategy { |  | ||||||
|  |  | ||||||
|     private final SysLoginService loginService; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public LoginVo login(String body, SysClientVo client) { |  | ||||||
|         XcxLoginBody loginBody = JsonUtils.parseObject(body, XcxLoginBody.class); |  | ||||||
|         ValidatorUtils.validate(loginBody); |  | ||||||
|         // xcxCode 为 小程序调用 wx.login 授权后获取 |  | ||||||
|         String xcxCode = loginBody.getXcxCode(); |  | ||||||
|         // 多个小程序识别使用 |  | ||||||
|         String appid = loginBody.getAppid(); |  | ||||||
|  |  | ||||||
|         // todo 以下自行实现 |  | ||||||
|         // 校验 appid + appsrcret + xcxCode 调用登录凭证校验接口 获取 session_key 与 openid |  | ||||||
|         String openid = ""; |  | ||||||
|         // 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可 |  | ||||||
|         SysUserVo user = loadUserByOpenid(openid); |  | ||||||
|  |  | ||||||
|         // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 |  | ||||||
|         XcxLoginUser loginUser = new XcxLoginUser(); |  | ||||||
|         loginUser.setTenantId(user.getTenantId()); |  | ||||||
|         loginUser.setUserId(user.getUserId()); |  | ||||||
|         loginUser.setUsername(user.getUserName()); |  | ||||||
|         loginUser.setNickname(user.getNickName()); |  | ||||||
|         loginUser.setUserType(user.getUserType()); |  | ||||||
|         loginUser.setClientKey(client.getClientKey()); |  | ||||||
|         loginUser.setDeviceType(client.getDeviceType()); |  | ||||||
|         loginUser.setOpenid(openid); |  | ||||||
|  |  | ||||||
|         SaLoginModel model = new SaLoginModel(); |  | ||||||
|         model.setDevice(client.getDeviceType()); |  | ||||||
|         // 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置 |  | ||||||
|         // 例如: 后台用户30分钟过期 app用户1天过期 |  | ||||||
|         model.setTimeout(client.getTimeout()); |  | ||||||
|         model.setActiveTimeout(client.getActiveTimeout()); |  | ||||||
|         model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId()); |  | ||||||
|         // 生成token |  | ||||||
|         LoginHelper.login(loginUser, model); |  | ||||||
|  |  | ||||||
|         LoginVo loginVo = new LoginVo(); |  | ||||||
|         loginVo.setAccessToken(StpUtil.getTokenValue()); |  | ||||||
|         loginVo.setExpireIn(StpUtil.getTokenTimeout()); |  | ||||||
|         loginVo.setClientId(client.getClientId()); |  | ||||||
|         loginVo.setOpenid(openid); |  | ||||||
|         return loginVo; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private SysUserVo loadUserByOpenid(String openid) { |  | ||||||
|         // 使用 openid 查询绑定用户 如未绑定用户 则根据业务自行处理 例如 创建默认用户 |  | ||||||
|         // todo 自行实现 userService.selectUserByOpenid(openid); |  | ||||||
|         SysUserVo user = new SysUserVo(); |  | ||||||
|         if (ObjectUtil.isNull(user)) { |  | ||||||
|             log.info("登录用户:{} 不存在.", openid); |  | ||||||
|             // todo 用户不存在 业务逻辑自行实现 |  | ||||||
|         } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |  | ||||||
|             log.info("登录用户:{} 已被停用.", openid); |  | ||||||
|             // todo 用户已被停用 业务逻辑自行实现 |  | ||||||
|         } |  | ||||||
|         return user; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -5,28 +5,30 @@ spring.boot.admin.client: | |||||||
|   url: http://localhost:9090/admin |   url: http://localhost:9090/admin | ||||||
|   instance: |   instance: | ||||||
|     service-host-type: IP |     service-host-type: IP | ||||||
|     metadata: |   username: ruoyi | ||||||
|       username: ${spring.boot.admin.client.username} |   password: 123456 | ||||||
|       userpassword: ${spring.boot.admin.client.password} |  | ||||||
|   username: @monitor.username@ |  | ||||||
|   password: @monitor.password@ |  | ||||||
|  |  | ||||||
| --- # snail-job 配置 | --- # xxl-job 配置 | ||||||
| snail-job: | xxl.job: | ||||||
|  |   # 执行器开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务 |   # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 | ||||||
|   group: "ruoyi_group" |   admin-addresses: http://localhost:9100/xxl-job-admin | ||||||
|   # SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表 |   # 执行器通讯TOKEN:非空时启用 | ||||||
|   token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT" |   access-token: xxl-job | ||||||
|   server: |   executor: | ||||||
|     host: 127.0.0.1 |     # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 | ||||||
|     port: 17888 |     appname: xxl-job-executor | ||||||
|   # 详见 script/sql/snail_job.sql `sj_namespace` 表 |     # 执行器端口号 执行器从9101开始往后写 | ||||||
|   namespace: ${spring.profiles.active} |     port: 9101 | ||||||
|   # 随主应用端口飘逸 |     # 执行器注册:默认IP:PORT | ||||||
|   port: 2${server.port} |     address: | ||||||
|   # 客户端ip指定 |     # 执行器IP:默认自动获取IP | ||||||
|   host: |     ip: | ||||||
|  |     # 执行器运行日志文件存储磁盘路径 | ||||||
|  |     logpath: ./logs/xxl-job | ||||||
|  |     # 执行器日志文件保存天数:大于3生效 | ||||||
|  |     logretentiondays: 30 | ||||||
|  |  | ||||||
| --- # 数据源配置 | --- # 数据源配置 | ||||||
| spring: | spring: | ||||||
| @@ -47,7 +49,7 @@ spring: | |||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 |           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 | ||||||
|           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) |           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) | ||||||
|           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true | ||||||
|           username: root |           username: root | ||||||
|           password: root |           password: root | ||||||
|         # 从库数据源 |         # 从库数据源 | ||||||
| @@ -55,7 +57,7 @@ spring: | |||||||
|           lazy: true |           lazy: true | ||||||
|           type: ${spring.datasource.type} |           type: ${spring.datasource.type} | ||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true | ||||||
|           username: |           username: | ||||||
|           password: |           password: | ||||||
| #        oracle: | #        oracle: | ||||||
| @@ -64,6 +66,8 @@ spring: | |||||||
| #          url: jdbc:oracle:thin:@//localhost:1521/XE | #          url: jdbc:oracle:thin:@//localhost:1521/XE | ||||||
| #          username: ROOT | #          username: ROOT | ||||||
| #          password: root | #          password: root | ||||||
|  | #          hikari: | ||||||
|  | #            connectionTestQuery: SELECT 1 FROM DUAL | ||||||
| #        postgres: | #        postgres: | ||||||
| #          type: ${spring.datasource.type} | #          type: ${spring.datasource.type} | ||||||
| #          driverClassName: org.postgresql.Driver | #          driverClassName: org.postgresql.Driver | ||||||
| @@ -82,18 +86,18 @@ spring: | |||||||
|         # 最小空闲线程数量 |         # 最小空闲线程数量 | ||||||
|         minIdle: 10 |         minIdle: 10 | ||||||
|         # 配置获取连接等待超时的时间 |         # 配置获取连接等待超时的时间 | ||||||
|         connectionTimeout: 30000 |         connectionTimeout: 10000 | ||||||
|         # 校验超时时间 |         # 校验超时时间 | ||||||
|         validationTimeout: 5000 |         validationTimeout: 5000 | ||||||
|         # 空闲连接存活最大时间,默认10分钟 |         # 空闲连接存活最大时间,默认10分钟 | ||||||
|         idleTimeout: 600000 |         idleTimeout: 60000 | ||||||
|         # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 |         # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 | ||||||
|         maxLifetime: 1800000 |         maxLifetime: 900000 | ||||||
|         # 多久检查一次连接的活性 |         # 连接测试query(配置检测连接是否有效) | ||||||
|         keepaliveTime: 30000 |         connectionTestQuery: SELECT 1 | ||||||
|  |  | ||||||
| --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) | --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) | ||||||
| spring.data: | spring: | ||||||
|   redis: |   redis: | ||||||
|     # 地址 |     # 地址 | ||||||
|     host: localhost |     host: localhost | ||||||
| @@ -101,14 +105,13 @@ spring.data: | |||||||
|     port: 6379 |     port: 6379 | ||||||
|     # 数据库索引 |     # 数据库索引 | ||||||
|     database: 0 |     database: 0 | ||||||
|     # redis 密码必须配置 |     # 密码(如没有密码请注释掉) | ||||||
|     password: ruoyi123 |     # password: | ||||||
|     # 连接超时时间 |     # 连接超时时间 | ||||||
|     timeout: 10s |     timeout: 10s | ||||||
|     # 是否开启ssl |     # 是否开启ssl | ||||||
|     ssl.enabled: false |     ssl: false | ||||||
|  |  | ||||||
| # redisson 配置 |  | ||||||
| redisson: | redisson: | ||||||
|   # redis key前缀 |   # redis key前缀 | ||||||
|   keyPrefix: |   keyPrefix: | ||||||
| @@ -153,111 +156,14 @@ mail: | |||||||
|   # Socket连接超时值,单位毫秒,缺省值不超时 |   # Socket连接超时值,单位毫秒,缺省值不超时 | ||||||
|   connectionTimeout: 0 |   connectionTimeout: 0 | ||||||
|  |  | ||||||
| --- # sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商 | --- # sms 短信 | ||||||
| # https://sms4j.com/doc3/ 差异配置文档地址 支持单厂商多配置,可以配置多个同时使用 |  | ||||||
| sms: | sms: | ||||||
|   # 配置源类型用于标定配置来源(interface,yaml) |   enabled: false | ||||||
|   config-type: yaml |   # 阿里云 dysmsapi.aliyuncs.com | ||||||
|   # 用于标定yml中的配置是否开启短信拦截,接口配置不受此限制 |   # 腾讯云 sms.tencentcloudapi.com | ||||||
|   restricted: true |   endpoint: "dysmsapi.aliyuncs.com" | ||||||
|   # 短信拦截限制单手机号每分钟最大发送,只对开启了拦截的配置有效 |   accessKeyId: xxxxxxx | ||||||
|   minute-max: 1 |   accessKeySecret: xxxxxx | ||||||
|   # 短信拦截限制单手机号每日最大发送量,只对开启了拦截的配置有效 |   signName: 测试 | ||||||
|   account-max: 30 |   # 腾讯专用 | ||||||
|   # 以下配置来自于 org.dromara.sms4j.provider.config.BaseConfig类中 |   sdkAppId: | ||||||
|   blends: |  | ||||||
|     # 唯一ID 用于发送短信寻找具体配置 随便定义别用中文即可 |  | ||||||
|     # 可以同时存在两个相同厂商 例如: ali1 ali2 两个不同的阿里短信账号 也可用于区分租户 |  | ||||||
|     config1: |  | ||||||
|       # 框架定义的厂商名称标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |  | ||||||
|       supplier: alibaba |  | ||||||
|       # 有些称为accessKey有些称之为apiKey,也有称为sdkKey或者appId。 |  | ||||||
|       access-key-id: 您的accessKey |  | ||||||
|       # 称为accessSecret有些称之为apiSecret |  | ||||||
|       access-key-secret: 您的accessKeySecret |  | ||||||
|       signature: 您的短信签名 |  | ||||||
|       sdk-app-id: 您的sdkAppId |  | ||||||
|     config2: |  | ||||||
|       # 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |  | ||||||
|       supplier: tencent |  | ||||||
|       access-key-id: 您的accessKey |  | ||||||
|       access-key-secret: 您的accessKeySecret |  | ||||||
|       signature: 您的短信签名 |  | ||||||
|       sdk-app-id: 您的sdkAppId |  | ||||||
|  |  | ||||||
|  |  | ||||||
| --- # 三方授权 |  | ||||||
| justauth: |  | ||||||
|   # 前端外网访问地址 |  | ||||||
|   address: http://localhost:80 |  | ||||||
|   type: |  | ||||||
|     maxkey: |  | ||||||
|       # maxkey 服务器地址 |  | ||||||
|       # 注意 如下均配置均不需要修改 maxkey 已经内置好了数据 |  | ||||||
|       server-url: http://sso.maxkey.top |  | ||||||
|       client-id: 876892492581044224 |  | ||||||
|       client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8 |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=maxkey |  | ||||||
|     topiam: |  | ||||||
|       # topiam 服务器地址 |  | ||||||
|       server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol |  | ||||||
|       client-id: 449c4*********937************759 |  | ||||||
|       client-secret: ac7***********1e0************28d |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=topiam |  | ||||||
|       scopes: [openid, email, phone, profile] |  | ||||||
|     qq: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=qq |  | ||||||
|       union-id: false |  | ||||||
|     weibo: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=weibo |  | ||||||
|     gitee: |  | ||||||
|       client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98 |  | ||||||
|       client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=gitee |  | ||||||
|     dingtalk: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=dingtalk |  | ||||||
|     baidu: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=baidu |  | ||||||
|     csdn: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=csdn |  | ||||||
|     coding: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=coding |  | ||||||
|       coding-group-name: xx |  | ||||||
|     oschina: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=oschina |  | ||||||
|     alipay_wallet: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet |  | ||||||
|       alipay-public-key: MIIB**************DAQAB |  | ||||||
|     wechat_open: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_open |  | ||||||
|     wechat_mp: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_mp |  | ||||||
|     wechat_enterprise: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise |  | ||||||
|       agent-id: 1000002 |  | ||||||
|     gitlab: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=gitlab |  | ||||||
|   | |||||||
| @@ -8,28 +8,30 @@ spring.boot.admin.client: | |||||||
|   url: http://localhost:9090/admin |   url: http://localhost:9090/admin | ||||||
|   instance: |   instance: | ||||||
|     service-host-type: IP |     service-host-type: IP | ||||||
|     metadata: |   username: ruoyi | ||||||
|       username: ${spring.boot.admin.client.username} |   password: 123456 | ||||||
|       userpassword: ${spring.boot.admin.client.password} |  | ||||||
|   username: @monitor.username@ |  | ||||||
|   password: @monitor.password@ |  | ||||||
|  |  | ||||||
| --- # snail-job 配置 | --- # xxl-job 配置 | ||||||
| snail-job: | xxl.job: | ||||||
|  |   # 执行器开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务 |   # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 | ||||||
|   group: "ruoyi_group" |   admin-addresses: http://localhost:9100/xxl-job-admin | ||||||
|   # SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表 |   # 执行器通讯TOKEN:非空时启用 | ||||||
|   token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT" |   access-token: xxl-job | ||||||
|   server: |   executor: | ||||||
|     host: 127.0.0.1 |     # 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册 | ||||||
|     port: 17888 |     appname: xxl-job-executor | ||||||
|   # 详见 script/sql/snail_job.sql `sj_namespace` 表 |     # 执行器端口号 执行器从9101开始往后写 | ||||||
|   namespace: ${spring.profiles.active} |     port: 9101 | ||||||
|   # 随主应用端口飘逸 |     # 执行器注册:默认IP:PORT | ||||||
|   port: 2${server.port} |     address: | ||||||
|   # 客户端ip指定 |     # 执行器IP:默认自动获取IP | ||||||
|   host: |     ip: | ||||||
|  |     # 执行器运行日志文件存储磁盘路径 | ||||||
|  |     logpath: ./logs/xxl-job | ||||||
|  |     # 执行器日志文件保存天数:大于3生效 | ||||||
|  |     logretentiondays: 30 | ||||||
|  |  | ||||||
| --- # 数据源配置 | --- # 数据源配置 | ||||||
| spring: | spring: | ||||||
| @@ -50,7 +52,7 @@ spring: | |||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 |           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 | ||||||
|           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) |           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) | ||||||
|           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true | ||||||
|           username: root |           username: root | ||||||
|           password: root |           password: root | ||||||
|         # 从库数据源 |         # 从库数据源 | ||||||
| @@ -58,7 +60,7 @@ spring: | |||||||
|           lazy: true |           lazy: true | ||||||
|           type: ${spring.datasource.type} |           type: ${spring.datasource.type} | ||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true | ||||||
|           username: |           username: | ||||||
|           password: |           password: | ||||||
| #        oracle: | #        oracle: | ||||||
| @@ -67,6 +69,8 @@ spring: | |||||||
| #          url: jdbc:oracle:thin:@//localhost:1521/XE | #          url: jdbc:oracle:thin:@//localhost:1521/XE | ||||||
| #          username: ROOT | #          username: ROOT | ||||||
| #          password: root | #          password: root | ||||||
|  | #          hikari: | ||||||
|  | #            connectionTestQuery: SELECT 1 FROM DUAL | ||||||
| #        postgres: | #        postgres: | ||||||
| #          type: ${spring.datasource.type} | #          type: ${spring.datasource.type} | ||||||
| #          driverClassName: org.postgresql.Driver | #          driverClassName: org.postgresql.Driver | ||||||
| @@ -85,18 +89,18 @@ spring: | |||||||
|         # 最小空闲线程数量 |         # 最小空闲线程数量 | ||||||
|         minIdle: 10 |         minIdle: 10 | ||||||
|         # 配置获取连接等待超时的时间 |         # 配置获取连接等待超时的时间 | ||||||
|         connectionTimeout: 30000 |         connectionTimeout: 10000 | ||||||
|         # 校验超时时间 |         # 校验超时时间 | ||||||
|         validationTimeout: 5000 |         validationTimeout: 5000 | ||||||
|         # 空闲连接存活最大时间,默认10分钟 |         # 空闲连接存活最大时间,默认10分钟 | ||||||
|         idleTimeout: 600000 |         idleTimeout: 60000 | ||||||
|         # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 |         # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 | ||||||
|         maxLifetime: 1800000 |         maxLifetime: 900000 | ||||||
|         # 多久检查一次连接的活性 |         # 连接测试query(配置检测连接是否有效) | ||||||
|         keepaliveTime: 30000 |         connectionTestQuery: SELECT 1 | ||||||
|  |  | ||||||
| --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) | --- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) | ||||||
| spring.data: | spring: | ||||||
|   redis: |   redis: | ||||||
|     # 地址 |     # 地址 | ||||||
|     host: localhost |     host: localhost | ||||||
| @@ -104,14 +108,13 @@ spring.data: | |||||||
|     port: 6379 |     port: 6379 | ||||||
|     # 数据库索引 |     # 数据库索引 | ||||||
|     database: 0 |     database: 0 | ||||||
|     # redis 密码必须配置 |     # 密码(如没有密码请注释掉) | ||||||
|     password: ruoyi123 |     # password: | ||||||
|     # 连接超时时间 |     # 连接超时时间 | ||||||
|     timeout: 10s |     timeout: 10s | ||||||
|     # 是否开启ssl |     # 是否开启ssl | ||||||
|     ssl.enabled: false |     ssl: false | ||||||
|  |  | ||||||
| # redisson 配置 |  | ||||||
| redisson: | redisson: | ||||||
|   # redis key前缀 |   # redis key前缀 | ||||||
|   keyPrefix: |   keyPrefix: | ||||||
| @@ -156,110 +159,14 @@ mail: | |||||||
|   # Socket连接超时值,单位毫秒,缺省值不超时 |   # Socket连接超时值,单位毫秒,缺省值不超时 | ||||||
|   connectionTimeout: 0 |   connectionTimeout: 0 | ||||||
|  |  | ||||||
| --- # sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商 | --- # sms 短信 | ||||||
| # https://sms4j.com/doc3/ 差异配置文档地址 支持单厂商多配置,可以配置多个同时使用 |  | ||||||
| sms: | sms: | ||||||
|   # 配置源类型用于标定配置来源(interface,yaml) |   enabled: false | ||||||
|   config-type: yaml |   # 阿里云 dysmsapi.aliyuncs.com | ||||||
|   # 用于标定yml中的配置是否开启短信拦截,接口配置不受此限制 |   # 腾讯云 sms.tencentcloudapi.com | ||||||
|   restricted: true |   endpoint: "dysmsapi.aliyuncs.com" | ||||||
|   # 短信拦截限制单手机号每分钟最大发送,只对开启了拦截的配置有效 |   accessKeyId: xxxxxxx | ||||||
|   minute-max: 1 |   accessKeySecret: xxxxxx | ||||||
|   # 短信拦截限制单手机号每日最大发送量,只对开启了拦截的配置有效 |   signName: 测试 | ||||||
|   account-max: 30 |   # 腾讯专用 | ||||||
|   # 以下配置来自于 org.dromara.sms4j.provider.config.BaseConfig类中 |   sdkAppId: | ||||||
|   blends: |  | ||||||
|     # 唯一ID 用于发送短信寻找具体配置 随便定义别用中文即可 |  | ||||||
|     # 可以同时存在两个相同厂商 例如: ali1 ali2 两个不同的阿里短信账号 也可用于区分租户 |  | ||||||
|     config1: |  | ||||||
|       # 框架定义的厂商名称标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |  | ||||||
|       supplier: alibaba |  | ||||||
|       # 有些称为accessKey有些称之为apiKey,也有称为sdkKey或者appId。 |  | ||||||
|       access-key-id: 您的accessKey |  | ||||||
|       # 称为accessSecret有些称之为apiSecret |  | ||||||
|       access-key-secret: 您的accessKeySecret |  | ||||||
|       signature: 您的短信签名 |  | ||||||
|       sdk-app-id: 您的sdkAppId |  | ||||||
|     config2: |  | ||||||
|       # 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |  | ||||||
|       supplier: tencent |  | ||||||
|       access-key-id: 您的accessKey |  | ||||||
|       access-key-secret: 您的accessKeySecret |  | ||||||
|       signature: 您的短信签名 |  | ||||||
|       sdk-app-id: 您的sdkAppId |  | ||||||
|  |  | ||||||
| --- # 三方授权 |  | ||||||
| justauth: |  | ||||||
|   # 前端外网访问地址 |  | ||||||
|   address: http://localhost:80 |  | ||||||
|   type: |  | ||||||
|     maxkey: |  | ||||||
|       # maxkey 服务器地址 |  | ||||||
|       # 注意 如下均配置均不需要修改 maxkey 已经内置好了数据 |  | ||||||
|       server-url: http://sso.maxkey.top |  | ||||||
|       client-id: 876892492581044224 |  | ||||||
|       client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8 |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=maxkey |  | ||||||
|     topiam: |  | ||||||
|       # topiam 服务器地址 |  | ||||||
|       server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol |  | ||||||
|       client-id: 449c4*********937************759 |  | ||||||
|       client-secret: ac7***********1e0************28d |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=topiam |  | ||||||
|       scopes: [ openid, email, phone, profile ] |  | ||||||
|     qq: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=qq |  | ||||||
|       union-id: false |  | ||||||
|     weibo: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=weibo |  | ||||||
|     gitee: |  | ||||||
|       client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98 |  | ||||||
|       client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=gitee |  | ||||||
|     dingtalk: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=dingtalk |  | ||||||
|     baidu: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=baidu |  | ||||||
|     csdn: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=csdn |  | ||||||
|     coding: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=coding |  | ||||||
|       coding-group-name: xx |  | ||||||
|     oschina: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=oschina |  | ||||||
|     alipay_wallet: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet |  | ||||||
|       alipay-public-key: MIIB**************DAQAB |  | ||||||
|     wechat_open: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_open |  | ||||||
|     wechat_mp: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_mp |  | ||||||
|     wechat_enterprise: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise |  | ||||||
|       agent-id: 1000002 |  | ||||||
|     gitlab: |  | ||||||
|       client-id: 10**********6 |  | ||||||
|       client-secret: 1f7d08**********5b7**********29e |  | ||||||
|       redirect-uri: ${justauth.address}/social-callback?source=gitlab |  | ||||||
|   | |||||||
| @@ -3,12 +3,17 @@ ruoyi: | |||||||
|   # 名称 |   # 名称 | ||||||
|   name: RuoYi-Vue-Plus |   name: RuoYi-Vue-Plus | ||||||
|   # 版本 |   # 版本 | ||||||
|   version: ${revision} |   version: ${ruoyi-vue-plus.version} | ||||||
|   # 版权年份 |   # 版权年份 | ||||||
|   copyrightYear: 2024 |   copyrightYear: 2022 | ||||||
|  |   # 实例演示开关 | ||||||
|  |   demoEnabled: true | ||||||
|  |   # 获取ip地址开关 | ||||||
|  |   addressEnabled: true | ||||||
|  |   # 缓存懒加载 | ||||||
|  |   cacheLazy: false | ||||||
|  |  | ||||||
| captcha: | captcha: | ||||||
|   enable: true |  | ||||||
|   # 页面 <参数设置> 可开启关闭 验证码校验 |   # 页面 <参数设置> 可开启关闭 验证码校验 | ||||||
|   # 验证码类型 math 数组计算 char 字符验证 |   # 验证码类型 math 数组计算 char 字符验证 | ||||||
|   type: MATH |   type: MATH | ||||||
| @@ -44,10 +49,9 @@ server: | |||||||
| # 日志配置 | # 日志配置 | ||||||
| logging: | logging: | ||||||
|   level: |   level: | ||||||
|     org.dromara: @logging.level@ |     com.ruoyi: @logging.level@ | ||||||
|     org.springframework: warn |     org.springframework: warn | ||||||
|     org.mybatis.spring.mapper: error |   config: classpath:logback.xml | ||||||
|   config: classpath:logback-plus.xml |  | ||||||
|  |  | ||||||
| # 用户配置 | # 用户配置 | ||||||
| user: | user: | ||||||
| @@ -61,10 +65,6 @@ user: | |||||||
| spring: | spring: | ||||||
|   application: |   application: | ||||||
|     name: ${ruoyi.name} |     name: ${ruoyi.name} | ||||||
|   threads: |  | ||||||
|     # 开启虚拟线程 仅jdk21可用 |  | ||||||
|     virtual: |  | ||||||
|       enabled: false |  | ||||||
|   # 资源信息 |   # 资源信息 | ||||||
|   messages: |   messages: | ||||||
|     # 国际化资源文件路径 |     # 国际化资源文件路径 | ||||||
| @@ -78,11 +78,11 @@ spring: | |||||||
|       max-file-size: 10MB |       max-file-size: 10MB | ||||||
|       # 设置总上传的文件大小 |       # 设置总上传的文件大小 | ||||||
|       max-request-size: 20MB |       max-request-size: 20MB | ||||||
|   mvc: |   # 服务模块 | ||||||
|     # 设置静态资源路径 防止所有请求都去查静态资源 |   devtools: | ||||||
|     static-path-pattern: /static/** |     restart: | ||||||
|     format: |       # 热部署开关 | ||||||
|       date-time: yyyy-MM-dd HH:mm:ss |       enabled: true | ||||||
|   jackson: |   jackson: | ||||||
|     # 日期格式化 |     # 日期格式化 | ||||||
|     date-format: yyyy-MM-dd HH:mm:ss |     date-format: yyyy-MM-dd HH:mm:ss | ||||||
| @@ -99,10 +99,20 @@ spring: | |||||||
| sa-token: | sa-token: | ||||||
|   # token名称 (同时也是cookie名称) |   # token名称 (同时也是cookie名称) | ||||||
|   token-name: Authorization |   token-name: Authorization | ||||||
|  |   # token有效期 设为一天 (必定过期) 单位: 秒 | ||||||
|  |   timeout: 86400 | ||||||
|  |   # token临时有效期 (指定时间无操作就过期) 单位: 秒 | ||||||
|  |   activity-timeout: 1800 | ||||||
|   # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) |   # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) | ||||||
|   is-concurrent: true |   is-concurrent: true | ||||||
|   # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) |   # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) | ||||||
|   is-share: false |   is-share: false | ||||||
|  |   # 是否尝试从header里读取token | ||||||
|  |   is-read-header: true | ||||||
|  |   # 是否尝试从cookie里读取token | ||||||
|  |   is-read-cookie: false | ||||||
|  |   # token前缀 | ||||||
|  |   token-prefix: "Bearer" | ||||||
|   # jwt秘钥 |   # jwt秘钥 | ||||||
|   jwt-secret-key: abcdefghijklmnopqrstuvwxyz |   jwt-secret-key: abcdefghijklmnopqrstuvwxyz | ||||||
|  |  | ||||||
| @@ -115,91 +125,74 @@ security: | |||||||
|     - /**/*.html |     - /**/*.html | ||||||
|     - /**/*.css |     - /**/*.css | ||||||
|     - /**/*.js |     - /**/*.js | ||||||
|     # 公共路径 |  | ||||||
|     - /favicon.ico |  | ||||||
|     - /error |  | ||||||
|     # swagger 文档配置 |     # swagger 文档配置 | ||||||
|  |     - /favicon.ico | ||||||
|     - /*/api-docs |     - /*/api-docs | ||||||
|     - /*/api-docs/** |     - /*/api-docs/** | ||||||
|  |     # actuator 监控配置 | ||||||
| # 多租户配置 |     - /actuator | ||||||
| tenant: |     - /actuator/** | ||||||
|   # 是否开启 |  | ||||||
|   enable: true |  | ||||||
|   # 排除表 |  | ||||||
|   excludes: |  | ||||||
|     - sys_menu |  | ||||||
|     - sys_tenant |  | ||||||
|     - sys_tenant_package |  | ||||||
|     - sys_role_dept |  | ||||||
|     - sys_role_menu |  | ||||||
|     - sys_user_post |  | ||||||
|     - sys_user_role |  | ||||||
|     - sys_client |  | ||||||
|     - sys_oss_config |  | ||||||
|  |  | ||||||
| # MyBatisPlus配置 | # MyBatisPlus配置 | ||||||
| # https://baomidou.com/config/ | # https://baomidou.com/config/ | ||||||
| mybatis-plus: | mybatis-plus: | ||||||
|   # 多包名使用 例如 org.dromara.**.mapper,org.xxx.**.mapper |   # 不支持多包, 如有需要可在注解配置 或 提升扫包等级 | ||||||
|   mapperPackage: org.dromara.**.mapper |   # 例如 com.**.**.mapper | ||||||
|  |   mapperPackage: com.ruoyi.**.mapper | ||||||
|   # 对应的 XML 文件位置 |   # 对应的 XML 文件位置 | ||||||
|   mapperLocations: classpath*:mapper/**/*Mapper.xml |   mapperLocations: classpath*:mapper/**/*Mapper.xml | ||||||
|   # 实体扫描,多个package用逗号或者分号分隔 |   # 实体扫描,多个package用逗号或者分号分隔 | ||||||
|   typeAliasesPackage: org.dromara.**.domain |   typeAliasesPackage: com.ruoyi.**.domain | ||||||
|  |   # 启动时是否检查 MyBatis XML 文件的存在,默认不检查 | ||||||
|  |   checkConfigLocation: false | ||||||
|  |   configuration: | ||||||
|  |     # 自动驼峰命名规则(camel case)映射 | ||||||
|  |     mapUnderscoreToCamelCase: true | ||||||
|  |     # MyBatis 自动映射策略 | ||||||
|  |     # NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射 | ||||||
|  |     autoMappingBehavior: PARTIAL | ||||||
|  |     # MyBatis 自动映射时未知列或未知属性处理策 | ||||||
|  |     # NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息 | ||||||
|  |     autoMappingUnknownColumnBehavior: NONE | ||||||
|  |     # 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl | ||||||
|  |     # 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl | ||||||
|  |     # 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl | ||||||
|  |     logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl | ||||||
|   global-config: |   global-config: | ||||||
|  |     # 是否打印 Logo banner | ||||||
|  |     banner: true | ||||||
|     dbConfig: |     dbConfig: | ||||||
|       # 主键类型 |       # 主键类型 | ||||||
|       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID |       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID | ||||||
|       # 如需改为自增 需要将数据库表全部设置为自增 |  | ||||||
|       idType: ASSIGN_ID |       idType: ASSIGN_ID | ||||||
|  |       # 逻辑已删除值 | ||||||
|  |       logicDeleteValue: 2 | ||||||
|  |       # 逻辑未删除值 | ||||||
|  |       logicNotDeleteValue: 0 | ||||||
|  |       # 字段验证策略之 insert,在 insert 的时候的字段验证策略 | ||||||
|  |       # IGNORED 忽略 NOT_NULL 非NULL NOT_EMPTY 非空 DEFAULT 默认 NEVER 不加入 SQL | ||||||
|  |       insertStrategy: NOT_NULL | ||||||
|  |       # 字段验证策略之 update,在 update 的时候的字段验证策略 | ||||||
|  |       updateStrategy: NOT_NULL | ||||||
|  |       # 字段验证策略之 select,在 select 的时候的字段验证策略既 wrapper 根据内部 entity 生成的 where 条件 | ||||||
|  |       where-strategy: NOT_NULL | ||||||
|  |  | ||||||
| # 数据加密 | # Swagger配置 | ||||||
| mybatis-encryptor: | swagger: | ||||||
|   # 是否开启加密 |   # 是否开启swagger | ||||||
|   enable: false |  | ||||||
|   # 默认加密算法 |  | ||||||
|   algorithm: BASE64 |  | ||||||
|   # 编码方式 BASE64/HEX。默认BASE64 |  | ||||||
|   encode: BASE64 |  | ||||||
|   # 安全秘钥 对称算法的秘钥 如:AES,SM4 |  | ||||||
|   password: |  | ||||||
|   # 公私钥 非对称算法的公私钥 如:SM2,RSA |  | ||||||
|   publicKey: |  | ||||||
|   privateKey: |  | ||||||
|  |  | ||||||
| # api接口加密 |  | ||||||
| api-decrypt: |  | ||||||
|   # 是否开启全局接口加密 |  | ||||||
|   enabled: true |   enabled: true | ||||||
|   # AES 加密头标识 |  | ||||||
|   headerFlag: encrypt-key |  | ||||||
|   # 响应加密公钥 非对称算法的公私钥 如:SM2,RSA 使用者请自行更换 |  | ||||||
|   # 对应前端解密私钥 MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3CuPiGL/LcIIm7zryCEIbl1SPzBkr75E2VMtxegyZ1lYRD+7TZGAPkvIsBcaMs6Nsy0L78n2qh+lIZMpLH8wIDAQABAkEAk82Mhz0tlv6IVCyIcw/s3f0E+WLmtPFyR9/WtV3Y5aaejUkU60JpX4m5xNR2VaqOLTZAYjW8Wy0aXr3zYIhhQQIhAMfqR9oFdYw1J9SsNc+CrhugAvKTi0+BF6VoL6psWhvbAiEAxPPNTmrkmrXwdm/pQQu3UOQmc2vCZ5tiKpW10CgJi8kCIFGkL6utxw93Ncj4exE/gPLvKcT+1Emnoox+O9kRXss5AiAMtYLJDaLEzPrAWcZeeSgSIzbL+ecokmFKSDDcRske6QIgSMkHedwND1olF8vlKsJUGK3BcdtM8w4Xq7BpSBwsloE= |  | ||||||
|   publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJnNwrj4hi/y3CCJu868ghCG5dUj8wZK++RNlTLcXoMmdZWEQ/u02RgD5LyLAXGjLOjbMtC+/J9qofpSGTKSx/MCAwEAAQ== |  | ||||||
|   # 请求解密私钥 非对称算法的公私钥 如:SM2,RSA 使用者请自行更换 |  | ||||||
|   # 对应前端加密公钥 MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ== |  | ||||||
|   privateKey: MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y= |  | ||||||
|  |  | ||||||
| springdoc: |  | ||||||
|   api-docs: |  | ||||||
|     # 是否开启接口文档 |  | ||||||
|     enabled: true |  | ||||||
| #  swagger-ui: |  | ||||||
| #    # 持久化认证数据 |  | ||||||
| #    persistAuthorization: true |  | ||||||
|   info: |   info: | ||||||
|     # 标题 |     # 标题 | ||||||
|     title: '标题:${ruoyi.name}多租户管理系统_接口文档' |     title: '标题:${ruoyi.name}后台管理系统_接口文档' | ||||||
|     # 描述 |     # 描述 | ||||||
|     description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' |     description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' | ||||||
|     # 版本 |     # 版本 | ||||||
|     version: '版本号: ${ruoyi.version}' |     version: '版本号: ${ruoyi-vue-plus.version}' | ||||||
|     # 作者信息 |     # 作者信息 | ||||||
|     contact: |     contact: | ||||||
|       name: Lion Li |       name: Lion Li | ||||||
|       email: crazylionli@163.com |       email: crazylionli@163.com | ||||||
|       url: https://gitee.com/dromara/RuoYi-Vue-Plus |       url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus | ||||||
|   components: |   components: | ||||||
|     # 鉴权方式配置 |     # 鉴权方式配置 | ||||||
|     security-schemes: |     security-schemes: | ||||||
| @@ -207,29 +200,27 @@ springdoc: | |||||||
|         type: APIKEY |         type: APIKEY | ||||||
|         in: HEADER |         in: HEADER | ||||||
|         name: ${sa-token.token-name} |         name: ${sa-token.token-name} | ||||||
|  |  | ||||||
|  | springdoc: | ||||||
|   #这里定义了两个分组,可定义多个,也可以不定义 |   #这里定义了两个分组,可定义多个,也可以不定义 | ||||||
|   group-configs: |   group-configs: | ||||||
|     - group: 1.演示模块 |     - group: 1.演示模块 | ||||||
|       packages-to-scan: org.dromara.demo |       packages-to-scan: com.ruoyi.demo | ||||||
|     - group: 2.通用模块 |     - group: 2.系统模块 | ||||||
|       packages-to-scan: org.dromara.web |       packages-to-scan: com.ruoyi.web | ||||||
|     - group: 3.系统模块 |     - group: 3.代码生成模块 | ||||||
|       packages-to-scan: org.dromara.system |       packages-to-scan: com.ruoyi.generator | ||||||
|     - group: 4.代码生成模块 |  | ||||||
|       packages-to-scan: org.dromara.generator |  | ||||||
|  |  | ||||||
| # 防止XSS攻击 | # 防止XSS攻击 | ||||||
| xss: | xss: | ||||||
|   # 过滤开关 |   # 过滤开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 排除链接(多个用逗号分隔) |   # 排除链接(多个用逗号分隔) | ||||||
|   excludeUrls: |   excludes: /system/notice | ||||||
|     - /system/notice |   # 匹配链接 | ||||||
|     - /workflow/model/save |   urlPatterns: /system/*,/monitor/*,/tool/* | ||||||
|     - /workflow/model/editModelXml |  | ||||||
|  |  | ||||||
| # 全局线程池相关配置 | # 全局线程池相关配置 | ||||||
| # 如使用JDK21请直接使用虚拟线程 不要开启此配置 |  | ||||||
| thread-pool: | thread-pool: | ||||||
|   # 是否开启线程池 |   # 是否开启线程池 | ||||||
|   enabled: false |   enabled: false | ||||||
| @@ -256,39 +247,3 @@ management: | |||||||
|       show-details: ALWAYS |       show-details: ALWAYS | ||||||
|     logfile: |     logfile: | ||||||
|       external-file: ./logs/sys-console.log |       external-file: ./logs/sys-console.log | ||||||
|  |  | ||||||
| --- # 默认/推荐使用sse推送 |  | ||||||
| sse: |  | ||||||
|   enabled: true |  | ||||||
|   path: /resource/sse |  | ||||||
|  |  | ||||||
| --- # websocket |  | ||||||
| websocket: |  | ||||||
|   # 如果关闭 需要和前端开关一起关闭 |  | ||||||
|   enabled: false |  | ||||||
|   # 路径 |  | ||||||
|   path: /resource/websocket |  | ||||||
|   # 设置访问源地址 |  | ||||||
|   allowedOrigins: '*' |  | ||||||
|  |  | ||||||
| --- #flowable配置 |  | ||||||
| flowable: |  | ||||||
|   # 开关 用于启动/停用工作流 |  | ||||||
|   enabled: true |  | ||||||
|   process.enabled: ${flowable.enabled} |  | ||||||
|   eventregistry.enabled: ${flowable.enabled} |  | ||||||
|   async-executor-activate: false #关闭定时任务JOB |  | ||||||
|   #  将databaseSchemaUpdate设置为true。当Flowable发现库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。 |  | ||||||
|   database-schema-update: true |  | ||||||
|   activity-font-name: 宋体 |  | ||||||
|   label-font-name: 宋体 |  | ||||||
|   annotation-font-name: 宋体 |  | ||||||
|   # 关闭各个模块生成表,目前只使用工作流基础表 |  | ||||||
|   idm: |  | ||||||
|     enabled: false |  | ||||||
|   cmmn: |  | ||||||
|     enabled: false |  | ||||||
|   dmn: |  | ||||||
|     enabled: false |  | ||||||
|   app: |  | ||||||
|     enabled: false |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| Application Version: ${revision} | Application Version: ${ruoyi-vue-plus.version} | ||||||
| Spring Boot Version: ${spring-boot.version} | Spring Boot Version: ${spring-boot.version} | ||||||
| __________            _____.___.__         ____   ____                     __________.__ | __________            _____.___.__         ____   ____                     __________.__ | ||||||
| \______   \__ __  ____\__  |   |__|        \   \ /   /_ __   ____          \______   \  |  __ __  ______ | \______   \__ __  ____\__  |   |__|        \   \ /   /_ __   ____          \______   \  |  __ __  ______ | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ user.password.not.blank=用户密码不能为空 | |||||||
| user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | ||||||
| user.password.not.valid=* 5-50个字符 | user.password.not.valid=* 5-50个字符 | ||||||
| user.email.not.valid=邮箱格式错误 | user.email.not.valid=邮箱格式错误 | ||||||
| user.email.not.blank=邮箱不能为空 |  | ||||||
| user.phonenumber.not.blank=用户手机号不能为空 | user.phonenumber.not.blank=用户手机号不能为空 | ||||||
| user.mobile.phone.number.not.valid=手机号格式错误 | user.mobile.phone.number.not.valid=手机号格式错误 | ||||||
| user.login.success=登录成功 | user.login.success=登录成功 | ||||||
| @@ -28,10 +27,6 @@ user.register.error=注册失败,请联系系统管理人员 | |||||||
| user.notfound=请重新登录 | user.notfound=请重新登录 | ||||||
| user.forcelogout=管理员强制退出,请重新登录 | user.forcelogout=管理员强制退出,请重新登录 | ||||||
| user.unknown.error=未知错误,请重新登录 | user.unknown.error=未知错误,请重新登录 | ||||||
| auth.grant.type.error=认证权限类型错误 |  | ||||||
| auth.grant.type.blocked=认证权限类型已禁用 |  | ||||||
| auth.grant.type.not.blank=认证权限类型不能为空 |  | ||||||
| auth.clientid.not.blank=认证客户端id不能为空 |  | ||||||
| ##文件上传消息 | ##文件上传消息 | ||||||
| upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | ||||||
| upload.filename.exceed.length=上传的文件名最长{0}个字符 | upload.filename.exceed.length=上传的文件名最长{0}个字符 | ||||||
| @@ -46,16 +41,5 @@ repeat.submit.message=不允许重复提交,请稍候再试 | |||||||
| rate.limiter.message=访问过于频繁,请稍候再试 | rate.limiter.message=访问过于频繁,请稍候再试 | ||||||
| sms.code.not.blank=短信验证码不能为空 | sms.code.not.blank=短信验证码不能为空 | ||||||
| sms.code.retry.limit.count=短信验证码输入错误{0}次 | sms.code.retry.limit.count=短信验证码输入错误{0}次 | ||||||
| sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 | sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{0}分钟 | ||||||
| email.code.not.blank=邮箱验证码不能为空 | xcx.code.not.blank=小程序code不能为空 | ||||||
| email.code.retry.limit.count=邮箱验证码输入错误{0}次 |  | ||||||
| email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟 |  | ||||||
| xcx.code.not.blank=小程序[code]不能为空 |  | ||||||
| social.source.not.blank=第三方登录平台[source]不能为空 |  | ||||||
| social.code.not.blank=第三方登录平台[code]不能为空 |  | ||||||
| social.state.not.blank=第三方登录平台[state]不能为空 |  | ||||||
| ##租户 |  | ||||||
| tenant.number.not.blank=租户编号不能为空 |  | ||||||
| tenant.not.exists=对不起, 您的租户不存在,请联系管理员 |  | ||||||
| tenant.blocked=对不起,您的租户已禁用,请联系管理员 |  | ||||||
| tenant.expired=对不起,您的租户已过期,请联系管理员 |  | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ user.password.not.blank=Password cannot be empty | |||||||
| user.password.length.valid=Password length must be between {min} and {max} characters | user.password.length.valid=Password length must be between {min} and {max} characters | ||||||
| user.password.not.valid=* 5-50 characters | user.password.not.valid=* 5-50 characters | ||||||
| user.email.not.valid=Mailbox format error | user.email.not.valid=Mailbox format error | ||||||
| user.email.not.blank=Mailbox cannot be blank |  | ||||||
| user.phonenumber.not.blank=Phone number cannot be blank | user.phonenumber.not.blank=Phone number cannot be blank | ||||||
| user.mobile.phone.number.not.valid=Phone number format error | user.mobile.phone.number.not.valid=Phone number format error | ||||||
| user.login.success=Login successful | user.login.success=Login successful | ||||||
| @@ -28,10 +27,6 @@ user.register.error=Register failed, please contact system administrator | |||||||
| user.notfound=Please login again | user.notfound=Please login again | ||||||
| user.forcelogout=The administrator is forced to exit,please login again | user.forcelogout=The administrator is forced to exit,please login again | ||||||
| user.unknown.error=Unknown error, please login again | user.unknown.error=Unknown error, please login again | ||||||
| auth.grant.type.error=Auth grant type error |  | ||||||
| auth.grant.type.blocked=Auth grant type disabled |  | ||||||
| auth.grant.type.not.blank=Auth grant type cannot be blank |  | ||||||
| auth.clientid.not.blank=Auth clientid cannot be blank |  | ||||||
| ##文件上传消息 | ##文件上传消息 | ||||||
| upload.exceed.maxSize=The uploaded file size exceeds the limit file size!<br/>the maximum allowed file size is:{0}MB! | upload.exceed.maxSize=The uploaded file size exceeds the limit file size!<br/>the maximum allowed file size is:{0}MB! | ||||||
| upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters | upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters | ||||||
| @@ -46,16 +41,5 @@ repeat.submit.message=Repeat submit is not allowed, please try again later | |||||||
| rate.limiter.message=Visit too frequently, please try again later | rate.limiter.message=Visit too frequently, please try again later | ||||||
| sms.code.not.blank=Sms code cannot be blank | sms.code.not.blank=Sms code cannot be blank | ||||||
| sms.code.retry.limit.count=Sms code input error {0} times | sms.code.retry.limit.count=Sms code input error {0} times | ||||||
| sms.code.retry.limit.exceed=Sms code input error {0} times, account locked for {1} minutes | sms.code.retry.limit.exceed=Sms code input error {0} times, account locked for {0} minutes | ||||||
| email.code.not.blank=Email code cannot be blank | xcx.code.not.blank=Mini program code cannot be blank | ||||||
| email.code.retry.limit.count=Email code input error {0} times |  | ||||||
| email.code.retry.limit.exceed=Email code input error {0} times, account locked for {1} minutes |  | ||||||
| xcx.code.not.blank=Mini program [code] cannot be blank |  | ||||||
| social.source.not.blank=Social login platform [source] cannot be blank |  | ||||||
| social.code.not.blank=Social login platform [code] cannot be blank |  | ||||||
| social.state.not.blank=Social login platform [state] cannot be blank |  | ||||||
| ##租户 |  | ||||||
| tenant.number.not.blank=Tenant number cannot be blank |  | ||||||
| tenant.not.exists=Sorry, your tenant does not exist. Please contact the administrator |  | ||||||
| tenant.blocked=Sorry, your tenant is disabled. Please contact the administrator |  | ||||||
| tenant.expired=Sorry, your tenant has expired. Please contact the administrator. |  | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ user.password.not.blank=用户密码不能为空 | |||||||
| user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | ||||||
| user.password.not.valid=* 5-50个字符 | user.password.not.valid=* 5-50个字符 | ||||||
| user.email.not.valid=邮箱格式错误 | user.email.not.valid=邮箱格式错误 | ||||||
| user.email.not.blank=邮箱不能为空 |  | ||||||
| user.phonenumber.not.blank=用户手机号不能为空 | user.phonenumber.not.blank=用户手机号不能为空 | ||||||
| user.mobile.phone.number.not.valid=手机号格式错误 | user.mobile.phone.number.not.valid=手机号格式错误 | ||||||
| user.login.success=登录成功 | user.login.success=登录成功 | ||||||
| @@ -28,10 +27,6 @@ user.register.error=注册失败,请联系系统管理人员 | |||||||
| user.notfound=请重新登录 | user.notfound=请重新登录 | ||||||
| user.forcelogout=管理员强制退出,请重新登录 | user.forcelogout=管理员强制退出,请重新登录 | ||||||
| user.unknown.error=未知错误,请重新登录 | user.unknown.error=未知错误,请重新登录 | ||||||
| auth.grant.type.error=认证权限类型错误 |  | ||||||
| auth.grant.type.blocked=认证权限类型已禁用 |  | ||||||
| auth.grant.type.not.blank=认证权限类型不能为空 |  | ||||||
| auth.clientid.not.blank=认证客户端id不能为空 |  | ||||||
| ##文件上传消息 | ##文件上传消息 | ||||||
| upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | ||||||
| upload.filename.exceed.length=上传的文件名最长{0}个字符 | upload.filename.exceed.length=上传的文件名最长{0}个字符 | ||||||
| @@ -46,16 +41,5 @@ repeat.submit.message=不允许重复提交,请稍候再试 | |||||||
| rate.limiter.message=访问过于频繁,请稍候再试 | rate.limiter.message=访问过于频繁,请稍候再试 | ||||||
| sms.code.not.blank=短信验证码不能为空 | sms.code.not.blank=短信验证码不能为空 | ||||||
| sms.code.retry.limit.count=短信验证码输入错误{0}次 | sms.code.retry.limit.count=短信验证码输入错误{0}次 | ||||||
| sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 | sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{0}分钟 | ||||||
| email.code.not.blank=邮箱验证码不能为空 | xcx.code.not.blank=小程序code不能为空 | ||||||
| email.code.retry.limit.count=邮箱验证码输入错误{0}次 |  | ||||||
| email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟 |  | ||||||
| xcx.code.not.blank=小程序[code]不能为空 |  | ||||||
| social.source.not.blank=第三方登录平台[source]不能为空 |  | ||||||
| social.code.not.blank=第三方登录平台[code]不能为空 |  | ||||||
| social.state.not.blank=第三方登录平台[state]不能为空 |  | ||||||
| ##租户 |  | ||||||
| tenant.number.not.blank=租户编号不能为空 |  | ||||||
| tenant.not.exists=对不起, 您的租户不存在,请联系管理员 |  | ||||||
| tenant.blocked=对不起,您的租户已禁用,请联系管理员 |  | ||||||
| tenant.expired=对不起,您的租户已过期,请联系管理员 |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| @@ -6,6 +6,8 @@ logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger | |||||||
| appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger | appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger | ||||||
| # 使用日志系统记录 sql | # 使用日志系统记录 sql | ||||||
| #appender=com.p6spy.engine.spy.appender.Slf4JLogger | #appender=com.p6spy.engine.spy.appender.Slf4JLogger | ||||||
|  | # 设置 p6spy driver 代理 | ||||||
|  | #deregisterdrivers=true | ||||||
| # 取消JDBC URL前缀 | # 取消JDBC URL前缀 | ||||||
| useprefix=true | useprefix=true | ||||||
| # 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. | # 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. | ||||||
| @@ -14,7 +16,13 @@ excludecategories=info,debug,result,commit,resultset | |||||||
| dateformat=yyyy-MM-dd HH:mm:ss | dateformat=yyyy-MM-dd HH:mm:ss | ||||||
| # SQL语句打印时间格式 | # SQL语句打印时间格式 | ||||||
| databaseDialectTimestampFormat=yyyy-MM-dd HH:mm:ss | databaseDialectTimestampFormat=yyyy-MM-dd HH:mm:ss | ||||||
|  | # 实际驱动可多个 | ||||||
|  | #driverlist=org.h2.Driver | ||||||
|  | # 是否开启慢SQL记录 | ||||||
|  | outagedetection=true | ||||||
|  | # 慢SQL记录标准 2 秒 | ||||||
|  | outagedetectioninterval=2 | ||||||
| # 是否过滤 Log | # 是否过滤 Log | ||||||
| filter=true | filter=true | ||||||
| # 过滤 Log 时所排除的 sql 关键字,以逗号分隔 | # 过滤 Log 时所排除的 sql 关键字,以逗号分隔 | ||||||
| exclude= | exclude=SELECT 1 | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| package org.dromara.test; | package com.ruoyi.test; | ||||||
| 
 | 
 | ||||||
| import org.junit.jupiter.api.Assertions; | import org.junit.jupiter.api.Assertions; | ||||||
| import org.junit.jupiter.api.DisplayName; | import org.junit.jupiter.api.DisplayName; | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| package org.dromara.test; | package com.ruoyi.test; | ||||||
| 
 | 
 | ||||||
| import org.dromara.common.core.config.RuoYiConfig; | import com.ruoyi.common.config.RuoYiConfig; | ||||||
| import org.junit.jupiter.api.*; | import org.junit.jupiter.api.*; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.boot.test.context.SpringBootTest; | import org.springframework.boot.test.context.SpringBootTest; | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| package org.dromara.test; | package com.ruoyi.test; | ||||||
| 
 | 
 | ||||||
| import org.dromara.common.core.enums.UserType; | import com.ruoyi.common.enums.UserType; | ||||||
| import org.junit.jupiter.api.AfterEach; | import org.junit.jupiter.api.AfterEach; | ||||||
| import org.junit.jupiter.api.BeforeEach; | import org.junit.jupiter.api.BeforeEach; | ||||||
| import org.junit.jupiter.api.DisplayName; | import org.junit.jupiter.api.DisplayName; | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| package org.dromara.test; | package com.ruoyi.test; | ||||||
| 
 | 
 | ||||||
| import org.junit.jupiter.api.*; | import org.junit.jupiter.api.*; | ||||||
| import org.springframework.boot.test.context.SpringBootTest; | import org.springframework.boot.test.context.SpringBootTest; | ||||||
| @@ -4,43 +4,154 @@ | |||||||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>org.dromara</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>${revision}</version> |         <version>4.4.0</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
|     <modules> |  | ||||||
|         <module>ruoyi-common-bom</module> |  | ||||||
|         <module>ruoyi-common-social</module> |  | ||||||
|         <module>ruoyi-common-core</module> |  | ||||||
|         <module>ruoyi-common-doc</module> |  | ||||||
|         <module>ruoyi-common-excel</module> |  | ||||||
|         <module>ruoyi-common-idempotent</module> |  | ||||||
|         <module>ruoyi-common-job</module> |  | ||||||
|         <module>ruoyi-common-log</module> |  | ||||||
|         <module>ruoyi-common-mail</module> |  | ||||||
|         <module>ruoyi-common-mybatis</module> |  | ||||||
|         <module>ruoyi-common-oss</module> |  | ||||||
|         <module>ruoyi-common-ratelimiter</module> |  | ||||||
|         <module>ruoyi-common-redis</module> |  | ||||||
|         <module>ruoyi-common-satoken</module> |  | ||||||
|         <module>ruoyi-common-security</module> |  | ||||||
|         <module>ruoyi-common-sms</module> |  | ||||||
|         <module>ruoyi-common-web</module> |  | ||||||
|         <module>ruoyi-common-translation</module> |  | ||||||
|         <module>ruoyi-common-sensitive</module> |  | ||||||
|         <module>ruoyi-common-json</module> |  | ||||||
|         <module>ruoyi-common-encrypt</module> |  | ||||||
|         <module>ruoyi-common-tenant</module> |  | ||||||
|         <module>ruoyi-common-websocket</module> |  | ||||||
|         <module>ruoyi-common-sse</module> |  | ||||||
|     </modules> |  | ||||||
|  |  | ||||||
|     <artifactId>ruoyi-common</artifactId> |     <artifactId>ruoyi-common</artifactId> | ||||||
|     <packaging>pom</packaging> |  | ||||||
|  |  | ||||||
|     <description> |     <description> | ||||||
|         common 通用模块 |         common通用工具 | ||||||
|     </description> |     </description> | ||||||
|  |  | ||||||
|  |     <dependencies> | ||||||
|  |  | ||||||
|  |         <!-- Spring框架基本的核心工具 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework</groupId> | ||||||
|  |             <artifactId>spring-context-support</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- SpringWeb模块 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework</groupId> | ||||||
|  |             <artifactId>spring-web</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.dev33</groupId> | ||||||
|  |             <artifactId>sa-token-spring-boot-starter</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- Sa-Token 整合 jwt --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.dev33</groupId> | ||||||
|  |             <artifactId>sa-token-jwt</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- 自定义验证注解 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-validation</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!--常用工具类 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.apache.commons</groupId> | ||||||
|  |             <artifactId>commons-lang3</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- JSON工具类 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.fasterxml.jackson.core</groupId> | ||||||
|  |             <artifactId>jackson-databind</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.alibaba</groupId> | ||||||
|  |             <artifactId>easyexcel</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- yml解析器 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.yaml</groupId> | ||||||
|  |             <artifactId>snakeyaml</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- servlet包 --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>javax.servlet</groupId> | ||||||
|  |             <artifactId>javax.servlet-api</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.baomidou</groupId> | ||||||
|  |             <artifactId>mybatis-plus-boot-starter</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.baomidou</groupId> | ||||||
|  |             <artifactId>mybatis-plus-extension</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- dynamic-datasource 多数据源--> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.baomidou</groupId> | ||||||
|  |             <artifactId>dynamic-datasource-spring-boot-starter</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.hutool</groupId> | ||||||
|  |             <artifactId>hutool-core</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.hutool</groupId> | ||||||
|  |             <artifactId>hutool-http</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.hutool</groupId> | ||||||
|  |             <artifactId>hutool-captcha</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.hutool</groupId> | ||||||
|  |             <artifactId>hutool-jwt</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>cn.hutool</groupId> | ||||||
|  |             <artifactId>hutool-extra</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.sun.mail</groupId> | ||||||
|  |             <artifactId>jakarta.mail</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.projectlombok</groupId> | ||||||
|  |             <artifactId>lombok</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springdoc</groupId> | ||||||
|  |             <artifactId>springdoc-openapi-webmvc-core</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springdoc</groupId> | ||||||
|  |             <artifactId>springdoc-openapi-javadoc</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!--  自动生成YML配置关联JSON文件  --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-configuration-processor</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!--redisson--> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.redisson</groupId> | ||||||
|  |             <artifactId>redisson-spring-boot-starter</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.baomidou</groupId> | ||||||
|  |             <artifactId>lock4j-redisson-spring-boot-starter</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |     </dependencies> | ||||||
|  |  | ||||||
| </project> | </project> | ||||||
|   | |||||||
| @@ -1,185 +0,0 @@ | |||||||
| <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |  | ||||||
|     <modelVersion>4.0.0</modelVersion> |  | ||||||
|  |  | ||||||
|     <groupId>org.dromara</groupId> |  | ||||||
|     <artifactId>ruoyi-common-bom</artifactId> |  | ||||||
|     <version>${revision}</version> |  | ||||||
|     <packaging>pom</packaging> |  | ||||||
|  |  | ||||||
|     <description> |  | ||||||
|         ruoyi-common-bom common依赖项 |  | ||||||
|     </description> |  | ||||||
|  |  | ||||||
|     <properties> |  | ||||||
|         <revision>5.2.3</revision> |  | ||||||
|     </properties> |  | ||||||
|  |  | ||||||
|     <dependencyManagement> |  | ||||||
|         <dependencies> |  | ||||||
|             <!-- 核心模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-core</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 接口模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-doc</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- excel --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-excel</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 幂等 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-idempotent</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 调度模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-job</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 日志记录 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-log</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 邮件服务 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-mail</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 数据库服务 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-mybatis</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- OSS --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-oss</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 限流 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-ratelimiter</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 缓存服务 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-redis</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- satoken --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-satoken</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 安全模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-security</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 短信模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-sms</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-social</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- web服务 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-web</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 翻译模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-translation</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 脱敏模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-sensitive</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 序列化模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-json</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 数据库加解密模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-encrypt</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- 租户模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-tenant</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- WebSocket模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-websocket</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|             <!-- SSE模块 --> |  | ||||||
|             <dependency> |  | ||||||
|                 <groupId>org.dromara</groupId> |  | ||||||
|                 <artifactId>ruoyi-common-sse</artifactId> |  | ||||||
|                 <version>${revision}</version> |  | ||||||
|             </dependency> |  | ||||||
|  |  | ||||||
|         </dependencies> |  | ||||||
|     </dependencyManagement> |  | ||||||
|  |  | ||||||
| </project> |  | ||||||
| @@ -1,99 +0,0 @@ | |||||||
| <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |  | ||||||
|     <parent> |  | ||||||
|         <groupId>org.dromara</groupId> |  | ||||||
|         <artifactId>ruoyi-common</artifactId> |  | ||||||
|         <version>${revision}</version> |  | ||||||
|     </parent> |  | ||||||
|     <modelVersion>4.0.0</modelVersion> |  | ||||||
|  |  | ||||||
|     <artifactId>ruoyi-common-core</artifactId> |  | ||||||
|  |  | ||||||
|     <description> |  | ||||||
|         ruoyi-common-core 核心模块 |  | ||||||
|     </description> |  | ||||||
|  |  | ||||||
|     <dependencies> |  | ||||||
|         <!-- Spring框架基本的核心工具 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework</groupId> |  | ||||||
|             <artifactId>spring-context-support</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!-- SpringWeb模块 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework</groupId> |  | ||||||
|             <artifactId>spring-web</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!-- 自定义验证注解 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework.boot</groupId> |  | ||||||
|             <artifactId>spring-boot-starter-validation</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework.boot</groupId> |  | ||||||
|             <artifactId>spring-boot-starter-aop</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!--常用工具类 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.apache.commons</groupId> |  | ||||||
|             <artifactId>commons-lang3</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!-- servlet包 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>jakarta.servlet</groupId> |  | ||||||
|             <artifactId>jakarta.servlet-api</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>cn.hutool</groupId> |  | ||||||
|             <artifactId>hutool-core</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>cn.hutool</groupId> |  | ||||||
|             <artifactId>hutool-http</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>cn.hutool</groupId> |  | ||||||
|             <artifactId>hutool-extra</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.projectlombok</groupId> |  | ||||||
|             <artifactId>lombok</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!--  自动生成YML配置关联JSON文件  --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework.boot</groupId> |  | ||||||
|             <artifactId>spring-boot-configuration-processor</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springframework.boot</groupId> |  | ||||||
|             <artifactId>spring-boot-properties-migrator</artifactId> |  | ||||||
|             <scope>runtime</scope> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>io.github.linpeilie</groupId> |  | ||||||
|             <artifactId>mapstruct-plus-spring-boot-starter</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <!-- 离线IP地址定位库 --> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.lionsoul</groupId> |  | ||||||
|             <artifactId>ip2region</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|     </dependencies> |  | ||||||
|  |  | ||||||
| </project> |  | ||||||
| @@ -1,17 +0,0 @@ | |||||||
| package org.dromara.common.core.config; |  | ||||||
|  |  | ||||||
| import org.springframework.boot.autoconfigure.AutoConfiguration; |  | ||||||
| import org.springframework.context.annotation.EnableAspectJAutoProxy; |  | ||||||
| import org.springframework.scheduling.annotation.EnableAsync; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 程序注解配置 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @AutoConfiguration |  | ||||||
| @EnableAspectJAutoProxy |  | ||||||
| @EnableAsync(proxyTargetClass = true) |  | ||||||
| public class ApplicationConfig { |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,40 +0,0 @@ | |||||||
| package org.dromara.common.core.config; |  | ||||||
|  |  | ||||||
| import jakarta.validation.Validator; |  | ||||||
| import org.hibernate.validator.HibernateValidator; |  | ||||||
| import org.springframework.boot.autoconfigure.AutoConfiguration; |  | ||||||
| import org.springframework.context.MessageSource; |  | ||||||
| import org.springframework.context.annotation.Bean; |  | ||||||
| import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; |  | ||||||
|  |  | ||||||
| import java.util.Properties; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 校验框架配置类 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @AutoConfiguration |  | ||||||
| public class ValidatorConfig { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 配置校验框架 快速返回模式 |  | ||||||
|      */ |  | ||||||
|     @Bean |  | ||||||
|     public Validator validator(MessageSource messageSource) { |  | ||||||
|         try (LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean()) { |  | ||||||
|             // 国际化 |  | ||||||
|             factoryBean.setValidationMessageSource(messageSource); |  | ||||||
|             // 设置使用 HibernateValidator 校验器 |  | ||||||
|             factoryBean.setProviderClass(HibernateValidator.class); |  | ||||||
|             Properties properties = new Properties(); |  | ||||||
|             // 设置 快速异常返回 |  | ||||||
|             properties.setProperty("hibernate.validator.fail_fast", "true"); |  | ||||||
|             factoryBean.setValidationProperties(properties); |  | ||||||
|             // 加载配置 |  | ||||||
|             factoryBean.afterPropertiesSet(); |  | ||||||
|             return factoryBean.getValidator(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,34 +0,0 @@ | |||||||
| package org.dromara.common.core.constant; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 全局的key常量 (业务无关的key) |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public interface GlobalConstants { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 全局 redis key (业务无关的key) |  | ||||||
|      */ |  | ||||||
|     String GLOBAL_REDIS_KEY = "global:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证码 redis key |  | ||||||
|      */ |  | ||||||
|     String CAPTCHA_CODE_KEY = GLOBAL_REDIS_KEY + "captcha_codes:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 防重提交 redis key |  | ||||||
|      */ |  | ||||||
|     String REPEAT_SUBMIT_KEY = GLOBAL_REDIS_KEY + "repeat_submit:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 限流 redis key |  | ||||||
|      */ |  | ||||||
|     String RATE_LIMIT_KEY = GLOBAL_REDIS_KEY + "rate_limit:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 三方认证 redis key |  | ||||||
|      */ |  | ||||||
|     String SOCIAL_AUTH_CODE_KEY = GLOBAL_REDIS_KEY + "social_auth_codes:"; |  | ||||||
| } |  | ||||||
| @@ -1,54 +0,0 @@ | |||||||
| package org.dromara.common.core.constant; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.lang.RegexPool; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 常用正则表达式字符串 |  | ||||||
|  * <p> |  | ||||||
|  * 常用正则表达式集合,更多正则见: https://any86.github.io/any-rule/ |  | ||||||
|  * |  | ||||||
|  * @author Feng |  | ||||||
|  */ |  | ||||||
| public interface RegexConstants extends RegexPool { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线) |  | ||||||
|      */ |  | ||||||
|     String DICTIONARY_TYPE = "^[a-z][a-z0-9_]*$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 权限标识必须符合 tool:build:list 格式,或者空字符串 |  | ||||||
|      */ |  | ||||||
|     String PERMISSION_STRING = "^(|^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+:[a-zA-Z0-9_]+)$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 身份证号码(后6位) |  | ||||||
|      */ |  | ||||||
|     String ID_CARD_LAST_6 = "^(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * QQ号码 |  | ||||||
|      */ |  | ||||||
|     String QQ_NUMBER = "^[1-9][0-9]\\d{4,9}$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮政编码 |  | ||||||
|      */ |  | ||||||
|     String POSTAL_CODE = "^[1-9]\\d{5}$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 注册账号 |  | ||||||
|      */ |  | ||||||
|     String ACCOUNT = "^[a-zA-Z][a-zA-Z0-9_]{4,15}$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 密码:包含至少8个字符,包括大写字母、小写字母、数字和特殊字符 |  | ||||||
|      */ |  | ||||||
|     String PASSWORD = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通用状态(0表示正常,1表示停用) |  | ||||||
|      */ |  | ||||||
|     String STATUS = "^[01]$"; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,45 +0,0 @@ | |||||||
| package org.dromara.common.core.constant; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 租户常量信息 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public interface TenantConstants { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户正常状态 |  | ||||||
|      */ |  | ||||||
|     String NORMAL = "0"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户封禁状态 |  | ||||||
|      */ |  | ||||||
|     String DISABLE = "1"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 超级管理员ID |  | ||||||
|      */ |  | ||||||
|     Long SUPER_ADMIN_ID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 超级管理员角色 roleKey |  | ||||||
|      */ |  | ||||||
|     String SUPER_ADMIN_ROLE_KEY = "superadmin"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户管理员角色 roleKey |  | ||||||
|      */ |  | ||||||
|     String TENANT_ADMIN_ROLE_KEY = "admin"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户管理员角色名称 |  | ||||||
|      */ |  | ||||||
|     String TENANT_ADMIN_ROLE_NAME = "管理员"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 默认租户ID |  | ||||||
|      */ |  | ||||||
|     String DEFAULT_TENANT_ID = "000000"; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,73 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.dto; |  | ||||||
|  |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.NoArgsConstructor; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
| import java.util.Date; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户 |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @NoArgsConstructor |  | ||||||
| public class UserDTO implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户ID |  | ||||||
|      */ |  | ||||||
|     private Long userId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 部门ID |  | ||||||
|      */ |  | ||||||
|     private Long deptId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户账号 |  | ||||||
|      */ |  | ||||||
|     private String userName; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户昵称 |  | ||||||
|      */ |  | ||||||
|     private String nickName; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户类型(sys_user系统用户) |  | ||||||
|      */ |  | ||||||
|     private String userType; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户邮箱 |  | ||||||
|      */ |  | ||||||
|     private String email; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 手机号码 |  | ||||||
|      */ |  | ||||||
|     private String phonenumber; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户性别(0男 1女 2未知) |  | ||||||
|      */ |  | ||||||
|     private String sex; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 帐号状态(0正常 1停用) |  | ||||||
|      */ |  | ||||||
|     private String status; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 创建时间 |  | ||||||
|      */ |  | ||||||
|     private Date createTime; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,41 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.event; |  | ||||||
|  |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 总体流程监听 |  | ||||||
|  * |  | ||||||
|  * @author may |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| public class ProcessEvent implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 流程定义key |  | ||||||
|      */ |  | ||||||
|     private String key; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 业务id |  | ||||||
|      */ |  | ||||||
|     private String businessKey; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 状态 |  | ||||||
|      */ |  | ||||||
|     private String status; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 当为true时为申请人节点办理 |  | ||||||
|      */ |  | ||||||
|     private boolean submit; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,40 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.event; |  | ||||||
|  |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 流程办理监听 |  | ||||||
|  * |  | ||||||
|  * @author may |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| public class ProcessTaskEvent implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 流程定义key |  | ||||||
|      */ |  | ||||||
|     private String key; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 审批节点key |  | ||||||
|      */ |  | ||||||
|     private String taskDefinitionKey; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务id |  | ||||||
|      */ |  | ||||||
|     private String taskId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 业务id |  | ||||||
|      */ |  | ||||||
|     private String businessKey; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.Email; |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 邮件登录对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| public class EmailLoginBody extends LoginBody { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮箱 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{user.email.not.blank}") |  | ||||||
|     @Email(message = "{user.email.not.valid}") |  | ||||||
|     private String email; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮箱code |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{email.code.not.blank}") |  | ||||||
|     private String emailCode; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,48 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户登录对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| public class LoginBody implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 客户端id |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{auth.clientid.not.blank}") |  | ||||||
|     private String clientId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 授权类型 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{auth.grant.type.not.blank}") |  | ||||||
|     private String grantType; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 租户ID |  | ||||||
|      */ |  | ||||||
|     private String tenantId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证码 |  | ||||||
|      */ |  | ||||||
|     private String code; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 唯一标识 |  | ||||||
|      */ |  | ||||||
|     private String uuid; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,33 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
| import org.hibernate.validator.constraints.Length; |  | ||||||
|  |  | ||||||
| import static org.dromara.common.core.constant.UserConstants.*; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 密码登录对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| public class PasswordLoginBody extends LoginBody { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户名 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{user.username.not.blank}") |  | ||||||
|     @Length(min = USERNAME_MIN_LENGTH, max = USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") |  | ||||||
|     private String username; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户密码 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{user.password.not.blank}") |  | ||||||
|     @Length(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") |  | ||||||
|     private String password; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,35 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
| import org.hibernate.validator.constraints.Length; |  | ||||||
|  |  | ||||||
| import static org.dromara.common.core.constant.UserConstants.*; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户注册对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| public class RegisterBody extends LoginBody { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户名 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{user.username.not.blank}") |  | ||||||
|     @Length(min = USERNAME_MIN_LENGTH, max = USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") |  | ||||||
|     private String username; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 用户密码 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{user.password.not.blank}") |  | ||||||
|     @Length(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") |  | ||||||
|     private String password; |  | ||||||
|  |  | ||||||
|     private String userType; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,35 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 三方登录对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| public class SocialLoginBody extends LoginBody { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 第三方登录平台 |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{social.source.not.blank}") |  | ||||||
|     private String source; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 第三方登录code |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{social.code.not.blank}") |  | ||||||
|     private String socialCode; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 第三方登录socialState |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{social.state.not.blank}") |  | ||||||
|     private String socialState; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,28 +0,0 @@ | |||||||
| package org.dromara.common.core.domain.model; |  | ||||||
|  |  | ||||||
| import jakarta.validation.constraints.NotBlank; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 三方登录对象 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| public class XcxLoginBody extends LoginBody { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 小程序id(多个小程序时使用) |  | ||||||
|      */ |  | ||||||
|     private String appid; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 小程序code |  | ||||||
|      */ |  | ||||||
|     @NotBlank(message = "{xcx.code.not.blank}") |  | ||||||
|     private String xcxCode; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,152 +0,0 @@ | |||||||
| package org.dromara.common.core.enums; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.util.StrUtil; |  | ||||||
| import lombok.AllArgsConstructor; |  | ||||||
| import lombok.Getter; |  | ||||||
| import org.dromara.common.core.exception.ServiceException; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
|  |  | ||||||
| import java.util.Arrays; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 业务状态枚举 |  | ||||||
|  * |  | ||||||
|  * @author may |  | ||||||
|  */ |  | ||||||
| @Getter |  | ||||||
| @AllArgsConstructor |  | ||||||
| public enum BusinessStatusEnum { |  | ||||||
|     /** |  | ||||||
|      * 已撤销 |  | ||||||
|      */ |  | ||||||
|     CANCEL("cancel", "已撤销"), |  | ||||||
|     /** |  | ||||||
|      * 草稿 |  | ||||||
|      */ |  | ||||||
|     DRAFT("draft", "草稿"), |  | ||||||
|     /** |  | ||||||
|      * 待审核 |  | ||||||
|      */ |  | ||||||
|     WAITING("waiting", "待审核"), |  | ||||||
|     /** |  | ||||||
|      * 已完成 |  | ||||||
|      */ |  | ||||||
|     FINISH("finish", "已完成"), |  | ||||||
|     /** |  | ||||||
|      * 已作废 |  | ||||||
|      */ |  | ||||||
|     INVALID("invalid", "已作废"), |  | ||||||
|     /** |  | ||||||
|      * 已退回 |  | ||||||
|      */ |  | ||||||
|     BACK("back", "已退回"), |  | ||||||
|     /** |  | ||||||
|      * 已终止 |  | ||||||
|      */ |  | ||||||
|     TERMINATION("termination", "已终止"); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 状态 |  | ||||||
|      */ |  | ||||||
|     private final String status; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 描述 |  | ||||||
|      */ |  | ||||||
|     private final String desc; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 获取业务状态 |  | ||||||
|      * |  | ||||||
|      * @param status 状态 |  | ||||||
|      */ |  | ||||||
|     public static String findByStatus(String status) { |  | ||||||
|         if (StringUtils.isBlank(status)) { |  | ||||||
|             return StrUtil.EMPTY; |  | ||||||
|         } |  | ||||||
|         return Arrays.stream(BusinessStatusEnum.values()) |  | ||||||
|             .filter(statusEnum -> statusEnum.getStatus().equals(status)) |  | ||||||
|             .findFirst() |  | ||||||
|             .map(BusinessStatusEnum::getDesc) |  | ||||||
|             .orElse(StrUtil.EMPTY); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 启动流程校验 |  | ||||||
|      * |  | ||||||
|      * @param status 状态 |  | ||||||
|      */ |  | ||||||
|     public static void checkStartStatus(String status) { |  | ||||||
|         if (WAITING.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已提交过申请,正在审批中!"); |  | ||||||
|         } else if (FINISH.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已完成申请!"); |  | ||||||
|         } else if (INVALID.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已作废!"); |  | ||||||
|         } else if (TERMINATION.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已终止!"); |  | ||||||
|         } else if (StringUtils.isBlank(status)) { |  | ||||||
|             throw new ServiceException("流程状态为空!"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 撤销流程校验 |  | ||||||
|      * |  | ||||||
|      * @param status 状态 |  | ||||||
|      */ |  | ||||||
|     public static void checkCancelStatus(String status) { |  | ||||||
|         if (CANCEL.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已撤销!"); |  | ||||||
|         } else if (FINISH.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已完成申请!"); |  | ||||||
|         } else if (INVALID.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已作废!"); |  | ||||||
|         } else if (TERMINATION.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已终止!"); |  | ||||||
|         } else if (BACK.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已退回!"); |  | ||||||
|         } else if (StringUtils.isBlank(status)) { |  | ||||||
|             throw new ServiceException("流程状态为空!"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 驳回流程校验 |  | ||||||
|      * |  | ||||||
|      * @param status 状态 |  | ||||||
|      */ |  | ||||||
|     public static void checkBackStatus(String status) { |  | ||||||
|         if (BACK.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已退回!"); |  | ||||||
|         } else if (FINISH.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已完成申请!"); |  | ||||||
|         } else if (INVALID.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已作废!"); |  | ||||||
|         } else if (TERMINATION.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已终止!"); |  | ||||||
|         } else if (CANCEL.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已撤销!"); |  | ||||||
|         } else if (StringUtils.isBlank(status)) { |  | ||||||
|             throw new ServiceException("流程状态为空!"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 作废,终止流程校验 |  | ||||||
|      * |  | ||||||
|      * @param status 状态 |  | ||||||
|      */ |  | ||||||
|     public static void checkInvalidStatus(String status) { |  | ||||||
|         if (FINISH.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已完成申请!"); |  | ||||||
|         } else if (INVALID.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已作废!"); |  | ||||||
|         } else if (TERMINATION.getStatus().equals(status)) { |  | ||||||
|             throw new ServiceException("该单据已终止!"); |  | ||||||
|         } else if (StringUtils.isBlank(status)) { |  | ||||||
|             throw new ServiceException("流程状态为空!"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @@ -1,30 +0,0 @@ | |||||||
| package org.dromara.common.core.enums; |  | ||||||
|  |  | ||||||
| import lombok.AllArgsConstructor; |  | ||||||
| import lombok.Getter; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户状态 |  | ||||||
|  * |  | ||||||
|  * @author LionLi |  | ||||||
|  */ |  | ||||||
| @Getter |  | ||||||
| @AllArgsConstructor |  | ||||||
| public enum TenantStatus { |  | ||||||
|     /** |  | ||||||
|      * 正常 |  | ||||||
|      */ |  | ||||||
|     OK("0", "正常"), |  | ||||||
|     /** |  | ||||||
|      * 停用 |  | ||||||
|      */ |  | ||||||
|     DISABLE("1", "停用"), |  | ||||||
|     /** |  | ||||||
|      * 删除 |  | ||||||
|      */ |  | ||||||
|     DELETED("2", "删除"); |  | ||||||
|  |  | ||||||
|     private final String code; |  | ||||||
|     private final String info; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,30 +0,0 @@ | |||||||
| package org.dromara.common.core.enums; |  | ||||||
|  |  | ||||||
| import lombok.AllArgsConstructor; |  | ||||||
| import lombok.Getter; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 用户状态 |  | ||||||
|  * |  | ||||||
|  * @author ruoyi |  | ||||||
|  */ |  | ||||||
| @Getter |  | ||||||
| @AllArgsConstructor |  | ||||||
| public enum UserStatus { |  | ||||||
|     /** |  | ||||||
|      * 正常 |  | ||||||
|      */ |  | ||||||
|     OK("0", "正常"), |  | ||||||
|     /** |  | ||||||
|      * 停用 |  | ||||||
|      */ |  | ||||||
|     DISABLE("1", "停用"), |  | ||||||
|     /** |  | ||||||
|      * 删除 |  | ||||||
|      */ |  | ||||||
|     DELETED("2", "删除"); |  | ||||||
|  |  | ||||||
|     private final String code; |  | ||||||
|     private final String info; |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,62 +0,0 @@ | |||||||
| package org.dromara.common.core.exception; |  | ||||||
|  |  | ||||||
| import lombok.AllArgsConstructor; |  | ||||||
| import lombok.Data; |  | ||||||
| import lombok.EqualsAndHashCode; |  | ||||||
| import lombok.NoArgsConstructor; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * sse 特制异常 |  | ||||||
|  * |  | ||||||
|  * @author LionLi |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @EqualsAndHashCode(callSuper = true) |  | ||||||
| @NoArgsConstructor |  | ||||||
| @AllArgsConstructor |  | ||||||
| public final class SseException extends RuntimeException { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 错误码 |  | ||||||
|      */ |  | ||||||
|     private Integer code; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 错误提示 |  | ||||||
|      */ |  | ||||||
|     private String message; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 错误明细,内部调试错误 |  | ||||||
|      */ |  | ||||||
|     private String detailMessage; |  | ||||||
|  |  | ||||||
|     public SseException(String message) { |  | ||||||
|         this.message = message; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public SseException(String message, Integer code) { |  | ||||||
|         this.message = message; |  | ||||||
|         this.code = code; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public String getMessage() { |  | ||||||
|         return message; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public SseException setMessage(String message) { |  | ||||||
|         this.message = message; |  | ||||||
|         return this; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public SseException setDetailMessage(String detailMessage) { |  | ||||||
|         this.detailMessage = detailMessage; |  | ||||||
|         return this; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,52 +0,0 @@ | |||||||
| package org.dromara.common.core.factory; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.lang.PatternPool; |  | ||||||
| import org.dromara.common.core.constant.RegexConstants; |  | ||||||
|  |  | ||||||
| import java.util.regex.Pattern; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 正则表达式模式池工厂 |  | ||||||
|  * <p>初始化的时候将正则表达式加入缓存池当中</p> |  | ||||||
|  * <p>提高正则表达式的性能,避免重复编译相同的正则表达式</p> |  | ||||||
|  * |  | ||||||
|  * @author 21001 |  | ||||||
|  */ |  | ||||||
| public class RegexPatternPoolFactory extends PatternPool { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern DICTIONARY_TYPE = get(RegexConstants.DICTIONARY_TYPE); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 身份证号码(后6位) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern ID_CARD_LAST_6 = get(RegexConstants.ID_CARD_LAST_6); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * QQ号码 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern QQ_NUMBER = get(RegexConstants.QQ_NUMBER); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮政编码 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern POSTAL_CODE = get(RegexConstants.POSTAL_CODE); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 注册账号 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern ACCOUNT = get(RegexConstants.ACCOUNT); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 密码:包含至少8个字符,包括大写字母、小写字母、数字和特殊字符 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern PASSWORD = get(RegexConstants.PASSWORD); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通用状态(0表示正常,1表示停用) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern STATUS = get(RegexConstants.STATUS); |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| package org.dromara.common.core.factory; |  | ||||||
|  |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; |  | ||||||
| import org.springframework.core.env.PropertiesPropertySource; |  | ||||||
| import org.springframework.core.env.PropertySource; |  | ||||||
| import org.springframework.core.io.support.DefaultPropertySourceFactory; |  | ||||||
| import org.springframework.core.io.support.EncodedResource; |  | ||||||
|  |  | ||||||
| import java.io.IOException; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * yml 配置源工厂 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public class YmlPropertySourceFactory extends DefaultPropertySourceFactory { |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException { |  | ||||||
|         String sourceName = resource.getResource().getFilename(); |  | ||||||
|         if (StringUtils.isNotBlank(sourceName) && StringUtils.endsWithAny(sourceName, ".yml", ".yaml")) { |  | ||||||
|             YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); |  | ||||||
|             factory.setResources(resource.getResource()); |  | ||||||
|             factory.afterPropertiesSet(); |  | ||||||
|             return new PropertiesPropertySource(sourceName, factory.getObject()); |  | ||||||
|         } |  | ||||||
|         return super.createPropertySource(name, resource); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,18 +0,0 @@ | |||||||
| package org.dromara.common.core.service; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 通用 部门服务 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public interface DeptService { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过部门ID查询部门名称 |  | ||||||
|      * |  | ||||||
|      * @param deptIds 部门ID串逗号分隔 |  | ||||||
|      * @return 部门名称串逗号分隔 |  | ||||||
|      */ |  | ||||||
|     String selectDeptNameByIds(String deptIds); |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,29 +0,0 @@ | |||||||
| package org.dromara.common.core.service; |  | ||||||
|  |  | ||||||
| import org.dromara.common.core.domain.dto.OssDTO; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 通用 OSS服务 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public interface OssService { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过ossId查询对应的url |  | ||||||
|      * |  | ||||||
|      * @param ossIds ossId串逗号分隔 |  | ||||||
|      * @return url串逗号分隔 |  | ||||||
|      */ |  | ||||||
|     String selectUrlByIds(String ossIds); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过ossId查询列表 |  | ||||||
|      * |  | ||||||
|      * @param ossIds ossId串逗号分隔 |  | ||||||
|      * @return 列表 |  | ||||||
|      */ |  | ||||||
|     List<OssDTO> selectByIds(String ossIds); |  | ||||||
| } |  | ||||||
| @@ -1,85 +0,0 @@ | |||||||
| package org.dromara.common.core.service; |  | ||||||
|  |  | ||||||
| import org.dromara.common.core.domain.dto.UserDTO; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 通用 用户服务 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| public interface UserService { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户账户 |  | ||||||
|      * |  | ||||||
|      * @param userId 用户ID |  | ||||||
|      * @return 用户账户 |  | ||||||
|      */ |  | ||||||
|     String selectUserNameById(Long userId); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户账户 |  | ||||||
|      * |  | ||||||
|      * @param userId 用户ID |  | ||||||
|      * @return 用户名称 |  | ||||||
|      */ |  | ||||||
|     String selectNicknameById(Long userId); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户账户 |  | ||||||
|      * |  | ||||||
|      * @param userIds 用户ID 多个用逗号隔开 |  | ||||||
|      * @return 用户名称 |  | ||||||
|      */ |  | ||||||
|     String selectNicknameByIds(String userIds); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户手机号 |  | ||||||
|      * |  | ||||||
|      * @param userId 用户id |  | ||||||
|      * @return 用户手机号 |  | ||||||
|      */ |  | ||||||
|     String selectPhonenumberById(Long userId); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户邮箱 |  | ||||||
|      * |  | ||||||
|      * @param userId 用户id |  | ||||||
|      * @return 用户邮箱 |  | ||||||
|      */ |  | ||||||
|     String selectEmailById(Long userId); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过用户ID查询用户列表 |  | ||||||
|      * |  | ||||||
|      * @param userIds 用户ids |  | ||||||
|      * @return 用户列表 |  | ||||||
|      */ |  | ||||||
|     List<UserDTO> selectListByIds(List<Long> userIds); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过角色ID查询用户ID |  | ||||||
|      * |  | ||||||
|      * @param roleIds 角色ids |  | ||||||
|      * @return 用户ids |  | ||||||
|      */ |  | ||||||
|     List<Long> selectUserIdsByRoleIds(List<Long> roleIds); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过角色ID查询用户 |  | ||||||
|      * |  | ||||||
|      * @param roleIds 角色ids |  | ||||||
|      * @return 用户 |  | ||||||
|      */ |  | ||||||
|     List<UserDTO> selectUsersByRoleIds(List<Long> roleIds); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通过部门ID查询用户 |  | ||||||
|      * |  | ||||||
|      * @param deptIds 部门ids |  | ||||||
|      * @return 用户 |  | ||||||
|      */ |  | ||||||
|     List<UserDTO> selectUsersByDeptIds(List<Long> deptIds); |  | ||||||
| } |  | ||||||
| @@ -1,76 +0,0 @@ | |||||||
| package org.dromara.common.core.service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 通用 工作流服务 |  | ||||||
|  * |  | ||||||
|  * @author may |  | ||||||
|  */ |  | ||||||
| public interface WorkflowService { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 运行中的实例 删除程实例,删除历史记录,删除业务与流程关联信息 |  | ||||||
|      * |  | ||||||
|      * @param businessKeys 业务id |  | ||||||
|      * @return 结果 |  | ||||||
|      */ |  | ||||||
|     boolean deleteRunAndHisInstance(List<String> businessKeys); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 获取当前流程状态 |  | ||||||
|      * |  | ||||||
|      * @param taskId 任务id |  | ||||||
|      */ |  | ||||||
|     String getBusinessStatusByTaskId(String taskId); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 获取当前流程状态 |  | ||||||
|      * |  | ||||||
|      * @param businessKey 业务id |  | ||||||
|      */ |  | ||||||
|     String getBusinessStatus(String businessKey); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 设置流程变量(全局变量) |  | ||||||
|      * |  | ||||||
|      * @param taskId       任务id |  | ||||||
|      * @param variableName 变量名称 |  | ||||||
|      * @param value        变量值 |  | ||||||
|      */ |  | ||||||
|     void setVariable(String taskId, String variableName, Object value); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 设置流程变量(全局变量) |  | ||||||
|      * |  | ||||||
|      * @param taskId    任务id |  | ||||||
|      * @param variables 流程变量 |  | ||||||
|      */ |  | ||||||
|     void setVariables(String taskId, Map<String, Object> variables); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 设置流程变量(本地变量,非全局变量) |  | ||||||
|      * |  | ||||||
|      * @param taskId       任务id |  | ||||||
|      * @param variableName 变量名称 |  | ||||||
|      * @param value        变量值 |  | ||||||
|      */ |  | ||||||
|     void setVariableLocal(String taskId, String variableName, Object value); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 设置流程变量(本地变量,非全局变量) |  | ||||||
|      * |  | ||||||
|      * @param taskId    任务id |  | ||||||
|      * @param variables 流程变量 |  | ||||||
|      */ |  | ||||||
|     void setVariablesLocal(String taskId, Map<String, Object> variables); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 按照业务id查询流程实例id |  | ||||||
|      * |  | ||||||
|      * @param businessKey 业务id |  | ||||||
|      * @return 结果 |  | ||||||
|      */ |  | ||||||
|     String getInstanceIdByBusinessKey(String businessKey); |  | ||||||
| } |  | ||||||
| @@ -1,93 +0,0 @@ | |||||||
| package org.dromara.common.core.utils; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.collection.CollUtil; |  | ||||||
| import cn.hutool.core.map.MapUtil; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import io.github.linpeilie.Converter; |  | ||||||
| import lombok.AccessLevel; |  | ||||||
| import lombok.NoArgsConstructor; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Mapstruct 工具类 |  | ||||||
|  * <p>参考文档:<a href="https://mapstruct.plus/introduction/quick-start.html">mapstruct-plus</a></p> |  | ||||||
|  * |  | ||||||
|  * |  | ||||||
|  * @author Michelle.Chung |  | ||||||
|  */ |  | ||||||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) |  | ||||||
| public class MapstructUtils { |  | ||||||
|  |  | ||||||
|     private final static Converter CONVERTER = SpringUtils.getBean(Converter.class); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 将 T 类型对象,转换为 desc 类型的对象并返回 |  | ||||||
|      * |  | ||||||
|      * @param source 数据来源实体 |  | ||||||
|      * @param desc   描述对象 转换后的对象 |  | ||||||
|      * @return desc |  | ||||||
|      */ |  | ||||||
|     public static <T, V> V convert(T source, Class<V> desc) { |  | ||||||
|         if (ObjectUtil.isNull(source)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         if (ObjectUtil.isNull(desc)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         return CONVERTER.convert(source, desc); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 将 T 类型对象,按照配置的映射字段规则,给 desc 类型的对象赋值并返回 desc 对象 |  | ||||||
|      * |  | ||||||
|      * @param source 数据来源实体 |  | ||||||
|      * @param desc   转换后的对象 |  | ||||||
|      * @return desc |  | ||||||
|      */ |  | ||||||
|     public static <T, V> V convert(T source, V desc) { |  | ||||||
|         if (ObjectUtil.isNull(source)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         if (ObjectUtil.isNull(desc)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         return CONVERTER.convert(source, desc); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 将 T 类型的集合,转换为 desc 类型的集合并返回 |  | ||||||
|      * |  | ||||||
|      * @param sourceList 数据来源实体列表 |  | ||||||
|      * @param desc       描述对象 转换后的对象 |  | ||||||
|      * @return desc |  | ||||||
|      */ |  | ||||||
|     public static <T, V> List<V> convert(List<T> sourceList, Class<V> desc) { |  | ||||||
|         if (ObjectUtil.isNull(sourceList)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         if (CollUtil.isEmpty(sourceList)) { |  | ||||||
|             return CollUtil.newArrayList(); |  | ||||||
|         } |  | ||||||
|         return CONVERTER.convert(sourceList, desc); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 将 Map 转换为 beanClass 类型的集合并返回 |  | ||||||
|      * |  | ||||||
|      * @param map       数据来源 |  | ||||||
|      * @param beanClass bean类 |  | ||||||
|      * @return bean对象 |  | ||||||
|      */ |  | ||||||
|     public static <T> T convert(Map<String, Object> map, Class<T> beanClass) { |  | ||||||
|         if (MapUtil.isEmpty(map)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         if (ObjectUtil.isNull(beanClass)) { |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|         return CONVERTER.convert(map, beanClass); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,79 +0,0 @@ | |||||||
| package org.dromara.common.core.utils; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.collection.CollUtil; |  | ||||||
| import cn.hutool.core.lang.tree.Tree; |  | ||||||
| import cn.hutool.core.lang.tree.TreeNodeConfig; |  | ||||||
| import cn.hutool.core.lang.tree.TreeUtil; |  | ||||||
| import cn.hutool.core.lang.tree.parser.NodeParser; |  | ||||||
| import lombok.AccessLevel; |  | ||||||
| import lombok.NoArgsConstructor; |  | ||||||
| import org.dromara.common.core.utils.reflect.ReflectUtils; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.stream.Collectors; |  | ||||||
| import java.util.stream.Stream; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 扩展 hutool TreeUtil 封装系统树构建 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) |  | ||||||
| public class TreeBuildUtils extends TreeUtil { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据前端定制差异化字段 |  | ||||||
|      */ |  | ||||||
|     public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("label"); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 构建树形结构 |  | ||||||
|      * |  | ||||||
|      * @param <T>        输入节点的类型 |  | ||||||
|      * @param <K>        节点ID的类型 |  | ||||||
|      * @param list       节点列表,其中包含了要构建树形结构的所有节点 |  | ||||||
|      * @param nodeParser 解析器,用于将输入节点转换为树节点 |  | ||||||
|      * @return 构建好的树形结构列表 |  | ||||||
|      */ |  | ||||||
|     public static <T, K> List<Tree<K>> build(List<T> list, NodeParser<T, K> nodeParser) { |  | ||||||
|         if (CollUtil.isEmpty(list)) { |  | ||||||
|             return CollUtil.newArrayList(); |  | ||||||
|         } |  | ||||||
|         K k = ReflectUtils.invokeGetter(list.get(0), "parentId"); |  | ||||||
|         return TreeUtil.build(list, k, DEFAULT_CONFIG, nodeParser); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 获取节点列表中所有节点的叶子节点 |  | ||||||
|      * |  | ||||||
|      * @param <K>   节点ID的类型 |  | ||||||
|      * @param nodes 节点列表 |  | ||||||
|      * @return 包含所有叶子节点的列表 |  | ||||||
|      */ |  | ||||||
|     public static <K> List<Tree<K>> getLeafNodes(List<Tree<K>> nodes) { |  | ||||||
|         if (CollUtil.isEmpty(nodes)) { |  | ||||||
|             return CollUtil.newArrayList(); |  | ||||||
|         } |  | ||||||
|         return nodes.stream() |  | ||||||
|             .flatMap(TreeBuildUtils::extractLeafNodes) |  | ||||||
|             .collect(Collectors.toList()); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 获取指定节点下的所有叶子节点 |  | ||||||
|      * |  | ||||||
|      * @param <K>  节点ID的类型 |  | ||||||
|      * @param node 要查找叶子节点的根节点 |  | ||||||
|      * @return 包含所有叶子节点的列表 |  | ||||||
|      */ |  | ||||||
|     private static <K> Stream<Tree<K>> extractLeafNodes(Tree<K> node) { |  | ||||||
|         if (!node.hasChild()) { |  | ||||||
|             return Stream.of(node); |  | ||||||
|         } else { |  | ||||||
|             // 递归调用,获取所有子节点的叶子节点 |  | ||||||
|             return node.getChildren().stream() |  | ||||||
|                 .flatMap(TreeBuildUtils::extractLeafNodes); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,33 +0,0 @@ | |||||||
| package org.dromara.common.core.utils.ip; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.net.NetUtil; |  | ||||||
| import cn.hutool.http.HtmlUtil; |  | ||||||
| import org.dromara.common.core.utils.StringUtils; |  | ||||||
| import lombok.AccessLevel; |  | ||||||
| import lombok.NoArgsConstructor; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 获取地址类 |  | ||||||
|  * |  | ||||||
|  * @author Lion Li |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) |  | ||||||
| public class AddressUtils { |  | ||||||
|  |  | ||||||
|     // 未知地址 |  | ||||||
|     public static final String UNKNOWN = "XX XX"; |  | ||||||
|  |  | ||||||
|     public static String getRealAddressByIP(String ip) { |  | ||||||
|         if (StringUtils.isBlank(ip)) { |  | ||||||
|             return UNKNOWN; |  | ||||||
|         } |  | ||||||
|         // 内网不查询 |  | ||||||
|         ip = StringUtils.contains(ip, "0:0:0:0:0:0:0:1") ? "127.0.0.1" : HtmlUtil.cleanHtmlTag(ip); |  | ||||||
|         if (NetUtil.isInnerIP(ip)) { |  | ||||||
|             return "内网IP"; |  | ||||||
|         } |  | ||||||
|         return RegionUtils.getCityInfo(ip); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,67 +0,0 @@ | |||||||
| package org.dromara.common.core.utils.ip; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.io.FileUtil; |  | ||||||
| import cn.hutool.core.io.resource.ClassPathResource; |  | ||||||
| import cn.hutool.core.util.ObjectUtil; |  | ||||||
| import org.dromara.common.core.exception.ServiceException; |  | ||||||
| import org.dromara.common.core.utils.file.FileUtils; |  | ||||||
| import lombok.extern.slf4j.Slf4j; |  | ||||||
| import org.lionsoul.ip2region.xdb.Searcher; |  | ||||||
|  |  | ||||||
| import java.io.File; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 根据ip地址定位工具类,离线方式 |  | ||||||
|  * 参考地址:<a href="https://gitee.com/lionsoul/ip2region/tree/master/binding/java">集成 ip2region 实现离线IP地址定位库</a> |  | ||||||
|  * |  | ||||||
|  * @author lishuyan |  | ||||||
|  */ |  | ||||||
| @Slf4j |  | ||||||
| public class RegionUtils { |  | ||||||
|  |  | ||||||
|     private static final Searcher SEARCHER; |  | ||||||
|  |  | ||||||
|     static { |  | ||||||
|         String fileName = "/ip2region.xdb"; |  | ||||||
|         File existFile = FileUtils.file(FileUtil.getTmpDir() + FileUtil.FILE_SEPARATOR + fileName); |  | ||||||
|         if (!FileUtils.exist(existFile)) { |  | ||||||
|             ClassPathResource fileStream = new ClassPathResource(fileName); |  | ||||||
|             if (ObjectUtil.isEmpty(fileStream.getStream())) { |  | ||||||
|                 throw new ServiceException("RegionUtils初始化失败,原因:IP地址库数据不存在!"); |  | ||||||
|             } |  | ||||||
|             FileUtils.writeFromStream(fileStream.getStream(), existFile); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         String dbPath = existFile.getPath(); |  | ||||||
|  |  | ||||||
|         // 1、从 dbPath 加载整个 xdb 到内存。 |  | ||||||
|         byte[] cBuff; |  | ||||||
|         try { |  | ||||||
|             cBuff = Searcher.loadContentFromFile(dbPath); |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             throw new ServiceException("RegionUtils初始化失败,原因:从ip2region.xdb文件加载内容失败!" + e.getMessage()); |  | ||||||
|         } |  | ||||||
|         // 2、使用上述的 cBuff 创建一个完全基于内存的查询对象。 |  | ||||||
|         try { |  | ||||||
|             SEARCHER = Searcher.newWithBuffer(cBuff); |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             throw new ServiceException("RegionUtils初始化失败,原因:" + e.getMessage()); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据IP地址离线获取城市 |  | ||||||
|      */ |  | ||||||
|     public static String getCityInfo(String ip) { |  | ||||||
|         try { |  | ||||||
|             ip = ip.trim(); |  | ||||||
|             // 3、执行查询 |  | ||||||
|             String region = SEARCHER.search(ip); |  | ||||||
|             return region.replace("0|", "").replace("|0", ""); |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             log.error("IP地址离线获取城市异常 {}", ip); |  | ||||||
|             return "未知"; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| package org.dromara.common.core.utils.regex; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import cn.hutool.core.util.ReUtil; |  | ||||||
| import org.dromara.common.core.constant.RegexConstants; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 正则相关工具类 |  | ||||||
|  * |  | ||||||
|  * @author Feng |  | ||||||
|  */ |  | ||||||
| public final class RegexUtils extends ReUtil { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 从输入字符串中提取匹配的部分,如果没有匹配则返回默认值 |  | ||||||
|      * |  | ||||||
|      * @param input        要提取的输入字符串 |  | ||||||
|      * @param regex        用于匹配的正则表达式,可以使用 {@link RegexConstants} 中定义的常量 |  | ||||||
|      * @param defaultInput 如果没有匹配时返回的默认值 |  | ||||||
|      * @return 如果找到匹配的部分,则返回匹配的部分,否则返回默认值 |  | ||||||
|      */ |  | ||||||
|     public static String extractFromString(String input, String regex, String defaultInput) { |  | ||||||
|         try { |  | ||||||
|             String str = ReUtil.get(regex, input, 1); |  | ||||||
|             return str == null ? defaultInput : str; |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             return defaultInput; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,105 +0,0 @@ | |||||||
| package org.dromara.common.core.utils.regex; |  | ||||||
|  |  | ||||||
| import cn.hutool.core.exceptions.ValidateException; |  | ||||||
| import cn.hutool.core.lang.Validator; |  | ||||||
| import org.dromara.common.core.factory.RegexPatternPoolFactory; |  | ||||||
|  |  | ||||||
| import java.util.regex.Pattern; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 正则字段校验器 |  | ||||||
|  * 主要验证字段非空、是否为满足指定格式等 |  | ||||||
|  * |  | ||||||
|  * @author Feng |  | ||||||
|  */ |  | ||||||
| public class RegexValidator extends Validator { |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern DICTIONARY_TYPE = RegexPatternPoolFactory.DICTIONARY_TYPE; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 身份证号码(后6位) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern ID_CARD_LAST_6 = RegexPatternPoolFactory.ID_CARD_LAST_6; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * QQ号码 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern QQ_NUMBER = RegexPatternPoolFactory.QQ_NUMBER; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 邮政编码 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern POSTAL_CODE = RegexPatternPoolFactory.POSTAL_CODE; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 注册账号 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern ACCOUNT = RegexPatternPoolFactory.ACCOUNT; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 密码:包含至少8个字符,包括大写字母、小写字母、数字和特殊字符 |  | ||||||
|      */ |  | ||||||
|     public static final Pattern PASSWORD = RegexPatternPoolFactory.PASSWORD; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 通用状态(0表示正常,1表示停用) |  | ||||||
|      */ |  | ||||||
|     public static final Pattern STATUS = RegexPatternPoolFactory.STATUS; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 检查输入的账号是否匹配预定义的规则 |  | ||||||
|      * |  | ||||||
|      * @param value 要验证的账号 |  | ||||||
|      * @return 如果账号符合规则,返回 true;否则,返回 false。 |  | ||||||
|      */ |  | ||||||
|     public static boolean isAccount(CharSequence value) { |  | ||||||
|         return isMatchRegex(ACCOUNT, value); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证输入的账号是否符合规则,如果不符合,则抛出 ValidateException 异常 |  | ||||||
|      * |  | ||||||
|      * @param value    要验证的账号 |  | ||||||
|      * @param errorMsg 验证失败时抛出的异常消息 |  | ||||||
|      * @param <T>      CharSequence 的子类型 |  | ||||||
|      * @return 如果验证通过,返回输入的账号 |  | ||||||
|      * @throws ValidateException 如果验证失败 |  | ||||||
|      */ |  | ||||||
|     public static <T extends CharSequence> T validateAccount(T value, String errorMsg) throws ValidateException { |  | ||||||
|         if (!isAccount(value)) { |  | ||||||
|             throw new ValidateException(errorMsg); |  | ||||||
|         } |  | ||||||
|         return value; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 检查输入的状态是否匹配预定义的规则 |  | ||||||
|      * |  | ||||||
|      * @param value 要验证的状态 |  | ||||||
|      * @return 如果状态符合规则,返回 true;否则,返回 false。 |  | ||||||
|      */ |  | ||||||
|     public static boolean isStatus(CharSequence value) { |  | ||||||
|         return isMatchRegex(STATUS, value); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证输入的状态是否符合规则,如果不符合,则抛出 ValidateException 异常 |  | ||||||
|      * |  | ||||||
|      * @param value    要验证的状态 |  | ||||||
|      * @param errorMsg 验证失败时抛出的异常消息 |  | ||||||
|      * @param <T>      CharSequence 的子类型 |  | ||||||
|      * @return 如果验证通过,返回输入的状态 |  | ||||||
|      * @throws ValidateException 如果验证失败 |  | ||||||
|      */ |  | ||||||
|     public static <T extends CharSequence> T validateStatus(T value, String errorMsg) throws ValidateException { |  | ||||||
|         if (!isStatus(value)) { |  | ||||||
|             throw new ValidateException(errorMsg); |  | ||||||
|         } |  | ||||||
|         return value; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| org.dromara.common.core.config.ApplicationConfig |  | ||||||
| org.dromara.common.core.config.AsyncConfig |  | ||||||
| org.dromara.common.core.config.RuoYiConfig |  | ||||||
| org.dromara.common.core.config.ThreadPoolConfig |  | ||||||
| org.dromara.common.core.config.ValidatorConfig |  | ||||||
| org.dromara.common.core.utils.SpringUtils |  | ||||||
| @@ -1,41 +0,0 @@ | |||||||
| <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |  | ||||||
|     <parent> |  | ||||||
|         <groupId>org.dromara</groupId> |  | ||||||
|         <artifactId>ruoyi-common</artifactId> |  | ||||||
|         <version>${revision}</version> |  | ||||||
|     </parent> |  | ||||||
|     <modelVersion>4.0.0</modelVersion> |  | ||||||
|  |  | ||||||
|     <artifactId>ruoyi-common-doc</artifactId> |  | ||||||
|  |  | ||||||
|     <description> |  | ||||||
|         ruoyi-common-doc 系统接口 |  | ||||||
|     </description> |  | ||||||
|  |  | ||||||
|     <dependencies> |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.dromara</groupId> |  | ||||||
|             <artifactId>ruoyi-common-core</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>org.springdoc</groupId> |  | ||||||
|             <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>com.github.therapi</groupId> |  | ||||||
|             <artifactId>therapi-runtime-javadoc</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|         <dependency> |  | ||||||
|             <groupId>com.fasterxml.jackson.module</groupId> |  | ||||||
|             <artifactId>jackson-module-kotlin</artifactId> |  | ||||||
|         </dependency> |  | ||||||
|  |  | ||||||
|     </dependencies> |  | ||||||
|  |  | ||||||
| </project> |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| org.dromara.common.doc.config.SpringDocConfig |  | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user