mirror of
https://gitee.com/y_project/RuoYi-Vue.git
synced 2025-12-08 15:02:29 +08:00
Compare commits
438 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 170cfb356c | |||
| 5879c2484a | |||
| c02dad2ca3 | |||
| 1bfa14e3c6 | |||
| 5dec58e7f5 | |||
| 8321f92d2c | |||
| da1095e298 | |||
| f56da498ab | |||
| e259093e01 | |||
| e963a86b15 | |||
| e447fb806b | |||
| 90c41d498c | |||
| ce6bea4ba0 | |||
| 9c7901f526 | |||
| 04f5a93aa8 | |||
| 751ca90690 | |||
| 1dfeae6a03 | |||
| 1ed60c79c0 | |||
| aee1e53140 | |||
| 253e2b2de1 | |||
| b1413f021e | |||
| 60c22b6a43 | |||
| 3f05ed6ffa | |||
| 090ad5323a | |||
| 3e90fd010d | |||
| 462862ba65 | |||
| 7601a72faf | |||
| 7ab14ff293 | |||
| 200106df39 | |||
| ea66e20282 | |||
| a209b39552 | |||
| 557672ba9f | |||
| a3116cd27d | |||
| 2ace3257f9 | |||
| c16ee7fc2c | |||
| fd33fe869d | |||
| b7446f8d0f | |||
| 19924cd184 | |||
| 85470a1549 | |||
| 2a604c0548 | |||
| b7f3c68eca | |||
| edd2981076 | |||
| c105a63c8b | |||
| 01fef0b9e1 | |||
| af9cfb40a4 | |||
| 6fa3bfe051 | |||
| 5e64a93d11 | |||
| 4aabf5d8be | |||
| cf6254a8d5 | |||
| 883cff5de9 | |||
| 7e79c4f249 | |||
| 504638eb41 | |||
| 2adac4a899 | |||
| 56a943bf48 | |||
| 77ebca264a | |||
| 7b94ae3a9a | |||
| bd1edc6dcc | |||
| 09d166e97d | |||
| f3e5d908d6 | |||
| 9651a7d7fc | |||
| b2914cbcb1 | |||
| d0a4d6b111 | |||
| b431703262 | |||
| 99726be9ac | |||
| 32f333a00e | |||
| be5c19b764 | |||
| dd384e4a31 | |||
| bdde195e2b | |||
| 14ea071306 | |||
| 50034301ac | |||
| 85ed712c50 | |||
| f67d682345 | |||
| 3f1427eef9 | |||
| 7d0f5e94ef | |||
| 62081aebb9 | |||
| 3f07632cd4 | |||
| 2c94587263 | |||
| 2575c17f47 | |||
| b6f13c546b | |||
| e60a69b670 | |||
| cb18eec802 | |||
| bef080c60a | |||
| de73cf300b | |||
| cbcee86d2c | |||
| cc50224d90 | |||
| ff09e1cf55 | |||
| fe2ccbdc1b | |||
| c8df1f5e1f | |||
| e71c00e6fa | |||
| dcb9839596 | |||
| f13b6d92d2 | |||
| 6595c68df1 | |||
| 5a2a0c09b6 | |||
| 9aac65ff32 | |||
| 5f2350569a | |||
| ccf05b697d | |||
| 6810243ab7 | |||
| b56b8846d9 | |||
| 8e1e4cd8fe | |||
| 9fa5c79713 | |||
| 40a72c2b7e | |||
| 6fe9a358b7 | |||
| 9f6bc13e64 | |||
| ba5ab4b091 | |||
| 17407d0127 | |||
| 30f330f4a0 | |||
| 6ca7870393 | |||
| 2a7342ec43 | |||
| fc57e91b80 | |||
| 347f36ceff | |||
| 9b9c1b999f | |||
| ec627704b2 | |||
| 9e6b2a1265 | |||
| 266a5e844f | |||
| 0822680158 | |||
| 090e258bf9 | |||
| 505fa06dc3 | |||
| 6cf53bfacb | |||
| 881dc3fcf0 | |||
| b65c8d4512 | |||
| 67371a9028 | |||
| 01b545e4ab | |||
| c2e9200626 | |||
| 9502203bbe | |||
| c0f1569ad9 | |||
| 61432480c8 | |||
| 78deee063d | |||
| 4ad003649e | |||
| 616f5a6aca | |||
| fea3ff7b2a | |||
| f938a24df0 | |||
| 45fa686a64 | |||
| 0d8c3b4940 | |||
| 64e807f27b | |||
| 9a384a2fc2 | |||
| 339b932a3d | |||
| 0b5c7f4c96 | |||
| 265e3010aa | |||
| b7a36bfe8a | |||
| 3a51c53823 | |||
| df504c5c14 | |||
| baeed2e8d3 | |||
| 2903de1561 | |||
| cca2f5c62d | |||
| ce54416e4f | |||
| bd19892aff | |||
| 14a859899c | |||
| f3cb18c836 | |||
| 7d0eb3b8c7 | |||
| 654aa6b30c | |||
| b7cdd10f9f | |||
| 9bd35cb7be | |||
| 7a86c714fc | |||
| edd090a098 | |||
| 3cd886785b | |||
| ae5a0f9774 | |||
| 074b3c735d | |||
| a118738d0f | |||
| 56fa3912ae | |||
| 2116ee1822 | |||
| 57a2eb4217 | |||
| 647af5b485 | |||
| 3f33219134 | |||
| a04bb71777 | |||
| 63992ac906 | |||
| 0187344798 | |||
| a9c6ba12e6 | |||
| ba068eae65 | |||
| 1a87ee7c19 | |||
| 3c4b01ab83 | |||
| 886ce995af | |||
| 52264b6e2a | |||
| fd7e88a518 | |||
| 854a6f805f | |||
| 1caec85f46 | |||
| c86dc20743 | |||
| ecc7a8be46 | |||
| e23ad20186 | |||
| 6cf2a8edeb | |||
| 67198aede9 | |||
| 4f33da2a3f | |||
| 8988d0b4ab | |||
| ceefa20aa2 | |||
| 89e1f2a53f | |||
| 6800a12014 | |||
| e8f63b2994 | |||
| ecfe7006e2 | |||
| 9e387dc447 | |||
| 231bbf6928 | |||
| d6eac2dc8d | |||
| b368ad764f | |||
| ffd5f0ce5d | |||
| a50beae599 | |||
| cf7f51a633 | |||
| 4d46f4c1b5 | |||
| a941c1b488 | |||
| d6b6151aea | |||
| fbc071a573 | |||
| 6cfff90b4a | |||
| 474cca921e | |||
| 1657e06be6 | |||
| c01eeb8521 | |||
| f90899d72a | |||
| 7e78a9167f | |||
| 563e11d9c1 | |||
| ef92ad4d8c | |||
| d8b006c15f | |||
| 0e2b97a886 | |||
| 1c7a5faae8 | |||
| 23868c4fad | |||
| 3b2669d148 | |||
| 1147ea5f8a | |||
| a1bf5aaf8e | |||
| 2797c1eb3a | |||
| 1791d7cf40 | |||
| 01861f0aae | |||
| a69cc94f35 | |||
| c666faed66 | |||
| 6072239a40 | |||
| a3b86d6f6d | |||
| fd831d5a90 | |||
| e83412b9a5 | |||
| 90ac416e02 | |||
| 5b63f0cab9 | |||
| 8f145bba3a | |||
| 6bb166b89f | |||
| 823e95667e | |||
| 566053da0c | |||
| 0ef007240d | |||
| 0a75dcdd85 | |||
| 4c2626ffec | |||
| 082b19e33a | |||
| b779cf053d | |||
| 212012dc62 | |||
| 7de2cf77b4 | |||
| 2b9d46439f | |||
| 79265d59b7 | |||
| 093ba5b389 | |||
| 3807b11290 | |||
| c9f25cb34e | |||
| 203b54e5aa | |||
| 403f5c5dcf | |||
| c6d0b9a9ae | |||
| 08df2c93a9 | |||
| fbbdd94999 | |||
| 0cae7d0058 | |||
| b0965653bf | |||
| e472f62523 | |||
| 69256940df | |||
| b9f686be53 | |||
| 521ff51238 | |||
| f67c97e095 | |||
| dd721ff894 | |||
| ae4290bdda | |||
| c19fec2cf8 | |||
| 669c42795a | |||
| 0d79f10c2f | |||
| d3595cd930 | |||
| 5b0525d05c | |||
| fb07677c32 | |||
| a82a3d9465 | |||
| 28bceda630 | |||
| 69829827fe | |||
| 89607fb028 | |||
| 1aa18c523d | |||
| abeb8d7fd8 | |||
| 478fae0d28 | |||
| 0ecf27f8d6 | |||
| 0a5bb34fbf | |||
| 9e38c7de2e | |||
| 9ca28d6dbf | |||
| 497f98ba90 | |||
| a948affb2d | |||
| 57b49dd5fa | |||
| 9c0ed9c424 | |||
| 70ab18052c | |||
| aeb02c79d8 | |||
| 33793d8eff | |||
| 9652906954 | |||
| 9fccc7de40 | |||
| 599be64fa8 | |||
| 50ac363682 | |||
| f84b157419 | |||
| f4536d5d2e | |||
| aed958b1be | |||
| 0a51f7d743 | |||
| 3fd9147afb | |||
| 4f86b6d9ca | |||
| a65c287075 | |||
| 1af0d1665c | |||
| 4e32788b36 | |||
| 068c3e6f0d | |||
| dd6640086e | |||
| be54188ba6 | |||
| a4e2339f90 | |||
| bf771ae5c8 | |||
| fa5596bb20 | |||
| eb30fc4b1a | |||
| 0446d211df | |||
| da146c2a70 | |||
| 7de5358dcd | |||
| 549c7ee97a | |||
| 5fcf342f5a | |||
| c89722a7dd | |||
| 61e10f2783 | |||
| c6912ca1d5 | |||
| 5c4f0c5503 | |||
| 4f7702b22a | |||
| 04e294b3e5 | |||
| d596d5bb8e | |||
| 8f9f0c04cc | |||
| 1bad003fe3 | |||
| ad4df6245d | |||
| 0070297fe1 | |||
| 71ec44a545 | |||
| 1efae4a588 | |||
| 650359c357 | |||
| a78211ca00 | |||
| 74f52677be | |||
| 60d5c03e65 | |||
| 5b04f388e9 | |||
| a7eb07c7a0 | |||
| d0b315f4a5 | |||
| a6051d4638 | |||
| c4ee9ea7c8 | |||
| 7c39f92538 | |||
| 51fa66f61a | |||
| 3b61ed56b0 | |||
| db904f679e | |||
| 98982515f7 | |||
| 1a7baa0639 | |||
| a9695d1756 | |||
| d78f642201 | |||
| 26dfee2ce8 | |||
| b56898858d | |||
| 503dd64e3f | |||
| 876ecf21c7 | |||
| 107672419e | |||
| 21d07c1d71 | |||
| d8d636fdbd | |||
| 743fce7829 | |||
| de2ac66f0b | |||
| 8b5d254242 | |||
| a7eb0f98ac | |||
| 4dcf737db0 | |||
| b32d0724b7 | |||
| 8deacb702e | |||
| 5be8d46d05 | |||
| fb19dd3e4e | |||
| cbf4795fd5 | |||
| 5d74ed32bd | |||
| 6afaced3cf | |||
| f3976c0792 | |||
| 22225a5119 | |||
| fe030cc022 | |||
| ca657b0482 | |||
| c1d1ace36d | |||
| 6e7d7aba93 | |||
| 388e36ed4d | |||
| 5d89d0b36a | |||
| 55095a50b5 | |||
| ee4b4de7b1 | |||
| 92c6301285 | |||
| 5c6adb25fc | |||
| 8dd3ca5bb6 | |||
| be778ba370 | |||
| 52d48fa63e | |||
| df3ef54b41 | |||
| 1e40e60dbf | |||
| 133a10ecf2 | |||
| 6a84ae42a5 | |||
| b2d79b62d1 | |||
| a09a342f58 | |||
| 3e1bd8e3bc | |||
| 8a076e175f | |||
| cee572f237 | |||
| 0d341f1aaa | |||
| 11ab4b4832 | |||
| 3afa664173 | |||
| 1624debefe | |||
| 0238c4ad92 | |||
| 0d52e11e3d | |||
| d5cc95fefb | |||
| d29fe10b93 | |||
| 086b9cdc23 | |||
| 22b09535af | |||
| aad58640dc | |||
| 2211a75704 | |||
| 4088463adf | |||
| dd7a9850e3 | |||
| a691da0c97 | |||
| ec09696512 | |||
| d04ec69df4 | |||
| bc56aae219 | |||
| 31765f6392 | |||
| 1e2a2026c6 | |||
| e56efebce5 | |||
| fb53780d8a | |||
| 3a69a31d07 | |||
| d9367425fa | |||
| 338f661d41 | |||
| 794d6f17db | |||
| 7a9564ced5 | |||
| 5d5f955a34 | |||
| eac9403ea4 | |||
| f7f02e3a3f | |||
| 0dff669374 | |||
| 5bd2838b2b | |||
| f39be3ab9b | |||
| f5badba2bb | |||
| 9ea0041fab | |||
| f6de03a009 | |||
| a195df175f | |||
| 48ba7d5ed6 | |||
| 03aef64693 | |||
| c3b5cb20d8 | |||
| 2daf89e0c6 | |||
| a2d1160205 | |||
| 0c069a57cc | |||
| 19b8688759 | |||
| 33f09d7747 | |||
| 7afc5acc6f | |||
| 8a7f33807b | |||
| 945fb282dd | |||
| 2fd3cbbd18 | |||
| 5680d91a87 | |||
| 9d8da28f2e | |||
| 40185f27e2 | |||
| ef5adf2e2a | |||
| ff695831dc | |||
| ea9effaf32 | |||
| 4cb4de86db | |||
| c861b78f80 | |||
| 5123832cd7 | |||
| ec407bbe25 | |||
| 0d7f5e037e | |||
| 31b63bf14d | |||
| 5ce4291ef1 |
3
ruoyi/.gitignore → .gitignore
vendored
3
ruoyi/.gitignore → .gitignore
vendored
@ -37,7 +37,8 @@ nbdist/
|
|||||||
# Others
|
# Others
|
||||||
*.log
|
*.log
|
||||||
*.xml.versionsBackup
|
*.xml.versionsBackup
|
||||||
|
*.swp
|
||||||
|
|
||||||
!*/build/*.java
|
!*/build/*.java
|
||||||
!*/build/*.html
|
!*/build/*.html
|
||||||
!*/build/*.xml
|
!*/build/*.xml
|
||||||
36
README.md
36
README.md
@ -1,14 +1,17 @@
|
|||||||
## 平台简介
|
## 平台简介
|
||||||
|
|
||||||
|
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||||
|
|
||||||
* 前端采用Vue、Element UI。
|
* 前端采用Vue、Element UI。
|
||||||
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
|
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
|
||||||
* 权限认证使用Jwt,支持多终端认证系统。
|
* 权限认证使用Jwt,支持多终端认证系统。
|
||||||
* 支持加载动态权限菜单,多方式轻松权限控制。
|
* 支持加载动态权限菜单,多方式轻松权限控制。
|
||||||
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
||||||
* 提供了一个Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
||||||
* 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。
|
|
||||||
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
||||||
* 阿里云优惠券:[点我进入](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
|
||||||
|
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
||||||
|
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
||||||
|
|
||||||
## 内置功能
|
## 内置功能
|
||||||
|
|
||||||
@ -27,8 +30,9 @@
|
|||||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
||||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
||||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
||||||
16. 在线构建器:拖动表单元素生成相应的HTML代码。
|
16. 缓存监控:对系统的缓存信息查询,命令统计等。
|
||||||
17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
17. 在线构建器:拖动表单元素生成相应的HTML代码。
|
||||||
|
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
||||||
|
|
||||||
## 在线体验
|
## 在线体验
|
||||||
|
|
||||||
@ -46,36 +50,36 @@
|
|||||||
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/707825ad3f29de74a8d6d02fbd73ad631ea.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/46be40cc6f01aa300eed53a19b5012bf484.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/4284796d4cea240d181b8f2201813dda710.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/3ecfac87a049f7fe36abbcaafb2c40d36cf.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/71c2d48905221a09a728df4aff4160b8607.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/c14c1ee9a64a6a9c2c22f67d43198767dbe.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/fdea1d8bb8625c27bf964176a2c8ebc6945.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/509d2708cfd762b6e6339364cac1cc1970c.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-f1fd681cc9d295db74e85ad6d2fe4389454.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-6d73c2140ce694e3de4c05035fdc1868d4c.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
## 若依前后端分离交流群
|
## 若依前后端分离交流群
|
||||||
|
|
||||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) 点击按钮入群。
|
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。
|
||||||
14
bin/run.bat
Normal file
14
bin/run.bat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̡<EFBFBD>
|
||||||
|
echo.
|
||||||
|
|
||||||
|
cd %~dp0
|
||||||
|
cd ../ruoyi-admin/target
|
||||||
|
|
||||||
|
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
|
java -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
pause
|
||||||
BIN
doc/若依环境使用手册.docx
Normal file
BIN
doc/若依环境使用手册.docx
Normal file
Binary file not shown.
266
pom.xml
Normal file
266
pom.xml
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
<?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>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
|
||||||
|
<name>ruoyi</name>
|
||||||
|
<url>http://www.ruoyi.vip</url>
|
||||||
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<ruoyi.version>3.6.0</ruoyi.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<druid.version>1.2.6</druid.version>
|
||||||
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
|
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
|
||||||
|
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
||||||
|
<fastjson.version>1.2.76</fastjson.version>
|
||||||
|
<oshi.version>5.7.4</oshi.version>
|
||||||
|
<jna.version>5.8.0</jna.version>
|
||||||
|
<commons.io.version>2.10.0</commons.io.version>
|
||||||
|
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||||
|
<commons.collections.version>3.2.2</commons.collections.version>
|
||||||
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<velocity.version>1.7</velocity.version>
|
||||||
|
<jwt.version>0.9.1</jwt.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!-- 依赖声明 -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>2.2.13.RELEASE</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
<version>${bitwalker.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot集成mybatis框架 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-spring-boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>${pagehelper.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 获取系统信息 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core</artifactId>
|
||||||
|
<version>${oshi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
<artifactId>jna</artifactId>
|
||||||
|
<version>${jna.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
<artifactId>jna-platform</artifactId>
|
||||||
|
<version>${jna.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger3依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons.io.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 文件上传工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>${commons.fileupload.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>${poi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- velocity代码生成使用模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity</artifactId>
|
||||||
|
<version>${velocity.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- collections工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
<version>${commons.collections.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>${jwt.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 验证码 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.penggle</groupId>
|
||||||
|
<artifactId>kaptcha</artifactId>
|
||||||
|
<version>${kaptcha.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-quartz</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>ruoyi-admin</module>
|
||||||
|
<module>ruoyi-framework</module>
|
||||||
|
<module>ruoyi-system</module>
|
||||||
|
<module>ruoyi-quartz</module>
|
||||||
|
<module>ruoyi-generator</module>
|
||||||
|
<module>ruoyi-common</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
</project>
|
||||||
96
ruoyi-admin/pom.xml
Normal file
96
ruoyi-admin/pom.xml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?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>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>ruoyi-admin</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger3-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql驱动包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.1.1.RELEASE</version>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<warName>${project.artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -14,7 +14,7 @@ public class RuoYiApplication
|
|||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
SpringApplication.run(RuoYiApplication.class, args);
|
SpringApplication.run(RuoYiApplication.class, args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
" .-------. ____ __ \n" +
|
" .-------. ____ __ \n" +
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.sign.Base64;
|
||||||
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class CaptchaController
|
||||||
|
{
|
||||||
|
@Resource(name = "captchaProducer")
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
@Resource(name = "captchaProducerMath")
|
||||||
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
// 验证码类型
|
||||||
|
@Value("${ruoyi.captchaType}")
|
||||||
|
private String captchaType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成验证码
|
||||||
|
*/
|
||||||
|
@GetMapping("/captchaImage")
|
||||||
|
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||||
|
{
|
||||||
|
// 保存验证码信息
|
||||||
|
String uuid = IdUtils.simpleUUID();
|
||||||
|
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||||
|
|
||||||
|
String capStr = null, code = null;
|
||||||
|
BufferedImage image = null;
|
||||||
|
|
||||||
|
// 生成验证码
|
||||||
|
if ("math".equals(captchaType))
|
||||||
|
{
|
||||||
|
String capText = captchaProducerMath.createText();
|
||||||
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
|
image = captchaProducerMath.createImage(capStr);
|
||||||
|
}
|
||||||
|
else if ("char".equals(captchaType))
|
||||||
|
{
|
||||||
|
capStr = code = captchaProducer.createText();
|
||||||
|
image = captchaProducer.createImage(capStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||||
|
// 转换流信息写出
|
||||||
|
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("uuid", uuid);
|
||||||
|
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,21 +1,22 @@
|
|||||||
package com.ruoyi.project.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
import com.ruoyi.framework.config.RuoYiConfig;
|
|
||||||
import com.ruoyi.framework.config.ServerConfig;
|
import com.ruoyi.framework.config.ServerConfig;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
@ -41,17 +42,15 @@ public class CommonController
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!FileUtils.isValidFilename(fileName))
|
if (!FileUtils.checkAllowDownload(fileName))
|
||||||
{
|
{
|
||||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
}
|
}
|
||||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||||
|
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
response.setContentType("multipart/form-data");
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
response.setHeader("Content-Disposition",
|
|
||||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete)
|
||||||
{
|
{
|
||||||
@ -92,18 +91,28 @@ public class CommonController
|
|||||||
* 本地资源通用下载
|
* 本地资源通用下载
|
||||||
*/
|
*/
|
||||||
@GetMapping("/common/download/resource")
|
@GetMapping("/common/download/resource")
|
||||||
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
// 本地资源路径
|
try
|
||||||
String localPath = RuoYiConfig.getProfile();
|
{
|
||||||
// 数据库资源地址
|
if (!FileUtils.checkAllowDownload(resource))
|
||||||
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
|
{
|
||||||
// 下载名称
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
}
|
||||||
response.setCharacterEncoding("utf-8");
|
// 本地资源路径
|
||||||
response.setContentType("multipart/form-data");
|
String localPath = RuoYiConfig.getProfile();
|
||||||
response.setHeader("Content-Disposition",
|
// 数据库资源地址
|
||||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
// 下载名称
|
||||||
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/cache")
|
||||||
|
public class CacheController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping()
|
||||||
|
public AjaxResult getInfo() throws Exception
|
||||||
|
{
|
||||||
|
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||||
|
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||||
|
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>(3);
|
||||||
|
result.put("info", info);
|
||||||
|
result.put("dbSize", dbSize);
|
||||||
|
|
||||||
|
List<Map<String, String>> pieList = new ArrayList<>();
|
||||||
|
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 AjaxResult.success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,10 @@
|
|||||||
package com.ruoyi.project.monitor.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.domain.Server;
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +14,7 @@ import com.ruoyi.framework.web.domain.Server;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/server")
|
@RequestMapping("/monitor/server")
|
||||||
public class ServerController extends BaseController
|
public class ServerController
|
||||||
{
|
{
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -8,14 +8,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.domain.SysLogininfor;
|
|
||||||
import com.ruoyi.project.monitor.service.ISysLogininforService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
@ -38,18 +38,18 @@ public class SysLogininforController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult export(SysLogininfor logininfor)
|
public AjaxResult export(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
return util.exportExcel(list, "登陆日志");
|
return util.exportExcel(list, "登录日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{infoIds}")
|
@DeleteMapping("/{infoIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ public class SysLogininforController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clean")
|
@DeleteMapping("/clean")
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -8,14 +8,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.domain.SysOperLog;
|
|
||||||
import com.ruoyi.project.monitor.service.ISysOperLogService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
@ -48,6 +48,7 @@ public class SysOperlogController extends BaseController
|
|||||||
return util.exportExcel(list, "操作日志");
|
return util.exportExcel(list, "操作日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
@DeleteMapping("/{operIds}")
|
@DeleteMapping("/{operIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.monitor.controller;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -11,17 +11,17 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
import com.ruoyi.framework.redis.RedisCache;
|
|
||||||
import com.ruoyi.framework.security.LoginUser;
|
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.monitor.domain.SysUserOnline;
|
|
||||||
import com.ruoyi.project.system.service.ISysUserOnlineService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
@ -82,7 +82,7 @@ public class SysUserOnlineController extends BaseController
|
|||||||
* 强退用户
|
* 强退用户
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||||
@Log(title = "在线用户", businessType = BusinessType.DELETE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@DeleteMapping("/{tokenId}")
|
@DeleteMapping("/{tokenId}")
|
||||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||||
{
|
{
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,16 +12,17 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysConfig;
|
|
||||||
import com.ruoyi.project.system.service.ISysConfigService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
@ -82,6 +83,7 @@ public class SysConfigController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@RepeatSubmit
|
||||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
@ -116,18 +118,19 @@ public class SysConfigController extends BaseController
|
|||||||
@DeleteMapping("/{configIds}")
|
@DeleteMapping("/{configIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||||
{
|
{
|
||||||
return toAjax(configService.deleteConfigByIds(configIds));
|
configService.deleteConfigByIds(configIds);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存
|
* 刷新参数缓存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clearCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult clearCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
configService.clearCache();
|
configService.resetConfigCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -14,15 +14,15 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.project.system.domain.SysDept;
|
|
||||||
import com.ruoyi.project.system.service.ISysDeptService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -12,16 +13,17 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysDictData;
|
|
||||||
import com.ruoyi.project.system.service.ISysDictDataService;
|
|
||||||
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
@ -73,7 +75,12 @@ public class SysDictDataController extends BaseController
|
|||||||
@GetMapping(value = "/type/{dictType}")
|
@GetMapping(value = "/type/{dictType}")
|
||||||
public AjaxResult dictType(@PathVariable String dictType)
|
public AjaxResult dictType(@PathVariable String dictType)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNull(data))
|
||||||
|
{
|
||||||
|
data = new ArrayList<SysDictData>();
|
||||||
|
}
|
||||||
|
return AjaxResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,6 +115,7 @@ public class SysDictDataController extends BaseController
|
|||||||
@DeleteMapping("/{dictCodes}")
|
@DeleteMapping("/{dictCodes}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||||
{
|
{
|
||||||
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,16 +12,16 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysDictType;
|
|
||||||
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
@ -104,18 +104,19 @@ public class SysDictTypeController extends BaseController
|
|||||||
@DeleteMapping("/{dictIds}")
|
@DeleteMapping("/{dictIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||||
{
|
{
|
||||||
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存
|
* 刷新字典缓存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/clearCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult clearCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
dictTypeService.clearCache();
|
dictTypeService.resetDictCache();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysIndexController
|
||||||
|
{
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private RuoYiConfig ruoyiConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问首页,提示语
|
||||||
|
*/
|
||||||
|
@RequestMapping("/")
|
||||||
|
public String index()
|
||||||
|
{
|
||||||
|
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -8,16 +8,16 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.framework.security.LoginBody;
|
import com.ruoyi.framework.web.service.SysLoginService;
|
||||||
import com.ruoyi.framework.security.LoginUser;
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
import com.ruoyi.framework.security.service.SysLoginService;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
import com.ruoyi.framework.security.service.SysPermissionService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
import com.ruoyi.framework.security.service.TokenService;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.project.system.domain.SysMenu;
|
|
||||||
import com.ruoyi.project.system.domain.SysUser;
|
|
||||||
import com.ruoyi.project.system.service.ISysMenuService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
@ -42,10 +42,7 @@ public class SysLoginController
|
|||||||
/**
|
/**
|
||||||
* 登录方法
|
* 登录方法
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param loginBody 登录信息
|
||||||
* @param password 密码
|
|
||||||
* @param captcha 验证码
|
|
||||||
* @param uuid 唯一标识
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,19 +12,18 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
import com.ruoyi.framework.security.LoginUser;
|
|
||||||
import com.ruoyi.framework.security.service.TokenService;
|
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.project.system.domain.SysMenu;
|
|
||||||
import com.ruoyi.project.system.service.ISysMenuService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
@ -102,8 +101,7 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
@ -123,10 +121,13 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
|
}
|
||||||
|
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,14 +12,14 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysNotice;
|
|
||||||
import com.ruoyi.project.system.service.ISysNoticeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,16 +12,16 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysPost;
|
|
||||||
import com.ruoyi.project.system.service.ISysPostService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
@ -48,7 +48,7 @@ public class SysPostController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult export(SysPost post)
|
public AjaxResult export(SysPost post)
|
||||||
{
|
{
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -10,18 +10,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import com.ruoyi.framework.config.RuoYiConfig;
|
|
||||||
import com.ruoyi.framework.security.LoginUser;
|
|
||||||
import com.ruoyi.framework.security.service.TokenService;
|
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.project.system.domain.SysUser;
|
|
||||||
import com.ruoyi.project.system.service.ISysUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
@ -59,6 +61,16 @@ public class SysProfileController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
if (userService.updateUserProfile(user) > 0)
|
if (userService.updateUserProfile(user) > 0)
|
||||||
{
|
{
|
||||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -12,16 +12,24 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import com.ruoyi.project.system.domain.SysRole;
|
|
||||||
import com.ruoyi.project.system.service.ISysRoleService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
@ -35,6 +43,15 @@ public class SysRoleController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo list(SysRole role)
|
||||||
@ -103,7 +120,20 @@ public class SysRoleController extends BaseController
|
|||||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(SecurityUtils.getUsername());
|
role.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(roleService.updateRole(role));
|
|
||||||
|
if (roleService.updateRole(role) > 0)
|
||||||
|
{
|
||||||
|
// 更新缓存用户权限
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
|
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||||
|
{
|
||||||
|
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||||
|
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,4 +181,61 @@ public class SysRoleController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.success(roleService.selectRoleAll());
|
return AjaxResult.success(roleService.selectRoleAll());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 查询已分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/allocatedList")
|
||||||
|
public TableDataInfo allocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/unallocatedList")
|
||||||
|
public TableDataInfo unallocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancel")
|
||||||
|
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancelAll")
|
||||||
|
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量选择用户授权
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/selectAll")
|
||||||
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -13,22 +14,23 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.framework.security.LoginUser;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.framework.security.service.TokenService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.project.system.domain.SysUser;
|
|
||||||
import com.ruoyi.project.system.service.ISysPostService;
|
|
||||||
import com.ruoyi.project.system.service.ISysRoleService;
|
|
||||||
import com.ruoyi.project.system.service.ISysUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
@ -101,7 +103,8 @@ public class SysUserController extends BaseController
|
|||||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("roles", roleService.selectRoleAll());
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostAll());
|
ajax.put("posts", postService.selectPostAll());
|
||||||
if (StringUtils.isNotNull(userId))
|
if (StringUtils.isNotNull(userId))
|
||||||
{
|
{
|
||||||
@ -124,11 +127,13 @@ public class SysUserController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
@ -146,11 +151,13 @@ public class SysUserController extends BaseController
|
|||||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
@ -172,7 +179,7 @@ public class SysUserController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/resetPwd")
|
@PutMapping("/resetPwd")
|
||||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||||
@ -195,4 +202,31 @@ public class SysUserController extends BaseController
|
|||||||
user.setUpdateBy(SecurityUtils.getUsername());
|
user.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(userService.updateUserStatus(user));
|
return toAjax(userService.updateUserStatus(user));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号获取授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
|
@GetMapping("/authRole/{userId}")
|
||||||
|
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
SysUser user = userService.selectUserById(userId);
|
||||||
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
ajax.put("user", user);
|
||||||
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authRole")
|
||||||
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||||
|
{
|
||||||
|
userService.insertUserAuth(userId, roleIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger 接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/tool/swagger")
|
||||||
|
public class SwaggerController extends BaseController
|
||||||
|
{
|
||||||
|
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
|
||||||
|
@GetMapping()
|
||||||
|
public String index()
|
||||||
|
{
|
||||||
|
return redirect("/swagger-ui.html");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.tool.swagger;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -9,13 +9,15 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -55,34 +57,38 @@ public class TestController extends BaseController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return AjaxResult.error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"),
|
||||||
|
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String")
|
||||||
|
})
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public AjaxResult save(UserEntity user)
|
public AjaxResult save(UserEntity user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("更新用户")
|
@ApiOperation("更新用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public AjaxResult update(UserEntity user)
|
public AjaxResult update(@RequestBody UserEntity user)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||||
{
|
{
|
||||||
return AjaxResult.error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
users.remove(user.getUserId());
|
users.remove(user.getUserId());
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
@ -96,16 +102,16 @@ public class TestController extends BaseController
|
|||||||
if (!users.isEmpty() && users.containsKey(userId))
|
if (!users.isEmpty() && users.containsKey(userId))
|
||||||
{
|
{
|
||||||
users.remove(userId);
|
users.remove(userId);
|
||||||
return AjaxResult.success();
|
return success();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return AjaxResult.error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModel("用户实体")
|
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||||
class UserEntity
|
class UserEntity
|
||||||
{
|
{
|
||||||
@ApiModelProperty("用户ID")
|
@ApiModelProperty("用户ID")
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -6,7 +6,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
@ -15,10 +17,10 @@ import springfox.documentation.service.ApiKey;
|
|||||||
import springfox.documentation.service.AuthorizationScope;
|
import springfox.documentation.service.AuthorizationScope;
|
||||||
import springfox.documentation.service.Contact;
|
import springfox.documentation.service.Contact;
|
||||||
import springfox.documentation.service.SecurityReference;
|
import springfox.documentation.service.SecurityReference;
|
||||||
|
import springfox.documentation.service.SecurityScheme;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger2的接口配置
|
* Swagger2的接口配置
|
||||||
@ -26,7 +28,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
|
||||||
public class SwaggerConfig
|
public class SwaggerConfig
|
||||||
{
|
{
|
||||||
/** 系统基础配置 */
|
/** 系统基础配置 */
|
||||||
@ -47,7 +48,7 @@ public class SwaggerConfig
|
|||||||
@Bean
|
@Bean
|
||||||
public Docket createRestApi()
|
public Docket createRestApi()
|
||||||
{
|
{
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.OAS_30)
|
||||||
// 是否启用Swagger
|
// 是否启用Swagger
|
||||||
.enable(enabled)
|
.enable(enabled)
|
||||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
@ -70,10 +71,10 @@ public class SwaggerConfig
|
|||||||
/**
|
/**
|
||||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
*/
|
*/
|
||||||
private List<ApiKey> securitySchemes()
|
private List<SecurityScheme> securitySchemes()
|
||||||
{
|
{
|
||||||
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||||
return apiKeyList;
|
return apiKeyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ public class SwaggerConfig
|
|||||||
securityContexts.add(
|
securityContexts.add(
|
||||||
SecurityContext.builder()
|
SecurityContext.builder()
|
||||||
.securityReferences(defaultAuth())
|
.securityReferences(defaultAuth())
|
||||||
.forPaths(PathSelectors.regex("^(?!auth).*$"))
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||||
.build());
|
.build());
|
||||||
return securityContexts;
|
return securityContexts;
|
||||||
}
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
restart.include.json=/com.alibaba.fastjson.*.jar
|
||||||
@ -43,8 +43,8 @@ spring:
|
|||||||
allow:
|
allow:
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
# 控制台管理用户名和密码
|
# 控制台管理用户名和密码
|
||||||
login-username:
|
login-username: ruoyi
|
||||||
login-password:
|
login-password: 123456
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -3,15 +3,17 @@ ruoyi:
|
|||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
# 版本
|
# 版本
|
||||||
version: 2.3.0
|
version: 3.6.0
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2019
|
copyrightYear: 2021
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: true
|
demoEnabled: true
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/ruoyi/uploadPath
|
profile: D:/ruoyi/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: false
|
addressEnabled: false
|
||||||
|
# 验证码类型 math 数组计算 char 字符验证
|
||||||
|
captchaType: math
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
@ -60,6 +62,8 @@ spring:
|
|||||||
host: localhost
|
host: localhost
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
|
# 数据库索引
|
||||||
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
password:
|
password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
@ -79,7 +83,7 @@ spring:
|
|||||||
token:
|
token:
|
||||||
# 令牌自定义标识
|
# 令牌自定义标识
|
||||||
header: Authorization
|
header: Authorization
|
||||||
# 令牌秘钥
|
# 令牌密钥
|
||||||
secret: abcdefghijklmnopqrstuvwxyz
|
secret: abcdefghijklmnopqrstuvwxyz
|
||||||
# 令牌有效期(默认30分钟)
|
# 令牌有效期(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 30
|
||||||
@ -87,9 +91,9 @@ token:
|
|||||||
# MyBatis配置
|
# MyBatis配置
|
||||||
mybatis:
|
mybatis:
|
||||||
# 搜索指定包别名
|
# 搜索指定包别名
|
||||||
typeAliasesPackage: com.ruoyi.project.**.domain
|
typeAliasesPackage: com.ruoyi.**.domain
|
||||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
mapperLocations: classpath*:mybatis/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
|
||||||
@ -115,14 +119,3 @@ xss:
|
|||||||
excludes: /system/notice/*
|
excludes: /system/notice/*
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
# 代码生成
|
|
||||||
gen:
|
|
||||||
# 作者
|
|
||||||
author: ruoyi
|
|
||||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
|
||||||
packageName: com.ruoyi.project.system
|
|
||||||
# 自动去除表前缀,默认是true
|
|
||||||
autoRemovePre: false
|
|
||||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
|
||||||
tablePrefix: sys_
|
|
||||||
124
ruoyi-common/pom.xml
Normal file
124
ruoyi-common/pom.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?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>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
common通用工具
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- spring security 安全认证 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自定义验证注解 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</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>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 文件上传工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- yml解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis 缓存操作 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pool 对象池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- servlet包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
@ -6,7 +6,7 @@ import java.lang.annotation.Inherited;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义多数据源切换注解
|
* 自定义多数据源切换注解
|
||||||
@ -1,113 +1,165 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
import java.math.BigDecimal;
|
||||||
/**
|
|
||||||
* 自定义导出Excel数据注解
|
/**
|
||||||
*
|
* 自定义导出Excel数据注解
|
||||||
* @author ruoyi
|
*
|
||||||
*/
|
* @author ruoyi
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
*/
|
||||||
@Target(ElementType.FIELD)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Excel
|
@Target(ElementType.FIELD)
|
||||||
{
|
public @interface Excel
|
||||||
/**
|
{
|
||||||
* 导出到Excel中的名字.
|
/**
|
||||||
*/
|
* 导出时在excel中排序
|
||||||
public String name() default "";
|
*/
|
||||||
|
public int sort() default Integer.MAX_VALUE;
|
||||||
/**
|
|
||||||
* 日期格式, 如: yyyy-MM-dd
|
/**
|
||||||
*/
|
* 导出到Excel中的名字.
|
||||||
public String dateFormat() default "";
|
*/
|
||||||
|
public String name() default "";
|
||||||
/**
|
|
||||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
/**
|
||||||
*/
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
public String readConverterExp() default "";
|
*/
|
||||||
|
public String dateFormat() default "";
|
||||||
/**
|
|
||||||
* 导出类型(0数字 1字符串)
|
/**
|
||||||
*/
|
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||||
public ColumnType cellType() default ColumnType.STRING;
|
*/
|
||||||
|
public String dictType() default "";
|
||||||
/**
|
|
||||||
* 导出时在excel中每个列的高度 单位为字符
|
/**
|
||||||
*/
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
public double height() default 14;
|
*/
|
||||||
|
public String readConverterExp() default "";
|
||||||
/**
|
|
||||||
* 导出时在excel中每个列的宽 单位为字符
|
/**
|
||||||
*/
|
* 分隔符,读取字符串组内容
|
||||||
public double width() default 16;
|
*/
|
||||||
|
public String separator() default ",";
|
||||||
/**
|
|
||||||
* 文字后缀,如% 90 变成90%
|
/**
|
||||||
*/
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
public String suffix() default "";
|
*/
|
||||||
|
public int scale() default -1;
|
||||||
/**
|
|
||||||
* 当值为空时,字段的默认值
|
/**
|
||||||
*/
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
public String defaultValue() default "";
|
*/
|
||||||
|
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
/**
|
|
||||||
* 提示信息
|
/**
|
||||||
*/
|
* 导出类型(0数字 1字符串)
|
||||||
public String prompt() default "";
|
*/
|
||||||
|
public ColumnType cellType() default ColumnType.STRING;
|
||||||
/**
|
|
||||||
* 设置只能选择不能输入的列内容.
|
/**
|
||||||
*/
|
* 导出时在excel中每个列的高度 单位为字符
|
||||||
public String[] combo() default {};
|
*/
|
||||||
|
public double height() default 14;
|
||||||
/**
|
|
||||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
/**
|
||||||
*/
|
* 导出时在excel中每个列的宽 单位为字符
|
||||||
public boolean isExport() default true;
|
*/
|
||||||
|
public double width() default 16;
|
||||||
/**
|
|
||||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
/**
|
||||||
*/
|
* 文字后缀,如% 90 变成90%
|
||||||
public String targetAttr() default "";
|
*/
|
||||||
|
public String suffix() default "";
|
||||||
/**
|
|
||||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
/**
|
||||||
*/
|
* 当值为空时,字段的默认值
|
||||||
Type type() default Type.ALL;
|
*/
|
||||||
|
public String defaultValue() default "";
|
||||||
public enum Type
|
|
||||||
{
|
/**
|
||||||
ALL(0), EXPORT(1), IMPORT(2);
|
* 提示信息
|
||||||
private final int value;
|
*/
|
||||||
|
public String prompt() default "";
|
||||||
Type(int value)
|
|
||||||
{
|
/**
|
||||||
this.value = value;
|
* 设置只能选择不能输入的列内容.
|
||||||
}
|
*/
|
||||||
|
public String[] combo() default {};
|
||||||
public int value()
|
|
||||||
{
|
/**
|
||||||
return this.value;
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
}
|
*/
|
||||||
}
|
public boolean isExport() default true;
|
||||||
|
|
||||||
public enum ColumnType
|
/**
|
||||||
{
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
NUMERIC(0), STRING(1);
|
*/
|
||||||
private final int value;
|
public String targetAttr() default "";
|
||||||
|
|
||||||
ColumnType(int value)
|
/**
|
||||||
{
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
this.value = value;
|
*/
|
||||||
}
|
public boolean isStatistics() default false;
|
||||||
|
|
||||||
public int value()
|
/**
|
||||||
{
|
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
|
||||||
return this.value;
|
*/
|
||||||
}
|
Align align() default Align.AUTO;
|
||||||
}
|
|
||||||
|
public enum Align
|
||||||
|
{
|
||||||
|
AUTO(0), LEFT(1), CENTER(2), RIGHT(3);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
Align(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
|
*/
|
||||||
|
Type type() default Type.ALL;
|
||||||
|
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
Type(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ColumnType
|
||||||
|
{
|
||||||
|
NUMERIC(0), STRING(1), IMAGE(2);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ColumnType(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,18 +1,18 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel注解集
|
* Excel注解集
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.FIELD)
|
@Target(ElementType.FIELD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Excels
|
public @interface Excels
|
||||||
{
|
{
|
||||||
Excel[] value();
|
Excel[] value();
|
||||||
}
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.OperatorType;
|
import com.ruoyi.common.enums.OperatorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义操作日志记录注解
|
* 自定义操作日志记录注解
|
||||||
@ -1,23 +1,23 @@
|
|||||||
package com.ruoyi.framework.interceptor.annotation;
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Inherited;
|
import java.lang.annotation.Inherited;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义注解防止表单重复提交
|
* 自定义注解防止表单重复提交
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Inherited
|
@Inherited
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface RepeatSubmit
|
public @interface RepeatSubmit
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.common.config;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -113,4 +113,4 @@ public class RuoYiConfig
|
|||||||
{
|
{
|
||||||
return getProfile() + "/upload";
|
return getProfile() + "/upload";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,5 @@
|
|||||||
package com.ruoyi.common.constant;
|
package com.ruoyi.common.constant;
|
||||||
|
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用常量信息
|
* 通用常量信息
|
||||||
*
|
*
|
||||||
@ -63,6 +61,11 @@ public class Constants
|
|||||||
* 登录用户 redis key
|
* 登录用户 redis key
|
||||||
*/
|
*/
|
||||||
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防重提交 redis key
|
||||||
|
*/
|
||||||
|
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码有效期(分钟)
|
* 验证码有效期(分钟)
|
||||||
@ -92,7 +95,7 @@ public class Constants
|
|||||||
/**
|
/**
|
||||||
* 用户名称
|
* 用户名称
|
||||||
*/
|
*/
|
||||||
public static final String JWT_USERNAME = Claims.SUBJECT;
|
public static final String JWT_USERNAME = "sub";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户头像
|
* 用户头像
|
||||||
@ -123,4 +126,9 @@ public class Constants
|
|||||||
* 资源映射路径 前缀
|
* 资源映射路径 前缀
|
||||||
*/
|
*/
|
||||||
public static final String RESOURCE_PREFIX = "/profile";
|
public static final String RESOURCE_PREFIX = "/profile";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RMI 远程方法调用
|
||||||
|
*/
|
||||||
|
public static final String LOOKUP_RMI = "rmi://";
|
||||||
}
|
}
|
||||||
@ -13,6 +13,9 @@ public class GenConstants
|
|||||||
/** 树表(增删改查) */
|
/** 树表(增删改查) */
|
||||||
public static final String TPL_TREE = "tree";
|
public static final String TPL_TREE = "tree";
|
||||||
|
|
||||||
|
/** 主子表(增删改查) */
|
||||||
|
public static final String TPL_SUB = "sub";
|
||||||
|
|
||||||
/** 树编码字段 */
|
/** 树编码字段 */
|
||||||
public static final String TREE_CODE = "treeCode";
|
public static final String TREE_CODE = "treeCode";
|
||||||
|
|
||||||
@ -22,16 +25,24 @@ public class GenConstants
|
|||||||
/** 树名称字段 */
|
/** 树名称字段 */
|
||||||
public static final String TREE_NAME = "treeName";
|
public static final String TREE_NAME = "treeName";
|
||||||
|
|
||||||
|
/** 上级菜单ID字段 */
|
||||||
|
public static final String PARENT_MENU_ID = "parentMenuId";
|
||||||
|
|
||||||
|
/** 上级菜单名称字段 */
|
||||||
|
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||||
|
|
||||||
/** 数据库字符串类型 */
|
/** 数据库字符串类型 */
|
||||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "narchar", "varchar2", "tinytext", "text",
|
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||||
"mediumtext", "longtext" };
|
|
||||||
|
/** 数据库文本类型 */
|
||||||
|
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
|
||||||
|
|
||||||
/** 数据库时间类型 */
|
/** 数据库时间类型 */
|
||||||
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
||||||
|
|
||||||
/** 数据库数字类型 */
|
/** 数据库数字类型 */
|
||||||
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
||||||
"bigint", "float", "float", "double", "decimal" };
|
"bit", "bigint", "float", "double", "decimal" };
|
||||||
|
|
||||||
/** 页面不需要编辑字段 */
|
/** 页面不需要编辑字段 */
|
||||||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
||||||
@ -68,6 +79,15 @@ public class GenConstants
|
|||||||
/** 日期控件 */
|
/** 日期控件 */
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
|
/** 图片上传控件 */
|
||||||
|
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||||
|
|
||||||
|
/** 文件上传控件 */
|
||||||
|
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||||
|
|
||||||
|
/** 富文本控件 */
|
||||||
|
public static final String HTML_EDITOR = "editor";
|
||||||
|
|
||||||
/** 字符串类型 */
|
/** 字符串类型 */
|
||||||
public static final String TYPE_STRING = "String";
|
public static final String TYPE_STRING = "String";
|
||||||
|
|
||||||
@ -5,7 +5,7 @@ package com.ruoyi.common.constant;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface HttpStatus
|
public class HttpStatus
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 操作成功
|
* 操作成功
|
||||||
@ -1,50 +1,50 @@
|
|||||||
package com.ruoyi.common.constant;
|
package com.ruoyi.common.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务调度通用常量
|
* 任务调度通用常量
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ScheduleConstants
|
public class ScheduleConstants
|
||||||
{
|
{
|
||||||
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
||||||
|
|
||||||
/** 执行目标key */
|
/** 执行目标key */
|
||||||
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
||||||
|
|
||||||
/** 默认 */
|
/** 默认 */
|
||||||
public static final String MISFIRE_DEFAULT = "0";
|
public static final String MISFIRE_DEFAULT = "0";
|
||||||
|
|
||||||
/** 立即触发执行 */
|
/** 立即触发执行 */
|
||||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||||
|
|
||||||
/** 触发一次执行 */
|
/** 触发一次执行 */
|
||||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||||
|
|
||||||
/** 不触发立即执行 */
|
/** 不触发立即执行 */
|
||||||
public static final String MISFIRE_DO_NOTHING = "3";
|
public static final String MISFIRE_DO_NOTHING = "3";
|
||||||
|
|
||||||
public enum Status
|
public enum Status
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 正常
|
* 正常
|
||||||
*/
|
*/
|
||||||
NORMAL("0"),
|
NORMAL("0"),
|
||||||
/**
|
/**
|
||||||
* 暂停
|
* 暂停
|
||||||
*/
|
*/
|
||||||
PAUSE("1");
|
PAUSE("1");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
private Status(String value)
|
private Status(String value)
|
||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue()
|
public String getValue()
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,6 +54,12 @@ public class UserConstants
|
|||||||
/** Layout组件标识 */
|
/** Layout组件标识 */
|
||||||
public final static String LAYOUT = "Layout";
|
public final static String LAYOUT = "Layout";
|
||||||
|
|
||||||
|
/** ParentView组件标识 */
|
||||||
|
public final static String PARENT_VIEW = "ParentView";
|
||||||
|
|
||||||
|
/** InnerLink组件标识 */
|
||||||
|
public final static String INNER_LINK = "InnerLink";
|
||||||
|
|
||||||
/** 校验返回结果码 */
|
/** 校验返回结果码 */
|
||||||
public final static String UNIQUE = "0";
|
public final static String UNIQUE = "0";
|
||||||
public final static String NOT_UNIQUE = "1";
|
public final static String NOT_UNIQUE = "1";
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.web.controller;
|
package com.ruoyi.common.core.controller;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -10,13 +10,13 @@ import org.springframework.web.bind.annotation.InitBinder;
|
|||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.common.constant.HttpStatus;
|
import com.ruoyi.common.constant.HttpStatus;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.page.PageDomain;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.framework.web.page.TableSupport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
@ -25,7 +25,7 @@ import com.ruoyi.framework.web.page.TableSupport;
|
|||||||
*/
|
*/
|
||||||
public class BaseController
|
public class BaseController
|
||||||
{
|
{
|
||||||
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||||
@ -59,6 +59,19 @@ public class BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求排序数据
|
||||||
|
*/
|
||||||
|
protected void startOrderBy()
|
||||||
|
{
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
||||||
|
{
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.orderBy(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应请求分页数据
|
* 响应请求分页数据
|
||||||
*/
|
*/
|
||||||
@ -83,4 +96,55 @@ public class BaseController
|
|||||||
{
|
{
|
||||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param result 结果
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(boolean result)
|
||||||
|
{
|
||||||
|
return result ? success() : error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功
|
||||||
|
*/
|
||||||
|
public AjaxResult success()
|
||||||
|
{
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error()
|
||||||
|
{
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(String message)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error(String message)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面跳转
|
||||||
|
*/
|
||||||
|
public String redirect(String url)
|
||||||
|
{
|
||||||
|
return StringUtils.format("redirect:{}", url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.web.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import com.ruoyi.common.constant.HttpStatus;
|
import com.ruoyi.common.constant.HttpStatus;
|
||||||
@ -1,11 +1,10 @@
|
|||||||
package com.ruoyi.framework.web.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity基类
|
* Entity基类
|
||||||
@ -36,17 +35,6 @@ public class BaseEntity implements Serializable
|
|||||||
/** 备注 */
|
/** 备注 */
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/** 数据权限 */
|
|
||||||
private String dataScope;
|
|
||||||
|
|
||||||
/** 开始时间 */
|
|
||||||
@JsonIgnore
|
|
||||||
private String beginTime;
|
|
||||||
|
|
||||||
/** 结束时间 */
|
|
||||||
@JsonIgnore
|
|
||||||
private String endTime;
|
|
||||||
|
|
||||||
/** 请求参数 */
|
/** 请求参数 */
|
||||||
private Map<String, Object> params;
|
private Map<String, Object> params;
|
||||||
|
|
||||||
@ -110,36 +98,6 @@ public class BaseEntity implements Serializable
|
|||||||
this.remark = remark;
|
this.remark = remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataScope()
|
|
||||||
{
|
|
||||||
return dataScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataScope(String dataScope)
|
|
||||||
{
|
|
||||||
this.dataScope = dataScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBeginTime()
|
|
||||||
{
|
|
||||||
return beginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBeginTime(String beginTime)
|
|
||||||
{
|
|
||||||
this.beginTime = beginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEndTime()
|
|
||||||
{
|
|
||||||
return endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEndTime(String endTime)
|
|
||||||
{
|
|
||||||
this.endTime = endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getParams()
|
public Map<String, Object> getParams()
|
||||||
{
|
{
|
||||||
if (params == null)
|
if (params == null)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.web.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1,11 +1,11 @@
|
|||||||
package com.ruoyi.framework.web.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.ruoyi.project.system.domain.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.project.system.domain.SysMenu;
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Treeselect树结构实体类
|
* Treeselect树结构实体类
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -7,7 +7,7 @@ import javax.validation.constraints.NotBlank;
|
|||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
@ -1,13 +1,13 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典数据表 sys_dict_data
|
* 字典数据表 sys_dict_data
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型表 sys_dict_type
|
* 字典类型表 sys_dict_type
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank;
|
|||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单权限表 sys_menu
|
* 菜单权限表 sys_menu
|
||||||
@ -41,6 +41,9 @@ public class SysMenu extends BaseEntity
|
|||||||
/** 是否为外链(0是 1否) */
|
/** 是否为外链(0是 1否) */
|
||||||
private String isFrame;
|
private String isFrame;
|
||||||
|
|
||||||
|
/** 是否缓存(0缓存 1不缓存) */
|
||||||
|
private String isCache;
|
||||||
|
|
||||||
/** 类型(M目录 C菜单 F按钮) */
|
/** 类型(M目录 C菜单 F按钮) */
|
||||||
private String menuType;
|
private String menuType;
|
||||||
|
|
||||||
@ -144,6 +147,16 @@ public class SysMenu extends BaseEntity
|
|||||||
this.isFrame = isFrame;
|
this.isFrame = isFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIsCache()
|
||||||
|
{
|
||||||
|
return isCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsCache(String isCache)
|
||||||
|
{
|
||||||
|
this.isCache = isCache;
|
||||||
|
}
|
||||||
|
|
||||||
@NotBlank(message = "菜单类型不能为空")
|
@NotBlank(message = "菜单类型不能为空")
|
||||||
public String getMenuType()
|
public String getMenuType()
|
||||||
{
|
{
|
||||||
@ -216,6 +229,7 @@ public class SysMenu extends BaseEntity
|
|||||||
.append("path", getPath())
|
.append("path", getPath())
|
||||||
.append("component", getComponent())
|
.append("component", getComponent())
|
||||||
.append("isFrame", getIsFrame())
|
.append("isFrame", getIsFrame())
|
||||||
|
.append("IsCache", getIsCache())
|
||||||
.append("menuType", getMenuType())
|
.append("menuType", getMenuType())
|
||||||
.append("visible", getVisible())
|
.append("visible", getVisible())
|
||||||
.append("status ", getStatus())
|
.append("status ", getStatus())
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 sys_role
|
* 角色表 sys_role
|
||||||
@ -33,10 +33,16 @@ public class SysRole extends BaseEntity
|
|||||||
@Excel(name = "角色排序")
|
@Excel(name = "角色排序")
|
||||||
private String roleSort;
|
private String roleSort;
|
||||||
|
|
||||||
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) */
|
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
|
||||||
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限")
|
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||||
private String dataScope;
|
private String dataScope;
|
||||||
|
|
||||||
|
/** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
|
||||||
|
private boolean menuCheckStrictly;
|
||||||
|
|
||||||
|
/** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
|
||||||
|
private boolean deptCheckStrictly;
|
||||||
|
|
||||||
/** 角色状态(0正常 1停用) */
|
/** 角色状态(0正常 1停用) */
|
||||||
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
@ -128,6 +134,26 @@ public class SysRole extends BaseEntity
|
|||||||
this.dataScope = dataScope;
|
this.dataScope = dataScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMenuCheckStrictly()
|
||||||
|
{
|
||||||
|
return menuCheckStrictly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMenuCheckStrictly(boolean menuCheckStrictly)
|
||||||
|
{
|
||||||
|
this.menuCheckStrictly = menuCheckStrictly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDeptCheckStrictly()
|
||||||
|
{
|
||||||
|
return deptCheckStrictly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptCheckStrictly(boolean deptCheckStrictly)
|
||||||
|
{
|
||||||
|
this.deptCheckStrictly = deptCheckStrictly;
|
||||||
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus()
|
||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
@ -178,6 +204,7 @@ public class SysRole extends BaseEntity
|
|||||||
this.deptIds = deptIds;
|
this.deptIds = deptIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("roleId", getRoleId())
|
.append("roleId", getRoleId())
|
||||||
@ -185,6 +212,8 @@ public class SysRole extends BaseEntity
|
|||||||
.append("roleKey", getRoleKey())
|
.append("roleKey", getRoleKey())
|
||||||
.append("roleSort", getRoleSort())
|
.append("roleSort", getRoleSort())
|
||||||
.append("dataScope", getDataScope())
|
.append("dataScope", getDataScope())
|
||||||
|
.append("menuCheckStrictly", isMenuCheckStrictly())
|
||||||
|
.append("deptCheckStrictly", isDeptCheckStrictly())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -7,12 +7,13 @@ import javax.validation.constraints.NotBlank;
|
|||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel.Type;
|
import com.ruoyi.common.annotation.Excel.Type;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Excels;
|
import com.ruoyi.common.annotation.Excels;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
@ -67,12 +68,12 @@ public class SysUser extends BaseEntity
|
|||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 最后登陆IP */
|
/** 最后登录IP */
|
||||||
@Excel(name = "最后登陆IP", type = Type.EXPORT)
|
@Excel(name = "最后登录IP", type = Type.EXPORT)
|
||||||
private String loginIp;
|
private String loginIp;
|
||||||
|
|
||||||
/** 最后登陆时间 */
|
/** 最后登录时间 */
|
||||||
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
/** 部门对象 */
|
/** 部门对象 */
|
||||||
@ -91,6 +92,9 @@ public class SysUser extends BaseEntity
|
|||||||
/** 岗位组 */
|
/** 岗位组 */
|
||||||
private Long[] postIds;
|
private Long[] postIds;
|
||||||
|
|
||||||
|
/** 角色ID */
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
public SysUser()
|
public SysUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -197,6 +201,7 @@ public class SysUser extends BaseEntity
|
|||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public String getPassword()
|
public String getPassword()
|
||||||
{
|
{
|
||||||
@ -297,7 +302,17 @@ public class SysUser extends BaseEntity
|
|||||||
{
|
{
|
||||||
this.postIds = postIds;
|
this.postIds = postIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRoleId()
|
||||||
|
{
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(Long roleId)
|
||||||
|
{
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.security;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
||||||
@ -1,11 +1,11 @@
|
|||||||
package com.ruoyi.framework.security;
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.ruoyi.project.system.domain.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录用户身份权限
|
* 登录用户身份权限
|
||||||
@ -22,7 +22,7 @@ public class LoginUser implements UserDetails
|
|||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登陆时间
|
* 登录时间
|
||||||
*/
|
*/
|
||||||
private Long loginTime;
|
private Long loginTime;
|
||||||
|
|
||||||
@ -1,69 +1,84 @@
|
|||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.common.core.page;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页数据
|
* 分页数据
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class PageDomain
|
public class PageDomain
|
||||||
{
|
{
|
||||||
/** 当前记录起始索引 */
|
/** 当前记录起始索引 */
|
||||||
private Integer pageNum;
|
private Integer pageNum;
|
||||||
/** 每页显示记录数 */
|
|
||||||
private Integer pageSize;
|
/** 每页显示记录数 */
|
||||||
/** 排序列 */
|
private Integer pageSize;
|
||||||
private String orderByColumn;
|
|
||||||
/** 排序的方向 "desc" 或者 "asc". */
|
/** 排序列 */
|
||||||
private String isAsc;
|
private String orderByColumn;
|
||||||
|
|
||||||
public String getOrderBy()
|
/** 排序的方向desc或者asc */
|
||||||
{
|
private String isAsc = "asc";
|
||||||
if (StringUtils.isEmpty(orderByColumn))
|
|
||||||
{
|
public String getOrderBy()
|
||||||
return "";
|
{
|
||||||
}
|
if (StringUtils.isEmpty(orderByColumn))
|
||||||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
{
|
||||||
}
|
return "";
|
||||||
|
}
|
||||||
public Integer getPageNum()
|
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||||
{
|
}
|
||||||
return pageNum;
|
|
||||||
}
|
public Integer getPageNum()
|
||||||
|
{
|
||||||
public void setPageNum(Integer pageNum)
|
return pageNum;
|
||||||
{
|
}
|
||||||
this.pageNum = pageNum;
|
|
||||||
}
|
public void setPageNum(Integer pageNum)
|
||||||
|
{
|
||||||
public Integer getPageSize()
|
this.pageNum = pageNum;
|
||||||
{
|
}
|
||||||
return pageSize;
|
|
||||||
}
|
public Integer getPageSize()
|
||||||
|
{
|
||||||
public void setPageSize(Integer pageSize)
|
return pageSize;
|
||||||
{
|
}
|
||||||
this.pageSize = pageSize;
|
|
||||||
}
|
public void setPageSize(Integer pageSize)
|
||||||
|
{
|
||||||
public String getOrderByColumn()
|
this.pageSize = pageSize;
|
||||||
{
|
}
|
||||||
return orderByColumn;
|
|
||||||
}
|
public String getOrderByColumn()
|
||||||
|
{
|
||||||
public void setOrderByColumn(String orderByColumn)
|
return orderByColumn;
|
||||||
{
|
}
|
||||||
this.orderByColumn = orderByColumn;
|
|
||||||
}
|
public void setOrderByColumn(String orderByColumn)
|
||||||
|
{
|
||||||
public String getIsAsc()
|
this.orderByColumn = orderByColumn;
|
||||||
{
|
}
|
||||||
return isAsc;
|
|
||||||
}
|
public String getIsAsc()
|
||||||
|
{
|
||||||
public void setIsAsc(String isAsc)
|
return isAsc;
|
||||||
{
|
}
|
||||||
this.isAsc = isAsc;
|
|
||||||
}
|
public void setIsAsc(String isAsc)
|
||||||
}
|
{
|
||||||
|
if (StringUtils.isNotEmpty(isAsc))
|
||||||
|
{
|
||||||
|
// 兼容前端排序类型
|
||||||
|
if ("ascending".equals(isAsc))
|
||||||
|
{
|
||||||
|
isAsc = "asc";
|
||||||
|
}
|
||||||
|
else if ("descending".equals(isAsc))
|
||||||
|
{
|
||||||
|
isAsc = "desc";
|
||||||
|
}
|
||||||
|
this.isAsc = isAsc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.common.core.page;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -82,4 +82,4 @@ public class TableDataInfo implements Serializable
|
|||||||
{
|
{
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.common.core.page;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
package com.ruoyi.common.core.redis;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.BoundSetOperations;
|
||||||
|
import org.springframework.data.redis.core.HashOperations;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.core.ValueOperations;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* spring redis 工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
**/
|
||||||
|
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||||
|
@Component
|
||||||
|
public class RedisCache
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
public RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存基本的对象,Integer、String、实体类等
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param value 缓存的值
|
||||||
|
*/
|
||||||
|
public <T> void setCacheObject(final String key, final T value)
|
||||||
|
{
|
||||||
|
redisTemplate.opsForValue().set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存基本的对象,Integer、String、实体类等
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param value 缓存的值
|
||||||
|
* @param timeout 时间
|
||||||
|
* @param timeUnit 时间颗粒度
|
||||||
|
*/
|
||||||
|
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
|
||||||
|
{
|
||||||
|
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置有效时间
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param timeout 超时时间
|
||||||
|
* @return true=设置成功;false=设置失败
|
||||||
|
*/
|
||||||
|
public boolean expire(final String key, final long timeout)
|
||||||
|
{
|
||||||
|
return expire(key, timeout, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置有效时间
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param timeout 超时时间
|
||||||
|
* @param unit 时间单位
|
||||||
|
* @return true=设置成功;false=设置失败
|
||||||
|
*/
|
||||||
|
public boolean expire(final String key, final long timeout, final TimeUnit unit)
|
||||||
|
{
|
||||||
|
return redisTemplate.expire(key, timeout, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存的基本对象。
|
||||||
|
*
|
||||||
|
* @param key 缓存键值
|
||||||
|
* @return 缓存键值对应的数据
|
||||||
|
*/
|
||||||
|
public <T> T getCacheObject(final String key)
|
||||||
|
{
|
||||||
|
ValueOperations<String, T> operation = redisTemplate.opsForValue();
|
||||||
|
return operation.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个对象
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
public boolean deleteObject(final String key)
|
||||||
|
{
|
||||||
|
return redisTemplate.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除集合对象
|
||||||
|
*
|
||||||
|
* @param collection 多个对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long deleteObject(final Collection collection)
|
||||||
|
{
|
||||||
|
return redisTemplate.delete(collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存List数据
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @param dataList 待缓存的List数据
|
||||||
|
* @return 缓存的对象
|
||||||
|
*/
|
||||||
|
public <T> long setCacheList(final String key, final List<T> dataList)
|
||||||
|
{
|
||||||
|
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
|
||||||
|
return count == null ? 0 : count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存的list对象
|
||||||
|
*
|
||||||
|
* @param key 缓存的键值
|
||||||
|
* @return 缓存键值对应的数据
|
||||||
|
*/
|
||||||
|
public <T> List<T> getCacheList(final String key)
|
||||||
|
{
|
||||||
|
return redisTemplate.opsForList().range(key, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存Set
|
||||||
|
*
|
||||||
|
* @param key 缓存键值
|
||||||
|
* @param dataSet 缓存的数据
|
||||||
|
* @return 缓存数据的对象
|
||||||
|
*/
|
||||||
|
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
|
||||||
|
{
|
||||||
|
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||||
|
Iterator<T> it = dataSet.iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
setOperation.add(it.next());
|
||||||
|
}
|
||||||
|
return setOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存的set
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public <T> Set<T> getCacheSet(final String key)
|
||||||
|
{
|
||||||
|
return redisTemplate.opsForSet().members(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存Map
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param dataMap
|
||||||
|
*/
|
||||||
|
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
|
||||||
|
{
|
||||||
|
if (dataMap != null) {
|
||||||
|
redisTemplate.opsForHash().putAll(key, dataMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存的Map
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public <T> Map<String, T> getCacheMap(final String key)
|
||||||
|
{
|
||||||
|
return redisTemplate.opsForHash().entries(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 往Hash中存入数据
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param hKey Hash键
|
||||||
|
* @param value 值
|
||||||
|
*/
|
||||||
|
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
|
||||||
|
{
|
||||||
|
redisTemplate.opsForHash().put(key, hKey, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Hash中的数据
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param hKey Hash键
|
||||||
|
* @return Hash中的对象
|
||||||
|
*/
|
||||||
|
public <T> T getCacheMapValue(final String key, final String hKey)
|
||||||
|
{
|
||||||
|
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
|
||||||
|
return opsForHash.get(key, hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取多个Hash中的数据
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param hKeys Hash键集合
|
||||||
|
* @return Hash对象集合
|
||||||
|
*/
|
||||||
|
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
|
||||||
|
{
|
||||||
|
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存的基本对象列表
|
||||||
|
*
|
||||||
|
* @param pattern 字符串前缀
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
public Collection<String> keys(final String pattern)
|
||||||
|
{
|
||||||
|
return redisTemplate.keys(pattern);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -66,7 +66,7 @@ public class CharsetKit
|
|||||||
|
|
||||||
if (null == destCharset)
|
if (null == destCharset)
|
||||||
{
|
{
|
||||||
srcCharset = StandardCharsets.UTF_8;
|
destCharset = StandardCharsets.UTF_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
|
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
|
||||||
@ -7,10 +7,11 @@ import java.nio.charset.Charset;
|
|||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型转换器
|
* 类型转换器
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Convert
|
public class Convert
|
||||||
@ -19,7 +20,7 @@ public class Convert
|
|||||||
* 转换为字符串<br>
|
* 转换为字符串<br>
|
||||||
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -41,7 +42,7 @@ public class Convert
|
|||||||
* 转换为字符串<br>
|
* 转换为字符串<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -54,7 +55,7 @@ public class Convert
|
|||||||
* 转换为字符<br>
|
* 转换为字符<br>
|
||||||
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -78,7 +79,7 @@ public class Convert
|
|||||||
* 转换为字符<br>
|
* 转换为字符<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -91,7 +92,7 @@ public class Convert
|
|||||||
* 转换为byte<br>
|
* 转换为byte<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -129,7 +130,7 @@ public class Convert
|
|||||||
* 转换为byte<br>
|
* 转换为byte<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -142,7 +143,7 @@ public class Convert
|
|||||||
* 转换为Short<br>
|
* 转换为Short<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -180,7 +181,7 @@ public class Convert
|
|||||||
* 转换为Short<br>
|
* 转换为Short<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -193,7 +194,7 @@ public class Convert
|
|||||||
* 转换为Number<br>
|
* 转换为Number<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -227,7 +228,7 @@ public class Convert
|
|||||||
* 转换为Number<br>
|
* 转换为Number<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -240,7 +241,7 @@ public class Convert
|
|||||||
* 转换为int<br>
|
* 转换为int<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -278,7 +279,7 @@ public class Convert
|
|||||||
* 转换为int<br>
|
* 转换为int<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -289,7 +290,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为Integer数组<br>
|
* 转换为Integer数组<br>
|
||||||
*
|
*
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -300,7 +301,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为Long数组<br>
|
* 转换为Long数组<br>
|
||||||
*
|
*
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -311,7 +312,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为Integer数组<br>
|
* 转换为Integer数组<br>
|
||||||
*
|
*
|
||||||
* @param split 分隔符
|
* @param split 分隔符
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -334,7 +335,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为Long数组<br>
|
* 转换为Long数组<br>
|
||||||
*
|
*
|
||||||
* @param split 分隔符
|
* @param split 分隔符
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -357,7 +358,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为String数组<br>
|
* 转换为String数组<br>
|
||||||
*
|
*
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -368,7 +369,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为String数组<br>
|
* 转换为String数组<br>
|
||||||
*
|
*
|
||||||
* @param split 分隔符
|
* @param split 分隔符
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -382,7 +383,7 @@ public class Convert
|
|||||||
* 转换为long<br>
|
* 转换为long<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -421,7 +422,7 @@ public class Convert
|
|||||||
* 转换为long<br>
|
* 转换为long<br>
|
||||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -434,7 +435,7 @@ public class Convert
|
|||||||
* 转换为double<br>
|
* 转换为double<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -473,7 +474,7 @@ public class Convert
|
|||||||
* 转换为double<br>
|
* 转换为double<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -486,7 +487,7 @@ public class Convert
|
|||||||
* 转换为Float<br>
|
* 转换为Float<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -524,7 +525,7 @@ public class Convert
|
|||||||
* 转换为Float<br>
|
* 转换为Float<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -537,7 +538,7 @@ public class Convert
|
|||||||
* 转换为boolean<br>
|
* 转换为boolean<br>
|
||||||
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -583,7 +584,7 @@ public class Convert
|
|||||||
* 转换为boolean<br>
|
* 转换为boolean<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -595,7 +596,7 @@ public class Convert
|
|||||||
/**
|
/**
|
||||||
* 转换为Enum对象<br>
|
* 转换为Enum对象<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
*
|
*
|
||||||
* @param clazz Enum的Class
|
* @param clazz Enum的Class
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @param defaultValue 默认值
|
* @param defaultValue 默认值
|
||||||
@ -631,7 +632,7 @@ public class Convert
|
|||||||
/**
|
/**
|
||||||
* 转换为Enum对象<br>
|
* 转换为Enum对象<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
*
|
*
|
||||||
* @param clazz Enum的Class
|
* @param clazz Enum的Class
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @return Enum
|
* @return Enum
|
||||||
@ -645,7 +646,7 @@ public class Convert
|
|||||||
* 转换为BigInteger<br>
|
* 转换为BigInteger<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -683,7 +684,7 @@ public class Convert
|
|||||||
* 转换为BigInteger<br>
|
* 转换为BigInteger<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -696,7 +697,7 @@ public class Convert
|
|||||||
* 转换为BigDecimal<br>
|
* 转换为BigDecimal<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
@ -742,7 +743,7 @@ public class Convert
|
|||||||
* 转换为BigDecimal<br>
|
* 转换为BigDecimal<br>
|
||||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||||
* 转换失败不会报错
|
* 转换失败不会报错
|
||||||
*
|
*
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -754,7 +755,7 @@ public class Convert
|
|||||||
/**
|
/**
|
||||||
* 将对象转为字符串<br>
|
* 将对象转为字符串<br>
|
||||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
*
|
*
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
@ -766,7 +767,7 @@ public class Convert
|
|||||||
/**
|
/**
|
||||||
* 将对象转为字符串<br>
|
* 将对象转为字符串<br>
|
||||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
*
|
*
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @param charsetName 字符集
|
* @param charsetName 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
@ -779,7 +780,7 @@ public class Convert
|
|||||||
/**
|
/**
|
||||||
* 将对象转为字符串<br>
|
* 将对象转为字符串<br>
|
||||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||||
*
|
*
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
@ -795,9 +796,14 @@ public class Convert
|
|||||||
{
|
{
|
||||||
return (String) obj;
|
return (String) obj;
|
||||||
}
|
}
|
||||||
else if (obj instanceof byte[] || obj instanceof Byte[])
|
else if (obj instanceof byte[])
|
||||||
{
|
{
|
||||||
return str((Byte[]) obj, charset);
|
return str((byte[]) obj, charset);
|
||||||
|
}
|
||||||
|
else if (obj instanceof Byte[])
|
||||||
|
{
|
||||||
|
byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
|
||||||
|
return str(bytes, charset);
|
||||||
}
|
}
|
||||||
else if (obj instanceof ByteBuffer)
|
else if (obj instanceof ByteBuffer)
|
||||||
{
|
{
|
||||||
@ -808,7 +814,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将byte数组转为字符串
|
* 将byte数组转为字符串
|
||||||
*
|
*
|
||||||
* @param bytes byte数组
|
* @param bytes byte数组
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
@ -820,7 +826,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 解码字节码
|
* 解码字节码
|
||||||
*
|
*
|
||||||
* @param data 字符串
|
* @param data 字符串
|
||||||
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
||||||
* @return 解码后的字符串
|
* @return 解码后的字符串
|
||||||
@ -841,7 +847,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将编码的byteBuffer数据转换为字符串
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
*
|
*
|
||||||
* @param data 数据
|
* @param data 数据
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
@ -858,7 +864,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将编码的byteBuffer数据转换为字符串
|
* 将编码的byteBuffer数据转换为字符串
|
||||||
*
|
*
|
||||||
* @param data 数据
|
* @param data 数据
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
@ -875,7 +881,7 @@ public class Convert
|
|||||||
// ----------------------------------------------------------------------- 全角半角转换
|
// ----------------------------------------------------------------------- 全角半角转换
|
||||||
/**
|
/**
|
||||||
* 半角转全角
|
* 半角转全角
|
||||||
*
|
*
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
*/
|
*/
|
||||||
@ -886,7 +892,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 半角转全角
|
* 半角转全角
|
||||||
*
|
*
|
||||||
* @param input String
|
* @param input String
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
@ -917,7 +923,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 全角转半角
|
* 全角转半角
|
||||||
*
|
*
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 半角字符串
|
* @return 半角字符串
|
||||||
*/
|
*/
|
||||||
@ -928,7 +934,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 替换全角为半角
|
* 替换全角为半角
|
||||||
*
|
*
|
||||||
* @param text 文本
|
* @param text 文本
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 替换后的字符
|
* @return 替换后的字符
|
||||||
@ -960,7 +966,7 @@ public class Convert
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
|
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
|
||||||
*
|
*
|
||||||
* @param n 数字
|
* @param n 数字
|
||||||
* @return 中文大写数字
|
* @return 中文大写数字
|
||||||
*/
|
*/
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.enums;
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作状态
|
* 操作状态
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.enums;
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务操作类型
|
* 业务操作类型
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.enums;
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源
|
* 数据源
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.framework.aspectj.lang.enums;
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作人类别
|
* 操作人类别
|
||||||
@ -68,4 +68,14 @@ public class InvalidExtensionException extends FileUploadException
|
|||||||
super(allowedExtension, extension, filename);
|
super(allowedExtension, extension, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class InvalidVideoExtensionException extends InvalidExtensionException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
|
||||||
|
{
|
||||||
|
super(allowedExtension, extension, filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,34 +1,34 @@
|
|||||||
package com.ruoyi.common.exception.job;
|
package com.ruoyi.common.exception.job;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计划策略异常
|
* 计划策略异常
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class TaskException extends Exception
|
public class TaskException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Code code;
|
private Code code;
|
||||||
|
|
||||||
public TaskException(String msg, Code code)
|
public TaskException(String msg, Code code)
|
||||||
{
|
{
|
||||||
this(msg, code, null);
|
this(msg, code, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskException(String msg, Code code, Exception nestedEx)
|
public TaskException(String msg, Code code, Exception nestedEx)
|
||||||
{
|
{
|
||||||
super(msg, nestedEx);
|
super(msg, nestedEx);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Code getCode()
|
public Code getCode()
|
||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Code
|
public enum Code
|
||||||
{
|
{
|
||||||
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,52 +1,52 @@
|
|||||||
package com.ruoyi.common.filter;
|
package com.ruoyi.common.filter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repeatable 过滤器
|
* Repeatable 过滤器
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RepeatableFilter implements Filter
|
public class RepeatableFilter implements Filter
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void init(FilterConfig filterConfig) throws ServletException
|
public void init(FilterConfig filterConfig) throws ServletException
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
ServletRequest requestWrapper = null;
|
ServletRequest requestWrapper = null;
|
||||||
if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(),
|
if (request instanceof HttpServletRequest
|
||||||
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE))
|
&& StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE))
|
||||||
{
|
{
|
||||||
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
||||||
}
|
}
|
||||||
if (null == requestWrapper)
|
if (null == requestWrapper)
|
||||||
{
|
{
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chain.doFilter(requestWrapper, response);
|
chain.doFilter(requestWrapper, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,72 +1,75 @@
|
|||||||
package com.ruoyi.common.filter;
|
package com.ruoyi.common.filter;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import javax.servlet.ReadListener;
|
import javax.servlet.ReadListener;
|
||||||
import javax.servlet.ServletInputStream;
|
import javax.servlet.ServletInputStream;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequestWrapper;
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
import com.ruoyi.common.utils.http.HttpHelper;
|
import com.ruoyi.common.utils.http.HttpHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建可重复读取inputStream的request
|
* 构建可重复读取inputStream的request
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper
|
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper
|
||||||
{
|
{
|
||||||
private final byte[] body;
|
private final byte[] body;
|
||||||
|
|
||||||
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException
|
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException
|
||||||
{
|
{
|
||||||
super(request);
|
super(request);
|
||||||
request.setCharacterEncoding("UTF-8");
|
request.setCharacterEncoding("UTF-8");
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
|
||||||
body = HttpHelper.getBodyString(request).getBytes("UTF-8");
|
body = HttpHelper.getBodyString(request).getBytes("UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedReader getReader() throws IOException
|
public BufferedReader getReader() throws IOException
|
||||||
{
|
{
|
||||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServletInputStream getInputStream() throws IOException
|
public ServletInputStream getInputStream() throws IOException
|
||||||
{
|
{
|
||||||
|
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
||||||
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
return new ServletInputStream()
|
||||||
|
{
|
||||||
return new ServletInputStream()
|
@Override
|
||||||
{
|
public int read() throws IOException
|
||||||
|
{
|
||||||
@Override
|
return bais.read();
|
||||||
public int read() throws IOException
|
}
|
||||||
{
|
|
||||||
return bais.read();
|
@Override
|
||||||
}
|
public int available() throws IOException
|
||||||
|
{
|
||||||
@Override
|
return body.length;
|
||||||
public boolean isFinished()
|
}
|
||||||
{
|
|
||||||
return false;
|
@Override
|
||||||
}
|
public boolean isFinished()
|
||||||
|
{
|
||||||
@Override
|
return false;
|
||||||
public boolean isReady()
|
}
|
||||||
{
|
|
||||||
return false;
|
@Override
|
||||||
}
|
public boolean isReady()
|
||||||
|
{
|
||||||
@Override
|
return false;
|
||||||
public void setReadListener(ReadListener readListener)
|
}
|
||||||
{
|
|
||||||
|
@Override
|
||||||
}
|
public void setReadListener(ReadListener readListener)
|
||||||
};
|
{
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
|||||||
public boolean isJsonRequest()
|
public boolean isJsonRequest()
|
||||||
{
|
{
|
||||||
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||||
return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header)
|
return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|| MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,114 +1,114 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确的浮点数运算
|
* 精确的浮点数运算
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Arith
|
public class Arith
|
||||||
{
|
{
|
||||||
|
|
||||||
/** 默认除法运算精度 */
|
/** 默认除法运算精度 */
|
||||||
private static final int DEF_DIV_SCALE = 10;
|
private static final int DEF_DIV_SCALE = 10;
|
||||||
|
|
||||||
/** 这个类不能实例化 */
|
/** 这个类不能实例化 */
|
||||||
private Arith()
|
private Arith()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的加法运算。
|
* 提供精确的加法运算。
|
||||||
* @param v1 被加数
|
* @param v1 被加数
|
||||||
* @param v2 加数
|
* @param v2 加数
|
||||||
* @return 两个参数的和
|
* @return 两个参数的和
|
||||||
*/
|
*/
|
||||||
public static double add(double v1, double v2)
|
public static double add(double v1, double v2)
|
||||||
{
|
{
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.add(b2).doubleValue();
|
return b1.add(b2).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的减法运算。
|
* 提供精确的减法运算。
|
||||||
* @param v1 被减数
|
* @param v1 被减数
|
||||||
* @param v2 减数
|
* @param v2 减数
|
||||||
* @return 两个参数的差
|
* @return 两个参数的差
|
||||||
*/
|
*/
|
||||||
public static double sub(double v1, double v2)
|
public static double sub(double v1, double v2)
|
||||||
{
|
{
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.subtract(b2).doubleValue();
|
return b1.subtract(b2).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的乘法运算。
|
* 提供精确的乘法运算。
|
||||||
* @param v1 被乘数
|
* @param v1 被乘数
|
||||||
* @param v2 乘数
|
* @param v2 乘数
|
||||||
* @return 两个参数的积
|
* @return 两个参数的积
|
||||||
*/
|
*/
|
||||||
public static double mul(double v1, double v2)
|
public static double mul(double v1, double v2)
|
||||||
{
|
{
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
return b1.multiply(b2).doubleValue();
|
return b1.multiply(b2).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
|
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
|
||||||
* 小数点以后10位,以后的数字四舍五入。
|
* 小数点以后10位,以后的数字四舍五入。
|
||||||
* @param v1 被除数
|
* @param v1 被除数
|
||||||
* @param v2 除数
|
* @param v2 除数
|
||||||
* @return 两个参数的商
|
* @return 两个参数的商
|
||||||
*/
|
*/
|
||||||
public static double div(double v1, double v2)
|
public static double div(double v1, double v2)
|
||||||
{
|
{
|
||||||
return div(v1, v2, DEF_DIV_SCALE);
|
return div(v1, v2, DEF_DIV_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
|
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
|
||||||
* 定精度,以后的数字四舍五入。
|
* 定精度,以后的数字四舍五入。
|
||||||
* @param v1 被除数
|
* @param v1 被除数
|
||||||
* @param v2 除数
|
* @param v2 除数
|
||||||
* @param scale 表示表示需要精确到小数点以后几位。
|
* @param scale 表示表示需要精确到小数点以后几位。
|
||||||
* @return 两个参数的商
|
* @return 两个参数的商
|
||||||
*/
|
*/
|
||||||
public static double div(double v1, double v2, int scale)
|
public static double div(double v1, double v2, int scale)
|
||||||
{
|
{
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||||
if (b1.compareTo(BigDecimal.ZERO) == 0)
|
if (b1.compareTo(BigDecimal.ZERO) == 0)
|
||||||
{
|
{
|
||||||
return BigDecimal.ZERO.doubleValue();
|
return BigDecimal.ZERO.doubleValue();
|
||||||
}
|
}
|
||||||
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的小数位四舍五入处理。
|
* 提供精确的小数位四舍五入处理。
|
||||||
* @param v 需要四舍五入的数字
|
* @param v 需要四舍五入的数字
|
||||||
* @param scale 小数点后保留几位
|
* @param scale 小数点后保留几位
|
||||||
* @return 四舍五入后的结果
|
* @return 四舍五入后的结果
|
||||||
*/
|
*/
|
||||||
public static double round(double v, int scale)
|
public static double round(double v, int scale)
|
||||||
{
|
{
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
BigDecimal b = new BigDecimal(Double.toString(v));
|
BigDecimal b = new BigDecimal(Double.toString(v));
|
||||||
BigDecimal one = new BigDecimal("1");
|
BigDecimal one = BigDecimal.ONE;
|
||||||
return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
|
return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
183
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
Normal file
183
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class DictUtils
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 分隔符
|
||||||
|
*/
|
||||||
|
public static final String SEPARATOR = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置字典缓存
|
||||||
|
*
|
||||||
|
* @param key 参数键
|
||||||
|
* @param dictDatas 字典数据列表
|
||||||
|
*/
|
||||||
|
public static void setDictCache(String key, List<SysDictData> dictDatas)
|
||||||
|
{
|
||||||
|
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典缓存
|
||||||
|
*
|
||||||
|
* @param key 参数键
|
||||||
|
* @return dictDatas 字典数据列表
|
||||||
|
*/
|
||||||
|
public static List<SysDictData> getDictCache(String key)
|
||||||
|
{
|
||||||
|
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
||||||
|
if (StringUtils.isNotNull(cacheObj))
|
||||||
|
{
|
||||||
|
List<SysDictData> dictDatas = StringUtils.cast(cacheObj);
|
||||||
|
return dictDatas;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
public static String getDictLabel(String dictType, String dictValue)
|
||||||
|
{
|
||||||
|
return getDictLabel(dictType, dictValue, SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典标签获取字典值
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictLabel 字典标签
|
||||||
|
* @return 字典值
|
||||||
|
*/
|
||||||
|
public static String getDictValue(String dictType, String dictLabel)
|
||||||
|
{
|
||||||
|
return getDictValue(dictType, dictLabel, SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典值获取字典标签
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典值
|
||||||
|
* @param separator 分隔符
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
public static String getDictLabel(String dictType, String dictValue, String separator)
|
||||||
|
{
|
||||||
|
StringBuilder propertyString = new StringBuilder();
|
||||||
|
List<SysDictData> datas = getDictCache(dictType);
|
||||||
|
|
||||||
|
if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas))
|
||||||
|
{
|
||||||
|
for (SysDictData dict : datas)
|
||||||
|
{
|
||||||
|
for (String value : dictValue.split(separator))
|
||||||
|
{
|
||||||
|
if (value.equals(dict.getDictValue()))
|
||||||
|
{
|
||||||
|
propertyString.append(dict.getDictLabel() + separator);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (SysDictData dict : datas)
|
||||||
|
{
|
||||||
|
if (dictValue.equals(dict.getDictValue()))
|
||||||
|
{
|
||||||
|
return dict.getDictLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典标签获取字典值
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictLabel 字典标签
|
||||||
|
* @param separator 分隔符
|
||||||
|
* @return 字典值
|
||||||
|
*/
|
||||||
|
public static String getDictValue(String dictType, String dictLabel, String separator)
|
||||||
|
{
|
||||||
|
StringBuilder propertyString = new StringBuilder();
|
||||||
|
List<SysDictData> datas = getDictCache(dictType);
|
||||||
|
|
||||||
|
if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas))
|
||||||
|
{
|
||||||
|
for (SysDictData dict : datas)
|
||||||
|
{
|
||||||
|
for (String label : dictLabel.split(separator))
|
||||||
|
{
|
||||||
|
if (label.equals(dict.getDictLabel()))
|
||||||
|
{
|
||||||
|
propertyString.append(dict.getDictValue() + separator);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (SysDictData dict : datas)
|
||||||
|
{
|
||||||
|
if (dictLabel.equals(dict.getDictLabel()))
|
||||||
|
{
|
||||||
|
return dict.getDictValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定字典缓存
|
||||||
|
*
|
||||||
|
* @param key 字典键
|
||||||
|
*/
|
||||||
|
public static void removeDictCache(String key)
|
||||||
|
{
|
||||||
|
SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空字典缓存
|
||||||
|
*/
|
||||||
|
public static void clearDictCache()
|
||||||
|
{
|
||||||
|
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*");
|
||||||
|
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置cache key
|
||||||
|
*
|
||||||
|
* @param configKey 参数键
|
||||||
|
* @return 缓存键key
|
||||||
|
*/
|
||||||
|
public static String getCacheKey(String configKey)
|
||||||
|
{
|
||||||
|
return Constants.SYS_DICT_KEY + configKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,40 +1,40 @@
|
|||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误信息处理类。
|
* 错误信息处理类。
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ExceptionUtil
|
public class ExceptionUtil
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 获取exception的详细错误信息。
|
* 获取exception的详细错误信息。
|
||||||
*/
|
*/
|
||||||
public static String getExceptionMessage(Throwable e)
|
public static String getExceptionMessage(Throwable e)
|
||||||
{
|
{
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(sw, true));
|
e.printStackTrace(new PrintWriter(sw, true));
|
||||||
String str = sw.toString();
|
String str = sw.toString();
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRootErrorMseeage(Exception e)
|
public static String getRootErrorMessage(Exception e)
|
||||||
{
|
{
|
||||||
Throwable root = ExceptionUtils.getRootCause(e);
|
Throwable root = ExceptionUtils.getRootCause(e);
|
||||||
root = (root == null ? e : root);
|
root = (root == null ? e : root);
|
||||||
if (root == null)
|
if (root == null)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String msg = root.getMessage();
|
String msg = root.getMessage();
|
||||||
if (msg == null)
|
if (msg == null)
|
||||||
{
|
{
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
return StringUtils.defaultString(msg);
|
return StringUtils.defaultString(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user