Compare commits
99
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94ad6d1f5a | ||
|
|
afdeb7116d | ||
|
|
92571fed91 | ||
|
|
368121b938 | ||
|
|
c918523a7a | ||
|
|
4d39627d96 | ||
|
|
feaa0b4b97 | ||
|
|
4839ea178b | ||
|
|
011a93585c | ||
|
|
20d0af6dbd | ||
|
|
8ed47cd95e | ||
|
|
fcd392ec10 | ||
|
|
2e3b2af397 | ||
|
|
fb27c1c0e0 | ||
|
|
00b2230773 | ||
|
|
268c0f319d | ||
|
|
03a77cc741 | ||
|
|
cffcb2efd3 | ||
|
|
d4902a488d | ||
|
|
bbb50ba56f | ||
|
|
03f9609e28 | ||
|
|
a1552e34b4 | ||
|
|
67a627054b | ||
|
|
00fffd0aef | ||
|
|
05c67476e6 | ||
|
|
9fdafe542d | ||
|
|
00d574fb5f | ||
|
|
3c1edfcd2e | ||
|
|
8cc321bf14 | ||
|
|
5b28479625 | ||
|
|
0fdce6b13b | ||
|
|
60db343cb0 | ||
|
|
0fb6a33f2e | ||
|
|
5dd9004081 | ||
|
|
f8e0ab1b2a | ||
|
|
180c522ca3 | ||
|
|
180986ba16 | ||
|
|
f75a49474a | ||
|
|
9809ae673c | ||
|
|
1dab9b1cf4 | ||
|
|
29a30b1f52 | ||
|
|
589c80fa6f | ||
|
|
3ef0aacf0c | ||
|
|
5dd1b90acb | ||
|
|
edddf77b6a | ||
|
|
5564b03ed2 | ||
|
|
493ecba0ba | ||
|
|
fe0225012f | ||
|
|
b384aa8db5 | ||
|
|
31cf6dbb04 | ||
|
|
14a750a736 | ||
|
|
4ed1a66466 | ||
|
|
d62fe4b99a | ||
|
|
f39aa887c8 | ||
|
|
c921a83d27 | ||
|
|
ac406d88fe | ||
|
|
2b2f70a910 | ||
|
|
5c9ae4fba4 | ||
|
|
14b0e39d5b | ||
|
|
52090c6f37 | ||
|
|
f5f5a97744 | ||
|
|
d7432bc53f | ||
|
|
ea6caa0211 | ||
|
|
86d7385c15 | ||
|
|
a2659d0c6b | ||
|
|
2593c58741 | ||
|
|
4651da4fe4 | ||
|
|
08680bb46a | ||
|
|
6e2ca8ac53 | ||
|
|
c852fbd506 | ||
|
|
16a28f798b | ||
|
|
30373bbb1e | ||
|
|
5eda46802e | ||
|
|
1af9d3fbc5 | ||
|
|
4e7a30ed61 | ||
|
|
5ab1b6e8a4 | ||
|
|
92cf598941 | ||
|
|
343028ade5 | ||
|
|
597b5dad01 | ||
|
|
e818c0319e | ||
|
|
6d3b5201e0 | ||
|
|
9a81408ada | ||
|
|
f3bdfbc6bf | ||
|
|
2eaf62ea82 | ||
|
|
13e51c11e1 | ||
|
|
1f133e8c05 | ||
|
|
cd8cafaf3f | ||
|
|
cbf017a8e2 | ||
|
|
802e668d9a | ||
|
|
9dee067a87 | ||
|
|
a5b5f5b08d | ||
|
|
a40a6f344e | ||
|
|
7d26d2fb3b | ||
|
|
ed6c0a4c80 | ||
|
|
2f8fd79de5 | ||
|
|
31e1f7f8dc | ||
|
|
afbf1eead0 | ||
|
|
a0b0b57110 | ||
|
|
de49404116 |
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 若依
|
Copyright (c) 2020 彤然
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,129 +1,27 @@
|
|||||||
<p align="center">
|
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
|
|
||||||
</p>
|
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.6</h1>
|
|
||||||
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
|
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.6-brightgreen.svg"></a>
|
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## 平台简介
|
|
||||||
|
|
||||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
|
||||||
|
|
||||||
* 采用前后端分离的模式,微服务版本前端(基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue))。
|
|
||||||
* 后端采用Spring Boot、Spring Cloud & Alibaba。
|
|
||||||
* 注册中心、配置中心选型Nacos,权限认证使用Redis。
|
|
||||||
* 流量控制框架选型Sentinel,分布式事务选型Seata。
|
|
||||||
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Cloud-Vue3](https://gitcode.com/yangzongzhuan/RuoYi-Cloud-Vue3),保持同步更新。
|
|
||||||
* 如需不分离应用,请移步 [RuoYi](https://gitee.com/y_project/RuoYi),如需分离应用,请移步 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue)
|
|
||||||
* 阿里云优惠券:[点我进入](http://aly.ruoyi.vip),腾讯云优惠券:[点我进入](http://txy.ruoyi.vip)
|
|
||||||
|
|
||||||
## 系统模块
|
## 系统模块
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
com.ruoyi
|
com.tongran
|
||||||
├── ruoyi-ui // 前端框架 [80]
|
├── tongran-ui // 前端框架 [80]
|
||||||
├── ruoyi-gateway // 网关模块 [8080]
|
├── tongran-gateway // 网关模块 [8080]
|
||||||
├── ruoyi-auth // 认证中心 [9200]
|
├── tongran-auth // 认证中心 [9200]
|
||||||
├── ruoyi-api // 接口模块
|
├── tongran-api // 接口模块
|
||||||
│ └── ruoyi-api-system // 系统接口
|
│ └── tongran-api-system // 系统接口
|
||||||
├── ruoyi-common // 通用模块
|
├── tongran-common // 通用模块
|
||||||
│ └── ruoyi-common-core // 核心模块
|
│ └── tongran-common-core // 核心模块
|
||||||
│ └── ruoyi-common-datascope // 权限范围
|
│ └── tongran-common-datascope // 权限范围
|
||||||
│ └── ruoyi-common-datasource // 多数据源
|
│ └── tongran-common-datasource // 多数据源
|
||||||
│ └── ruoyi-common-log // 日志记录
|
│ └── tongran-common-log // 日志记录
|
||||||
│ └── ruoyi-common-redis // 缓存服务
|
│ └── tongran-common-redis // 缓存服务
|
||||||
│ └── ruoyi-common-seata // 分布式事务
|
│ └── tongran-common-seata // 分布式事务
|
||||||
│ └── ruoyi-common-security // 安全模块
|
│ └── tongran-common-security // 安全模块
|
||||||
│ └── ruoyi-common-sensitive // 数据脱敏
|
│ └── tongran-common-sensitive // 数据脱敏
|
||||||
│ └── ruoyi-common-swagger // 系统接口
|
│ └── tongran-common-swagger // 系统接口
|
||||||
├── ruoyi-modules // 业务模块
|
├── tongran-modules // 业务模块
|
||||||
│ └── ruoyi-system // 系统模块 [9201]
|
│ └── tongran-system // 系统模块 [9201]
|
||||||
│ └── ruoyi-gen // 代码生成 [9202]
|
│ └── tongran-gen // 代码生成 [9202]
|
||||||
│ └── ruoyi-job // 定时任务 [9203]
|
│ └── tongran-job // 定时任务 [9203]
|
||||||
│ └── ruoyi-file // 文件服务 [9300]
|
│ └── tongran-file // 文件服务 [9300]
|
||||||
├── ruoyi-visual // 图形化管理模块
|
├── tongran-visual // 图形化管理模块
|
||||||
│ └── ruoyi-visual-monitor // 监控中心 [9100]
|
│ └── tongran-visual-monitor // 监控中心 [9100]
|
||||||
├──pom.xml // 公共依赖
|
├──pom.xml // 公共依赖
|
||||||
~~~
|
|
||||||
|
|
||||||
## 架构图
|
|
||||||
|
|
||||||
<img src="https://oscimg.oschina.net/oscnet/up-82e9722ecb846786405a904bafcf19f73f3.png"/>
|
|
||||||
|
|
||||||
## 内置功能
|
|
||||||
|
|
||||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
|
||||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
|
|
||||||
3. 岗位管理:配置系统用户所属担任职务。
|
|
||||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
|
||||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
|
|
||||||
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
|
|
||||||
7. 参数管理:对系统动态配置常用参数。
|
|
||||||
8. 通知公告:系统通知公告信息发布维护。
|
|
||||||
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
|
||||||
10. 登录日志:系统登录日志记录查询包含登录异常。
|
|
||||||
11. 在线用户:当前系统中活跃用户状态监控。
|
|
||||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
|
||||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
|
||||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
|
||||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
|
||||||
16. 在线构建器:拖动表单元素生成相应的HTML代码。
|
|
||||||
17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
|
||||||
|
|
||||||
## 在线体验
|
|
||||||
|
|
||||||
- admin/admin123
|
|
||||||
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
|
|
||||||
|
|
||||||
演示地址:http://ruoyi.vip
|
|
||||||
文档地址:http://doc.ruoyi.vip
|
|
||||||
|
|
||||||
## 演示图
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-4148b24f58660a9dc347761e4cf6162f28f.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-ece3fd37a3d4bb75a3926e905a3c5629055.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-92ffb7f3835855cff100fa0f754a6be0d99.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-ff9e3066561574aca73005c5730c6a41f15.png"/></td>
|
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
## 若依微服务交流群
|
|
||||||
|
|
||||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Kuaw0Xdlw2Nlgn6s8h9elzuquHGxGObD&authKey=cSrQcWQ%2BzQZAFFrwxaR%2BbzcumX4WRduZnd1O6JO1dlclQMiu%2BKwxAy8t2JfNp67V&noverify=0&group_code=112869560) 点击按钮入群。
|
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Auth工程。
|
echo [��Ϣ] ʹ��Jar��������Auth���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-auth/target
|
cd ../tongran-auth/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-auth.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-auth.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Gateway工程。
|
echo [��Ϣ] ʹ��Jar��������Gateway���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-gateway/target
|
cd ../tongran-gateway/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-gateway.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-gateway.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Modules-File工程。
|
echo [��Ϣ] ʹ��Jar��������Modules-File���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-modules/ruoyi-file/target
|
cd ../tongran-modules/tongran-file/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-file.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-modules-file.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Modules-Gen工程。
|
echo [��Ϣ] ʹ��Jar��������Modules-Gen���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-modules/ruoyi-gen/target
|
cd ../tongran-modules/tongran-gen/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-gen.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-modules-gen.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Modules-Job工程。
|
echo [��Ϣ] ʹ��Jar��������Modules-Job���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-modules/ruoyi-job/target
|
cd ../tongran-modules/tongran-job/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-job.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-modules-job.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Modules-System工程。
|
echo [��Ϣ] ʹ��Jar��������Modules-System���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-modules/ruoyi-system/target
|
cd ../tongran-modules/tongran-system/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-system.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-modules-system.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
echo [信息] 使用Jar命令运行Monitor工程。
|
echo [��Ϣ] ʹ��Jar��������Monitor���̡�
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
cd ../ruoyi-visual/ruoyi-monitor/target
|
cd ../tongran-visual/tongran-monitor/target
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-visual-monitor.jar
|
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar tongran-visual-monitor.jar
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
pause
|
pause
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# 复制项目的文件到对应docker路径,便于一键生成镜像。
|
|
||||||
usage() {
|
|
||||||
echo "Usage: sh copy.sh"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# copy sql
|
|
||||||
echo "begin copy sql "
|
|
||||||
cp ../sql/ry_20250523.sql ./mysql/db
|
|
||||||
cp ../sql/ry_config_20250224.sql ./mysql/db
|
|
||||||
|
|
||||||
# copy html
|
|
||||||
echo "begin copy html "
|
|
||||||
cp -r ../ruoyi-ui/dist/** ./nginx/html/dist
|
|
||||||
|
|
||||||
|
|
||||||
# copy jar
|
|
||||||
echo "begin copy ruoyi-gateway "
|
|
||||||
cp ../ruoyi-gateway/target/ruoyi-gateway.jar ./ruoyi/gateway/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-auth "
|
|
||||||
cp ../ruoyi-auth/target/ruoyi-auth.jar ./ruoyi/auth/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-visual "
|
|
||||||
cp ../ruoyi-visual/ruoyi-monitor/target/ruoyi-visual-monitor.jar ./ruoyi/visual/monitor/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-modules-system "
|
|
||||||
cp ../ruoyi-modules/ruoyi-system/target/ruoyi-modules-system.jar ./ruoyi/modules/system/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-modules-file "
|
|
||||||
cp ../ruoyi-modules/ruoyi-file/target/ruoyi-modules-file.jar ./ruoyi/modules/file/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-modules-job "
|
|
||||||
cp ../ruoyi-modules/ruoyi-job/target/ruoyi-modules-job.jar ./ruoyi/modules/job/jar
|
|
||||||
|
|
||||||
echo "begin copy ruoyi-modules-gen "
|
|
||||||
cp ../ruoyi-modules/ruoyi-gen/target/ruoyi-modules-gen.jar ./ruoyi/modules/gen/jar
|
|
||||||
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# 使用说明,用来提示输入参数
|
|
||||||
usage() {
|
|
||||||
echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm]"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# 开启所需端口
|
|
||||||
port(){
|
|
||||||
firewall-cmd --add-port=80/tcp --permanent
|
|
||||||
firewall-cmd --add-port=8080/tcp --permanent
|
|
||||||
firewall-cmd --add-port=8848/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9848/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9849/tcp --permanent
|
|
||||||
firewall-cmd --add-port=6379/tcp --permanent
|
|
||||||
firewall-cmd --add-port=3306/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9100/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9200/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9201/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9202/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9203/tcp --permanent
|
|
||||||
firewall-cmd --add-port=9300/tcp --permanent
|
|
||||||
service firewalld restart
|
|
||||||
}
|
|
||||||
|
|
||||||
# 启动基础环境(必须)
|
|
||||||
base(){
|
|
||||||
docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos
|
|
||||||
}
|
|
||||||
|
|
||||||
# 启动程序模块(必须)
|
|
||||||
modules(){
|
|
||||||
docker-compose up -d ruoyi-nginx ruoyi-gateway ruoyi-auth ruoyi-modules-system
|
|
||||||
}
|
|
||||||
|
|
||||||
# 关闭所有环境/模块
|
|
||||||
stop(){
|
|
||||||
docker-compose stop
|
|
||||||
}
|
|
||||||
|
|
||||||
# 删除所有环境/模块
|
|
||||||
rm(){
|
|
||||||
docker-compose rm
|
|
||||||
}
|
|
||||||
|
|
||||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
|
||||||
case "$1" in
|
|
||||||
"port")
|
|
||||||
port
|
|
||||||
;;
|
|
||||||
"base")
|
|
||||||
base
|
|
||||||
;;
|
|
||||||
"modules")
|
|
||||||
modules
|
|
||||||
;;
|
|
||||||
"stop")
|
|
||||||
stop
|
|
||||||
;;
|
|
||||||
"rm")
|
|
||||||
rm
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
version : '3.8'
|
|
||||||
services:
|
|
||||||
ruoyi-nacos:
|
|
||||||
container_name: ruoyi-nacos
|
|
||||||
image: nacos/nacos-server
|
|
||||||
build:
|
|
||||||
context: ./nacos
|
|
||||||
environment:
|
|
||||||
- MODE=standalone
|
|
||||||
volumes:
|
|
||||||
- ./nacos/logs/:/home/nacos/logs
|
|
||||||
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
|
|
||||||
ports:
|
|
||||||
- "8848:8848"
|
|
||||||
- "9848:9848"
|
|
||||||
- "9849:9849"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-mysql
|
|
||||||
ruoyi-mysql:
|
|
||||||
container_name: ruoyi-mysql
|
|
||||||
image: mysql:5.7
|
|
||||||
build:
|
|
||||||
context: ./mysql
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
volumes:
|
|
||||||
- ./mysql/conf:/etc/mysql/conf.d
|
|
||||||
- ./mysql/logs:/logs
|
|
||||||
- ./mysql/data:/var/lib/mysql
|
|
||||||
command: [
|
|
||||||
'mysqld',
|
|
||||||
'--innodb-buffer-pool-size=80M',
|
|
||||||
'--character-set-server=utf8mb4',
|
|
||||||
'--collation-server=utf8mb4_unicode_ci',
|
|
||||||
'--default-time-zone=+8:00',
|
|
||||||
'--lower-case-table-names=1'
|
|
||||||
]
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: 'ry-cloud'
|
|
||||||
MYSQL_ROOT_PASSWORD: password
|
|
||||||
ruoyi-redis:
|
|
||||||
container_name: ruoyi-redis
|
|
||||||
image: redis
|
|
||||||
build:
|
|
||||||
context: ./redis
|
|
||||||
ports:
|
|
||||||
- "6379:6379"
|
|
||||||
volumes:
|
|
||||||
- ./redis/conf/redis.conf:/home/ruoyi/redis/redis.conf
|
|
||||||
- ./redis/data:/data
|
|
||||||
command: redis-server /home/ruoyi/redis/redis.conf
|
|
||||||
ruoyi-nginx:
|
|
||||||
container_name: ruoyi-nginx
|
|
||||||
image: nginx
|
|
||||||
build:
|
|
||||||
context: ./nginx
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- ./nginx/html/dist:/home/ruoyi/projects/ruoyi-ui
|
|
||||||
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
|
||||||
- ./nginx/logs:/var/log/nginx
|
|
||||||
- ./nginx/conf.d:/etc/nginx/conf.d
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-gateway
|
|
||||||
links:
|
|
||||||
- ruoyi-gateway
|
|
||||||
ruoyi-gateway:
|
|
||||||
container_name: ruoyi-gateway
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/gateway
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-redis
|
|
||||||
links:
|
|
||||||
- ruoyi-redis
|
|
||||||
ruoyi-auth:
|
|
||||||
container_name: ruoyi-auth
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/auth
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9200:9200"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-redis
|
|
||||||
links:
|
|
||||||
- ruoyi-redis
|
|
||||||
ruoyi-modules-system:
|
|
||||||
container_name: ruoyi-modules-system
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/modules/system
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9201:9201"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-redis
|
|
||||||
- ruoyi-mysql
|
|
||||||
links:
|
|
||||||
- ruoyi-redis
|
|
||||||
- ruoyi-mysql
|
|
||||||
ruoyi-modules-gen:
|
|
||||||
container_name: ruoyi-modules-gen
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/modules/gen
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9202:9202"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-mysql
|
|
||||||
links:
|
|
||||||
- ruoyi-mysql
|
|
||||||
ruoyi-modules-job:
|
|
||||||
container_name: ruoyi-modules-job
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/modules/job
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9203:9203"
|
|
||||||
depends_on:
|
|
||||||
- ruoyi-mysql
|
|
||||||
links:
|
|
||||||
- ruoyi-mysql
|
|
||||||
ruoyi-modules-file:
|
|
||||||
container_name: ruoyi-modules-file
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/modules/file
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9300:9300"
|
|
||||||
volumes:
|
|
||||||
- ./ruoyi/uploadPath:/home/ruoyi/uploadPath
|
|
||||||
ruoyi-visual-monitor:
|
|
||||||
container_name: ruoyi-visual-monitor
|
|
||||||
build:
|
|
||||||
context: ./ruoyi/visual/monitor
|
|
||||||
dockerfile: dockerfile
|
|
||||||
ports:
|
|
||||||
- "9100:9100"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放sql目录下的所有脚本,用于docker自动执行。
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM mysql:5.7
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 执行sql脚本
|
|
||||||
ADD ./db/*.sql /docker-entrypoint-initdb.d/
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
spring.datasource.platform=mysql
|
|
||||||
db.num=1
|
|
||||||
db.url.0=jdbc:mysql://ruoyi-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
|
||||||
db.user=root
|
|
||||||
db.password=123456
|
|
||||||
|
|
||||||
nacos.naming.empty-service.auto-clean=true
|
|
||||||
nacos.naming.empty-service.clean.initial-delay-ms=50000
|
|
||||||
nacos.naming.empty-service.clean.period-time-ms=30000
|
|
||||||
|
|
||||||
management.endpoints.web.exposure.include=*
|
|
||||||
|
|
||||||
management.metrics.export.elastic.enabled=false
|
|
||||||
management.metrics.export.influx.enabled=false
|
|
||||||
|
|
||||||
server.tomcat.accesslog.enabled=true
|
|
||||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
|
||||||
|
|
||||||
server.tomcat.basedir=/home/ruoyi/nacos/tomcat/logs
|
|
||||||
|
|
||||||
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
|
||||||
|
|
||||||
nacos.core.auth.system.type=nacos
|
|
||||||
nacos.core.auth.enabled=false
|
|
||||||
nacos.core.auth.default.token.expire.seconds=18000
|
|
||||||
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
|
|
||||||
nacos.core.auth.caching.enabled=true
|
|
||||||
nacos.core.auth.enable.userAgentAuthWhite=false
|
|
||||||
nacos.core.auth.server.identity.key=serverIdentity
|
|
||||||
nacos.core.auth.server.identity.value=security
|
|
||||||
|
|
||||||
nacos.istio.mcp.server.enabled=false
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM nacos/nacos-server
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 复制conf文件到路径
|
|
||||||
COPY ./conf/application.properties /home/nacos/conf/application.properties
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
worker_processes 1;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
include mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
sendfile on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /home/ruoyi/projects/ruoyi-ui;
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
index index.html index.htm;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /prod-api/{
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header REMOTE-HOST $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_pass http://ruoyi-gateway:8080/;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 避免actuator暴露
|
|
||||||
if ($uri ~ "/actuator") {
|
|
||||||
return 403;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM nginx
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi/projects/ruoyi-ui
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi/projects/ruoyi-ui
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi/projects/ruoyi-ui
|
|
||||||
# 复制conf文件到路径
|
|
||||||
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
# 复制html文件到路径
|
|
||||||
COPY ./html/dist /home/ruoyi/projects/ruoyi-ui
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# requirepass 123456
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM redis
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi/redis
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi/redis
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi/redis
|
|
||||||
# 复制conf文件到路径
|
|
||||||
COPY ./conf/redis.conf /home/ruoyi/redis/redis.conf
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-auth.jar /home/ruoyi/ruoyi-auth.jar
|
|
||||||
# 启动认证服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-auth.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放认证中心打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar
|
|
||||||
# 启动网关服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放网关模块打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-modules-file.jar /home/ruoyi/ruoyi-modules-file.jar
|
|
||||||
# 启动文件服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-modules-file.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放文件服务打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-modules-gen.jar /home/ruoyi/ruoyi-modules-gen.jar
|
|
||||||
# 启动代码生成服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-modules-gen.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放代码生成打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-modules-job.jar /home/ruoyi/ruoyi-modules-job.jar
|
|
||||||
# 启动定时任务服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-modules-job.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放定时任务打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-modules-system.jar /home/ruoyi/ruoyi-modules-system.jar
|
|
||||||
# 启动系统服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-modules-system.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放系统模块打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# 基础镜像
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
# author
|
|
||||||
MAINTAINER ruoyi
|
|
||||||
|
|
||||||
# 挂载目录
|
|
||||||
VOLUME /home/ruoyi
|
|
||||||
# 创建目录
|
|
||||||
RUN mkdir -p /home/ruoyi
|
|
||||||
# 指定路径
|
|
||||||
WORKDIR /home/ruoyi
|
|
||||||
# 复制jar文件到路径
|
|
||||||
COPY ./jar/ruoyi-visual-monitor.jar /home/ruoyi/ruoyi-visual-monitor.jar
|
|
||||||
# 启动系统服务
|
|
||||||
ENTRYPOINT ["java","-jar","ruoyi-visual-monitor.jar"]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
存放监控中心打包好的jar文件,用于docker启动应用。
|
|
||||||
@@ -4,16 +4,15 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>tongran</artifactId>
|
||||||
<version>3.6.6</version>
|
<version>3.6.6</version>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>tongran</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<description>彤然微服务系统</description>
|
||||||
<description>若依微服务系统</description>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi.version>3.6.6</ruoyi.version>
|
<tongran.version>3.6.6</tongran.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
@@ -184,85 +183,85 @@
|
|||||||
|
|
||||||
<!-- 核心模块 -->
|
<!-- 核心模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
<artifactId>tongran-common-core</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 接口模块 -->
|
<!-- 接口模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-swagger</artifactId>
|
<artifactId>tongran-common-swagger</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 安全模块 -->
|
<!-- 安全模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-security</artifactId>
|
<artifactId>tongran-common-security</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 数据脱敏 -->
|
<!-- 数据脱敏 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
<artifactId>tongran-common-sensitive</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 权限范围 -->
|
<!-- 权限范围 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-datascope</artifactId>
|
<artifactId>tongran-common-datascope</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 多数据源 -->
|
<!-- 多数据源 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-datasource</artifactId>
|
<artifactId>tongran-common-datasource</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 分布式事务 -->
|
<!-- 分布式事务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-seata</artifactId>
|
<artifactId>tongran-common-seata</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 日志记录 -->
|
<!-- 日志记录 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-log</artifactId>
|
<artifactId>tongran-common-log</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 缓存服务 -->
|
<!-- 缓存服务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-redis</artifactId>
|
<artifactId>tongran-common-redis</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 系统接口 -->
|
<!-- 系统接口 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-api-system</artifactId>
|
<artifactId>tongran-api-system</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${tongran.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-auth</module>
|
<module>tongran-auth</module>
|
||||||
<module>ruoyi-gateway</module>
|
<module>tongran-gateway</module>
|
||||||
<module>ruoyi-visual</module>
|
<module>tongran-visual</module>
|
||||||
<module>ruoyi-modules</module>
|
<module>tongran-modules</module>
|
||||||
<module>ruoyi-rocketmq</module>
|
<module>tongran-rocketmq</module>
|
||||||
<module>ruoyi-api</module>
|
<module>tongran-api</module>
|
||||||
<module>ruoyi-common</module>
|
<module>tongran-common</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
com.ruoyi.system.api.factory.RemoteUserFallbackFactory
|
|
||||||
com.ruoyi.system.api.factory.RemoteLogFallbackFactory
|
|
||||||
com.ruoyi.system.api.factory.RemoteFileFallbackFactory
|
|
||||||
com.ruoyi.system.api.factory.RemoteRevenueConfigFallbackFactory
|
|
||||||
com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.ruoyi.auth;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 认证授权中心
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
|
||||||
public class RuoYiAuthApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiAuthApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ _ _
|
|
||||||
(_) | | | |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ __ _ _ _ | |_ | |__
|
|
||||||
| '__|| | | | / _ \ | | | || ||______| / _` || | | || __|| '_ \
|
|
||||||
| | | |_| || (_) || |_| || | | (_| || |_| || |_ | | | |
|
|
||||||
|_| \__,_| \___/ \__, ||_| \__,_| \__,_| \__||_| |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruoyi</groupId>
|
|
||||||
<artifactId>ruoyi</artifactId>
|
|
||||||
<version>3.6.6</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>ruoyi-common-log</module>
|
|
||||||
<module>ruoyi-common-core</module>
|
|
||||||
<module>ruoyi-common-redis</module>
|
|
||||||
<module>ruoyi-common-seata</module>
|
|
||||||
<module>ruoyi-common-swagger</module>
|
|
||||||
<module>ruoyi-common-security</module>
|
|
||||||
<module>ruoyi-common-sensitive</module>
|
|
||||||
<module>ruoyi-common-datascope</module>
|
|
||||||
<module>ruoyi-common-datasource</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<artifactId>ruoyi-common</artifactId>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
ruoyi-common通用模块
|
|
||||||
</description>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
package com.ruoyi.common.core.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务名称
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class ServiceNameConstants
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 认证服务的serviceid
|
|
||||||
*/
|
|
||||||
public static final String AUTH_SERVICE = "ruoyi-auth";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统模块的serviceid
|
|
||||||
*/
|
|
||||||
public static final String SYSTEM_SERVICE = "ruoyi-system";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件服务的serviceid
|
|
||||||
*/
|
|
||||||
public static final String FILE_SERVICE = "ruoyi-file";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* rocketMq的serviceid
|
|
||||||
*/
|
|
||||||
public static final String ROCKETMQ_SERVICE = "ruoyi-rocketmq";
|
|
||||||
}
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
com.ruoyi.common.core.utils.SpringUtils
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
com.ruoyi.common.datascope.aspect.DataScopeAspect
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
com.ruoyi.common.log.service.AsyncLogService
|
|
||||||
com.ruoyi.common.log.aspect.LogAspect
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
com.ruoyi.common.redis.configure.RedisConfig
|
|
||||||
com.ruoyi.common.redis.service.RedisService
|
|
||||||
-89
@@ -1,89 +0,0 @@
|
|||||||
package com.ruoyi.common.security.aspect;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
|
||||||
import org.aspectj.lang.annotation.Around;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresRoles;
|
|
||||||
import com.ruoyi.common.security.auth.AuthUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 基于 Spring Aop 的注解鉴权
|
|
||||||
*
|
|
||||||
* @author kong
|
|
||||||
*/
|
|
||||||
@Aspect
|
|
||||||
@Component
|
|
||||||
public class PreAuthorizeAspect
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 构建
|
|
||||||
*/
|
|
||||||
public PreAuthorizeAspect()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义AOP签名 (切入所有使用鉴权注解的方法)
|
|
||||||
*/
|
|
||||||
public static final String POINTCUT_SIGN = " @annotation(com.ruoyi.common.security.annotation.RequiresLogin) || "
|
|
||||||
+ "@annotation(com.ruoyi.common.security.annotation.RequiresPermissions) || "
|
|
||||||
+ "@annotation(com.ruoyi.common.security.annotation.RequiresRoles)";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 声明AOP签名
|
|
||||||
*/
|
|
||||||
@Pointcut(POINTCUT_SIGN)
|
|
||||||
public void pointcut()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 环绕切入
|
|
||||||
*
|
|
||||||
* @param joinPoint 切面对象
|
|
||||||
* @return 底层方法执行后的返回值
|
|
||||||
* @throws Throwable 底层方法抛出的异常
|
|
||||||
*/
|
|
||||||
@Around("pointcut()")
|
|
||||||
public Object around(ProceedingJoinPoint joinPoint) throws Throwable
|
|
||||||
{
|
|
||||||
// 注解鉴权
|
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
||||||
checkMethodAnnotation(signature.getMethod());
|
|
||||||
// 执行原有逻辑
|
|
||||||
return joinPoint.proceed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对一个Method对象进行注解检查
|
|
||||||
*/
|
|
||||||
public void checkMethodAnnotation(Method method)
|
|
||||||
{
|
|
||||||
// 校验 @RequiresLogin 注解
|
|
||||||
RequiresLogin requiresLogin = method.getAnnotation(RequiresLogin.class);
|
|
||||||
if (requiresLogin != null)
|
|
||||||
{
|
|
||||||
AuthUtil.checkLogin();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验 @RequiresRoles 注解
|
|
||||||
RequiresRoles requiresRoles = method.getAnnotation(RequiresRoles.class);
|
|
||||||
if (requiresRoles != null)
|
|
||||||
{
|
|
||||||
AuthUtil.checkRole(requiresRoles);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验 @RequiresPermissions 注解
|
|
||||||
RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class);
|
|
||||||
if (requiresPermissions != null)
|
|
||||||
{
|
|
||||||
AuthUtil.checkPermi(requiresPermissions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
com.ruoyi.common.security.config.WebMvcConfig
|
|
||||||
com.ruoyi.common.security.service.TokenService
|
|
||||||
com.ruoyi.common.security.aspect.PreAuthorizeAspect
|
|
||||||
com.ruoyi.common.security.aspect.InnerAuthAspect
|
|
||||||
com.ruoyi.common.security.handler.GlobalExceptionHandler
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
com.ruoyi.common.swagger.config.SpringDocAutoConfiguration
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.ruoyi.gateway;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网关启动程序
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
|
||||||
public class RuoYiGatewayApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiGatewayApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 若依网关启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ _
|
|
||||||
(_) | |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ __ _ __ _ | |_ ___ __ __ __ _ _ _
|
|
||||||
| '__|| | | | / _ \ | | | || ||______| / _` | / _` || __| / _ \\ \ /\ / / / _` || | | |
|
|
||||||
| | | |_| || (_) || |_| || | | (_| || (_| || |_ | __/ \ V V / | (_| || |_| |
|
|
||||||
|_| \__,_| \___/ \__, ||_| \__, | \__,_| \__| \___| \_/\_/ \__,_| \__, |
|
|
||||||
__/ | __/ | __/ |
|
|
||||||
|___/ |___/ |___/
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.ruoyi.file;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件服务
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
|
||||||
public class RuoYiFileApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiFileApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 文件服务模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ __ _ _
|
|
||||||
(_) / _|(_)| |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
|
|
||||||
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
|
|
||||||
| | | |_| || (_) || |_| || | | | | || || __/
|
|
||||||
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.ruoyi.gen;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 代码生成
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class RuoYiGenApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiGenApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 代码生成模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_
|
|
||||||
(_)
|
|
||||||
_ __ _ _ ___ _ _ _ ______ __ _ ___ _ __
|
|
||||||
| '__|| | | | / _ \ | | | || ||______| / _` | / _ \| '_ \
|
|
||||||
| | | |_| || (_) || |_| || | | (_| || __/| | | |
|
|
||||||
|_| \__,_| \___/ \__, ||_| \__, | \___||_| |_|
|
|
||||||
__/ | __/ |
|
|
||||||
|___/ |___/
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.ruoyi.job;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class RuoYiJobApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiJobApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 定时任务模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ _ _
|
|
||||||
(_) (_) | |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ _ ___ | |__
|
|
||||||
| '__|| | | | / _ \ | | | || ||______| | | / _ \ | '_ \
|
|
||||||
| | | |_| || (_) || |_| || | | || (_) || |_) |
|
|
||||||
|_| \__,_| \___/ \__, ||_| | | \___/ |_.__/
|
|
||||||
__/ | _/ |
|
|
||||||
|___/ |__/
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/ruoyi-job" />
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.ruoyi" level="info" />
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn" />
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info" />
|
|
||||||
<appender-ref ref="file_error" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
package com.ruoyi.mtragent;
|
|
||||||
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台管理模块
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableAsync
|
|
||||||
public class RuoYiMtragentApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiMtragentApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ RuoYiMtragent模块启动成功 ლ(´ڡ`ლ)゙");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-65
@@ -1,65 +0,0 @@
|
|||||||
package com.ruoyi.mtragent.domain;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户端网络接口信息对象 rm_network_interface
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-10-14
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class RmNetworkInterface extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 主键ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 客户端ID */
|
|
||||||
@Excel(name = "客户端ID")
|
|
||||||
private String clientId;
|
|
||||||
|
|
||||||
/** 运营商 */
|
|
||||||
@Excel(name = "运营商")
|
|
||||||
private String isp;
|
|
||||||
|
|
||||||
/** 省 */
|
|
||||||
@Excel(name = "省")
|
|
||||||
private String province;
|
|
||||||
|
|
||||||
/** 市 */
|
|
||||||
@Excel(name = "市")
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
/** 公网IP */
|
|
||||||
@Excel(name = "公网IP")
|
|
||||||
private String publicIp;
|
|
||||||
|
|
||||||
/** 接口名称 */
|
|
||||||
@Excel(name = "接口名称")
|
|
||||||
private String interfaceName;
|
|
||||||
|
|
||||||
/** MAC地址 */
|
|
||||||
@Excel(name = "MAC地址")
|
|
||||||
private String macAddress;
|
|
||||||
|
|
||||||
/** 接口类型 */
|
|
||||||
@Excel(name = "接口类型")
|
|
||||||
private String interfaceType;
|
|
||||||
|
|
||||||
/** IPv4地址 */
|
|
||||||
@Excel(name = "IPv4地址")
|
|
||||||
private String ipv4Address;
|
|
||||||
|
|
||||||
/** 网关 */
|
|
||||||
@Excel(name = "网关")
|
|
||||||
private String gateway;
|
|
||||||
/** 绑定ip 1业务IP,2管理ip */
|
|
||||||
private String bindIp;
|
|
||||||
/** 是否为新信息 */
|
|
||||||
private Integer newFlag;
|
|
||||||
|
|
||||||
}
|
|
||||||
-182
@@ -1,182 +0,0 @@
|
|||||||
package com.ruoyi.mtragent.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.ruoyi.common.core.enums.MsgEnum;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.mtragent.domain.DeviceMessage;
|
|
||||||
import com.ruoyi.mtragent.domain.RmNetworkInterface;
|
|
||||||
import com.ruoyi.mtragent.domain.vo.PolicyTypeVo;
|
|
||||||
import com.ruoyi.mtragent.mapper.RmNetworkInterfaceMapper;
|
|
||||||
import com.ruoyi.mtragent.model.ProducerMode;
|
|
||||||
import com.ruoyi.mtragent.producer.MessageProducer;
|
|
||||||
import com.ruoyi.mtragent.service.IRmNetworkInterfaceService;
|
|
||||||
import com.ruoyi.system.api.domain.RouteMsg;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户端网络接口信息Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-10-14
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class RmNetworkInterfaceServiceImpl implements IRmNetworkInterfaceService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private RmNetworkInterfaceMapper rmNetworkInterfaceMapper;
|
|
||||||
@Autowired
|
|
||||||
private ProducerMode producerMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 客户端网络接口信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public RmNetworkInterface selectRmNetworkInterfaceById(Long id)
|
|
||||||
{
|
|
||||||
return rmNetworkInterfaceMapper.selectRmNetworkInterfaceById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息列表
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 客户端网络接口信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<RmNetworkInterface> selectRmNetworkInterfaceList(RmNetworkInterface rmNetworkInterface)
|
|
||||||
{
|
|
||||||
return rmNetworkInterfaceMapper.selectRmNetworkInterfaceList(rmNetworkInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertRmNetworkInterface(RmNetworkInterface rmNetworkInterface)
|
|
||||||
{
|
|
||||||
rmNetworkInterface.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return rmNetworkInterfaceMapper.insertRmNetworkInterface(rmNetworkInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateRmNetworkInterface(RmNetworkInterface rmNetworkInterface)
|
|
||||||
{
|
|
||||||
rmNetworkInterface.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return rmNetworkInterfaceMapper.updateRmNetworkInterface(rmNetworkInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateRmNetworkInterfaceByMac(RmNetworkInterface rmNetworkInterface) {
|
|
||||||
rmNetworkInterface.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return rmNetworkInterfaceMapper.updateRmNetworkInterfaceByMac(rmNetworkInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的客户端网络接口信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteRmNetworkInterfaceByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return rmNetworkInterfaceMapper.deleteRmNetworkInterfaceByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除客户端网络接口信息信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteRmNetworkInterfaceById(Long id)
|
|
||||||
{
|
|
||||||
return rmNetworkInterfaceMapper.deleteRmNetworkInterfaceById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定公网ip
|
|
||||||
* @param rmNetworkInterface
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int bindPublicIp(RmNetworkInterface rmNetworkInterface) {
|
|
||||||
return rmNetworkInterfaceMapper.updateRmNetworkInterface(rmNetworkInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新路由信息
|
|
||||||
* @param clientId
|
|
||||||
*/
|
|
||||||
public void updateRouteMsg(String clientId){
|
|
||||||
MessageProducer messageProducer = new MessageProducer();
|
|
||||||
// 查询路由是否有变化
|
|
||||||
RmNetworkInterface rmNetworkInterface = new RmNetworkInterface();
|
|
||||||
rmNetworkInterface.setClientId(clientId);
|
|
||||||
rmNetworkInterface.setBindIp("2");
|
|
||||||
List<RmNetworkInterface> networkInterfaces = rmNetworkInterfaceMapper.selectRmNetworkInterfaceList(rmNetworkInterface);
|
|
||||||
if(!networkInterfaces.isEmpty()){
|
|
||||||
List<RmNetworkInterface> oldList = networkInterfaces.stream()
|
|
||||||
.filter(networkInterface -> networkInterface.getNewFlag() == 0)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if(!oldList.isEmpty()){
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
|
||||||
// 增加静态路由
|
|
||||||
RmNetworkInterface oldMsg = oldList.get(0);
|
|
||||||
RouteMsg oldRouteMsg = new RouteMsg();
|
|
||||||
oldRouteMsg.setGateway(oldMsg.getGateway());
|
|
||||||
oldRouteMsg.setName(oldMsg.getInterfaceName());
|
|
||||||
resultMap.put("delRoute", oldRouteMsg);
|
|
||||||
List<RmNetworkInterface> newList = networkInterfaces.stream()
|
|
||||||
.filter(networkInterface -> networkInterface.getNewFlag() == 1)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
RmNetworkInterface newMsg = newList.get(0);
|
|
||||||
RouteMsg newRouteMsg = new RouteMsg();
|
|
||||||
newRouteMsg.setGateway(newMsg.getGateway());
|
|
||||||
newRouteMsg.setName(newMsg.getInterfaceName());
|
|
||||||
resultMap.put("addRoute", newRouteMsg);
|
|
||||||
resultMap.put("upTime", Instant.now().getEpochSecond());
|
|
||||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
|
||||||
policyTypeVo.setRoutes(JSONObject.toJSONString(resultMap));
|
|
||||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
|
||||||
// 构建发送消息
|
|
||||||
DeviceMessage message = new DeviceMessage();
|
|
||||||
message.setClientId(clientId);
|
|
||||||
message.setData(configJson);
|
|
||||||
message.setDataType(MsgEnum.获取最新策略应答.getValue());
|
|
||||||
|
|
||||||
messageProducer.sendAsyncProducerMessage(
|
|
||||||
producerMode.getAgentTopic(),
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
JSONObject.toJSONString(message)
|
|
||||||
);
|
|
||||||
// 更新网卡信息表
|
|
||||||
RmNetworkInterface updateQuery = new RmNetworkInterface();
|
|
||||||
updateQuery.setNewFlag(999);
|
|
||||||
updateQuery.setMacAddress(networkInterfaces.get(0).getMacAddress());
|
|
||||||
rmNetworkInterfaceMapper.updateRmNetworkInterfaceByMac(updateQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-148
@@ -1,148 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.mtragent.mapper.RmNetworkInterfaceMapper">
|
|
||||||
|
|
||||||
<resultMap type="RmNetworkInterface" id="RmNetworkInterfaceResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="clientId" column="client_id" />
|
|
||||||
<result property="isp" column="isp" />
|
|
||||||
<result property="province" column="province" />
|
|
||||||
<result property="city" column="city" />
|
|
||||||
<result property="publicIp" column="public_ip" />
|
|
||||||
<result property="interfaceName" column="interface_name" />
|
|
||||||
<result property="macAddress" column="mac_address" />
|
|
||||||
<result property="interfaceType" column="interface_type" />
|
|
||||||
<result property="ipv4Address" column="ipv4_address" />
|
|
||||||
<result property="gateway" column="gateway" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="bindIp" column="bind_ip" />
|
|
||||||
<result property="newFlag" column="new_flag" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectRmNetworkInterfaceVo">
|
|
||||||
select id, client_id, isp, province, city, public_ip, interface_name, mac_address, interface_type, ipv4_address, gateway, create_time, update_time, create_by, update_by, bind_ip, new_flag from rm_network_interface
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectRmNetworkInterfaceList" parameterType="RmNetworkInterface" resultMap="RmNetworkInterfaceResult">
|
|
||||||
<include refid="selectRmNetworkInterfaceVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
||||||
<if test="isp != null and isp != ''"> and isp = #{isp}</if>
|
|
||||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
|
||||||
<if test="city != null and city != ''"> and city = #{city}</if>
|
|
||||||
<if test="publicIp != null and publicIp != ''"> and public_ip = #{publicIp}</if>
|
|
||||||
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
|
|
||||||
<if test="macAddress != null and macAddress != ''"> and mac_address = #{macAddress}</if>
|
|
||||||
<if test="interfaceType != null and interfaceType != ''"> and interface_type = #{interfaceType}</if>
|
|
||||||
<if test="ipv4Address != null and ipv4Address != ''"> and ipv4_address = #{ipv4Address}</if>
|
|
||||||
<if test="gateway != null and gateway != ''"> and gateway = #{gateway}</if>
|
|
||||||
<if test="bindIp != null and bindIp != ''"> and bind_ip = #{bindIp}</if>
|
|
||||||
<if test="newFlag != null "> and new_flag = #{newFlag}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectRmNetworkInterfaceById" parameterType="Long" resultMap="RmNetworkInterfaceResult">
|
|
||||||
<include refid="selectRmNetworkInterfaceVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertRmNetworkInterface" parameterType="RmNetworkInterface" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into rm_network_interface
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="clientId != null and clientId != ''">client_id,</if>
|
|
||||||
<if test="isp != null">isp,</if>
|
|
||||||
<if test="province != null">province,</if>
|
|
||||||
<if test="city != null">city,</if>
|
|
||||||
<if test="publicIp != null">public_ip,</if>
|
|
||||||
<if test="interfaceName != null and interfaceName != ''">interface_name,</if>
|
|
||||||
<if test="macAddress != null">mac_address,</if>
|
|
||||||
<if test="interfaceType != null">interface_type,</if>
|
|
||||||
<if test="ipv4Address != null">ipv4_address,</if>
|
|
||||||
<if test="gateway != null">gateway,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="bindIp != null">bind_ip,</if>
|
|
||||||
<if test="newFlag != null">new_flag,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
|
||||||
<if test="isp != null">#{isp},</if>
|
|
||||||
<if test="province != null">#{province},</if>
|
|
||||||
<if test="city != null">#{city},</if>
|
|
||||||
<if test="publicIp != null">#{publicIp},</if>
|
|
||||||
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
|
|
||||||
<if test="macAddress != null">#{macAddress},</if>
|
|
||||||
<if test="interfaceType != null">#{interfaceType},</if>
|
|
||||||
<if test="ipv4Address != null">#{ipv4Address},</if>
|
|
||||||
<if test="gateway != null">#{gateway},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="bindIp != null">#{bindIp},</if>
|
|
||||||
<if test="newFlag != null">#{newFlag},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateRmNetworkInterface" parameterType="RmNetworkInterface">
|
|
||||||
update rm_network_interface
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
|
||||||
<if test="isp != null">isp = #{isp},</if>
|
|
||||||
<if test="province != null">province = #{province},</if>
|
|
||||||
<if test="city != null">city = #{city},</if>
|
|
||||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
|
||||||
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
|
|
||||||
<if test="macAddress != null">mac_address = #{macAddress},</if>
|
|
||||||
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
|
|
||||||
<if test="ipv4Address != null">ipv4_address = #{ipv4Address},</if>
|
|
||||||
<if test="gateway != null">gateway = #{gateway},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="bindIp != null">bind_ip = #{bindIp},</if>
|
|
||||||
<if test="newFlag != null">new_flag = #{newFlag},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteRmNetworkInterfaceById" parameterType="Long">
|
|
||||||
delete from rm_network_interface where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteRmNetworkInterfaceByIds" parameterType="String">
|
|
||||||
delete from rm_network_interface where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
<update id="updateRmNetworkInterfaceByMac" parameterType="RmNetworkInterface">
|
|
||||||
update rm_network_interface
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="isp != null">isp = #{isp},</if>
|
|
||||||
<if test="province != null">province = #{province},</if>
|
|
||||||
<if test="city != null">city = #{city},</if>
|
|
||||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
|
||||||
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
|
|
||||||
<if test="macAddress != null">mac_address = #{macAddress},</if>
|
|
||||||
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
|
|
||||||
<if test="ipv4Address != null">ipv4_address = #{ipv4Address},</if>
|
|
||||||
<if test="gateway != null">gateway = #{gateway},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="bindIp != null">bind_ip = #{bindIp},</if>
|
|
||||||
<if test="newFlag != null">new_flag = #{newFlag},</if>
|
|
||||||
</trim>
|
|
||||||
where mac_address = #{macAddress} and clientId = #{clientId}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.ruoyi.system;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统模块
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableRyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class RuoYiSystemApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiSystemApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
package com.ruoyi.system.domain;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
import com.ruoyi.common.core.xss.Xss;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知公告表 sys_notice
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class SysNotice extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 公告ID */
|
|
||||||
private Long noticeId;
|
|
||||||
|
|
||||||
/** 公告标题 */
|
|
||||||
private String noticeTitle;
|
|
||||||
|
|
||||||
/** 公告类型(1通知 2公告) */
|
|
||||||
private String noticeType;
|
|
||||||
|
|
||||||
/** 公告内容 */
|
|
||||||
private String noticeContent;
|
|
||||||
|
|
||||||
/** 公告状态(0正常 1关闭) */
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
public Long getNoticeId()
|
|
||||||
{
|
|
||||||
return noticeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeId(Long noticeId)
|
|
||||||
{
|
|
||||||
this.noticeId = noticeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeTitle(String noticeTitle)
|
|
||||||
{
|
|
||||||
this.noticeTitle = noticeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Xss(message = "公告标题不能包含脚本字符")
|
|
||||||
@NotBlank(message = "公告标题不能为空")
|
|
||||||
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
|
||||||
public String getNoticeTitle()
|
|
||||||
{
|
|
||||||
return noticeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeType(String noticeType)
|
|
||||||
{
|
|
||||||
this.noticeType = noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeType()
|
|
||||||
{
|
|
||||||
return noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeContent(String noticeContent)
|
|
||||||
{
|
|
||||||
this.noticeContent = noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeContent()
|
|
||||||
{
|
|
||||||
return noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("noticeId", getNoticeId())
|
|
||||||
.append("noticeTitle", getNoticeTitle())
|
|
||||||
.append("noticeType", getNoticeType())
|
|
||||||
.append("noticeContent", getNoticeContent())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-372
@@ -1,372 +0,0 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.system.domain.*;
|
|
||||||
import com.ruoyi.system.mapper.*;
|
|
||||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
|
||||||
import com.ruoyi.system.service.IEpsServerRevenueConfigService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务器收益方式配置Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-19
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfigService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
|
||||||
@Autowired
|
|
||||||
private EpsInitialTrafficDataService epsInitialTrafficDataService;
|
|
||||||
@Autowired
|
|
||||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
|
||||||
@Autowired
|
|
||||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
|
||||||
@Autowired
|
|
||||||
private RmResourceRegistrationMapper rmResourceRegistrationMapper;
|
|
||||||
@Autowired
|
|
||||||
private EpsBusinessMapper epsBusinessMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询服务器收益方式配置
|
|
||||||
*
|
|
||||||
* @param id 服务器收益方式配置主键
|
|
||||||
* @return 服务器收益方式配置
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public EpsServerRevenueConfig selectEpsServerRevenueConfigById(Long id)
|
|
||||||
{
|
|
||||||
return epsServerRevenueConfigMapper.selectEpsServerRevenueConfigById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询服务器收益方式配置列表
|
|
||||||
*
|
|
||||||
* @param epsServerRevenueConfig 服务器收益方式配置
|
|
||||||
* @return 服务器收益方式配置
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<EpsServerRevenueConfig> selectEpsServerRevenueConfigList(EpsServerRevenueConfig epsServerRevenueConfig)
|
|
||||||
{
|
|
||||||
return epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增服务器收益方式配置
|
|
||||||
*
|
|
||||||
* @param epsServerRevenueConfig 服务器收益方式配置
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig)
|
|
||||||
{
|
|
||||||
epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(epsServerRevenueConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改服务器收益方式配置
|
|
||||||
*
|
|
||||||
* @param epsServerRevenueConfig 服务器收益方式配置
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig)
|
|
||||||
{
|
|
||||||
epsServerRevenueConfig.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
//原来的收益方式
|
|
||||||
EpsServerRevenueConfig serverRevenueConfig = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigById(epsServerRevenueConfig.getId());
|
|
||||||
String revenueMethod = getMethodName(serverRevenueConfig.getRevenueMethod());
|
|
||||||
//现在的收益方式
|
|
||||||
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
|
|
||||||
if(serverRevenueConfig.getBusinessCode() != null){
|
|
||||||
if(!serverRevenueConfig.getBusinessCode().equals(epsServerRevenueConfig.getBusinessCode())){
|
|
||||||
epsServerRevenueConfig.setChanged("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 修改条数
|
|
||||||
int rows = epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
|
|
||||||
if(rows>=0){
|
|
||||||
// 添加操作记录
|
|
||||||
addRecord(epsServerRevenueConfig);
|
|
||||||
// 添加包端数据到相关数据表
|
|
||||||
saveServiceTrafficData(epsServerRevenueConfig);
|
|
||||||
}
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 添加服务器配置操作记录
|
|
||||||
*/
|
|
||||||
private void addRecord(EpsServerRevenueConfig epsServerRevenueConfig) {
|
|
||||||
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
|
|
||||||
EpsMethodChangeRecord changeRecord = new EpsMethodChangeRecord();
|
|
||||||
// 设置基本信息
|
|
||||||
changeRecord.setNodeName(epsServerRevenueConfig.getNodeName());
|
|
||||||
changeRecord.setHardwareSn(epsServerRevenueConfig.getHardwareSn());
|
|
||||||
changeRecord.setCreateTime(DateUtils.getNowDate());
|
|
||||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
|
||||||
// 修改内容
|
|
||||||
String content = "";
|
|
||||||
if("流量".equals(nowRevenueMethod)){
|
|
||||||
// 修改内容
|
|
||||||
content = "收益方式变为【"+nowRevenueMethod+"】,流量网口设置为"+epsServerRevenueConfig.getTrafficPort()+
|
|
||||||
",业务为"+epsServerRevenueConfig.getBusinessName();
|
|
||||||
}
|
|
||||||
if("包端".equals(nowRevenueMethod)){
|
|
||||||
// 修改内容
|
|
||||||
content = "收益方式变为【"+nowRevenueMethod+"】,流量网口设置为"+epsServerRevenueConfig.getTrafficPort()+
|
|
||||||
",带宽值设置为"+epsServerRevenueConfig.getPackageBandwidth()+"Mbps,"+"业务为"+epsServerRevenueConfig.getBusinessName();
|
|
||||||
}
|
|
||||||
changeRecord.setChangeContent(content);
|
|
||||||
changeRecord.setBusinessCode(epsServerRevenueConfig.getBusinessCode());
|
|
||||||
changeRecord.setBusinessName(epsServerRevenueConfig.getBusinessName());
|
|
||||||
changeRecord.setRevenueMethod(epsServerRevenueConfig.getRevenueMethod());
|
|
||||||
changeRecord.setPackageBandwidth(epsServerRevenueConfig.getPackageBandwidth());
|
|
||||||
changeRecord.setTrafficPort(epsServerRevenueConfig.getTrafficPort());
|
|
||||||
// 添加操作记录
|
|
||||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存流量信息
|
|
||||||
* @param epsServerRevenueConfig
|
|
||||||
*/
|
|
||||||
private void saveServiceTrafficData(EpsServerRevenueConfig epsServerRevenueConfig) {
|
|
||||||
// 初始流量数据
|
|
||||||
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
|
|
||||||
epsInitialTrafficData.setServiceSn(epsServerRevenueConfig.getHardwareSn());
|
|
||||||
epsInitialTrafficData.setBusinessId(epsServerRevenueConfig.getBusinessCode());
|
|
||||||
epsInitialTrafficData.setBusinessName(epsServerRevenueConfig.getBusinessName());
|
|
||||||
epsInitialTrafficData.setName(epsServerRevenueConfig.getTrafficPort());
|
|
||||||
epsInitialTrafficData.setPackageBandwidth(epsServerRevenueConfig.getPackageBandwidth());
|
|
||||||
epsInitialTrafficData.setRevenueMethod(epsServerRevenueConfig.getRevenueMethod());
|
|
||||||
epsInitialTrafficData.setNodeName(epsServerRevenueConfig.getNodeName());
|
|
||||||
epsInitialTrafficData.setStartTime(epsServerRevenueConfig.getCreateTime() + "");
|
|
||||||
epsInitialTrafficData.setEndTime(epsServerRevenueConfig.getCreateTime() + "");
|
|
||||||
epsInitialTrafficDataService.save(epsInitialTrafficData);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存流量信息
|
|
||||||
* @param epsServerRevenueConfig
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public R<String> autoSaveServiceTrafficData(EpsServerRevenueConfig epsServerRevenueConfig) {
|
|
||||||
// 查询初始流量数据
|
|
||||||
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
|
|
||||||
epsInitialTrafficData.setStartTime(epsServerRevenueConfig.getStartTime());
|
|
||||||
epsInitialTrafficData.setEndTime(epsServerRevenueConfig.getEndTime());
|
|
||||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getAllTraficMsg(epsInitialTrafficData);
|
|
||||||
List<EpsInitialTrafficData> batchList = new ArrayList<>();
|
|
||||||
for (EpsInitialTrafficData initialTrafficData : dataList) {
|
|
||||||
// 根据clientId查询业务名称
|
|
||||||
RmResourceRegistration rmResourceRegistration = new RmResourceRegistration();
|
|
||||||
rmResourceRegistration.setClientId(initialTrafficData.getClientId());
|
|
||||||
List<RmResourceRegistration> registerLst = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
|
|
||||||
if(registerLst != null && !registerLst.isEmpty()){
|
|
||||||
RmResourceRegistration registerMsg = registerLst.get(0);
|
|
||||||
// 赋值
|
|
||||||
if(registerMsg != null){
|
|
||||||
String businessName = registerMsg.getBusinessName();
|
|
||||||
if(businessName != null){
|
|
||||||
initialTrafficData.setBusinessName(businessName);
|
|
||||||
// 根据业务名称查询业务代码
|
|
||||||
EpsBusiness epsBusiness = epsBusinessMapper.selectEpsBusinessByName(businessName);
|
|
||||||
if(epsBusiness != null){
|
|
||||||
initialTrafficData.setBusinessId(epsBusiness.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
initialTrafficData.setServiceSn(registerMsg.getHardwareSn());
|
|
||||||
initialTrafficData.setRevenueMethod("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// id自增
|
|
||||||
initialTrafficData.setId(null);
|
|
||||||
batchList.add(initialTrafficData);
|
|
||||||
}
|
|
||||||
epsInitialTrafficData.setDataList(batchList);
|
|
||||||
// 流量相关数据入库
|
|
||||||
try {
|
|
||||||
epsInitialTrafficDataService.saveBatch(epsInitialTrafficData);
|
|
||||||
log.info("流量数据批量入库成功,数据量:{}", batchList.size());
|
|
||||||
// 接口名称保存
|
|
||||||
processInterfaceNames(batchList);
|
|
||||||
return R.ok("数据保存成功");
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("流量数据入库失败,数据量:{},错误原因:{}",
|
|
||||||
batchList.size(), e.getMessage(), e);
|
|
||||||
return R.fail("数据保存失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 当前在线服务器的流量相关的业务数
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Integer countBusinessByTraffic() {
|
|
||||||
return epsServerRevenueConfigMapper.countBusinessByTraffic();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 当日业务的在线设备数量统计TOP5
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map> countDeviceNumTop5() {
|
|
||||||
return epsServerRevenueConfigMapper.countDeviceNumTop5();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getNullableString(Map<String, Object> map, String key) {
|
|
||||||
Object value = map.get(key);
|
|
||||||
return value != null ? value.toString() : null;
|
|
||||||
}
|
|
||||||
private String getCompositeKey(String clientId, String interfaceName) {
|
|
||||||
return clientId + "|" + interfaceName;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量处理接口名称
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.REPEATABLE_READ)
|
|
||||||
public void processInterfaceNames(List<EpsInitialTrafficData> trafficDataList) {
|
|
||||||
// 分类处理:新增列表 vs 更新列表
|
|
||||||
List<AllInterfaceName> namesToInsert = new ArrayList<>();
|
|
||||||
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
|
|
||||||
|
|
||||||
// 用于去重的临时集合,防止同一批数据中的重复
|
|
||||||
Set<String> processedKeys = new HashSet<>();
|
|
||||||
|
|
||||||
trafficDataList.forEach(data -> {
|
|
||||||
String name = data.getName();
|
|
||||||
String ip = data.getMac();
|
|
||||||
String clientId = data.getClientId();
|
|
||||||
if (StringUtils.isBlank(name) || StringUtils.isBlank(ip) || StringUtils.isBlank(clientId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成唯一键,防止同一批数据中的重复处理
|
|
||||||
String uniqueKey = name + "|" + clientId + "|" + ip;
|
|
||||||
if (processedKeys.contains(uniqueKey)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
processedKeys.add(uniqueKey);
|
|
||||||
|
|
||||||
// 构造新记录
|
|
||||||
AllInterfaceName newRecord = new AllInterfaceName();
|
|
||||||
newRecord.setInterfaceName(name);
|
|
||||||
newRecord.setClientId(data.getClientId());
|
|
||||||
newRecord.setResourceType("1");
|
|
||||||
newRecord.setDeviceSn(data.getServiceSn());
|
|
||||||
newRecord.setNodeName(data.getNodeName());
|
|
||||||
newRecord.setBusinessCode(data.getBusinessId());
|
|
||||||
newRecord.setBusinessName(data.getBusinessName());
|
|
||||||
newRecord.setServerIp(data.getMac());
|
|
||||||
|
|
||||||
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(newRecord);
|
|
||||||
|
|
||||||
if (!existingNames.isEmpty()) {
|
|
||||||
for (AllInterfaceName existingName : existingNames) {
|
|
||||||
if (isRecordChanged(existingName, newRecord)) {
|
|
||||||
newRecord.setId(existingName.getId());
|
|
||||||
newRecord.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
|
|
||||||
// 检查是否已经存在于更新列表中
|
|
||||||
boolean alreadyInUpdateList = namesToUpdate.stream()
|
|
||||||
.anyMatch(item -> item.getId() != null && item.getId().equals(existingName.getId()));
|
|
||||||
if (!alreadyInUpdateList) {
|
|
||||||
namesToUpdate.add(newRecord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newRecord.setCreateTime(DateUtils.getNowDate());
|
|
||||||
newRecord.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
|
|
||||||
// 检查namesToInsert中是否已有相同记录
|
|
||||||
boolean alreadyInInsertList = namesToInsert.stream()
|
|
||||||
.anyMatch(item -> item.getInterfaceName().equals(name)
|
|
||||||
&& item.getClientId().equals(clientId)
|
|
||||||
&& item.getServerIp().equals(ip));
|
|
||||||
|
|
||||||
if (!alreadyInInsertList) {
|
|
||||||
namesToInsert.add(newRecord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 批量操作数据库
|
|
||||||
if (!namesToInsert.isEmpty()) {
|
|
||||||
try {
|
|
||||||
allInterfaceNameMapper.batchInsert(namesToInsert);
|
|
||||||
log.info("新增接口名称数量:{}", namesToInsert.size());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("新增接口名称失败:{}", e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!namesToUpdate.isEmpty()) {
|
|
||||||
namesToUpdate.sort(Comparator.comparing(AllInterfaceName::getId));
|
|
||||||
allInterfaceNameMapper.batchUpdate(namesToUpdate);
|
|
||||||
log.info("更新接口名称数量:{}", namesToUpdate.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 辅助方法:检查记录是否有变化
|
|
||||||
private boolean isRecordChanged(AllInterfaceName oldRecord, AllInterfaceName newRecord) {
|
|
||||||
return !Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) ||
|
|
||||||
!Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) ||
|
|
||||||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
|
|
||||||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
|
|
||||||
!Objects.equals(oldRecord.getServerIp(), newRecord.getServerIp());
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除服务器收益方式配置
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的服务器收益方式配置主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteEpsServerRevenueConfigByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return epsServerRevenueConfigMapper.deleteEpsServerRevenueConfigByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除服务器收益方式配置信息
|
|
||||||
*
|
|
||||||
* @param id 服务器收益方式配置主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteEpsServerRevenueConfigById(Long id)
|
|
||||||
{
|
|
||||||
return epsServerRevenueConfigMapper.deleteEpsServerRevenueConfigById(id);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 把收益方式转化为文字
|
|
||||||
* @param method
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getMethodName(String method){
|
|
||||||
String revenueMethod = "";
|
|
||||||
if("1".equals(method)){
|
|
||||||
revenueMethod = "流量";
|
|
||||||
}
|
|
||||||
if("2".equals(method)){
|
|
||||||
revenueMethod = "包端";
|
|
||||||
}
|
|
||||||
return revenueMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-830
@@ -1,830 +0,0 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.enums.MsgEnum;
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.web.page.PageDomain;
|
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
|
||||||
import com.ruoyi.system.api.domain.*;
|
|
||||||
import com.ruoyi.system.domain.*;
|
|
||||||
import com.ruoyi.system.domain.vo.MessageVo;
|
|
||||||
import com.ruoyi.system.domain.vo.ResourceVo;
|
|
||||||
import com.ruoyi.system.domain.vo.RspVo;
|
|
||||||
import com.ruoyi.system.mapper.*;
|
|
||||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.core.utils.PageUtils.startPage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资源注册Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-12
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class RmResourceRegistrationServiceImpl implements IRmResourceRegistrationService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private RmResourceRegistrationMapper rmResourceRegistrationMapper;
|
|
||||||
@Autowired
|
|
||||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
|
||||||
@Autowired
|
|
||||||
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
|
|
||||||
@Autowired
|
|
||||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
|
||||||
@Autowired
|
|
||||||
private RemoteRocketMqService remoteRocketMqService;
|
|
||||||
@Autowired
|
|
||||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
|
||||||
@Autowired
|
|
||||||
private RmRegistrationMachineMapper rmRegistrationMachineMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询资源注册
|
|
||||||
*
|
|
||||||
* @param id 资源注册主键
|
|
||||||
* @return 资源注册
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public RmResourceRegistration selectRmResourceRegistrationById(Long id)
|
|
||||||
{
|
|
||||||
RmResourceRegistration rmResourceRegistration = rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
|
|
||||||
if(rmResourceRegistration.getClientId()!= null){
|
|
||||||
// set网卡信息
|
|
||||||
setNetWorkMsg(rmResourceRegistration);
|
|
||||||
// set金山machineCode
|
|
||||||
setMachineMsg(rmResourceRegistration);
|
|
||||||
}
|
|
||||||
return rmResourceRegistration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询资源注册列表
|
|
||||||
*
|
|
||||||
* @param rmResourceRegistration 资源注册
|
|
||||||
* @return 资源注册
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getRegistrationTableInfoList(RmResourceRegistration rmResourceRegistration)
|
|
||||||
{
|
|
||||||
Map<String, Object> resultMap = new HashMap();
|
|
||||||
if(rmResourceRegistration.getQueryParam() == null || rmResourceRegistration.getQueryParam() == ""){
|
|
||||||
PageDomain pageDomain = new PageDomain();
|
|
||||||
pageDomain.setPageNum(rmResourceRegistration.getPageNum());
|
|
||||||
pageDomain.setPageSize(rmResourceRegistration.getPageSize());
|
|
||||||
startPage(pageDomain);
|
|
||||||
}
|
|
||||||
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.getRegistrationTableInfoList(rmResourceRegistration);
|
|
||||||
for (RmResourceRegistration resourceRegistration : rmResourceRegistrationList) {
|
|
||||||
if(resourceRegistration.getClientId() != null){
|
|
||||||
// 网卡信息
|
|
||||||
setNetWorkMsg(resourceRegistration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(rmResourceRegistration.getQueryParam() != null && !rmResourceRegistration.getQueryParam().trim().isEmpty()){
|
|
||||||
String queryValue = rmResourceRegistration.getQueryParam().trim().toLowerCase(); // 转为小写便于模糊匹配
|
|
||||||
|
|
||||||
// 从rmResourceRegistrationList列表中筛选符合条件的数据
|
|
||||||
List<RmResourceRegistration> filteredList = rmResourceRegistrationList.stream()
|
|
||||||
.filter(item -> item != null)
|
|
||||||
.filter(item -> {
|
|
||||||
// 如果查询值为空,返回所有数据
|
|
||||||
if (queryValue.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查公网IP (IP1-3和管理网)
|
|
||||||
return (item.getIp1PublicIp() != null && item.getIp1PublicIp().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getIp2PublicIp() != null && item.getIp2PublicIp().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getIp3PublicIp() != null && item.getIp3PublicIp().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getMgmtPublicIp() != null && item.getMgmtPublicIp().toLowerCase().contains(queryValue)) ||
|
|
||||||
|
|
||||||
// 检查私网IP (IP1-3和管理网)
|
|
||||||
(item.getIp1Ipv4Address() != null && item.getIp1Ipv4Address().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getIp2Ipv4Address() != null && item.getIp2Ipv4Address().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getIp3Ipv4Address() != null && item.getIp3Ipv4Address().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getMgmtIpv4Address() != null && item.getMgmtIpv4Address().toLowerCase().contains(queryValue)) ||
|
|
||||||
|
|
||||||
// 检查设备SN
|
|
||||||
(item.getHardwareSn() != null && item.getHardwareSn().toLowerCase().contains(queryValue)) ||
|
|
||||||
(item.getClientId() != null && item.getClientId().toLowerCase().contains(queryValue));
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<RmResourceRegistration> pageInfo = applyPagination(filteredList, rmResourceRegistration.getPageNum(), rmResourceRegistration.getPageSize());
|
|
||||||
resultMap.put("list", pageInfo);
|
|
||||||
resultMap.put("total", filteredList.size());
|
|
||||||
return resultMap;
|
|
||||||
} else {
|
|
||||||
resultMap.put("list", rmResourceRegistrationList);
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询资源注册列表
|
|
||||||
*
|
|
||||||
* @param rmResourceRegistration 资源注册
|
|
||||||
* @return 资源注册
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration)
|
|
||||||
{
|
|
||||||
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.getRegistrationTableInfoList(rmResourceRegistration);
|
|
||||||
for (RmResourceRegistration resourceRegistration : rmResourceRegistrationList) {
|
|
||||||
if(resourceRegistration.getClientId() != null){
|
|
||||||
// 网卡信息
|
|
||||||
setNetWorkMsg(resourceRegistration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(rmResourceRegistration.getQueryParam() != null){
|
|
||||||
String queryValue = rmResourceRegistration.getQueryParam().trim();
|
|
||||||
// 筛选公网IP私网IP设备SN相等的数据
|
|
||||||
// 从rmResourceRegistrationList列表中筛选符合条件的数据
|
|
||||||
List<RmResourceRegistration> filteredList = rmResourceRegistrationList.stream()
|
|
||||||
.filter(item -> item != null)
|
|
||||||
.filter(item ->
|
|
||||||
// 检查公网IP (IP1-3和管理网)
|
|
||||||
queryValue.equals(item.getIp1PublicIp()) ||
|
|
||||||
queryValue.equals(item.getIp2PublicIp()) ||
|
|
||||||
queryValue.equals(item.getIp3PublicIp()) ||
|
|
||||||
queryValue.equals(item.getMgmtPublicIp()) ||
|
|
||||||
|
|
||||||
// 检查私网IP (IP1-3和管理网)
|
|
||||||
queryValue.equals(item.getIp1Ipv4Address()) ||
|
|
||||||
queryValue.equals(item.getIp2Ipv4Address()) ||
|
|
||||||
queryValue.equals(item.getIp3Ipv4Address()) ||
|
|
||||||
queryValue.equals(item.getMgmtIpv4Address()) ||
|
|
||||||
|
|
||||||
// 检查设备SN
|
|
||||||
queryValue.equals(item.getHardwareSn()) ||
|
|
||||||
queryValue.equals(item.getClientId())
|
|
||||||
)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return filteredList;
|
|
||||||
}
|
|
||||||
return rmResourceRegistrationList;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 内存分页
|
|
||||||
*/
|
|
||||||
private List<RmResourceRegistration> applyPagination(List<RmResourceRegistration> list, int pageNum, int pageSize) {
|
|
||||||
if (list == null || list.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
int fromIndex = (pageNum - 1) * pageSize;
|
|
||||||
if (fromIndex >= list.size()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
int toIndex = Math.min(fromIndex + pageSize, list.size());
|
|
||||||
return list.subList(fromIndex, toIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网卡信息赋值
|
|
||||||
* @param registration
|
|
||||||
*/
|
|
||||||
public void setNetWorkMsg(RmResourceRegistration registration) {
|
|
||||||
String clientId = registration.getClientId();
|
|
||||||
// 根据clientId查询网卡信息
|
|
||||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
|
||||||
queryParam.setClientId(clientId);
|
|
||||||
queryParam.setNewFlag(1);
|
|
||||||
// 安全获取网络接口列表
|
|
||||||
R<List<RmNetworkInterfaceRemote>> result = remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER);
|
|
||||||
// 多层安全判断
|
|
||||||
if (result == null || result.getData() == null) {
|
|
||||||
log.warn("获取网络接口列表为空,clientId: {}", clientId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<RmNetworkInterfaceRemote> networkList = result.getData();
|
|
||||||
|
|
||||||
if (networkList == null || networkList.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化业务IP计数器
|
|
||||||
int businessIpCount = 1;
|
|
||||||
|
|
||||||
for (RmNetworkInterfaceRemote network : networkList) {
|
|
||||||
if ("1".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
|
||||||
// 业务IP处理
|
|
||||||
if (businessIpCount > 3) {
|
|
||||||
continue; // 最多只处理3个业务IP
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置业务IP字段
|
|
||||||
switch (businessIpCount) {
|
|
||||||
case 1:
|
|
||||||
registration.setIp1Isp(network.getIsp());
|
|
||||||
registration.setIp1Province(network.getProvince());
|
|
||||||
registration.setIp1City(network.getCity());
|
|
||||||
registration.setIp1PublicIp(network.getPublicIp());
|
|
||||||
registration.setIp1InterfaceName(network.getInterfaceName());
|
|
||||||
registration.setIp1MacAddress(network.getMacAddress());
|
|
||||||
registration.setIp1InterfaceType(network.getInterfaceType());
|
|
||||||
registration.setIp1Ipv4Address(network.getIpv4Address());
|
|
||||||
registration.setIp1Gateway(network.getGateway());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
registration.setIp2Isp(network.getIsp());
|
|
||||||
registration.setIp2Province(network.getProvince());
|
|
||||||
registration.setIp2City(network.getCity());
|
|
||||||
registration.setIp2PublicIp(network.getPublicIp());
|
|
||||||
registration.setIp2InterfaceName(network.getInterfaceName());
|
|
||||||
registration.setIp2MacAddress(network.getMacAddress());
|
|
||||||
registration.setIp2InterfaceType(network.getInterfaceType());
|
|
||||||
registration.setIp2Ipv4Address(network.getIpv4Address());
|
|
||||||
registration.setIp2Gateway(network.getGateway());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
registration.setIp3Isp(network.getIsp());
|
|
||||||
registration.setIp3Province(network.getProvince());
|
|
||||||
registration.setIp3City(network.getCity());
|
|
||||||
registration.setIp3PublicIp(network.getPublicIp());
|
|
||||||
registration.setIp3InterfaceName(network.getInterfaceName());
|
|
||||||
registration.setIp3MacAddress(network.getMacAddress());
|
|
||||||
registration.setIp3InterfaceType(network.getInterfaceType());
|
|
||||||
registration.setIp3Ipv4Address(network.getIpv4Address());
|
|
||||||
registration.setIp3Gateway(network.getGateway());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
businessIpCount++;
|
|
||||||
}
|
|
||||||
if ("2".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
|
||||||
// 管理网IP处理
|
|
||||||
registration.setMgmtIsp(network.getIsp());
|
|
||||||
registration.setMgmtProvince(network.getProvince());
|
|
||||||
registration.setMgmtCity(network.getCity());
|
|
||||||
registration.setMgmtPublicIp(network.getPublicIp());
|
|
||||||
registration.setMgmtInterfaceName(network.getInterfaceName());
|
|
||||||
registration.setMgmtMacAddress(network.getMacAddress());
|
|
||||||
registration.setMgmtInterfaceType(network.getInterfaceType());
|
|
||||||
registration.setMgmtIpv4Address(network.getIpv4Address());
|
|
||||||
registration.setMgmtGateway(network.getGateway());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置金山machineCode
|
|
||||||
* @param registration
|
|
||||||
*/
|
|
||||||
public void setMachineMsg(RmResourceRegistration registration){
|
|
||||||
// 设置金山machineCode
|
|
||||||
RmRegistrationMachine rmRegistrationMachine = new RmRegistrationMachine();
|
|
||||||
rmRegistrationMachine.setClientId(registration.getClientId());
|
|
||||||
List<RmRegistrationMachine> machineList = rmRegistrationMachineMapper.selectRmRegistrationMachineList(rmRegistrationMachine);
|
|
||||||
if(!machineList.isEmpty()){
|
|
||||||
RmRegistrationMachine machineMsg = machineList.get(0);
|
|
||||||
registration.setMachineCode(machineMsg.getMachineCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 新增资源注册
|
|
||||||
*
|
|
||||||
* @param rmResourceRegistration 资源注册
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertRmResourceRegistration(RmResourceRegistration rmResourceRegistration)
|
|
||||||
{
|
|
||||||
rmResourceRegistration.setCreatorId(SecurityUtils.getUserId());
|
|
||||||
rmResourceRegistration.setCreatorName(SecurityUtils.getUsername());
|
|
||||||
rmResourceRegistration.setCreateTime(DateUtils.getNowDate());
|
|
||||||
// 查询此硬件sn是否已存在
|
|
||||||
int exits = rmResourceRegistrationMapper.countBySn(rmResourceRegistration.getHardwareSn());
|
|
||||||
if(exits>0){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return rmResourceRegistrationMapper.insertRmResourceRegistration(rmResourceRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改资源注册
|
|
||||||
*
|
|
||||||
* @param rmResourceRegistration 资源注册
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration)
|
|
||||||
{
|
|
||||||
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
|
|
||||||
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
|
|
||||||
// 拿到需要修改的id
|
|
||||||
Long id = rmResourceRegistration.getId();
|
|
||||||
// 根据id查询sn信息
|
|
||||||
RmResourceRegistration resourceRegistration = rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
|
|
||||||
String hardwareSn = resourceRegistration.getHardwareSn();
|
|
||||||
String newResourceName = rmResourceRegistration.getResourceName();
|
|
||||||
|
|
||||||
// 如果资源名称有修改,同步修改其他表的资源名称
|
|
||||||
if (!resourceRegistration.getResourceName().equals(newResourceName)) {
|
|
||||||
// 公共的更新对象创建
|
|
||||||
RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement();
|
|
||||||
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
|
|
||||||
|
|
||||||
switch (resourceRegistration.getResourceType()) {
|
|
||||||
case "1": // 服务器类型
|
|
||||||
// 更新拓扑管理配置
|
|
||||||
rmEpsTopologyManagement.setServerSn(hardwareSn);
|
|
||||||
rmEpsTopologyManagement.setServerName(newResourceName);
|
|
||||||
rmEpsTopologyManagementMapper.updateRmEpsTopologyManagementByServerSn(rmEpsTopologyManagement);
|
|
||||||
|
|
||||||
// 更新服务器收益配置表
|
|
||||||
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
|
|
||||||
epsServerRevenueConfig.setHardwareSn(hardwareSn);
|
|
||||||
epsServerRevenueConfig.setNodeName(newResourceName);
|
|
||||||
epsServerRevenueConfigMapper.updateEpsServerRevenueConfigByServerSn(epsServerRevenueConfig);
|
|
||||||
|
|
||||||
// 更新95收益信息表
|
|
||||||
epsNodeBandwidth.setHardwareSn(hardwareSn);
|
|
||||||
epsNodeBandwidth.setNodeName(newResourceName);
|
|
||||||
epsNodeBandwidthMapper.updateEpsNodeBandwidthByServerSn(epsNodeBandwidth);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "2": // 交换机类型
|
|
||||||
// 更新拓扑管理配置
|
|
||||||
rmEpsTopologyManagement.setSwitchSn(hardwareSn);
|
|
||||||
rmEpsTopologyManagement.setSwitchName(newResourceName);
|
|
||||||
rmEpsTopologyManagementMapper.updateRmEpsTopologyManagementBySwitchSn(rmEpsTopologyManagement);
|
|
||||||
|
|
||||||
// 更新95收益信息表
|
|
||||||
epsNodeBandwidth.setSwitchSn(hardwareSn);
|
|
||||||
epsNodeBandwidth.setUplinkSwitch(newResourceName);
|
|
||||||
epsNodeBandwidthMapper.updateEpsNodeBandwidthBySwitchSn(epsNodeBandwidth);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 禁止修改sn序列号
|
|
||||||
rmResourceRegistration.setHardwareSn(null);
|
|
||||||
// 已注册状态修改--仅可修改资源名称,描述
|
|
||||||
if ("1".equals(rmResourceRegistration.getRegistrationStatus())){
|
|
||||||
// 拿到需要修改的资源名称
|
|
||||||
String resourceName = rmResourceRegistration.getResourceName();
|
|
||||||
// 拿到需要修改的描述
|
|
||||||
String description = rmResourceRegistration.getDescription();
|
|
||||||
// 初始化
|
|
||||||
rmResourceRegistration = new RmResourceRegistration();
|
|
||||||
// id赋值
|
|
||||||
rmResourceRegistration.setId(id);
|
|
||||||
// 可修改资源名称
|
|
||||||
rmResourceRegistration.setResourceName(resourceName);
|
|
||||||
// 可修改描述
|
|
||||||
rmResourceRegistration.setDescription(description);
|
|
||||||
|
|
||||||
}
|
|
||||||
return rmResourceRegistrationMapper.updateRmResourceRegistration(rmResourceRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资源注册-注册
|
|
||||||
*
|
|
||||||
* @param rmResourceRegistration 资源注册
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int register(RmResourceRegistration rmResourceRegistration) {
|
|
||||||
// 设置更新信息
|
|
||||||
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
|
|
||||||
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
// 处理服务器资源注册
|
|
||||||
if ("1".equals(rmResourceRegistration.getResourceType())) {
|
|
||||||
handleServerRegistration(rmResourceRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送消息通知
|
|
||||||
sendRegistrationMessage(rmResourceRegistration);
|
|
||||||
// 更新注册状态
|
|
||||||
return updateRegistrationStatus(rmResourceRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理服务器资源注册
|
|
||||||
*/
|
|
||||||
private void handleServerRegistration(RmResourceRegistration registration) {
|
|
||||||
EpsServerRevenueConfig config = new EpsServerRevenueConfig();
|
|
||||||
config.setHardwareSn(registration.getHardwareSn());
|
|
||||||
config.setNodeName(registration.getResourceName());
|
|
||||||
config.setCreateTime(DateUtils.getNowDate());
|
|
||||||
config.setRegistrationStatus(registration.getRegistrationStatus());
|
|
||||||
config.setServerIp(registration.getIpAddress());
|
|
||||||
|
|
||||||
EpsServerRevenueConfig existing = epsServerRevenueConfigMapper.countBySn(config.getHardwareSn());
|
|
||||||
if (existing != null) {
|
|
||||||
config.setId(existing.getId());
|
|
||||||
epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(config);
|
|
||||||
} else {
|
|
||||||
epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送注册/断开连接消息
|
|
||||||
*/
|
|
||||||
private void sendRegistrationMessage(RmResourceRegistration registration) {
|
|
||||||
String messageType = "1".equals(registration.getRegistrationStatus()) ? MsgEnum.注册.getValue() : MsgEnum.断开.getValue();
|
|
||||||
ResourceVo resourceVo = createResourceVo(registration);
|
|
||||||
MessageVo messageVo = new MessageVo();
|
|
||||||
messageVo.setClientId(registration.getHardwareSn());
|
|
||||||
messageVo.setDataType(messageType);
|
|
||||||
messageVo.setData(JSONObject.toJSONString(resourceVo));
|
|
||||||
|
|
||||||
remoteRocketMqService.sendAsyncProducerMessage(
|
|
||||||
"tongran_agent_down", "", "", JSONObject.toJSONString(messageVo), SecurityConstants.INNER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建资源VO对象
|
|
||||||
*/
|
|
||||||
private ResourceVo createResourceVo(RmResourceRegistration registration) {
|
|
||||||
ResourceVo resourceVo = new ResourceVo();
|
|
||||||
resourceVo.setClientIp(registration.getIpAddress());
|
|
||||||
resourceVo.setClientPort(Integer.valueOf(registration.getResourcePort()));
|
|
||||||
|
|
||||||
if (!"1".equals(registration.getResourceType())) {
|
|
||||||
if("1".equals(registration.getSnmpDetect())){
|
|
||||||
Map<String, String> switchMap = new HashMap<>();
|
|
||||||
switchMap.put("community", registration.getTeamName());
|
|
||||||
switchMap.put("ip", registration.getSnmpCollectAddr());
|
|
||||||
switchMap.put("port", registration.getSnmpCollectPort());
|
|
||||||
resourceVo.setSwitchBoard(JSONObject.toJSONString(switchMap));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resourceVo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新注册状态
|
|
||||||
*/
|
|
||||||
private int updateRegistrationStatus(RmResourceRegistration registration) {
|
|
||||||
RmResourceRegistration updateParam = new RmResourceRegistration();
|
|
||||||
updateParam.setId(registration.getId());
|
|
||||||
updateParam.setRegistrationStatus(registration.getRegistrationStatus());
|
|
||||||
return rmResourceRegistrationMapper.updateRmResourceRegistration(updateParam);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除资源注册
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的资源注册主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteRmResourceRegistrationByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return rmResourceRegistrationMapper.deleteRmResourceRegistrationByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除资源注册信息
|
|
||||||
*
|
|
||||||
* @param id 资源注册主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteRmResourceRegistrationById(Long id)
|
|
||||||
{
|
|
||||||
return rmResourceRegistrationMapper.deleteRmResourceRegistrationById(id);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public List<Map> selectAllResourceName()
|
|
||||||
{
|
|
||||||
return rmResourceRegistrationMapper.selectAllResourceName();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration)
|
|
||||||
{
|
|
||||||
return rmResourceRegistrationMapper.selectAllResourceNameByType(resourceRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测到服务器离线,修改状态为离线
|
|
||||||
* @param rmResourceRegistration
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public R<String> updateStatusByResource(RmResourceRegistration rmResourceRegistration) {
|
|
||||||
rmResourceRegistrationMapper.updateStatusByResource(rmResourceRegistration);
|
|
||||||
return R.ok("状态修改成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务器在线率
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public AjaxResult getServerOnlineRate() {
|
|
||||||
// 查询所有符合条件的资源
|
|
||||||
RmResourceRegistration queryParam = new RmResourceRegistration();
|
|
||||||
queryParam.setResourceType("1");
|
|
||||||
List<RmResourceRegistration> resourceList = rmResourceRegistrationMapper.selectRmResourceRegistrationList(queryParam);
|
|
||||||
|
|
||||||
// 计算在线数量和总数
|
|
||||||
int totalCount = resourceList.size();
|
|
||||||
if (totalCount == 0) {
|
|
||||||
return AjaxResult.error("没有找到符合条件的资源");
|
|
||||||
}
|
|
||||||
|
|
||||||
int onlineCount = (int) resourceList.stream()
|
|
||||||
.filter(resource -> "1".equals(resource.getOnlineStatus()))
|
|
||||||
.count();
|
|
||||||
int offlineCount = (int) resourceList.stream()
|
|
||||||
.filter(resource -> "0".equals(resource.getOnlineStatus()))
|
|
||||||
.count();
|
|
||||||
|
|
||||||
// 计算在线率
|
|
||||||
BigDecimal onlineRate = BigDecimal.valueOf(onlineCount)
|
|
||||||
.divide(BigDecimal.valueOf(totalCount), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
||||||
|
|
||||||
// 返回结果
|
|
||||||
return AjaxResult.success()
|
|
||||||
.put("onlineCount", onlineCount)
|
|
||||||
.put("offlineCount", offlineCount)
|
|
||||||
.put("total", totalCount)
|
|
||||||
.put("onlineRate", onlineRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询资源注册信息
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<RmResourceRegistration> getRegistrationByIds(String[] ids) {
|
|
||||||
return rmResourceRegistrationMapper.getRegistrationByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自动注册
|
|
||||||
* @param registerMsg
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int innerAddRegist(RmRegisterMsgRemote registerMsg) {
|
|
||||||
if(registerMsg.getClientId() == null) {
|
|
||||||
log.error("注册失败:clientId为null");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// 解析mq接收的消息
|
|
||||||
// 时间戳转换
|
|
||||||
long timestamp = registerMsg.getTimestamp();
|
|
||||||
long millis = timestamp * 1000;
|
|
||||||
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
|
||||||
String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", createTime);
|
|
||||||
List<NetworkInfo> networkInfoList = registerMsg.getNetworkInfo();
|
|
||||||
if(!networkInfoList.isEmpty()){
|
|
||||||
// 查询此数据是否存在
|
|
||||||
RmResourceRegistration queryParam = new RmResourceRegistration();
|
|
||||||
queryParam.setClientId(registerMsg.getClientId());
|
|
||||||
RmResourceRegistration exits = rmResourceRegistrationMapper.selectRegistMsgByClientId(queryParam);
|
|
||||||
if(exits == null){
|
|
||||||
// 构建服务器信息
|
|
||||||
RmResourceRegistration insertData = new RmResourceRegistration();
|
|
||||||
try {
|
|
||||||
// 如果网卡信息只有1条,自动绑定多公网IP
|
|
||||||
if(networkInfoList.size()==1){
|
|
||||||
NetworkInfo networkInfo = networkInfoList.get(0);
|
|
||||||
insertData.setClientId(registerMsg.getClientId());
|
|
||||||
insertData.setHardwareSn(registerMsg.getSn());
|
|
||||||
insertData.setRegistrationStatus("1");
|
|
||||||
insertData.setMultiPublicIpStatus("1");
|
|
||||||
insertData.setHeartbeatCount(3);
|
|
||||||
insertData.setHeartbeatInterval(30);
|
|
||||||
insertData.setResourceType("1");
|
|
||||||
insertData.setCreateTime(createTime);
|
|
||||||
rmResourceRegistrationMapper.insertRmResourceRegistration(insertData);
|
|
||||||
// 添加业务变更记录
|
|
||||||
EpsMethodChangeRecord recordAddData = new EpsMethodChangeRecord();
|
|
||||||
recordAddData.setClientId(registerMsg.getClientId());
|
|
||||||
recordAddData.setTrafficPort(networkInfo.getName());
|
|
||||||
recordAddData.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
recordAddData.setCreateTime(DateUtils.getNowDate());
|
|
||||||
recordAddData.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
recordAddData.setCreatBy(SecurityUtils.getUsername());
|
|
||||||
StringBuilder content = new StringBuilder();
|
|
||||||
content.append("流量网口设置为").append(networkInfo.getName());
|
|
||||||
recordAddData.setChangeContent(content.toString());
|
|
||||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(recordAddData);
|
|
||||||
// 设置路由信息
|
|
||||||
RouteMsg routeMsg = new RouteMsg();
|
|
||||||
routeMsg.setName(networkInfo.getName());
|
|
||||||
routeMsg.setGateway(networkInfo.getGateway());
|
|
||||||
// 构建注册应答信息
|
|
||||||
MessageVo messageVo = new MessageVo();
|
|
||||||
messageVo.setClientId(registerMsg.getClientId());
|
|
||||||
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
|
||||||
RspVo rspVo = new RspVo();
|
|
||||||
rspVo.setResCode(1);
|
|
||||||
rspVo.setResMag("注册成功");
|
|
||||||
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
|
||||||
messageVo.setData(JSONObject.toJSONString(rspVo));
|
|
||||||
remoteRocketMqService.sendAsyncProducerMessage(
|
|
||||||
"tr_agent_down", "", "regist_rsp", JSONObject.toJSONString(messageVo), SecurityConstants.INNER
|
|
||||||
);
|
|
||||||
// 第一次注册
|
|
||||||
return 2;
|
|
||||||
}else{
|
|
||||||
insertData.setClientId(registerMsg.getClientId());
|
|
||||||
insertData.setHardwareSn(registerMsg.getSn());
|
|
||||||
insertData.setRegistrationStatus("0");
|
|
||||||
insertData.setMultiPublicIpStatus("0");
|
|
||||||
insertData.setResourceType("1");
|
|
||||||
insertData.setCreateTime(createTime);
|
|
||||||
insertData.setHeartbeatCount(3);
|
|
||||||
insertData.setHeartbeatInterval(30);
|
|
||||||
rmResourceRegistrationMapper.insertRmResourceRegistration(insertData);
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("注册服务器失败:{}",e.getMessage());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加节点标识
|
|
||||||
* @param rmResourceRegistration
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistration) {
|
|
||||||
// 查询此数据是否存在
|
|
||||||
RmResourceRegistration queryParam = new RmResourceRegistration();
|
|
||||||
queryParam.setClientId(rmResourceRegistration.getClientId());
|
|
||||||
RmResourceRegistration exits = rmResourceRegistrationMapper.selectRegistMsgByClientId(queryParam);
|
|
||||||
if(exits != null){
|
|
||||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
|
||||||
boolean needUpdate = false;
|
|
||||||
// 如果上机时间为空 设置上机时间
|
|
||||||
if(exits.getOnboardTime() == null){
|
|
||||||
// 如果服务器已注册 增加节点标识
|
|
||||||
updateData.setOnboardTime(DateUtils.getNowDate());
|
|
||||||
updateData.setOnlineStatus("1");
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if(exits.getLogicalNodeId() == null ||
|
|
||||||
!StringUtils.equals(rmResourceRegistration.getLogicalNodeId(),exits.getLogicalNodeId())){
|
|
||||||
// 如果服务器已注册 增加节点标识
|
|
||||||
updateData.setLogicalNodeId(rmResourceRegistration.getLogicalNodeId());
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if(exits.getAgentVersion() == null ||
|
|
||||||
!StringUtils.equals(rmResourceRegistration.getAgentVersion(),exits.getAgentVersion())){
|
|
||||||
// 如果服务器已注册 增加版本信息
|
|
||||||
updateData.setAgentVersion(rmResourceRegistration.getAgentVersion());
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if(needUpdate){
|
|
||||||
updateData.setId(exits.getId());
|
|
||||||
rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
|
|
||||||
log.info("设备:{},更新成功",rmResourceRegistration.getClientId());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int bindBusinessPublicIp(RmResourceRegistration rmResourceRegistration) {
|
|
||||||
// 参数校验
|
|
||||||
if (rmResourceRegistration == null || StringUtils.isEmpty(rmResourceRegistration.getClientId())) {
|
|
||||||
throw new IllegalArgumentException("参数不合法");
|
|
||||||
}
|
|
||||||
|
|
||||||
String clientId = rmResourceRegistration.getClientId();
|
|
||||||
String username = SecurityUtils.getUsername();
|
|
||||||
Date now = DateUtils.getNowDate();
|
|
||||||
|
|
||||||
// 1. 处理IP绑定和记录
|
|
||||||
rmResourceRegistration.getBindNetworkMsg().forEach(map -> {
|
|
||||||
// 绑定IP
|
|
||||||
RmNetworkInterfaceRemote network = new RmNetworkInterfaceRemote();
|
|
||||||
network.setId((Long) map.get("id"));
|
|
||||||
network.setBindIp(map.get("status").toString());
|
|
||||||
remoteRocketMqService.bindPublicIp(network, SecurityConstants.INNER);
|
|
||||||
|
|
||||||
// 添加变更记录
|
|
||||||
EpsMethodChangeRecord record = new EpsMethodChangeRecord();
|
|
||||||
record.setClientId(clientId);
|
|
||||||
record.setTrafficPort(map.get("interfaceName").toString());
|
|
||||||
record.setCreateTime(now);
|
|
||||||
record.setUpdateTime(now);
|
|
||||||
record.setUpdateBy(username);
|
|
||||||
record.setCreatBy(username);
|
|
||||||
record.setChangeContent("流量网口设置为" + map.get("interfaceName"));
|
|
||||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(record);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 2. 更新注册状态
|
|
||||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
|
||||||
updateData.setId(rmResourceRegistration.getId());
|
|
||||||
updateData.setMultiPublicIpStatus("1");
|
|
||||||
|
|
||||||
// 处理未注册情况
|
|
||||||
RmResourceRegistration isRegist = rmResourceRegistrationMapper.selectRmResourceRegistrationById(rmResourceRegistration.getId());
|
|
||||||
if (isRegist != null && "0".equals(isRegist.getRegistrationStatus())) {
|
|
||||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
|
||||||
queryParam.setClientId(clientId);
|
|
||||||
|
|
||||||
Optional.ofNullable(remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER))
|
|
||||||
.map(R::getData)
|
|
||||||
.flatMap(list -> list.stream()
|
|
||||||
.filter(ni -> "1".equals(ni.getBindIp()) || "3".equals(ni.getBindIp()))
|
|
||||||
.findFirst())
|
|
||||||
.ifPresent(network -> {
|
|
||||||
updateData.setRegistrationStatus("1");
|
|
||||||
|
|
||||||
// 发送注册响应
|
|
||||||
RouteMsg routeMsg = new RouteMsg();
|
|
||||||
routeMsg.setName(network.getInterfaceName());
|
|
||||||
routeMsg.setGateway(network.getGateway());
|
|
||||||
|
|
||||||
MessageVo messageVo = new MessageVo();
|
|
||||||
messageVo.setClientId(clientId);
|
|
||||||
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
|
||||||
|
|
||||||
RspVo rspVo = new RspVo();
|
|
||||||
rspVo.setResCode(1);
|
|
||||||
rspVo.setResMag("注册成功");
|
|
||||||
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
|
||||||
|
|
||||||
messageVo.setData(JSONObject.toJSONString(rspVo));
|
|
||||||
|
|
||||||
remoteRocketMqService.sendAsyncProducerMessage(
|
|
||||||
"tr_agent_down", "", "regist_rsp", JSONObject.toJSONString(messageVo), SecurityConstants.INNER
|
|
||||||
);
|
|
||||||
// 注册成功,下发优先级为0的策略
|
|
||||||
remoteRocketMqService.issueDefaultPolicyByClientId(clientId, SecurityConstants.INNER);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有逻辑节点标识
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map> getAllLogicalNodeId() {
|
|
||||||
return rmResourceRegistrationMapper.getAllLogicalNodeId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定业务
|
|
||||||
* @param rmResourceRegistration
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int bindBusinessByClientIds(RmResourceRegistration rmResourceRegistration) {
|
|
||||||
String clientIds = rmResourceRegistration.getDeployDevice();
|
|
||||||
String[] clientIdArr = clientIds.split("\n");
|
|
||||||
for (String clientId : clientIdArr) {
|
|
||||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
|
||||||
updateData.setClientId(clientId);
|
|
||||||
updateData.setBusinessName(rmResourceRegistration.getBusinessName());
|
|
||||||
rmResourceRegistrationMapper.updateStatusByResource(updateData);
|
|
||||||
// 增加业务变更记录
|
|
||||||
EpsMethodChangeRecord changeRecord = new EpsMethodChangeRecord();
|
|
||||||
// 设置基本信息
|
|
||||||
changeRecord.setClientId(clientId);
|
|
||||||
changeRecord.setBusinessCode(rmResourceRegistration.getBusinessCode());
|
|
||||||
changeRecord.setBusinessName(rmResourceRegistration.getBusinessName());
|
|
||||||
changeRecord.setCreateTime(DateUtils.getNowDate());
|
|
||||||
changeRecord.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
|
||||||
changeRecord.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
// 修改内容
|
|
||||||
String content = "业务为" + rmResourceRegistration.getBusinessName();
|
|
||||||
changeRecord.setChangeContent(content);
|
|
||||||
// 保存数据
|
|
||||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ _
|
|
||||||
(_) | |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___
|
|
||||||
| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \
|
|
||||||
| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | |
|
|
||||||
|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_|
|
|
||||||
__/ | __/ |
|
|
||||||
|___/ |___/
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/ruoyi-system" />
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.ruoyi" level="info" />
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn" />
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info" />
|
|
||||||
<appender-ref ref="file_error" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
-386
@@ -1,386 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.system.mapper.EpsInitialTrafficDataMapper">
|
|
||||||
|
|
||||||
<update id="createEpsTrafficTable">
|
|
||||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
||||||
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
|
||||||
`name` VARCHAR(255) COMMENT '接口名称',
|
|
||||||
`mac` VARCHAR(50) COMMENT 'MAC地址',
|
|
||||||
`status` VARCHAR(20) COMMENT '运行状态',
|
|
||||||
`type` VARCHAR(30) COMMENT '接口类型',
|
|
||||||
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
|
||||||
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
|
|
||||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
|
||||||
`in_speed` varchar(50) COMMENT '接收带宽(bit)',
|
|
||||||
`out_speed` varchar(50) COMMENT '发送带宽(bit)',
|
|
||||||
`total_in_speed` varchar(50) COMMENT '总接收带宽(bit)',
|
|
||||||
`total_out_speed` varchar(50) COMMENT '总发送带宽(bit)',
|
|
||||||
`machine_flow` varchar(50) COMMENT '金山带宽(bit)',
|
|
||||||
`speed` varchar(100) COMMENT '协商速度',
|
|
||||||
`duplex` varchar(100) COMMENT '工作模式',
|
|
||||||
business_id varchar(50) COMMENT '业务代码',
|
|
||||||
business_name varchar(200) COMMENT '业务名称',
|
|
||||||
service_sn varchar(64) COMMENT '服务器SN',
|
|
||||||
node_name varchar(200) COMMENT '服务器名称',
|
|
||||||
revenue_method varchar(10) COMMENT '收益方式(1.流量,2包端)',
|
|
||||||
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
|
|
||||||
create_time DATETIME COMMENT '创建时间',
|
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
|
||||||
update_by VARCHAR(50) COMMENT '修改人',
|
|
||||||
client_id VARCHAR(255) COMMENT '设备唯一标识',
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY uk_client_mac_name_time (client_id, mac, name, create_time),
|
|
||||||
INDEX idx_name_time (`name`,create_time),
|
|
||||||
INDEX idx_revenue_method (revenue_method),
|
|
||||||
INDEX idx_service_sn (service_sn)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='EPS设备流量初始数据表';
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="createEpsInitialTrafficTable">
|
|
||||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
||||||
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
|
||||||
`name` VARCHAR(255) COMMENT '接口名称',
|
|
||||||
`mac` VARCHAR(20) COMMENT 'MAC地址',
|
|
||||||
`status` VARCHAR(20) COMMENT '运行状态',
|
|
||||||
`type` VARCHAR(30) COMMENT '接口类型',
|
|
||||||
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
|
||||||
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
|
|
||||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
|
||||||
`in_speed` VARCHAR(50) COMMENT '接收带宽(Mbps)',
|
|
||||||
`out_speed` VARCHAR(50) COMMENT '发送带宽(Mbps)',
|
|
||||||
`total_in_speed` VARCHAR(50) COMMENT '总接收带宽(Mbps)',
|
|
||||||
`total_out_speed` VARCHAR(50) COMMENT '总发送带宽(Mbps)',
|
|
||||||
`speed` varchar(100) COMMENT '协商速度',
|
|
||||||
`duplex` varchar(100) COMMENT '工作模式',
|
|
||||||
create_time DATETIME COMMENT '创建时间',
|
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
|
||||||
update_by VARCHAR(50) COMMENT '修改人',
|
|
||||||
client_id VARCHAR(255) COMMENT '设备唯一标识',
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY uk_client_mac_name_time (client_id, mac, name, create_time),
|
|
||||||
INDEX idx_name_time (`name`,create_time)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
|
|
||||||
</update>
|
|
||||||
<update id="createMtrProbeResultTable">
|
|
||||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
||||||
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
mtr_client_id VARCHAR(200) COMMENT 'MTR客户端ID',
|
|
||||||
client_id VARCHAR(200) COMMENT '客户端ID',
|
|
||||||
public_ip VARCHAR(45) COMMENT '公网IP地址',
|
|
||||||
packet_loss_rate DECIMAL(5,2) COMMENT '丢包率(%)',
|
|
||||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
create_by VARCHAR(64) COMMENT '创建人',
|
|
||||||
update_by VARCHAR(64) COMMENT '更新人',
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY uk_probe_record (mtr_client_id, client_id, create_time),
|
|
||||||
INDEX idx_mtr_client_id (mtr_client_id, create_time)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网络mtr探测结果表';
|
|
||||||
</update>
|
|
||||||
<update id="createSwitchInfoTable">
|
|
||||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
||||||
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
client_id VARCHAR(255) NOT NULL COMMENT '客户端ID',
|
|
||||||
name VARCHAR(100) NOT NULL COMMENT '网络接口名称',
|
|
||||||
switch_ip VARCHAR(100) COMMENT '交换机IP',
|
|
||||||
in_bytes DECIMAL(22,0) COMMENT '接收流量(字节)',
|
|
||||||
out_bytes DECIMAL(22,0) COMMENT '发送流量(字节)',
|
|
||||||
in_speed DECIMAL(20,2) DEFAULT 0.00 COMMENT '接收速率(bit/s)',
|
|
||||||
out_speed DECIMAL(20,2) DEFAULT 0.00 COMMENT '发送速率(bit/s)',
|
|
||||||
max_speed DECIMAL(20,0) COMMENT '流量最大值',
|
|
||||||
status VARCHAR(20) COMMENT '接口状态',
|
|
||||||
type VARCHAR(30) COMMENT '接口类型',
|
|
||||||
if_speed VARCHAR(50) COMMENT '端口速率(Mbps)',
|
|
||||||
if_index VARCHAR(50) COMMENT '端口索引',
|
|
||||||
if_in_discards VARCHAR(50) COMMENT '入站丢包',
|
|
||||||
if_out_discards VARCHAR(50) COMMENT '出站丢包',
|
|
||||||
if_in_errors VARCHAR(50) COMMENT '入站错误',
|
|
||||||
if_out_errors VARCHAR(50) COMMENT '出站错误',
|
|
||||||
create_time DATETIME COMMENT '创建时间',
|
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
|
||||||
update_by VARCHAR(50) COMMENT '更新人',
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY uk_switch_record (client_id, switch_ip, name, create_time),
|
|
||||||
INDEX idx_create_time (create_time),
|
|
||||||
INDEX idx_draw (client_id, name, create_time)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交换机监控信息表';
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="createSwitchInfoDetailsTable">
|
|
||||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
||||||
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
client_id VARCHAR(255) NOT NULL COMMENT '客户端ID',
|
|
||||||
name VARCHAR(100) NOT NULL COMMENT '网络接口名称',
|
|
||||||
switch_ip VARCHAR(100) COMMENT '交换机IP',
|
|
||||||
switch_name VARCHAR(100) COMMENT '交换机名称',
|
|
||||||
switch_sn VARCHAR(64) COMMENT '交换机SN',
|
|
||||||
in_bytes DECIMAL(22,2) COMMENT '接收流量(字节)',
|
|
||||||
out_bytes DECIMAL(22,2) COMMENT '发送流量(字节)',
|
|
||||||
in_speed DECIMAL(20,2) COMMENT '接收速率(bit/s)',
|
|
||||||
out_speed DECIMAL(20,2) COMMENT '发送速率(bit/s)',
|
|
||||||
max_speed DECIMAL(20,2) COMMENT '流量最大值',
|
|
||||||
status VARCHAR(20) COMMENT '接口状态',
|
|
||||||
type VARCHAR(30) COMMENT '接口类型',
|
|
||||||
interface_device_type VARCHAR(50) COMMENT '连接设备类型',
|
|
||||||
interface_name_remark VARCHAR(255) COMMENT '接口别名',
|
|
||||||
server_name VARCHAR(100) COMMENT '服务器名称',
|
|
||||||
server_client_id VARCHAR(255) COMMENT '服务器客户端ID',
|
|
||||||
server_port VARCHAR(200) COMMENT '服务器网口',
|
|
||||||
server_sn VARCHAR(64) COMMENT '服务器SN',
|
|
||||||
business_code VARCHAR(100) COMMENT '业务代码',
|
|
||||||
business_name VARCHAR(200) COMMENT '业务名称',
|
|
||||||
if_speed VARCHAR(50) COMMENT '端口速率(Mbps)',
|
|
||||||
if_index VARCHAR(50) COMMENT '端口索引',
|
|
||||||
if_in_discards VARCHAR(50) COMMENT '入站丢包',
|
|
||||||
if_out_discards VARCHAR(50) COMMENT '出站丢包',
|
|
||||||
if_in_errors VARCHAR(50) COMMENT '入站错误',
|
|
||||||
if_out_errors VARCHAR(50) COMMENT '出站错误',
|
|
||||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
|
||||||
update_by VARCHAR(50) COMMENT '更新人',
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
UNIQUE KEY uk_switch_detail (client_id, switch_ip, name, create_time),
|
|
||||||
INDEX idx_filter_sort (name, interface_device_type, switch_sn, create_time),
|
|
||||||
INDEX idx_create_time (create_time),
|
|
||||||
INDEX idx_client_time (client_id, name, create_time)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交换机监控详情表';
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!-- 单条插入语句 -->
|
|
||||||
<insert id="insert">
|
|
||||||
INSERT INTO ${tableName} (
|
|
||||||
`name`,
|
|
||||||
`mac`,
|
|
||||||
`status`,
|
|
||||||
`type`,
|
|
||||||
ipV4,
|
|
||||||
`in_dropped`,
|
|
||||||
`out_dropped`,
|
|
||||||
`in_speed`,
|
|
||||||
`out_speed`,
|
|
||||||
`total_in_speed`,
|
|
||||||
`total_out_speed`,
|
|
||||||
`speed`,
|
|
||||||
`duplex`,
|
|
||||||
business_id,
|
|
||||||
business_name,
|
|
||||||
service_sn,
|
|
||||||
node_name,
|
|
||||||
revenue_method,
|
|
||||||
package_bandwidth,
|
|
||||||
create_by,
|
|
||||||
update_by,
|
|
||||||
client_id
|
|
||||||
) VALUES (
|
|
||||||
#{name},
|
|
||||||
#{mac},
|
|
||||||
#{status},
|
|
||||||
#{type},
|
|
||||||
#{ipV4},
|
|
||||||
#{inDropped},
|
|
||||||
#{outDropped},
|
|
||||||
#{inSpeed},
|
|
||||||
#{outSpeed},
|
|
||||||
#{totalInSpeed},
|
|
||||||
#{totalOutSpeed},
|
|
||||||
#{speed},
|
|
||||||
#{duplex},
|
|
||||||
#{businessId},
|
|
||||||
#{businessName},
|
|
||||||
#{serviceSn},
|
|
||||||
#{nodeName},
|
|
||||||
#{revenueMethod},
|
|
||||||
#{packageBandwidth},
|
|
||||||
#{createBy},
|
|
||||||
#{updateBy},
|
|
||||||
#{clientId}
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<!-- 批量插入语句 -->
|
|
||||||
<insert id="batchInsert">
|
|
||||||
INSERT IGNORE INTO ${tableName} (
|
|
||||||
id,
|
|
||||||
`name`,
|
|
||||||
`mac`,
|
|
||||||
`status`,
|
|
||||||
`type`,
|
|
||||||
ipV4,
|
|
||||||
`in_dropped`,
|
|
||||||
`out_dropped`,
|
|
||||||
`in_speed`,
|
|
||||||
`out_speed`,
|
|
||||||
`total_in_speed`,
|
|
||||||
`total_out_speed`,
|
|
||||||
`speed`,
|
|
||||||
`duplex`,
|
|
||||||
business_id,
|
|
||||||
business_name,
|
|
||||||
service_sn,
|
|
||||||
node_name,
|
|
||||||
revenue_method,
|
|
||||||
package_bandwidth,
|
|
||||||
create_time,
|
|
||||||
update_time,
|
|
||||||
create_by,
|
|
||||||
update_by,
|
|
||||||
client_id
|
|
||||||
) VALUES
|
|
||||||
<foreach collection="dataList" item="data" separator=",">
|
|
||||||
(
|
|
||||||
#{data.id,jdbcType=BIGINT},
|
|
||||||
#{data.name,jdbcType=VARCHAR},
|
|
||||||
#{data.mac,jdbcType=VARCHAR},
|
|
||||||
#{data.status,jdbcType=VARCHAR},
|
|
||||||
#{data.type,jdbcType=VARCHAR},
|
|
||||||
#{data.ipV4,jdbcType=VARCHAR},
|
|
||||||
#{data.inDropped,jdbcType=DECIMAL},
|
|
||||||
#{data.outDropped,jdbcType=DECIMAL},
|
|
||||||
#{data.inSpeed,jdbcType=VARCHAR},
|
|
||||||
#{data.outSpeed,jdbcType=VARCHAR},
|
|
||||||
#{data.totalInSpeed,jdbcType=VARCHAR},
|
|
||||||
#{data.totalOutSpeed,jdbcType=VARCHAR},
|
|
||||||
#{data.speed,jdbcType=VARCHAR},
|
|
||||||
#{data.duplex,jdbcType=VARCHAR},
|
|
||||||
#{data.businessId,jdbcType=VARCHAR},
|
|
||||||
#{data.businessName,jdbcType=VARCHAR},
|
|
||||||
#{data.serviceSn,jdbcType=VARCHAR},
|
|
||||||
#{data.nodeName,jdbcType=VARCHAR},
|
|
||||||
#{data.revenueMethod,jdbcType=VARCHAR},
|
|
||||||
#{data.packageBandwidth,jdbcType=DECIMAL},
|
|
||||||
#{data.createTime,jdbcType=TIMESTAMP},
|
|
||||||
#{data.updateTime,jdbcType=TIMESTAMP},
|
|
||||||
#{data.createBy,jdbcType=VARCHAR},
|
|
||||||
#{data.updateBy,jdbcType=VARCHAR},
|
|
||||||
#{data.clientId,jdbcType=VARCHAR}
|
|
||||||
)
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<!-- 条件查询 -->
|
|
||||||
<select id="selectByCondition" resultType="EpsInitialTrafficData">
|
|
||||||
SELECT
|
|
||||||
a.id,
|
|
||||||
GROUP_CONCAT(DISTINCT a.`name` SEPARATOR ',') AS name,
|
|
||||||
a.`mac` AS mac,
|
|
||||||
a.`status` AS status,
|
|
||||||
a.`type` AS type,
|
|
||||||
a.`ipV4` AS ipV4,
|
|
||||||
a.`in_dropped` AS inDropped,
|
|
||||||
a.`out_dropped` AS outDropped,
|
|
||||||
CAST(sum(ifnull(a.`in_speed`,0)) AS DECIMAL(20,0)) AS inSpeed,
|
|
||||||
CAST(sum(ifnull(a.`out_speed`,0)) AS DECIMAL(20,0)) AS outSpeed,
|
|
||||||
CAST(sum(ifnull(a.`total_in_speed`,0)) AS DECIMAL(20,0)) AS totalInSpeed,
|
|
||||||
CAST(sum(ifnull(a.`total_out_speed`,0)) AS DECIMAL(20,0)) AS totalOutSpeed,
|
|
||||||
a.`machine_flow` AS machineFlow,
|
|
||||||
a.`speed` AS speed,
|
|
||||||
a.`duplex` AS duplex,
|
|
||||||
a.business_id AS businessId,
|
|
||||||
a.business_name AS businessName,
|
|
||||||
a.service_sn AS serviceSn,
|
|
||||||
a.node_name AS nodeName,
|
|
||||||
a.revenue_method AS revenueMethod,
|
|
||||||
a.package_bandwidth AS packageBandwidth,
|
|
||||||
a.create_time AS createTime,
|
|
||||||
a.update_time AS updateTime,
|
|
||||||
a.create_by AS createBy,
|
|
||||||
a.update_by AS updateBy,
|
|
||||||
a.client_id AS clientId
|
|
||||||
FROM ${tableName} a
|
|
||||||
INNER JOIN rm_network_interface b ON a.client_id = b.client_id and a.mac=b.mac_address
|
|
||||||
AND (b.bind_ip = 1 OR b.bind_ip = 3)
|
|
||||||
AND b.new_flag = 1
|
|
||||||
<where>
|
|
||||||
<if test="serviceSn != '' and serviceSn != null">
|
|
||||||
and a.service_sn = #{serviceSn}
|
|
||||||
</if>
|
|
||||||
<if test="businessId != '' and businessId != null">
|
|
||||||
and a.business_id = #{businessId}
|
|
||||||
</if>
|
|
||||||
<if test="clientId != '' and clientId != null">
|
|
||||||
and a.client_id = #{clientId}
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
and a.create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and a.create_time <= #{endTime}
|
|
||||||
</if>
|
|
||||||
<if test="revenueMethod != null">
|
|
||||||
and a.revenue_method = #{revenueMethod}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
GROUP BY a.create_time DESC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 条件查询 -->
|
|
||||||
<select id="getAllTraficMsg" resultType="EpsInitialTrafficData">
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
`name` AS name,
|
|
||||||
`mac` AS mac,
|
|
||||||
`status` AS status,
|
|
||||||
`type` AS type,
|
|
||||||
`ipV4` AS ipV4,
|
|
||||||
`in_dropped` AS inDropped,
|
|
||||||
`out_dropped` AS outDropped,
|
|
||||||
`in_speed` AS inSpeed,
|
|
||||||
`out_speed` AS outSpeed,
|
|
||||||
`total_in_speed` AS totalInSpeed,
|
|
||||||
`total_out_speed` AS totalOutSpeed,
|
|
||||||
`speed` AS speed,
|
|
||||||
`duplex` AS duplex,
|
|
||||||
create_time AS createTime,
|
|
||||||
update_time AS updateTime,
|
|
||||||
create_by AS createBy,
|
|
||||||
update_by AS updateBy,
|
|
||||||
client_id AS clientId
|
|
||||||
FROM ${tableName}
|
|
||||||
<where>
|
|
||||||
<if test="startTime != null">
|
|
||||||
and create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and create_time <= #{endTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
ORDER BY create_time desc
|
|
||||||
</select>
|
|
||||||
<update id="updateMachineTraffic" parameterType="EpsInitialTrafficData">
|
|
||||||
update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData">
|
|
||||||
SELECT
|
|
||||||
CAST(sum(ifnull(in_speed,0)) AS DECIMAL(20,0)) AS inSpeed,
|
|
||||||
CAST(sum(ifnull(out_speed,0)) AS DECIMAL(20,0)) AS outSpeed,
|
|
||||||
create_time AS createTime
|
|
||||||
FROM ${tableName}
|
|
||||||
<where>
|
|
||||||
<if test="businessId != '' and businessId != null">
|
|
||||||
and business_id = #{businessId}
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
and create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and create_time <= #{endTime}
|
|
||||||
</if>
|
|
||||||
<if test="clientIds != null">
|
|
||||||
and client_id in
|
|
||||||
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
|
|
||||||
#{clientId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
group by create_time
|
|
||||||
ORDER BY out_speed desc
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
-420
@@ -1,420 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.system.mapper.RmResourceRegistrationMapper">
|
|
||||||
|
|
||||||
<resultMap type="RmResourceRegistration" id="RmResourceRegistrationResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="hardwareSn" column="hardware_sn" />
|
|
||||||
<result property="resourceType" column="resource_type" />
|
|
||||||
<result property="resourceName" column="resource_name" />
|
|
||||||
<result property="ipAddress" column="ip_address" />
|
|
||||||
<result property="resourcePort" column="resource_port" />
|
|
||||||
<result property="otherPortName" column="other_port_name" />
|
|
||||||
<result property="agentVersion" column="agent_version" />
|
|
||||||
<result property="protocol" column="protocol" />
|
|
||||||
<result property="resourceVersion" column="resource_version" />
|
|
||||||
<result property="rwPermission" column="rw_permission" />
|
|
||||||
<result property="snmpDetect" column="snmp_detect" />
|
|
||||||
<result property="teamName" column="team_name" />
|
|
||||||
<result property="snmpCollectAddr" column="snmp_collect_addr" />
|
|
||||||
<result property="snmpCollectPort" column="snmp_collect_port" />
|
|
||||||
<result property="securityLevel" column="security_level" />
|
|
||||||
<result property="encryption" column="encryption" />
|
|
||||||
<result property="resourceUserName" column="resource_user_name" />
|
|
||||||
<result property="resourcePwd" column="resource_pwd" />
|
|
||||||
<result property="registrationStatus" column="registration_status" />
|
|
||||||
<result property="onlineStatus" column="online_status" />
|
|
||||||
<result property="switchOnlineStatus" column="switch_online_status" />
|
|
||||||
<result property="description" column="description" />
|
|
||||||
<result property="customerId" column="customer_id" />
|
|
||||||
<result property="customerName" column="customer_name" />
|
|
||||||
<result property="serviceNumber" column="service_number" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
<result property="creatorId" column="creator_id" />
|
|
||||||
<result property="creatorName" column="creator_name" />
|
|
||||||
<result property="updaterId" column="updater_id" />
|
|
||||||
<result property="updaterName" column="updater_name" />
|
|
||||||
<result property="clientId" column="client_id" />
|
|
||||||
<result property="operator" column="operator" />
|
|
||||||
<result property="province" column="province" />
|
|
||||||
<result property="publicIp" column="public_ip" />
|
|
||||||
<result property="businessName" column="business_name" />
|
|
||||||
<result property="logicalNodeId" column="logical_node_id" />
|
|
||||||
<result property="multiPublicIpStatus" column="multi_public_ip_status" />
|
|
||||||
<result property="heartbeatCount" column="heartbeat_count" />
|
|
||||||
<result property="heartbeatInterval" column="heartbeat_interval" />
|
|
||||||
<result property="onboardTime" column="onboard_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectRmResourceRegistrationVo">
|
|
||||||
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name,
|
|
||||||
agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr,
|
|
||||||
snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status,
|
|
||||||
online_status, switch_online_status, description, customer_id, customer_name, service_number,
|
|
||||||
create_time, update_time, creator_id, creator_name, updater_id, updater_name, client_id, operator,
|
|
||||||
province, public_ip, business_name, logical_node_id, multi_public_ip_status, heartbeat_count,
|
|
||||||
heartbeat_interval, onboard_time from rm_resource_registration
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
|
|
||||||
<include refid="selectRmResourceRegistrationVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
|
||||||
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
|
|
||||||
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
|
|
||||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
|
||||||
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
|
|
||||||
<if test="otherPortName != null and otherPortName != ''"> and other_port_name like concat('%', #{otherPortName}, '%')</if>
|
|
||||||
<if test="agentVersion != null and agentVersion != ''"> and agent_version = #{agentVersion}</if>
|
|
||||||
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
|
|
||||||
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
|
|
||||||
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
|
|
||||||
<if test="snmpDetect != null and snmpDetect != ''"> and snmp_detect = #{snmpDetect}</if>
|
|
||||||
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
|
|
||||||
<if test="snmpCollectAddr != null and snmpCollectAddr != ''"> and snmp_collect_addr = #{snmpCollectAddr}</if>
|
|
||||||
<if test="snmpCollectPort != null "> and snmp_collect_port = #{snmpCollectPort}</if>
|
|
||||||
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
|
|
||||||
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
|
|
||||||
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name like concat('%', #{resourceUserName}, '%')</if>
|
|
||||||
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
|
|
||||||
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
|
|
||||||
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
|
|
||||||
<if test="switchOnlineStatus != null and switchOnlineStatus != ''"> and switch_online_status = #{switchOnlineStatus}</if>
|
|
||||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
||||||
<if test="customerId != null "> and customer_id = #{customerId}</if>
|
|
||||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
||||||
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
|
|
||||||
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
|
|
||||||
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
|
|
||||||
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
|
|
||||||
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
|
|
||||||
<if test="queryName != null and queryName != ''"> and (hardware_sn = #{queryName} or resource_name like concat('%', #{queryName}, '%')) </if>
|
|
||||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
||||||
<if test="operator != null and operator != ''"> and operator = #{operator}</if>
|
|
||||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
|
||||||
<if test="publicIp != null and publicIp != ''"> and public_ip = #{publicIp}</if>
|
|
||||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
|
||||||
<if test="logicalNodeId != null and logicalNodeId != ''"> and logical_node_id = #{logicalNodeId}</if>
|
|
||||||
<if test="multiPublicIpStatus != null and multiPublicIpStatus != ''"> and multi_public_ip_status = #{multiPublicIpStatus}</if>
|
|
||||||
</where>
|
|
||||||
order by create_time desc
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectRmResourceRegistrationById" parameterType="Long" resultMap="RmResourceRegistrationResult">
|
|
||||||
<include refid="selectRmResourceRegistrationVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into rm_resource_registration
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="hardwareSn != null">hardware_sn,</if>
|
|
||||||
<if test="resourceType != null">resource_type,</if>
|
|
||||||
<if test="resourceName != null">resource_name,</if>
|
|
||||||
<if test="ipAddress != null">ip_address,</if>
|
|
||||||
<if test="resourcePort != null">resource_port,</if>
|
|
||||||
<if test="otherPortName != null">other_port_name,</if>
|
|
||||||
<if test="agentVersion != null">agent_version,</if>
|
|
||||||
<if test="protocol != null">protocol,</if>
|
|
||||||
<if test="resourceVersion != null">resource_version,</if>
|
|
||||||
<if test="rwPermission != null">rw_permission,</if>
|
|
||||||
<if test="snmpDetect != null">snmp_detect,</if>
|
|
||||||
<if test="teamName != null">team_name,</if>
|
|
||||||
<if test="snmpCollectAddr != null">snmp_collect_addr,</if>
|
|
||||||
<if test="snmpCollectPort != null">snmp_collect_port,</if>
|
|
||||||
<if test="securityLevel != null">security_level,</if>
|
|
||||||
<if test="encryption != null">encryption,</if>
|
|
||||||
<if test="resourceUserName != null">resource_user_name,</if>
|
|
||||||
<if test="resourcePwd != null">resource_pwd,</if>
|
|
||||||
<if test="registrationStatus != null">registration_status,</if>
|
|
||||||
<if test="onlineStatus != null">online_status,</if>
|
|
||||||
<if test="switchOnlineStatus != null">switch_online_status,</if>
|
|
||||||
<if test="description != null">description,</if>
|
|
||||||
<if test="customerId != null">customer_id,</if>
|
|
||||||
<if test="customerName != null">customer_name,</if>
|
|
||||||
<if test="serviceNumber != null">service_number,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="creatorId != null">creator_id,</if>
|
|
||||||
<if test="creatorName != null">creator_name,</if>
|
|
||||||
<if test="updaterId != null">updater_id,</if>
|
|
||||||
<if test="updaterName != null">updater_name,</if>
|
|
||||||
<if test="clientId != null">client_id,</if>
|
|
||||||
<if test="operator != null">operator,</if>
|
|
||||||
<if test="province != null">province,</if>
|
|
||||||
<if test="publicIp != null">public_ip,</if>
|
|
||||||
<if test="businessName != null">business_name,</if>
|
|
||||||
<if test="logicalNodeId != null">logical_node_id,</if>
|
|
||||||
<if test="multiPublicIpStatus != null">multi_public_ip_status,</if>
|
|
||||||
<if test="heartbeatCount != null">heartbeat_count,</if>
|
|
||||||
<if test="heartbeatInterval != null">heartbeat_interval,</if>
|
|
||||||
<if test="onboardTime != null">onboard_time,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="hardwareSn != null">#{hardwareSn},</if>
|
|
||||||
<if test="resourceType != null">#{resourceType},</if>
|
|
||||||
<if test="resourceName != null">#{resourceName},</if>
|
|
||||||
<if test="ipAddress != null">#{ipAddress},</if>
|
|
||||||
<if test="resourcePort != null">#{resourcePort},</if>
|
|
||||||
<if test="otherPortName != null">#{otherPortName},</if>
|
|
||||||
<if test="agentVersion != null">#{agentVersion},</if>
|
|
||||||
<if test="protocol != null">#{protocol},</if>
|
|
||||||
<if test="resourceVersion != null">#{resourceVersion},</if>
|
|
||||||
<if test="rwPermission != null">#{rwPermission},</if>
|
|
||||||
<if test="snmpDetect != null">#{snmpDetect},</if>
|
|
||||||
<if test="teamName != null">#{teamName},</if>
|
|
||||||
<if test="snmpCollectAddr != null">#{snmpCollectAddr},</if>
|
|
||||||
<if test="snmpCollectPort != null">#{snmpCollectPort},</if>
|
|
||||||
<if test="securityLevel != null">#{securityLevel},</if>
|
|
||||||
<if test="encryption != null">#{encryption},</if>
|
|
||||||
<if test="resourceUserName != null">#{resourceUserName},</if>
|
|
||||||
<if test="resourcePwd != null">#{resourcePwd},</if>
|
|
||||||
<if test="registrationStatus != null">#{registrationStatus},</if>
|
|
||||||
<if test="onlineStatus != null">#{onlineStatus},</if>
|
|
||||||
<if test="switchOnlineStatus != null">#{switchOnlineStatus},</if>
|
|
||||||
<if test="description != null">#{description},</if>
|
|
||||||
<if test="customerId != null">#{customerId},</if>
|
|
||||||
<if test="customerName != null">#{customerName},</if>
|
|
||||||
<if test="serviceNumber != null">#{serviceNumber},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="creatorId != null">#{creatorId},</if>
|
|
||||||
<if test="creatorName != null">#{creatorName},</if>
|
|
||||||
<if test="updaterId != null">#{updaterId},</if>
|
|
||||||
<if test="updaterName != null">#{updaterName},</if>
|
|
||||||
<if test="clientId != null">#{clientId},</if>
|
|
||||||
<if test="operator != null">#{operator},</if>
|
|
||||||
<if test="province != null">#{province},</if>
|
|
||||||
<if test="publicIp != null">#{publicIp},</if>
|
|
||||||
<if test="businessName != null">#{businessName},</if>
|
|
||||||
<if test="logicalNodeId != null">#{logicalNodeId},</if>
|
|
||||||
<if test="multiPublicIpStatus != null">#{multiPublicIpStatus},</if>
|
|
||||||
<if test="heartbeatCount != null">#{heartbeatCount},</if>
|
|
||||||
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
|
|
||||||
<if test="onboardTime != null">#{onboardTime},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateRmResourceRegistration" parameterType="RmResourceRegistration">
|
|
||||||
update rm_resource_registration
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
|
|
||||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
|
||||||
<if test="resourceName != null">resource_name = #{resourceName},</if>
|
|
||||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
|
||||||
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
|
|
||||||
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
|
|
||||||
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
|
|
||||||
<if test="protocol != null">protocol = #{protocol},</if>
|
|
||||||
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
|
|
||||||
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
|
|
||||||
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
|
|
||||||
<if test="teamName != null">team_name = #{teamName},</if>
|
|
||||||
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
|
|
||||||
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
|
|
||||||
<if test="securityLevel != null">security_level = #{securityLevel},</if>
|
|
||||||
<if test="encryption != null">encryption = #{encryption},</if>
|
|
||||||
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
|
|
||||||
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
|
|
||||||
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
|
|
||||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
|
||||||
<if test="switchOnlineStatus != null">switch_online_status = #{switchOnlineStatus},</if>
|
|
||||||
<if test="description != null">description = #{description},</if>
|
|
||||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
|
||||||
<if test="customerName != null">customer_name = #{customerName},</if>
|
|
||||||
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
|
||||||
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
|
||||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
|
||||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
|
||||||
<if test="clientId != null">client_id = #{clientId},</if>
|
|
||||||
<if test="operator != null">operator = #{operator},</if>
|
|
||||||
<if test="province != null">province = #{province},</if>
|
|
||||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
|
||||||
<if test="businessName != null">business_name = #{businessName},</if>
|
|
||||||
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
|
|
||||||
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
|
|
||||||
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
|
|
||||||
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
|
|
||||||
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteRmResourceRegistrationById" parameterType="Long">
|
|
||||||
delete from rm_resource_registration where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteRmResourceRegistrationByIds" parameterType="String">
|
|
||||||
delete from rm_resource_registration where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
<!-- 查询所有资源名称(包含设备使用)-->
|
|
||||||
<select id="selectAllResourceName" resultType="java.util.Map">
|
|
||||||
select id id,resource_name resourceName from rm_resource_registration
|
|
||||||
<where>
|
|
||||||
and registration_status = 1
|
|
||||||
</where>
|
|
||||||
group by id
|
|
||||||
</select>
|
|
||||||
<!-- 查询所有资源名称-->
|
|
||||||
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
|
|
||||||
SELECT
|
|
||||||
resource_name AS resourceName,
|
|
||||||
CASE
|
|
||||||
WHEN resource_type = '1' THEN ip_address
|
|
||||||
WHEN resource_type = '2' THEN snmp_collect_addr
|
|
||||||
END AS ipAddress,
|
|
||||||
hardware_sn AS hardwareSn
|
|
||||||
FROM rm_resource_registration
|
|
||||||
<where>
|
|
||||||
and registration_status = 1
|
|
||||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
|
||||||
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
|
|
||||||
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
|
|
||||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
|
||||||
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
|
|
||||||
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if>
|
|
||||||
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
|
|
||||||
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
|
|
||||||
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
|
|
||||||
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
|
|
||||||
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
|
|
||||||
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if>
|
|
||||||
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
|
|
||||||
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
|
|
||||||
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
|
|
||||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
||||||
<if test="customerId != null "> and customer_id = #{customerId}</if>
|
|
||||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
|
||||||
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
|
|
||||||
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
|
|
||||||
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
|
|
||||||
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
|
|
||||||
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
|
|
||||||
</where>
|
|
||||||
group by resource_name
|
|
||||||
</select>
|
|
||||||
<select id="countBySn" parameterType="String">
|
|
||||||
select count(1) from rm_resource_registration
|
|
||||||
where hardware_sn = #{hardwareSn}
|
|
||||||
</select>
|
|
||||||
<update id="updateStatusByResource" parameterType="RmResourceRegistration">
|
|
||||||
update rm_resource_registration
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
|
||||||
<if test="resourceName != null">resource_name = #{resourceName},</if>
|
|
||||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
|
||||||
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
|
|
||||||
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
|
|
||||||
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
|
|
||||||
<if test="protocol != null">protocol = #{protocol},</if>
|
|
||||||
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
|
|
||||||
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
|
|
||||||
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
|
|
||||||
<if test="teamName != null">team_name = #{teamName},</if>
|
|
||||||
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
|
|
||||||
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
|
|
||||||
<if test="securityLevel != null">security_level = #{securityLevel},</if>
|
|
||||||
<if test="encryption != null">encryption = #{encryption},</if>
|
|
||||||
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
|
|
||||||
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
|
|
||||||
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
|
|
||||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
|
||||||
<if test="switchOnlineStatus != null">switch_online_status = #{switchOnlineStatus},</if>
|
|
||||||
<if test="description != null">description = #{description},</if>
|
|
||||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
|
||||||
<if test="customerName != null">customer_name = #{customerName},</if>
|
|
||||||
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
|
||||||
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
|
||||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
|
||||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
|
||||||
<if test="clientId != null">client_id = #{clientId},</if>
|
|
||||||
<if test="operator != null">operator = #{operator},</if>
|
|
||||||
<if test="province != null">province = #{province},</if>
|
|
||||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
|
||||||
<if test="businessName != null">business_name = #{businessName},</if>
|
|
||||||
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
|
|
||||||
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
|
|
||||||
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
|
|
||||||
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
|
|
||||||
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
|
|
||||||
</trim>
|
|
||||||
<where>
|
|
||||||
<choose>
|
|
||||||
<when test="hardwareSn != null">
|
|
||||||
and hardware_sn = #{hardwareSn}
|
|
||||||
</when>
|
|
||||||
<when test="clientId != null">
|
|
||||||
and client_id = #{clientId}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
and 1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</where>
|
|
||||||
</update>
|
|
||||||
<select id="getRegistrationByIds" parameterType="String" resultMap="RmResourceRegistrationResult">
|
|
||||||
<include refid="selectRmResourceRegistrationVo"/>
|
|
||||||
where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectRegistMsgByClientId" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
|
|
||||||
<include refid="selectRmResourceRegistrationVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
||||||
</where>
|
|
||||||
order by create_time desc
|
|
||||||
</select>
|
|
||||||
<select id="getAllLogicalNodeId" parameterType="RmResourceRegistration" resultType="java.util.Map">
|
|
||||||
select logical_node_id logicalNodeId from rm_resource_registration where logical_node_id != ''
|
|
||||||
group by logical_node_id
|
|
||||||
</select>
|
|
||||||
<select id="getRegistrationTableInfoList" parameterType="RmResourceRegistration" resultType="RmResourceRegistration">
|
|
||||||
select
|
|
||||||
a.id,
|
|
||||||
a.hardware_sn as hardwareSn,
|
|
||||||
a.agent_version as agentVersion,
|
|
||||||
a.registration_status as registrationStatus,
|
|
||||||
a.online_status as onlineStatus,
|
|
||||||
a.create_time as createTime,
|
|
||||||
a.update_time as updateTime,
|
|
||||||
a.client_id as clientId,
|
|
||||||
a.business_name as businessName,
|
|
||||||
a.logical_node_id as logicalNodeId,
|
|
||||||
a.multi_public_ip_status as multiPublicIpStatus,
|
|
||||||
a.heartbeat_count as heartbeatCount,
|
|
||||||
a.heartbeat_interval as heartbeatInterval,
|
|
||||||
a.onboard_time as onboardTime,
|
|
||||||
b.machine_code as machineCode
|
|
||||||
from rm_resource_registration a
|
|
||||||
left join rm_registration_machine b on a.client_id = b.client_id
|
|
||||||
<where>
|
|
||||||
<if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if>
|
|
||||||
<if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if>
|
|
||||||
<if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if>
|
|
||||||
<if test="registrationStatus != null and registrationStatus != ''"> and a.registration_status = #{registrationStatus}</if>
|
|
||||||
<if test="onlineStatus != null and onlineStatus != ''"> and a.online_status = #{onlineStatus}</if>
|
|
||||||
<if test="clientId != null and clientId != ''"> and a.client_id = #{clientId}</if>
|
|
||||||
<if test="businessName != null and businessName != ''"> and a.business_name like concat('%', #{businessName}, '%')</if>
|
|
||||||
<if test="logicalNodeId != null and logicalNodeId != ''"> and a.logical_node_id = #{logicalNodeId}</if>
|
|
||||||
<if test="multiPublicIpStatus != null and multiPublicIpStatus != ''"> and a.multi_public_ip_status = #{multiPublicIpStatus}</if>
|
|
||||||
<if test="businessEmpty"> and a.business_name is null</if>
|
|
||||||
<if test="logicalNodeEmpty"> and a.logical_node_id is null</if>
|
|
||||||
</where>
|
|
||||||
order by a.create_time desc
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper">
|
|
||||||
|
|
||||||
<resultMap type="SysNotice" id="SysNoticeResult">
|
|
||||||
<result property="noticeId" column="notice_id" />
|
|
||||||
<result property="noticeTitle" column="notice_title" />
|
|
||||||
<result property="noticeType" column="notice_type" />
|
|
||||||
<result property="noticeContent" column="notice_content" />
|
|
||||||
<result property="status" column="status" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectNoticeVo">
|
|
||||||
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
|
|
||||||
from sys_notice
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
|
||||||
<include refid="selectNoticeVo"/>
|
|
||||||
where notice_id = #{noticeId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
|
||||||
<include refid="selectNoticeVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="noticeTitle != null and noticeTitle != ''">
|
|
||||||
AND notice_title like concat('%', #{noticeTitle}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="noticeType != null and noticeType != ''">
|
|
||||||
AND notice_type = #{noticeType}
|
|
||||||
</if>
|
|
||||||
<if test="createBy != null and createBy != ''">
|
|
||||||
AND create_by like concat('%', #{createBy}, '%')
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="SysNotice">
|
|
||||||
insert into sys_notice (
|
|
||||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
|
|
||||||
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
|
|
||||||
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
|
|
||||||
<if test="status != null and status != '' ">status, </if>
|
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
||||||
create_time
|
|
||||||
)values(
|
|
||||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
|
|
||||||
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
|
|
||||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
|
|
||||||
<if test="status != null and status != ''">#{status}, </if>
|
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
||||||
sysdate()
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateNotice" parameterType="SysNotice">
|
|
||||||
update sys_notice
|
|
||||||
<set>
|
|
||||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
|
|
||||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
|
||||||
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
|
|
||||||
<if test="status != null and status != ''">status = #{status}, </if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
||||||
update_time = sysdate()
|
|
||||||
</set>
|
|
||||||
where notice_id = #{noticeId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteNoticeById" parameterType="Long">
|
|
||||||
delete from sys_notice where notice_id = #{noticeId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteNoticeByIds" parameterType="Long">
|
|
||||||
delete from sys_notice where notice_id in
|
|
||||||
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
|
|
||||||
#{noticeId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class DeviceMessage {
|
|
||||||
private String clientId;
|
|
||||||
private String dataType;
|
|
||||||
private String data;
|
|
||||||
}
|
|
||||||
-252
@@ -1,252 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.domain;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始带宽流量临时表对象 initial_bandwidth_traffic_temp
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-11-05
|
|
||||||
*/
|
|
||||||
public class InitialBandwidthTrafficTemp extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 唯一标识ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 接口名称 */
|
|
||||||
@Excel(name = "接口名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** MAC地址 */
|
|
||||||
@Excel(name = "MAC地址")
|
|
||||||
private String mac;
|
|
||||||
|
|
||||||
/** 运行状态 */
|
|
||||||
@Excel(name = "运行状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 接口类型 */
|
|
||||||
@Excel(name = "接口类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/** IPv4地址 */
|
|
||||||
@Excel(name = "IPv4地址")
|
|
||||||
private String ipV4;
|
|
||||||
|
|
||||||
/** 入站丢包率(%) */
|
|
||||||
@Excel(name = "入站丢包率(%)")
|
|
||||||
private BigDecimal inDropped;
|
|
||||||
|
|
||||||
/** 出站丢包率(%) */
|
|
||||||
@Excel(name = "出站丢包率(%)")
|
|
||||||
private BigDecimal outDropped;
|
|
||||||
|
|
||||||
/** 接收带宽(big) */
|
|
||||||
@Excel(name = "接收带宽(big)")
|
|
||||||
private String inSpeed;
|
|
||||||
|
|
||||||
/** 发送带宽(bit) */
|
|
||||||
@Excel(name = "发送带宽(bit)")
|
|
||||||
private String outSpeed;
|
|
||||||
|
|
||||||
/** 协商速度 */
|
|
||||||
@Excel(name = "协商速度")
|
|
||||||
private String speed;
|
|
||||||
|
|
||||||
/** 工作模式 */
|
|
||||||
@Excel(name = "工作模式")
|
|
||||||
private String duplex;
|
|
||||||
|
|
||||||
/** 设备唯一标识 */
|
|
||||||
@Excel(name = "设备唯一标识")
|
|
||||||
private String clientId;
|
|
||||||
|
|
||||||
/** 总接收带宽(bit) */
|
|
||||||
@Excel(name = "总接收带宽(bit)")
|
|
||||||
private String totalInSpeed;
|
|
||||||
|
|
||||||
/** 总发送带宽(bit) */
|
|
||||||
@Excel(name = "总发送带宽(bit)")
|
|
||||||
private String totalOutSpeed;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMac(String mac)
|
|
||||||
{
|
|
||||||
this.mac = mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMac()
|
|
||||||
{
|
|
||||||
return mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type)
|
|
||||||
{
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIpV4(String ipV4)
|
|
||||||
{
|
|
||||||
this.ipV4 = ipV4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIpV4()
|
|
||||||
{
|
|
||||||
return ipV4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInDropped(BigDecimal inDropped)
|
|
||||||
{
|
|
||||||
this.inDropped = inDropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getInDropped()
|
|
||||||
{
|
|
||||||
return inDropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutDropped(BigDecimal outDropped)
|
|
||||||
{
|
|
||||||
this.outDropped = outDropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getOutDropped()
|
|
||||||
{
|
|
||||||
return outDropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInSpeed(String inSpeed)
|
|
||||||
{
|
|
||||||
this.inSpeed = inSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInSpeed()
|
|
||||||
{
|
|
||||||
return inSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutSpeed(String outSpeed)
|
|
||||||
{
|
|
||||||
this.outSpeed = outSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOutSpeed()
|
|
||||||
{
|
|
||||||
return outSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpeed(String speed)
|
|
||||||
{
|
|
||||||
this.speed = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSpeed()
|
|
||||||
{
|
|
||||||
return speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDuplex(String duplex)
|
|
||||||
{
|
|
||||||
this.duplex = duplex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDuplex()
|
|
||||||
{
|
|
||||||
return duplex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientId(String clientId)
|
|
||||||
{
|
|
||||||
this.clientId = clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientId()
|
|
||||||
{
|
|
||||||
return clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalInSpeed(String totalInSpeed)
|
|
||||||
{
|
|
||||||
this.totalInSpeed = totalInSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTotalInSpeed()
|
|
||||||
{
|
|
||||||
return totalInSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalOutSpeed(String totalOutSpeed)
|
|
||||||
{
|
|
||||||
this.totalOutSpeed = totalOutSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTotalOutSpeed()
|
|
||||||
{
|
|
||||||
return totalOutSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("mac", getMac())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("type", getType())
|
|
||||||
.append("ipV4", getIpV4())
|
|
||||||
.append("inDropped", getInDropped())
|
|
||||||
.append("outDropped", getOutDropped())
|
|
||||||
.append("inSpeed", getInSpeed())
|
|
||||||
.append("outSpeed", getOutSpeed())
|
|
||||||
.append("speed", getSpeed())
|
|
||||||
.append("duplex", getDuplex())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("clientId", getClientId())
|
|
||||||
.append("totalInSpeed", getTotalInSpeed())
|
|
||||||
.append("totalOutSpeed", getTotalOutSpeed())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.domain.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class PolicyTypeVo {
|
|
||||||
|
|
||||||
/** 服务器监控策略信息 */
|
|
||||||
private String monitors;
|
|
||||||
/** 服务器脚本策略信息 */
|
|
||||||
private String scripts;
|
|
||||||
/** agent更新信息 */
|
|
||||||
private String versions;
|
|
||||||
/** 路由信息 */
|
|
||||||
private String routes;
|
|
||||||
/** 时间戳 */
|
|
||||||
private Long timestamp = Instant.now().getEpochSecond();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.enums;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public enum AlarmTypeEnum {
|
|
||||||
服务器下线("1", "服务器下线"),
|
|
||||||
交换机下线("2", "交换机下线");
|
|
||||||
private final String code;
|
|
||||||
private final String msg;
|
|
||||||
AlarmTypeEnum(String code, String msg){
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,64 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.mapper;
|
|
||||||
|
|
||||||
import com.ruoyi.rocketmq.domain.RmNetworkInterface;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户端网络接口信息Mapper接口
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-10-14
|
|
||||||
*/
|
|
||||||
public interface RmNetworkInterfaceMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 客户端网络接口信息
|
|
||||||
*/
|
|
||||||
public RmNetworkInterface selectRmNetworkInterfaceById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息列表
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 客户端网络接口信息集合
|
|
||||||
*/
|
|
||||||
public List<RmNetworkInterface> selectRmNetworkInterfaceList(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertRmNetworkInterface(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateRmNetworkInterface(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRmNetworkInterfaceById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRmNetworkInterfaceByIds(Long[] ids);
|
|
||||||
|
|
||||||
int updateRmNetworkInterfaceByMac(RmNetworkInterface rmNetworkInterface);
|
|
||||||
}
|
|
||||||
-82
@@ -1,82 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.service;
|
|
||||||
|
|
||||||
import com.ruoyi.rocketmq.domain.RmNetworkInterface;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户端网络接口信息Service接口
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-10-14
|
|
||||||
*/
|
|
||||||
public interface IRmNetworkInterfaceService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 客户端网络接口信息
|
|
||||||
*/
|
|
||||||
public RmNetworkInterface selectRmNetworkInterfaceById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询客户端网络接口信息列表
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 客户端网络接口信息集合
|
|
||||||
*/
|
|
||||||
public List<RmNetworkInterface> selectRmNetworkInterfaceList(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertRmNetworkInterface(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateRmNetworkInterface(RmNetworkInterface rmNetworkInterface);
|
|
||||||
/**
|
|
||||||
* 修改客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param rmNetworkInterface 客户端网络接口信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateRmNetworkInterfaceByMac(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除客户端网络接口信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的客户端网络接口信息主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRmNetworkInterfaceByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除客户端网络接口信息信息
|
|
||||||
*
|
|
||||||
* @param id 客户端网络接口信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRmNetworkInterfaceById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定公网ip
|
|
||||||
* @param rmNetworkInterface
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int bindPublicIp(RmNetworkInterface rmNetworkInterface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新路由信息
|
|
||||||
* @param clientId
|
|
||||||
*/
|
|
||||||
void updateRouteMsg(String clientId);
|
|
||||||
}
|
|
||||||
-283
@@ -1,283 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
|
||||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
|
||||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
|
|
||||||
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
|
|
||||||
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
|
|
||||||
import com.ruoyi.rocketmq.utils.TableRouterUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始带宽流量Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTrafficService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private InitialBandwidthTrafficMapper initialBandwidthTrafficMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询初始带宽流量
|
|
||||||
*
|
|
||||||
* @param id 初始带宽流量主键
|
|
||||||
* @return 初始带宽流量
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialBandwidthTraffic selectInitialBandwidthTrafficById(Long id)
|
|
||||||
{
|
|
||||||
return initialBandwidthTrafficMapper.selectInitialBandwidthTrafficById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询初始带宽流量列表
|
|
||||||
*
|
|
||||||
* @param initialBandwidthTraffic 初始带宽流量
|
|
||||||
* @return 初始带宽流量
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InitialBandwidthTraffic> selectInitialBandwidthTrafficList(InitialBandwidthTraffic initialBandwidthTraffic)
|
|
||||||
{
|
|
||||||
return initialBandwidthTrafficMapper.selectInitialBandwidthTrafficList(initialBandwidthTraffic);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增初始带宽流量
|
|
||||||
*
|
|
||||||
* @param initialBandwidthTraffic 初始带宽流量
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int insertInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic)
|
|
||||||
{
|
|
||||||
initialBandwidthTraffic.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return initialBandwidthTrafficMapper.insertInitialBandwidthTraffic(initialBandwidthTraffic);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改初始带宽流量
|
|
||||||
*
|
|
||||||
* @param initialBandwidthTraffic 初始带宽流量
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic)
|
|
||||||
{
|
|
||||||
initialBandwidthTraffic.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return initialBandwidthTrafficMapper.updateInitialBandwidthTraffic(initialBandwidthTraffic);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除初始带宽流量
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的初始带宽流量主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialBandwidthTrafficByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return initialBandwidthTrafficMapper.deleteInitialBandwidthTrafficByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除初始带宽流量信息
|
|
||||||
*
|
|
||||||
* @param id 初始带宽流量主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialBandwidthTrafficById(Long id)
|
|
||||||
{
|
|
||||||
return initialBandwidthTrafficMapper.deleteInitialBandwidthTrafficById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存单条数据到对应分表
|
|
||||||
* @param data 流量数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void save(InitialBandwidthTraffic data) {
|
|
||||||
if (data.getCreateTime() == null) {
|
|
||||||
data.setCreateTime(DateUtils.getNowDate());
|
|
||||||
}
|
|
||||||
Date date = data.getCreateTime();
|
|
||||||
LocalDateTime createTime = date.toInstant()
|
|
||||||
.atZone(ZoneId.systemDefault())
|
|
||||||
.toLocalDateTime();
|
|
||||||
data.setTableName(TableRouterUtil.getTableName(createTime));
|
|
||||||
initialBandwidthTrafficMapper.insert(data);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 保存多条数据到对应分表
|
|
||||||
* @param initialBandwidthTraffic 流量数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
||||||
public void batchInsert(InitialBandwidthTraffic initialBandwidthTraffic) {
|
|
||||||
if (initialBandwidthTraffic == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<InitialBandwidthTraffic> dataList = initialBandwidthTraffic.getList();
|
|
||||||
if (dataList.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 按表名分组批量插入
|
|
||||||
Map<String, List<InitialBandwidthTraffic>> groupedData = dataList.stream()
|
|
||||||
.map(data -> {
|
|
||||||
try {
|
|
||||||
InitialBandwidthTraffic processed = new InitialBandwidthTraffic();
|
|
||||||
BeanUtils.copyProperties(data,processed);
|
|
||||||
if (data.getCreateTime() == null) {
|
|
||||||
data.setCreateTime(DateUtils.getNowDate());
|
|
||||||
}
|
|
||||||
LocalDateTime createTime = data.getCreateTime().toInstant()
|
|
||||||
.atZone(ZoneId.systemDefault())
|
|
||||||
.toLocalDateTime();
|
|
||||||
processed.setTableName(TableRouterUtil.getTableName(createTime));
|
|
||||||
return processed;
|
|
||||||
} catch (Exception e){
|
|
||||||
log.error("数据处理失败",e.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}).collect(Collectors.groupingBy(
|
|
||||||
InitialBandwidthTraffic::getTableName,
|
|
||||||
LinkedHashMap::new, // 保持插入顺序
|
|
||||||
Collectors.toList()));
|
|
||||||
|
|
||||||
groupedData.forEach((tableName, list) -> {
|
|
||||||
try {
|
|
||||||
InitialBandwidthTraffic data = new InitialBandwidthTraffic();
|
|
||||||
BeanUtils.copyProperties(initialBandwidthTraffic,data);
|
|
||||||
data.setTableName(tableName);
|
|
||||||
data.setList(list);
|
|
||||||
initialBandwidthTrafficMapper.batchInsert(data);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("表{}插入失败", tableName, e);
|
|
||||||
throw new RuntimeException("批量插入失败", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 网络接口基础信息
|
|
||||||
* @param initialBandwidthTraffic
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialBandwidthTraffic getNetInterfaceDetailsMsg(InitialBandwidthTraffic initialBandwidthTraffic) {
|
|
||||||
if (initialBandwidthTraffic.getCreateTime() == null) {
|
|
||||||
initialBandwidthTraffic.setCreateTime(DateUtils.getNowDate());
|
|
||||||
}
|
|
||||||
LocalDateTime createTime = initialBandwidthTraffic.getCreateTime().toInstant()
|
|
||||||
.atZone(ZoneId.systemDefault())
|
|
||||||
.toLocalDateTime();
|
|
||||||
initialBandwidthTraffic.setTableName(TableRouterUtil.getTableName(createTime));
|
|
||||||
InitialBandwidthTraffic detailsMsg = initialBandwidthTrafficMapper.getNetInterfaceDetailsMsg(initialBandwidthTraffic);
|
|
||||||
return detailsMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分表查询需要的信息
|
|
||||||
* @param initialBandwidthTraffic
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<InitialBandwidthTraffic> getListByTableName(InitialBandwidthTraffic initialBandwidthTraffic){
|
|
||||||
// 获取涉及的表名
|
|
||||||
Set<String> tableNames = TableRouterUtil.getTableNamesBetween(initialBandwidthTraffic.getStartTime(), initialBandwidthTraffic.getEndTime());
|
|
||||||
// 并行查询各表
|
|
||||||
List<InitialBandwidthTraffic> list = tableNames.parallelStream()
|
|
||||||
.flatMap(tableName -> {
|
|
||||||
InitialBandwidthTraffic condition = new InitialBandwidthTraffic();
|
|
||||||
condition.setTableName(tableName);
|
|
||||||
condition.setStartTime(initialBandwidthTraffic.getStartTime());
|
|
||||||
condition.setEndTime(initialBandwidthTraffic.getEndTime());
|
|
||||||
condition.setClientId(initialBandwidthTraffic.getClientId());
|
|
||||||
condition.setName(initialBandwidthTraffic.getName());
|
|
||||||
return initialBandwidthTrafficMapper.getNetTrafficList(condition).stream();
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询eth0流量信息并封装为多折线ECharts图表数据
|
|
||||||
* @param initialBandwidthTraffic
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> netInterfaceTrafficEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
|
|
||||||
// 流量信息
|
|
||||||
List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
|
|
||||||
try {
|
|
||||||
String unit = SpeedUtils.calculateUnitWithStringTraffic(list, "inSpeed", "outSpeed");
|
|
||||||
if(initialBandwidthTraffic.getUnit() != null){
|
|
||||||
unit = initialBandwidthTraffic.getUnit();
|
|
||||||
}
|
|
||||||
BigDecimal divisor = SpeedUtils.getDivisor(unit);
|
|
||||||
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("netInSpeedData", info ->
|
|
||||||
info != null && info.getInSpeed() != null ?
|
|
||||||
new BigDecimal(info.getInSpeed()).divide(divisor, 2, RoundingMode.HALF_UP) :
|
|
||||||
0);
|
|
||||||
|
|
||||||
extractors.put("netOutSpeedData", info ->
|
|
||||||
info != null && info.getOutSpeed() != null ?
|
|
||||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 2, RoundingMode.HALF_UP) :
|
|
||||||
0);
|
|
||||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsDataAutoPadding(
|
|
||||||
list, InitialBandwidthTraffic::getCreateTime, extractors,
|
|
||||||
initialBandwidthTraffic.getStartTime(), initialBandwidthTraffic.getEndTime()
|
|
||||||
);
|
|
||||||
resultMap.put("unit", unit);
|
|
||||||
return resultMap;
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
// 安全转换方法(处理可能的NumberFormatException)
|
|
||||||
private Double safeConvertToKB(String byteValue) {
|
|
||||||
try {
|
|
||||||
return byteValue == null ? 0.0 : Double.parseDouble(byteValue) / 1024.0;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return 0.0; // 或根据业务需求返回null/抛出异常
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询eth0流量信息丢包数并封装为折线ECharts图表数据
|
|
||||||
* @param initialBandwidthTraffic
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> netInterfaceDroppedEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
|
|
||||||
// 流量信息
|
|
||||||
List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
|
|
||||||
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("inDroppedData", info -> info.getInDropped());
|
|
||||||
extractors.put("outDroppedData", info -> info.getOutDropped());
|
|
||||||
|
|
||||||
return EchartsDataUtils.buildEchartsDataAutoPadding(
|
|
||||||
list, InitialBandwidthTraffic::getCreateTime, extractors,
|
|
||||||
initialBandwidthTraffic.getStartTime(), initialBandwidthTraffic.getEndTime()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-164
@@ -1,164 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
|
||||||
import com.ruoyi.rocketmq.domain.InitialCpuInfo;
|
|
||||||
import com.ruoyi.rocketmq.mapper.InitialCpuInfoMapper;
|
|
||||||
import com.ruoyi.rocketmq.service.IInitialCpuInfoService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import static com.ruoyi.common.core.utils.EchartsDataUtils.convertMicrosecondsToSeconds;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CPU监控信息Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-25
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private InitialCpuInfoMapper initialCpuInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询CPU监控信息
|
|
||||||
*
|
|
||||||
* @param id CPU监控信息主键
|
|
||||||
* @return CPU监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialCpuInfo selectInitialCpuInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialCpuInfoMapper.selectInitialCpuInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询CPU监控信息列表
|
|
||||||
*
|
|
||||||
* @param initialCpuInfo CPU监控信息
|
|
||||||
* @return CPU监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InitialCpuInfo> selectInitialCpuInfoList(InitialCpuInfo initialCpuInfo)
|
|
||||||
{
|
|
||||||
return initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增CPU监控信息
|
|
||||||
*
|
|
||||||
* @param initialCpuInfo CPU监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertInitialCpuInfo(InitialCpuInfo initialCpuInfo)
|
|
||||||
{
|
|
||||||
initialCpuInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return initialCpuInfoMapper.insertInitialCpuInfo(initialCpuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改CPU监控信息
|
|
||||||
*
|
|
||||||
* @param initialCpuInfo CPU监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateInitialCpuInfo(InitialCpuInfo initialCpuInfo)
|
|
||||||
{
|
|
||||||
initialCpuInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return initialCpuInfoMapper.updateInitialCpuInfo(initialCpuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除CPU监控信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的CPU监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialCpuInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return initialCpuInfoMapper.deleteInitialCpuInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除CPU监控信息信息
|
|
||||||
*
|
|
||||||
* @param id CPU监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialCpuInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialCpuInfoMapper.deleteInitialCpuInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增CPU监控信息信息
|
|
||||||
*
|
|
||||||
* @param list CPU监控信息信息集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
||||||
public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list) {
|
|
||||||
try {
|
|
||||||
return initialCpuInfoMapper.batchInsertInitialCpuInfo(list);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("批量插入CPU信息失败,失败数量:{}", list.size(), e);
|
|
||||||
throw new RuntimeException("批量保存失败",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cpu负载
|
|
||||||
* @param initialCpuInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo) {
|
|
||||||
// 查询原始CPU监控数据并按时间排序
|
|
||||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
|
||||||
|
|
||||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("load1Data", InitialCpuInfo::getAvg1);
|
|
||||||
extractors.put("load5Data", InitialCpuInfo::getAvg5);
|
|
||||||
extractors.put("load15Data", InitialCpuInfo::getAvg15);
|
|
||||||
extractors.put("utiData", InitialCpuInfo::getUti);
|
|
||||||
|
|
||||||
return EchartsDataUtils.buildEchartsData(list, InitialCpuInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* cpu时间(s)
|
|
||||||
* @param initialCpuInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> cpuTimeEcharts(InitialCpuInfo initialCpuInfo) {
|
|
||||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
|
||||||
|
|
||||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("normalData", info -> convertMicrosecondsToSeconds(info.getNormal()));
|
|
||||||
extractors.put("idleData", info -> convertMicrosecondsToSeconds(info.getIdle()));
|
|
||||||
extractors.put("iowaitData", InitialCpuInfo::getIowait);
|
|
||||||
extractors.put("systemData", info -> convertMicrosecondsToSeconds(info.getSystem()));
|
|
||||||
extractors.put("norespData", InitialCpuInfo::getNoresp);
|
|
||||||
extractors.put("userpData", info -> convertMicrosecondsToSeconds(info.getUser()));
|
|
||||||
|
|
||||||
return EchartsDataUtils.buildEchartsData(list,InitialCpuInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-189
@@ -1,189 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
|
||||||
import com.ruoyi.common.core.utils.UnitChangeUtil;
|
|
||||||
import com.ruoyi.rocketmq.domain.InitialDiskInfo;
|
|
||||||
import com.ruoyi.rocketmq.mapper.InitialDiskInfoMapper;
|
|
||||||
import com.ruoyi.rocketmq.service.IInitialDiskInfoService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 磁盘监控信息Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-25
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private InitialDiskInfoMapper initialDiskInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询磁盘监控信息
|
|
||||||
*
|
|
||||||
* @param id 磁盘监控信息主键
|
|
||||||
* @return 磁盘监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialDiskInfo selectInitialDiskInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialDiskInfoMapper.selectInitialDiskInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询磁盘监控信息列表
|
|
||||||
*
|
|
||||||
* @param initialDiskInfo 磁盘监控信息
|
|
||||||
* @return 磁盘监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InitialDiskInfo> selectInitialDiskInfoList(InitialDiskInfo initialDiskInfo)
|
|
||||||
{
|
|
||||||
return initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增磁盘监控信息
|
|
||||||
*
|
|
||||||
* @param initialDiskInfo 磁盘监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertInitialDiskInfo(InitialDiskInfo initialDiskInfo)
|
|
||||||
{
|
|
||||||
initialDiskInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return initialDiskInfoMapper.insertInitialDiskInfo(initialDiskInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改磁盘监控信息
|
|
||||||
*
|
|
||||||
* @param initialDiskInfo 磁盘监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateInitialDiskInfo(InitialDiskInfo initialDiskInfo)
|
|
||||||
{
|
|
||||||
initialDiskInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return initialDiskInfoMapper.updateInitialDiskInfo(initialDiskInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除磁盘监控信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的磁盘监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialDiskInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return initialDiskInfoMapper.deleteInitialDiskInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除磁盘监控信息信息
|
|
||||||
*
|
|
||||||
* @param id 磁盘监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialDiskInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialDiskInfoMapper.deleteInitialDiskInfoById(id);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量新增磁盘监控信息
|
|
||||||
*
|
|
||||||
* @param list 磁盘监控信息集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
||||||
public int batchInsertInitialDiskInfo(List<InitialDiskInfo> list) {
|
|
||||||
try {
|
|
||||||
return initialDiskInfoMapper.batchInsertInitialDiskInfo(list);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("批量插入磁盘信息失败,失败数量:{}", list.size(), e);
|
|
||||||
throw new RuntimeException("批量保存失败",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 磁盘设备/dev/sda基础信息
|
|
||||||
* @param initialDiskInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialDiskInfo getDistDetailsMsg(InitialDiskInfo initialDiskInfo) {
|
|
||||||
InitialDiskInfo info = initialDiskInfoMapper.getDistDetailsMsgByClientId(initialDiskInfo);
|
|
||||||
if(info != null){
|
|
||||||
long gbUnit = 1024L * 1024 * 1024;
|
|
||||||
info.setTotal(info.getTotal() / gbUnit);
|
|
||||||
info.setReadTimesStr(UnitChangeUtil.formatWithUnit(info.getReadTimes()));
|
|
||||||
info.setWriteTimesStr(UnitChangeUtil.formatWithUnit(info.getWriteTimes()));
|
|
||||||
info.setReadBytesStr(UnitChangeUtil.formatWithKbMin(info.getReadBytes()));
|
|
||||||
info.setWriteBytesStr(UnitChangeUtil.formatWithKbMin(info.getWriteBytes()));
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* /dev/sda读写速率(KB/s)
|
|
||||||
* @param initialDiskInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> rwSpeedEcharts(InitialDiskInfo initialDiskInfo) {
|
|
||||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
|
||||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("readSpeedData", info -> info.getReadSpeed() / 1024.0);
|
|
||||||
extractors.put("writeSpeedData", info -> info.getWriteSpeed() / 1024.0);
|
|
||||||
return EchartsDataUtils.buildEchartsData(list, InitialDiskInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* /dev/sda读写次数
|
|
||||||
* @param initialDiskInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> rwTimesEcharts(InitialDiskInfo initialDiskInfo) {
|
|
||||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
|
||||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("readTimesData", info -> info.getReadTimes());
|
|
||||||
extractors.put("writeTimesData", info -> info.getWriteTimes());
|
|
||||||
return EchartsDataUtils.buildEchartsData(list, InitialDiskInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* /dev/sda读写字节
|
|
||||||
* @param initialDiskInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> rwBytesEcharts(InitialDiskInfo initialDiskInfo) {
|
|
||||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
|
||||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("readBytesData", info -> info.getReadBytes());
|
|
||||||
extractors.put("writeBytesData", info -> info.getWriteBytes());
|
|
||||||
return EchartsDataUtils.buildEchartsData(list, InitialDiskInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定服务器的磁盘名称
|
|
||||||
* @param initialDiskInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map> getAllDistName(InitialDiskInfo initialDiskInfo) {
|
|
||||||
return initialDiskInfoMapper.getAllDistName(initialDiskInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-164
@@ -1,164 +0,0 @@
|
|||||||
package com.ruoyi.rocketmq.service.impl;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
|
||||||
import com.ruoyi.common.core.utils.UnitChangeUtil;
|
|
||||||
import com.ruoyi.rocketmq.domain.InitialMountPointInfo;
|
|
||||||
import com.ruoyi.rocketmq.mapper.InitialMountPointInfoMapper;
|
|
||||||
import com.ruoyi.rocketmq.service.IInitialMountPointInfoService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 挂载点监控信息Service业务层处理
|
|
||||||
*
|
|
||||||
* @author gyt
|
|
||||||
* @date 2025-08-25
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private InitialMountPointInfoMapper initialMountPointInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询挂载点监控信息
|
|
||||||
*
|
|
||||||
* @param id 挂载点监控信息主键
|
|
||||||
* @return 挂载点监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public InitialMountPointInfo selectInitialMountPointInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialMountPointInfoMapper.selectInitialMountPointInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询挂载点监控信息列表
|
|
||||||
*
|
|
||||||
* @param initialMountPointInfo 挂载点监控信息
|
|
||||||
* @return 挂载点监控信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InitialMountPointInfo> selectInitialMountPointInfoList(InitialMountPointInfo initialMountPointInfo)
|
|
||||||
{
|
|
||||||
return initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增挂载点监控信息
|
|
||||||
*
|
|
||||||
* @param initialMountPointInfo 挂载点监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertInitialMountPointInfo(InitialMountPointInfo initialMountPointInfo)
|
|
||||||
{
|
|
||||||
initialMountPointInfo.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return initialMountPointInfoMapper.insertInitialMountPointInfo(initialMountPointInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改挂载点监控信息
|
|
||||||
*
|
|
||||||
* @param initialMountPointInfo 挂载点监控信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateInitialMountPointInfo(InitialMountPointInfo initialMountPointInfo)
|
|
||||||
{
|
|
||||||
initialMountPointInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return initialMountPointInfoMapper.updateInitialMountPointInfo(initialMountPointInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除挂载点监控信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的挂载点监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialMountPointInfoByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return initialMountPointInfoMapper.deleteInitialMountPointInfoByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除挂载点监控信息信息
|
|
||||||
*
|
|
||||||
* @param id 挂载点监控信息主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteInitialMountPointInfoById(Long id)
|
|
||||||
{
|
|
||||||
return initialMountPointInfoMapper.deleteInitialMountPointInfoById(id);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量新增挂载点监控信息
|
|
||||||
*
|
|
||||||
* @param list 挂载点监控信息集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
||||||
public int batchInsertInitialMountPointInfo(List<InitialMountPointInfo> list) {
|
|
||||||
try {
|
|
||||||
return initialMountPointInfoMapper.batchInsertInitialMountPointInfo(list);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("批量插入挂载点信息失败,失败数量:{}", list.size(), e);
|
|
||||||
throw new RuntimeException("批量保存失败",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InitialMountPointInfo pointDetailsMsg(InitialMountPointInfo initialMountPointInfo) {
|
|
||||||
return initialMountPointInfoMapper.pointDetailsMsg(initialMountPointInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取挂载点监控信息的空间图形
|
|
||||||
* @param initialMountPointInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> spaceEcharts(InitialMountPointInfo initialMountPointInfo) {
|
|
||||||
List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
|
|
||||||
Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("vfsFreeData", info -> UnitChangeUtil.bytesToGb(info.getVfsFree()));
|
|
||||||
extractors.put("vfsTotalData", info -> UnitChangeUtil.bytesToGb(info.getVfsTotal()));
|
|
||||||
return EchartsDataUtils.buildEchartsData(list,InitialMountPointInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取挂载文件/的空间利用率
|
|
||||||
* @param initialMountPointInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> spaceRateEcharts(InitialMountPointInfo initialMountPointInfo) {
|
|
||||||
List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
|
|
||||||
Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
|
|
||||||
extractors.put("vfsUtilData", InitialMountPointInfo::getVfsUtil);
|
|
||||||
return EchartsDataUtils.buildEchartsData(list,InitialMountPointInfo::getCreateTime, extractors);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定服务器的挂载文件系统名
|
|
||||||
* @param initialMountPointInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map> getAllMountName(InitialMountPointInfo initialMountPointInfo) {
|
|
||||||
return initialMountPointInfoMapper.getAllMountName(initialMountPointInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
package com.ruoyi.modules.monitor;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监控中心
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@EnableAdminServer
|
|
||||||
@SpringBootApplication
|
|
||||||
public class RuoYiMonitorApplication
|
|
||||||
{
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
SpringApplication.run(RuoYiMonitorApplication.class, args);
|
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 监控中心启动成功 ლ(´ڡ`ლ)゙ \n" +
|
|
||||||
" .-------. ____ __ \n" +
|
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
|
||||||
" | | \\ `' /| `-' / \n" +
|
|
||||||
" | | \\ / \\ / \n" +
|
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
||||||
_ _ _
|
|
||||||
(_) (_)| |
|
|
||||||
_ __ _ _ ___ _ _ _ ______ _ __ ___ ___ _ __ _ | |_ ___ _ __
|
|
||||||
| '__|| | | | / _ \ | | | || ||______|| '_ ` _ \ / _ \ | '_ \ | || __| / _ \ | '__|
|
|
||||||
| | | |_| || (_) || |_| || | | | | | | || (_) || | | || || |_ | (_) || |
|
|
||||||
|_| \__,_| \___/ \__, ||_| |_| |_| |_| \___/ |_| |_||_| \__| \___/ |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/ruoyi-visual-monitor" />
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.ruoyi" level="info" />
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn" />
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info" />
|
|
||||||
<appender-ref ref="file_error" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
-174
@@ -1,174 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_LOCKS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
|
|
||||||
DROP TABLE IF EXISTS QRTZ_CALENDARS;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 1、存储每一个已配置的 jobDetail 的详细信息
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_JOB_DETAILS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
job_name varchar(200) not null comment '任务名称',
|
|
||||||
job_group varchar(200) not null comment '任务组名',
|
|
||||||
description varchar(250) null comment '相关介绍',
|
|
||||||
job_class_name varchar(250) not null comment '执行任务类名称',
|
|
||||||
is_durable varchar(1) not null comment '是否持久化',
|
|
||||||
is_nonconcurrent varchar(1) not null comment '是否并发',
|
|
||||||
is_update_data varchar(1) not null comment '是否更新数据',
|
|
||||||
requests_recovery varchar(1) not null comment '是否接受恢复执行',
|
|
||||||
job_data blob null comment '存放持久化job对象',
|
|
||||||
primary key (sched_name, job_name, job_group)
|
|
||||||
) engine=innodb comment = '任务详细信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 2、 存储已配置的 Trigger 的信息
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_name varchar(200) not null comment '触发器的名字',
|
|
||||||
trigger_group varchar(200) not null comment '触发器所属组的名字',
|
|
||||||
job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键',
|
|
||||||
job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键',
|
|
||||||
description varchar(250) null comment '相关介绍',
|
|
||||||
next_fire_time bigint(13) null comment '上一次触发时间(毫秒)',
|
|
||||||
prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发)',
|
|
||||||
priority integer null comment '优先级',
|
|
||||||
trigger_state varchar(16) not null comment '触发器状态',
|
|
||||||
trigger_type varchar(8) not null comment '触发器的类型',
|
|
||||||
start_time bigint(13) not null comment '开始时间',
|
|
||||||
end_time bigint(13) null comment '结束时间',
|
|
||||||
calendar_name varchar(200) null comment '日程表名称',
|
|
||||||
misfire_instr smallint(2) null comment '补偿执行的策略',
|
|
||||||
job_data blob null comment '存放持久化job对象',
|
|
||||||
primary key (sched_name, trigger_name, trigger_group),
|
|
||||||
foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group)
|
|
||||||
) engine=innodb comment = '触发器详细信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_SIMPLE_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
repeat_count bigint(7) not null comment '重复的次数统计',
|
|
||||||
repeat_interval bigint(12) not null comment '重复的间隔时间',
|
|
||||||
times_triggered bigint(10) not null comment '已经触发的次数',
|
|
||||||
primary key (sched_name, trigger_name, trigger_group),
|
|
||||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
|
||||||
) engine=innodb comment = '简单触发器的信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_CRON_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
cron_expression varchar(200) not null comment 'cron表达式',
|
|
||||||
time_zone_id varchar(80) comment '时区',
|
|
||||||
primary key (sched_name, trigger_name, trigger_group),
|
|
||||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
|
||||||
) engine=innodb comment = 'Cron类型的触发器表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候)
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_BLOB_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
blob_data blob null comment '存放持久化Trigger对象',
|
|
||||||
primary key (sched_name, trigger_name, trigger_group),
|
|
||||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
|
||||||
) engine=innodb comment = 'Blob类型的触发器表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_CALENDARS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
calendar_name varchar(200) not null comment '日历名称',
|
|
||||||
calendar blob not null comment '存放持久化calendar对象',
|
|
||||||
primary key (sched_name, calendar_name)
|
|
||||||
) engine=innodb comment = '日历信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 7、 存储已暂停的 Trigger 组的信息
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_PAUSED_TRIGGER_GRPS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
primary key (sched_name, trigger_group)
|
|
||||||
) engine=innodb comment = '暂停的触发器表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_FIRED_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
entry_id varchar(95) not null comment '调度器实例id',
|
|
||||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
instance_name varchar(200) not null comment '调度器实例名',
|
|
||||||
fired_time bigint(13) not null comment '触发的时间',
|
|
||||||
sched_time bigint(13) not null comment '定时器制定的时间',
|
|
||||||
priority integer not null comment '优先级',
|
|
||||||
state varchar(16) not null comment '状态',
|
|
||||||
job_name varchar(200) null comment '任务名称',
|
|
||||||
job_group varchar(200) null comment '任务组名',
|
|
||||||
is_nonconcurrent varchar(1) null comment '是否并发',
|
|
||||||
requests_recovery varchar(1) null comment '是否接受恢复执行',
|
|
||||||
primary key (sched_name, entry_id)
|
|
||||||
) engine=innodb comment = '已触发的触发器表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_SCHEDULER_STATE (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
instance_name varchar(200) not null comment '实例名称',
|
|
||||||
last_checkin_time bigint(13) not null comment '上次检查时间',
|
|
||||||
checkin_interval bigint(13) not null comment '检查间隔时间',
|
|
||||||
primary key (sched_name, instance_name)
|
|
||||||
) engine=innodb comment = '调度器状态表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_LOCKS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
lock_name varchar(40) not null comment '悲观锁名称',
|
|
||||||
primary key (sched_name, lock_name)
|
|
||||||
) engine=innodb comment = '存储的悲观锁信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 11、 Quartz集群实现同步机制的行锁表
|
|
||||||
-- ----------------------------
|
|
||||||
create table QRTZ_SIMPROP_TRIGGERS (
|
|
||||||
sched_name varchar(120) not null comment '调度名称',
|
|
||||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
|
||||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
|
||||||
str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数',
|
|
||||||
str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数',
|
|
||||||
str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数',
|
|
||||||
int_prop_1 int null comment 'int类型的trigger的第一个参数',
|
|
||||||
int_prop_2 int null comment 'int类型的trigger的第二个参数',
|
|
||||||
long_prop_1 bigint null comment 'long类型的trigger的第一个参数',
|
|
||||||
long_prop_2 bigint null comment 'long类型的trigger的第二个参数',
|
|
||||||
dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数',
|
|
||||||
dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数',
|
|
||||||
bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数',
|
|
||||||
bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数',
|
|
||||||
primary key (sched_name, trigger_name, trigger_group),
|
|
||||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
|
||||||
) engine=innodb comment = '同步机制的行锁表';
|
|
||||||
|
|
||||||
commit;
|
|
||||||
@@ -1,700 +0,0 @@
|
|||||||
SET NAMES utf8mb4;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 1、部门表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_dept;
|
|
||||||
create table sys_dept (
|
|
||||||
dept_id bigint(20) not null auto_increment comment '部门id',
|
|
||||||
parent_id bigint(20) default 0 comment '父部门id',
|
|
||||||
ancestors varchar(50) default '' comment '祖级列表',
|
|
||||||
dept_name varchar(30) default '' comment '部门名称',
|
|
||||||
order_num int(4) default 0 comment '显示顺序',
|
|
||||||
leader varchar(20) default null comment '负责人',
|
|
||||||
phone varchar(11) default null comment '联系电话',
|
|
||||||
email varchar(50) default null comment '邮箱',
|
|
||||||
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
primary key (dept_id)
|
|
||||||
) engine=innodb auto_increment=200 comment = '部门表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-部门表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 2、用户信息表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_user;
|
|
||||||
create table sys_user (
|
|
||||||
user_id bigint(20) not null auto_increment comment '用户ID',
|
|
||||||
dept_id bigint(20) default null comment '部门ID',
|
|
||||||
user_name varchar(30) not null comment '用户账号',
|
|
||||||
nick_name varchar(30) not null comment '用户昵称',
|
|
||||||
user_type varchar(2) default '00' comment '用户类型(00系统用户)',
|
|
||||||
email varchar(50) default '' comment '用户邮箱',
|
|
||||||
phonenumber varchar(11) default '' comment '手机号码',
|
|
||||||
sex char(1) default '0' comment '用户性别(0男 1女 2未知)',
|
|
||||||
avatar varchar(100) default '' comment '头像地址',
|
|
||||||
password varchar(100) default '' comment '密码',
|
|
||||||
status char(1) default '0' comment '账号状态(0正常 1停用)',
|
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
|
||||||
login_ip varchar(128) default '' comment '最后登录IP',
|
|
||||||
login_date datetime comment '最后登录时间',
|
|
||||||
pwd_update_date datetime comment '密码最后更新时间',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (user_id)
|
|
||||||
) engine=innodb auto_increment=100 comment = '用户信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-用户信息表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '管理员');
|
|
||||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '测试员');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 3、岗位信息表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_post;
|
|
||||||
create table sys_post
|
|
||||||
(
|
|
||||||
post_id bigint(20) not null auto_increment comment '岗位ID',
|
|
||||||
post_code varchar(64) not null comment '岗位编码',
|
|
||||||
post_name varchar(50) not null comment '岗位名称',
|
|
||||||
post_sort int(4) not null comment '显示顺序',
|
|
||||||
status char(1) not null comment '状态(0正常 1停用)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (post_id)
|
|
||||||
) engine=innodb comment = '岗位信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-岗位信息表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, '');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 4、角色信息表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_role;
|
|
||||||
create table sys_role (
|
|
||||||
role_id bigint(20) not null auto_increment comment '角色ID',
|
|
||||||
role_name varchar(30) not null comment '角色名称',
|
|
||||||
role_key varchar(100) not null comment '角色权限字符串',
|
|
||||||
role_sort int(4) not null comment '显示顺序',
|
|
||||||
data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)',
|
|
||||||
menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
|
|
||||||
dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示',
|
|
||||||
status char(1) not null comment '角色状态(0正常 1停用)',
|
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (role_id)
|
|
||||||
) engine=innodb auto_increment=100 comment = '角色信息表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-角色信息表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员');
|
|
||||||
insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 5、菜单权限表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_menu;
|
|
||||||
create table sys_menu (
|
|
||||||
menu_id bigint(20) not null auto_increment comment '菜单ID',
|
|
||||||
menu_name varchar(50) not null comment '菜单名称',
|
|
||||||
parent_id bigint(20) default 0 comment '父菜单ID',
|
|
||||||
order_num int(4) default 0 comment '显示顺序',
|
|
||||||
path varchar(200) default '' comment '路由地址',
|
|
||||||
component varchar(255) default null comment '组件路径',
|
|
||||||
query varchar(255) default null comment '路由参数',
|
|
||||||
route_name varchar(50) default '' comment '路由名称',
|
|
||||||
is_frame int(1) default 1 comment '是否为外链(0是 1否)',
|
|
||||||
is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)',
|
|
||||||
menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)',
|
|
||||||
visible char(1) default 0 comment '菜单状态(0显示 1隐藏)',
|
|
||||||
status char(1) default 0 comment '菜单状态(0正常 1停用)',
|
|
||||||
perms varchar(100) default null comment '权限标识',
|
|
||||||
icon varchar(100) default '#' comment '菜单图标',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default '' comment '备注',
|
|
||||||
primary key (menu_id)
|
|
||||||
) engine=innodb auto_increment=2000 comment = '菜单权限表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-菜单信息表数据
|
|
||||||
-- ----------------------------
|
|
||||||
-- 一级菜单
|
|
||||||
insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录');
|
|
||||||
insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录');
|
|
||||||
insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录');
|
|
||||||
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址');
|
|
||||||
-- 二级菜单
|
|
||||||
insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单');
|
|
||||||
insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单');
|
|
||||||
insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单');
|
|
||||||
insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单');
|
|
||||||
insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单');
|
|
||||||
insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单');
|
|
||||||
insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单');
|
|
||||||
insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单');
|
|
||||||
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
|
|
||||||
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
|
|
||||||
insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
|
|
||||||
insert into sys_menu values('111', 'Sentinel控制台', '2', '3', 'http://localhost:8718', '', '', '', 0, 0, 'C', '0', '0', 'monitor:sentinel:list', 'sentinel', 'admin', sysdate(), '', null, '流量控制菜单');
|
|
||||||
insert into sys_menu values('112', 'Nacos控制台', '2', '4', 'http://localhost:8848/nacos', '', '', '', 0, 0, 'C', '0', '0', 'monitor:nacos:list', 'nacos', 'admin', sysdate(), '', null, '服务治理菜单');
|
|
||||||
insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://localhost:9100/login', '', '', '', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
|
||||||
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
|
|
||||||
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
|
|
||||||
insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:8080/swagger-ui/index.html', '', '', '', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
|
||||||
-- 三级菜单
|
|
||||||
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'system/operlog/index', '', '', 1, 0, 'C', '0', '0', 'system:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
|
|
||||||
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'system/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'system:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
|
|
||||||
-- 用户管理按钮
|
|
||||||
insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 角色管理按钮
|
|
||||||
insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 菜单管理按钮
|
|
||||||
insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 部门管理按钮
|
|
||||||
insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 岗位管理按钮
|
|
||||||
insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 字典管理按钮
|
|
||||||
insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 参数设置按钮
|
|
||||||
insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 通知公告按钮
|
|
||||||
insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 操作日志按钮
|
|
||||||
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:operlog:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:operlog:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:operlog:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 登录日志按钮
|
|
||||||
insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:unlock', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 在线用户按钮
|
|
||||||
insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 定时任务按钮
|
|
||||||
insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
-- 代码生成按钮
|
|
||||||
insert into sys_menu values('1055', '生成查询', '115', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1056', '生成修改', '115', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1057', '生成删除', '115', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1058', '导入代码', '115', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1059', '预览代码', '115', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_menu values('1060', '生成代码', '115', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 6、用户和角色关联表 用户N-1角色
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_user_role;
|
|
||||||
create table sys_user_role (
|
|
||||||
user_id bigint(20) not null comment '用户ID',
|
|
||||||
role_id bigint(20) not null comment '角色ID',
|
|
||||||
primary key(user_id, role_id)
|
|
||||||
) engine=innodb comment = '用户和角色关联表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-用户和角色关联表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_user_role values ('1', '1');
|
|
||||||
insert into sys_user_role values ('2', '2');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 7、角色和菜单关联表 角色1-N菜单
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_role_menu;
|
|
||||||
create table sys_role_menu (
|
|
||||||
role_id bigint(20) not null comment '角色ID',
|
|
||||||
menu_id bigint(20) not null comment '菜单ID',
|
|
||||||
primary key(role_id, menu_id)
|
|
||||||
) engine=innodb comment = '角色和菜单关联表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-角色和菜单关联表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_role_menu values ('2', '1');
|
|
||||||
insert into sys_role_menu values ('2', '2');
|
|
||||||
insert into sys_role_menu values ('2', '3');
|
|
||||||
insert into sys_role_menu values ('2', '4');
|
|
||||||
insert into sys_role_menu values ('2', '100');
|
|
||||||
insert into sys_role_menu values ('2', '101');
|
|
||||||
insert into sys_role_menu values ('2', '102');
|
|
||||||
insert into sys_role_menu values ('2', '103');
|
|
||||||
insert into sys_role_menu values ('2', '104');
|
|
||||||
insert into sys_role_menu values ('2', '105');
|
|
||||||
insert into sys_role_menu values ('2', '106');
|
|
||||||
insert into sys_role_menu values ('2', '107');
|
|
||||||
insert into sys_role_menu values ('2', '108');
|
|
||||||
insert into sys_role_menu values ('2', '109');
|
|
||||||
insert into sys_role_menu values ('2', '110');
|
|
||||||
insert into sys_role_menu values ('2', '111');
|
|
||||||
insert into sys_role_menu values ('2', '112');
|
|
||||||
insert into sys_role_menu values ('2', '113');
|
|
||||||
insert into sys_role_menu values ('2', '114');
|
|
||||||
insert into sys_role_menu values ('2', '115');
|
|
||||||
insert into sys_role_menu values ('2', '116');
|
|
||||||
insert into sys_role_menu values ('2', '500');
|
|
||||||
insert into sys_role_menu values ('2', '501');
|
|
||||||
insert into sys_role_menu values ('2', '1000');
|
|
||||||
insert into sys_role_menu values ('2', '1001');
|
|
||||||
insert into sys_role_menu values ('2', '1002');
|
|
||||||
insert into sys_role_menu values ('2', '1003');
|
|
||||||
insert into sys_role_menu values ('2', '1004');
|
|
||||||
insert into sys_role_menu values ('2', '1005');
|
|
||||||
insert into sys_role_menu values ('2', '1006');
|
|
||||||
insert into sys_role_menu values ('2', '1007');
|
|
||||||
insert into sys_role_menu values ('2', '1008');
|
|
||||||
insert into sys_role_menu values ('2', '1009');
|
|
||||||
insert into sys_role_menu values ('2', '1010');
|
|
||||||
insert into sys_role_menu values ('2', '1011');
|
|
||||||
insert into sys_role_menu values ('2', '1012');
|
|
||||||
insert into sys_role_menu values ('2', '1013');
|
|
||||||
insert into sys_role_menu values ('2', '1014');
|
|
||||||
insert into sys_role_menu values ('2', '1015');
|
|
||||||
insert into sys_role_menu values ('2', '1016');
|
|
||||||
insert into sys_role_menu values ('2', '1017');
|
|
||||||
insert into sys_role_menu values ('2', '1018');
|
|
||||||
insert into sys_role_menu values ('2', '1019');
|
|
||||||
insert into sys_role_menu values ('2', '1020');
|
|
||||||
insert into sys_role_menu values ('2', '1021');
|
|
||||||
insert into sys_role_menu values ('2', '1022');
|
|
||||||
insert into sys_role_menu values ('2', '1023');
|
|
||||||
insert into sys_role_menu values ('2', '1024');
|
|
||||||
insert into sys_role_menu values ('2', '1025');
|
|
||||||
insert into sys_role_menu values ('2', '1026');
|
|
||||||
insert into sys_role_menu values ('2', '1027');
|
|
||||||
insert into sys_role_menu values ('2', '1028');
|
|
||||||
insert into sys_role_menu values ('2', '1029');
|
|
||||||
insert into sys_role_menu values ('2', '1030');
|
|
||||||
insert into sys_role_menu values ('2', '1031');
|
|
||||||
insert into sys_role_menu values ('2', '1032');
|
|
||||||
insert into sys_role_menu values ('2', '1033');
|
|
||||||
insert into sys_role_menu values ('2', '1034');
|
|
||||||
insert into sys_role_menu values ('2', '1035');
|
|
||||||
insert into sys_role_menu values ('2', '1036');
|
|
||||||
insert into sys_role_menu values ('2', '1037');
|
|
||||||
insert into sys_role_menu values ('2', '1038');
|
|
||||||
insert into sys_role_menu values ('2', '1039');
|
|
||||||
insert into sys_role_menu values ('2', '1040');
|
|
||||||
insert into sys_role_menu values ('2', '1041');
|
|
||||||
insert into sys_role_menu values ('2', '1042');
|
|
||||||
insert into sys_role_menu values ('2', '1043');
|
|
||||||
insert into sys_role_menu values ('2', '1044');
|
|
||||||
insert into sys_role_menu values ('2', '1045');
|
|
||||||
insert into sys_role_menu values ('2', '1046');
|
|
||||||
insert into sys_role_menu values ('2', '1047');
|
|
||||||
insert into sys_role_menu values ('2', '1048');
|
|
||||||
insert into sys_role_menu values ('2', '1049');
|
|
||||||
insert into sys_role_menu values ('2', '1050');
|
|
||||||
insert into sys_role_menu values ('2', '1051');
|
|
||||||
insert into sys_role_menu values ('2', '1052');
|
|
||||||
insert into sys_role_menu values ('2', '1053');
|
|
||||||
insert into sys_role_menu values ('2', '1054');
|
|
||||||
insert into sys_role_menu values ('2', '1055');
|
|
||||||
insert into sys_role_menu values ('2', '1056');
|
|
||||||
insert into sys_role_menu values ('2', '1057');
|
|
||||||
insert into sys_role_menu values ('2', '1058');
|
|
||||||
insert into sys_role_menu values ('2', '1059');
|
|
||||||
insert into sys_role_menu values ('2', '1060');
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 8、角色和部门关联表 角色1-N部门
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_role_dept;
|
|
||||||
create table sys_role_dept (
|
|
||||||
role_id bigint(20) not null comment '角色ID',
|
|
||||||
dept_id bigint(20) not null comment '部门ID',
|
|
||||||
primary key(role_id, dept_id)
|
|
||||||
) engine=innodb comment = '角色和部门关联表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-角色和部门关联表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_role_dept values ('2', '100');
|
|
||||||
insert into sys_role_dept values ('2', '101');
|
|
||||||
insert into sys_role_dept values ('2', '105');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 9、用户与岗位关联表 用户1-N岗位
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_user_post;
|
|
||||||
create table sys_user_post
|
|
||||||
(
|
|
||||||
user_id bigint(20) not null comment '用户ID',
|
|
||||||
post_id bigint(20) not null comment '岗位ID',
|
|
||||||
primary key (user_id, post_id)
|
|
||||||
) engine=innodb comment = '用户与岗位关联表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-用户与岗位关联表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_user_post values ('1', '1');
|
|
||||||
insert into sys_user_post values ('2', '2');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 10、操作日志记录
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_oper_log;
|
|
||||||
create table sys_oper_log (
|
|
||||||
oper_id bigint(20) not null auto_increment comment '日志主键',
|
|
||||||
title varchar(50) default '' comment '模块标题',
|
|
||||||
business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
|
|
||||||
method varchar(200) default '' comment '方法名称',
|
|
||||||
request_method varchar(10) default '' comment '请求方式',
|
|
||||||
operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)',
|
|
||||||
oper_name varchar(50) default '' comment '操作人员',
|
|
||||||
dept_name varchar(50) default '' comment '部门名称',
|
|
||||||
oper_url varchar(255) default '' comment '请求URL',
|
|
||||||
oper_ip varchar(128) default '' comment '主机地址',
|
|
||||||
oper_location varchar(255) default '' comment '操作地点',
|
|
||||||
oper_param varchar(2000) default '' comment '请求参数',
|
|
||||||
json_result varchar(2000) default '' comment '返回参数',
|
|
||||||
status int(1) default 0 comment '操作状态(0正常 1异常)',
|
|
||||||
error_msg varchar(2000) default '' comment '错误消息',
|
|
||||||
oper_time datetime comment '操作时间',
|
|
||||||
cost_time bigint(20) default 0 comment '消耗时间',
|
|
||||||
primary key (oper_id),
|
|
||||||
key idx_sys_oper_log_bt (business_type),
|
|
||||||
key idx_sys_oper_log_s (status),
|
|
||||||
key idx_sys_oper_log_ot (oper_time)
|
|
||||||
) engine=innodb auto_increment=100 comment = '操作日志记录';
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 11、字典类型表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_dict_type;
|
|
||||||
create table sys_dict_type
|
|
||||||
(
|
|
||||||
dict_id bigint(20) not null auto_increment comment '字典主键',
|
|
||||||
dict_name varchar(100) default '' comment '字典名称',
|
|
||||||
dict_type varchar(100) default '' comment '字典类型',
|
|
||||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (dict_id),
|
|
||||||
unique (dict_type)
|
|
||||||
) engine=innodb auto_increment=100 comment = '字典类型表';
|
|
||||||
|
|
||||||
insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表');
|
|
||||||
insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表');
|
|
||||||
insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表');
|
|
||||||
insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表');
|
|
||||||
insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表');
|
|
||||||
insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表');
|
|
||||||
insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表');
|
|
||||||
insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表');
|
|
||||||
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表');
|
|
||||||
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 12、字典数据表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_dict_data;
|
|
||||||
create table sys_dict_data
|
|
||||||
(
|
|
||||||
dict_code bigint(20) not null auto_increment comment '字典编码',
|
|
||||||
dict_sort int(4) default 0 comment '字典排序',
|
|
||||||
dict_label varchar(100) default '' comment '字典标签',
|
|
||||||
dict_value varchar(100) default '' comment '字典键值',
|
|
||||||
dict_type varchar(100) default '' comment '字典类型',
|
|
||||||
css_class varchar(100) default null comment '样式属性(其他样式扩展)',
|
|
||||||
list_class varchar(100) default null comment '表格回显样式',
|
|
||||||
is_default char(1) default 'N' comment '是否默认(Y是 N否)',
|
|
||||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (dict_code)
|
|
||||||
) engine=innodb auto_increment=100 comment = '字典数据表';
|
|
||||||
|
|
||||||
insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男');
|
|
||||||
insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女');
|
|
||||||
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知');
|
|
||||||
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单');
|
|
||||||
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单');
|
|
||||||
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
|
||||||
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
|
||||||
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
|
||||||
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
|
||||||
insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组');
|
|
||||||
insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组');
|
|
||||||
insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是');
|
|
||||||
insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否');
|
|
||||||
insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知');
|
|
||||||
insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告');
|
|
||||||
insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
|
||||||
insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态');
|
|
||||||
insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他操作');
|
|
||||||
insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作');
|
|
||||||
insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作');
|
|
||||||
insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作');
|
|
||||||
insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作');
|
|
||||||
insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作');
|
|
||||||
insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作');
|
|
||||||
insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作');
|
|
||||||
insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作');
|
|
||||||
insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作');
|
|
||||||
insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态');
|
|
||||||
insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 13、参数配置表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_config;
|
|
||||||
create table sys_config (
|
|
||||||
config_id int(5) not null auto_increment comment '参数主键',
|
|
||||||
config_name varchar(100) default '' comment '参数名称',
|
|
||||||
config_key varchar(100) default '' comment '参数键名',
|
|
||||||
config_value varchar(500) default '' comment '参数键值',
|
|
||||||
config_type char(1) default 'N' comment '系统内置(Y是 N否)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (config_id)
|
|
||||||
) engine=innodb auto_increment=100 comment = '参数配置表';
|
|
||||||
|
|
||||||
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
|
|
||||||
insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' );
|
|
||||||
insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' );
|
|
||||||
insert into sys_config values(4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)');
|
|
||||||
insert into sys_config values(5, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)');
|
|
||||||
insert into sys_config values(6, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '1', 'Y', 'admin', sysdate(), '', null, '0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框');
|
|
||||||
insert into sys_config values(7, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 14、系统访问记录
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_logininfor;
|
|
||||||
create table sys_logininfor (
|
|
||||||
info_id bigint(20) not null auto_increment comment '访问ID',
|
|
||||||
user_name varchar(50) default '' comment '用户账号',
|
|
||||||
ipaddr varchar(128) default '' comment '登录IP地址',
|
|
||||||
status char(1) default '0' comment '登录状态(0成功 1失败)',
|
|
||||||
msg varchar(255) default '' comment '提示信息',
|
|
||||||
access_time datetime comment '访问时间',
|
|
||||||
primary key (info_id),
|
|
||||||
key idx_sys_logininfor_s (status),
|
|
||||||
key idx_sys_logininfor_lt (access_time)
|
|
||||||
) engine=innodb auto_increment=100 comment = '系统访问记录';
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 15、定时任务调度表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_job;
|
|
||||||
create table sys_job (
|
|
||||||
job_id bigint(20) not null auto_increment comment '任务ID',
|
|
||||||
job_name varchar(64) default '' comment '任务名称',
|
|
||||||
job_group varchar(64) default 'DEFAULT' comment '任务组名',
|
|
||||||
invoke_target varchar(500) not null comment '调用目标字符串',
|
|
||||||
cron_expression varchar(255) default '' comment 'cron执行表达式',
|
|
||||||
misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)',
|
|
||||||
concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)',
|
|
||||||
status char(1) default '0' comment '状态(0正常 1暂停)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default '' comment '备注信息',
|
|
||||||
primary key (job_id, job_name, job_group)
|
|
||||||
) engine=innodb auto_increment=100 comment = '定时任务调度表';
|
|
||||||
|
|
||||||
insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
|
||||||
insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 16、定时任务调度日志表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_job_log;
|
|
||||||
create table sys_job_log (
|
|
||||||
job_log_id bigint(20) not null auto_increment comment '任务日志ID',
|
|
||||||
job_name varchar(64) not null comment '任务名称',
|
|
||||||
job_group varchar(64) not null comment '任务组名',
|
|
||||||
invoke_target varchar(500) not null comment '调用目标字符串',
|
|
||||||
job_message varchar(500) comment '日志信息',
|
|
||||||
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
|
||||||
exception_info varchar(2000) default '' comment '异常信息',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
primary key (job_log_id)
|
|
||||||
) engine=innodb comment = '定时任务调度日志表';
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 17、通知公告表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists sys_notice;
|
|
||||||
create table sys_notice (
|
|
||||||
notice_id int(4) not null auto_increment comment '公告ID',
|
|
||||||
notice_title varchar(50) not null comment '公告标题',
|
|
||||||
notice_type char(1) not null comment '公告类型(1通知 2公告)',
|
|
||||||
notice_content longblob default null comment '公告内容',
|
|
||||||
status char(1) default '0' comment '公告状态(0正常 1关闭)',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(255) default null comment '备注',
|
|
||||||
primary key (notice_id)
|
|
||||||
) engine=innodb auto_increment=10 comment = '通知公告表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 初始化-公告信息表数据
|
|
||||||
-- ----------------------------
|
|
||||||
insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员');
|
|
||||||
insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员');
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 18、代码生成业务表
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists gen_table;
|
|
||||||
create table gen_table (
|
|
||||||
table_id bigint(20) not null auto_increment comment '编号',
|
|
||||||
table_name varchar(200) default '' comment '表名称',
|
|
||||||
table_comment varchar(500) default '' comment '表描述',
|
|
||||||
sub_table_name varchar(64) default null comment '关联子表的表名',
|
|
||||||
sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
|
|
||||||
class_name varchar(100) default '' comment '实体类名称',
|
|
||||||
tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)',
|
|
||||||
tpl_web_type varchar(30) default '' comment '前端模板类型(element-ui模版 element-plus模版)',
|
|
||||||
package_name varchar(100) comment '生成包路径',
|
|
||||||
module_name varchar(30) comment '生成模块名',
|
|
||||||
business_name varchar(30) comment '生成业务名',
|
|
||||||
function_name varchar(50) comment '生成功能名',
|
|
||||||
function_author varchar(50) comment '生成功能作者',
|
|
||||||
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
|
|
||||||
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
|
||||||
options varchar(1000) comment '其它生成选项',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
remark varchar(500) default null comment '备注',
|
|
||||||
primary key (table_id)
|
|
||||||
) engine=innodb auto_increment=1 comment = '代码生成业务表';
|
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 19、代码生成业务表字段
|
|
||||||
-- ----------------------------
|
|
||||||
drop table if exists gen_table_column;
|
|
||||||
create table gen_table_column (
|
|
||||||
column_id bigint(20) not null auto_increment comment '编号',
|
|
||||||
table_id bigint(20) comment '归属表编号',
|
|
||||||
column_name varchar(200) comment '列名称',
|
|
||||||
column_comment varchar(500) comment '列描述',
|
|
||||||
column_type varchar(100) comment '列类型',
|
|
||||||
java_type varchar(500) comment 'JAVA类型',
|
|
||||||
java_field varchar(200) comment 'JAVA字段名',
|
|
||||||
is_pk char(1) comment '是否主键(1是)',
|
|
||||||
is_increment char(1) comment '是否自增(1是)',
|
|
||||||
is_required char(1) comment '是否必填(1是)',
|
|
||||||
is_insert char(1) comment '是否为插入字段(1是)',
|
|
||||||
is_edit char(1) comment '是否编辑字段(1是)',
|
|
||||||
is_list char(1) comment '是否列表字段(1是)',
|
|
||||||
is_query char(1) comment '是否查询字段(1是)',
|
|
||||||
query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
|
|
||||||
html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
|
|
||||||
dict_type varchar(200) default '' comment '字典类型',
|
|
||||||
sort int comment '排序',
|
|
||||||
create_by varchar(64) default '' comment '创建者',
|
|
||||||
create_time datetime comment '创建时间',
|
|
||||||
update_by varchar(64) default '' comment '更新者',
|
|
||||||
update_time datetime comment '更新时间',
|
|
||||||
primary key (column_id)
|
|
||||||
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
|
|
||||||
@@ -1,247 +0,0 @@
|
|||||||
DROP DATABASE IF EXISTS `ry-config`;
|
|
||||||
|
|
||||||
CREATE DATABASE `ry-config` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
USE `ry-config`;
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_info */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_info` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) DEFAULT NULL COMMENT 'group_id',
|
|
||||||
`content` longtext NOT NULL COMMENT 'content',
|
|
||||||
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
`src_user` text COMMENT 'source user',
|
|
||||||
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
|
||||||
`c_desc` varchar(256) DEFAULT NULL COMMENT 'configuration description',
|
|
||||||
`c_use` varchar(64) DEFAULT NULL COMMENT 'configuration usage',
|
|
||||||
`effect` varchar(64) DEFAULT NULL COMMENT '配置生效的描述',
|
|
||||||
`type` varchar(64) DEFAULT NULL COMMENT '配置的类型',
|
|
||||||
`c_schema` text COMMENT '配置的模式',
|
|
||||||
`encrypted_data_key` varchar(1024) NOT NULL DEFAULT '' COMMENT '密钥',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
|
|
||||||
|
|
||||||
insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values
|
|
||||||
(1,'application-dev.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''),
|
|
||||||
(2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestBody\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','4d329eb08a941a8dd9d26f542c6ac6c5','2020-05-14 14:17:55','2024-09-02 12:13:50','nacos','0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml','',''),
|
|
||||||
(3,'ruoyi-auth-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n','a03e7632a0a74520eeb4fbedd6d82d97','2020-11-20 00:00:00','2024-09-02 12:13:58','nacos','0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','',''),
|
|
||||||
(4,'ruoyi-monitor-dev.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: ruoyi\n password: 123456\n boot:\n admin:\n ui:\n title: 若依服务状态监控\n','6f122fd2bfb8d45f858e7d6529a9cd44','2020-11-20 00:00:00','2024-08-29 12:15:11','nacos','0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','',''),
|
|
||||||
(5,'ruoyi-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: ruoyi\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'系统模块接口文档\'\n # 描述\n description: \'系统模块接口描述\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n','786c7daf4543411fc65c3e48dfb15243','2020-11-20 00:00:00','2024-09-02 12:14:33','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),
|
|
||||||
(6,'ruoyi-gen-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.gen.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'代码生成接口文档\'\n # 描述\n description: \'代码生成接口描述\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n\n# 代码生成\ngen:\n # 作者\n author: ruoyi\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: com.ruoyi.system\n # 自动去除表前缀,默认是false\n autoRemovePre: false\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\n tablePrefix: sys_\n # 是否允许生成文件覆盖到本地(自定义路径),默认不允许\n allowOverwrite: false','43d807aa0a4accbb193b6dc7e38ac8a3','2020-11-20 00:00:00','2024-12-25 08:29:33','nacos','0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml','',''),
|
|
||||||
(7,'ruoyi-job-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'定时任务接口文档\'\n # 描述\n description: \'定时任务接口描述\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n','f78483f845777335b9ed4a9f84758848','2020-11-20 00:00:00','2024-09-02 12:14:56','nacos','0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml','',''),
|
|
||||||
(8,'ruoyi-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://127.0.0.1:9300\r\n path: D:/ruoyi/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
|
||||||
(9,'sentinel-ruoyi-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"ruoyi-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]','9f3a3069261598f74220bc47958ec252','2020-11-20 00:00:00','2020-11-20 00:00:00',NULL,'0:0:0:0:0:0:0:1','','','限流策略','null','null','json',NULL,'');
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_info_aggr */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_info_aggr` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(255) NOT NULL COMMENT 'group_id',
|
|
||||||
`datum_id` varchar(255) NOT NULL COMMENT 'datum_id',
|
|
||||||
`content` longtext NOT NULL COMMENT '内容',
|
|
||||||
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL,
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_info since 2.5.0 */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_info_gray` (
|
|
||||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
|
||||||
`content` longtext NOT NULL COMMENT 'content',
|
|
||||||
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
|
||||||
`src_user` text COMMENT 'src_user',
|
|
||||||
`src_ip` varchar(100) DEFAULT NULL COMMENT 'src_ip',
|
|
||||||
`gmt_create` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'gmt_create',
|
|
||||||
`gmt_modified` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'gmt_modified',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
|
|
||||||
`gray_name` varchar(128) NOT NULL COMMENT 'gray_name',
|
|
||||||
`gray_rule` text NOT NULL COMMENT 'gray_rule',
|
|
||||||
`encrypted_data_key` varchar(256) NOT NULL DEFAULT '' COMMENT 'encrypted_data_key',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_configinfogray_datagrouptenantgray` (`data_id`,`group_id`,`tenant_id`,`gray_name`),
|
|
||||||
KEY `idx_dataid_gmt_modified` (`data_id`,`gmt_modified`),
|
|
||||||
KEY `idx_gmt_modified` (`gmt_modified`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='config_info_gray';
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_info_beta */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_info_beta` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
|
||||||
`content` longtext NOT NULL COMMENT 'content',
|
|
||||||
`beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',
|
|
||||||
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
`src_user` text COMMENT 'source user',
|
|
||||||
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
|
||||||
`encrypted_data_key` varchar(1024) NOT NULL DEFAULT '' COMMENT '密钥',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_info_tag */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_info_tag` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
|
|
||||||
`tag_id` varchar(128) NOT NULL COMMENT 'tag_id',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
|
||||||
`content` longtext NOT NULL COMMENT 'content',
|
|
||||||
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
`src_user` text COMMENT 'source user',
|
|
||||||
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = config_tags_relation */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `config_tags_relation` (
|
|
||||||
`id` bigint(20) NOT NULL COMMENT 'id',
|
|
||||||
`tag_name` varchar(128) NOT NULL COMMENT 'tag_name',
|
|
||||||
`tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
|
|
||||||
`nid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'nid, 自增长标识',
|
|
||||||
PRIMARY KEY (`nid`),
|
|
||||||
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
|
|
||||||
KEY `idx_tenant_id` (`tenant_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = group_capacity */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `group_capacity` (
|
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
`group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
|
|
||||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
|
||||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
|
||||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
|
||||||
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
|
|
||||||
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
|
||||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_group_id` (`group_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 表名称 = his_config_info */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `his_config_info` (
|
|
||||||
`id` bigint(20) unsigned NOT NULL COMMENT 'id',
|
|
||||||
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'nid, 自增标识',
|
|
||||||
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
|
|
||||||
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
|
|
||||||
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
|
|
||||||
`content` longtext NOT NULL COMMENT 'content',
|
|
||||||
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
`src_user` text COMMENT 'source user',
|
|
||||||
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
|
|
||||||
`op_type` char(10) DEFAULT NULL COMMENT 'operation type',
|
|
||||||
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
|
|
||||||
`encrypted_data_key` varchar(1024) NOT NULL DEFAULT '' COMMENT '密钥',
|
|
||||||
`publish_type` varchar(50) DEFAULT 'formal' COMMENT 'publish type gray or formal',
|
|
||||||
`gray_name` varchar(50) DEFAULT NULL COMMENT 'gray name',
|
|
||||||
`ext_info` longtext DEFAULT NULL COMMENT 'ext info',
|
|
||||||
PRIMARY KEY (`nid`),
|
|
||||||
KEY `idx_gmt_create` (`gmt_create`),
|
|
||||||
KEY `idx_gmt_modified` (`gmt_modified`),
|
|
||||||
KEY `idx_did` (`data_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
/* 数据库全名 = nacos_config */
|
|
||||||
/* 表名称 = tenant_capacity */
|
|
||||||
/******************************************/
|
|
||||||
CREATE TABLE `tenant_capacity` (
|
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
`tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',
|
|
||||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
|
||||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
|
||||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
|
||||||
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
|
|
||||||
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
|
||||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
|
||||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `tenant_info` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
||||||
`kp` varchar(128) NOT NULL COMMENT 'kp',
|
|
||||||
`tenant_id` varchar(128) default '' COMMENT 'tenant_id',
|
|
||||||
`tenant_name` varchar(128) default '' COMMENT 'tenant_name',
|
|
||||||
`tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',
|
|
||||||
`create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',
|
|
||||||
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
|
|
||||||
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
|
|
||||||
KEY `idx_tenant_id` (`tenant_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
|
|
||||||
|
|
||||||
CREATE TABLE `users` (
|
|
||||||
`username` varchar(50) NOT NULL PRIMARY KEY COMMENT 'username',
|
|
||||||
`password` varchar(500) NOT NULL COMMENT 'password',
|
|
||||||
`enabled` boolean NOT NULL COMMENT 'enabled'
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE `roles` (
|
|
||||||
`username` varchar(50) NOT NULL COMMENT 'username',
|
|
||||||
`role` varchar(50) NOT NULL COMMENT 'role',
|
|
||||||
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE `permissions` (
|
|
||||||
`role` varchar(50) NOT NULL COMMENT 'role',
|
|
||||||
`resource` varchar(128) NOT NULL COMMENT 'resource',
|
|
||||||
`action` varchar(8) NOT NULL COMMENT 'action',
|
|
||||||
UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
|
||||||
|
|
||||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
DROP DATABASE IF EXISTS `ry-seata`;
|
|
||||||
|
|
||||||
CREATE DATABASE `ry-seata` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
USE `ry-seata`;
|
|
||||||
|
|
||||||
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
|
|
||||||
-- the table to store GlobalSession data
|
|
||||||
CREATE TABLE IF NOT EXISTS `global_table`
|
|
||||||
(
|
|
||||||
`xid` VARCHAR(128) NOT NULL,
|
|
||||||
`transaction_id` BIGINT,
|
|
||||||
`status` TINYINT NOT NULL,
|
|
||||||
`application_id` VARCHAR(32),
|
|
||||||
`transaction_service_group` VARCHAR(32),
|
|
||||||
`transaction_name` VARCHAR(128),
|
|
||||||
`timeout` INT,
|
|
||||||
`begin_time` BIGINT,
|
|
||||||
`application_data` VARCHAR(2000),
|
|
||||||
`gmt_create` DATETIME,
|
|
||||||
`gmt_modified` DATETIME,
|
|
||||||
PRIMARY KEY (`xid`),
|
|
||||||
KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
|
|
||||||
KEY `idx_transaction_id` (`transaction_id`)
|
|
||||||
) ENGINE = InnoDB
|
|
||||||
DEFAULT CHARSET = utf8mb4;
|
|
||||||
|
|
||||||
-- the table to store BranchSession data
|
|
||||||
CREATE TABLE IF NOT EXISTS `branch_table`
|
|
||||||
(
|
|
||||||
`branch_id` BIGINT NOT NULL,
|
|
||||||
`xid` VARCHAR(128) NOT NULL,
|
|
||||||
`transaction_id` BIGINT,
|
|
||||||
`resource_group_id` VARCHAR(32),
|
|
||||||
`resource_id` VARCHAR(256),
|
|
||||||
`branch_type` VARCHAR(8),
|
|
||||||
`status` TINYINT,
|
|
||||||
`client_id` VARCHAR(64),
|
|
||||||
`application_data` VARCHAR(2000),
|
|
||||||
`gmt_create` DATETIME(6),
|
|
||||||
`gmt_modified` DATETIME(6),
|
|
||||||
PRIMARY KEY (`branch_id`),
|
|
||||||
KEY `idx_xid` (`xid`)
|
|
||||||
) ENGINE = InnoDB
|
|
||||||
DEFAULT CHARSET = utf8mb4;
|
|
||||||
|
|
||||||
-- the table to store lock data
|
|
||||||
CREATE TABLE IF NOT EXISTS `lock_table`
|
|
||||||
(
|
|
||||||
`row_key` VARCHAR(128) NOT NULL,
|
|
||||||
`xid` VARCHAR(96),
|
|
||||||
`transaction_id` BIGINT,
|
|
||||||
`branch_id` BIGINT NOT NULL,
|
|
||||||
`resource_id` VARCHAR(256),
|
|
||||||
`table_name` VARCHAR(32),
|
|
||||||
`pk` VARCHAR(36),
|
|
||||||
`gmt_create` DATETIME,
|
|
||||||
`gmt_modified` DATETIME,
|
|
||||||
PRIMARY KEY (`row_key`),
|
|
||||||
KEY `idx_branch_id` (`branch_id`)
|
|
||||||
) ENGINE = InnoDB
|
|
||||||
DEFAULT CHARSET = utf8mb4;
|
|
||||||
|
|
||||||
-- for AT mode you must to init this sql for you business database. the seata server not need it.
|
|
||||||
CREATE TABLE IF NOT EXISTS `undo_log`
|
|
||||||
(
|
|
||||||
`branch_id` BIGINT(20) NOT NULL COMMENT 'branch transaction id',
|
|
||||||
`xid` VARCHAR(100) NOT NULL COMMENT 'global transaction id',
|
|
||||||
`context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
|
|
||||||
`rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
|
|
||||||
`log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status',
|
|
||||||
`log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
|
|
||||||
`log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
|
|
||||||
UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
|
|
||||||
) ENGINE = InnoDB
|
|
||||||
AUTO_INCREMENT = 1
|
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='AT transaction mode undo table';
|
|
||||||
@@ -2,21 +2,21 @@
|
|||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>tongran</artifactId>
|
||||||
<version>3.6.6</version>
|
<version>3.6.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-api-system</module>
|
<module>tongran-api-system</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>ruoyi-api</artifactId>
|
<artifactId>tongran-api</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
ruoyi-api系统接口
|
tongran-api系统接口
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -3,24 +3,24 @@
|
|||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-api</artifactId>
|
<artifactId>tongran-api</artifactId>
|
||||||
<version>3.6.6</version>
|
<version>3.6.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>ruoyi-api-system</artifactId>
|
<artifactId>tongran-api-system</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
ruoyi-api-system系统接口模块
|
tongran-api-system系统接口模块
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- RuoYi Common Core-->
|
<!-- tongran Common Core-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.tongran</groupId>
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
<artifactId>tongran-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.system.api;
|
package com.tongran.system.api;
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -7,15 +7,15 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.tongran.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.tongran.common.core.domain.R;
|
||||||
import com.ruoyi.system.api.domain.SysFile;
|
import com.tongran.system.api.domain.SysFile;
|
||||||
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
|
import com.tongran.system.api.factory.RemoteFileFallbackFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件服务
|
* 文件服务
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author tongran
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||||
public interface RemoteFileService
|
public interface RemoteFileService
|
||||||
+8
-8
@@ -1,20 +1,20 @@
|
|||||||
package com.ruoyi.system.api;
|
package com.tongran.system.api;
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.tongran.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.tongran.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.tongran.common.core.domain.R;
|
||||||
import com.ruoyi.system.api.domain.SysLogininfor;
|
import com.tongran.system.api.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.tongran.system.api.domain.SysOperLog;
|
||||||
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
|
import com.tongran.system.api.factory.RemoteLogFallbackFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志服务
|
* 日志服务
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author tongran
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
|
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
|
||||||
public interface RemoteLogService
|
public interface RemoteLogService
|
||||||
+15
-8
@@ -1,11 +1,11 @@
|
|||||||
package com.ruoyi.system.api;
|
package com.tongran.system.api;
|
||||||
|
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.tongran.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.tongran.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.tongran.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
import com.tongran.common.core.web.page.TableDataInfo;
|
||||||
import com.ruoyi.system.api.domain.*;
|
import com.tongran.system.api.domain.*;
|
||||||
import com.ruoyi.system.api.factory.RemoteRevenueConfigFallbackFactory;
|
import com.tongran.system.api.factory.RemoteRevenueConfigFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 用户服务
|
* 用户服务
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author tongran
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteRevenueConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteRevenueConfigFallbackFactory.class)
|
@FeignClient(contextId = "remoteRevenueConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteRevenueConfigFallbackFactory.class)
|
||||||
public interface RemoteRevenueConfigService
|
public interface RemoteRevenueConfigService
|
||||||
@@ -133,4 +133,11 @@ public interface RemoteRevenueConfigService
|
|||||||
@GetMapping("/businessScript/inner/{id}")
|
@GetMapping("/businessScript/inner/{id}")
|
||||||
public R<EpsBusinessScriptRemote> getBusinessScriptMsgByScriptId(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<EpsBusinessScriptRemote> getBusinessScriptMsgByScriptId(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存流量数据
|
||||||
|
* @param queryParam 流量数据列表
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/revenueConfig/autoSaveServiceRecoverTrafficData")
|
||||||
|
public R<String> autoSaveServiceRecoverTrafficData(@RequestBody EpsInitialTrafficDataRemote queryParam, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
+26
-12
@@ -1,13 +1,10 @@
|
|||||||
package com.ruoyi.system.api;
|
package com.tongran.system.api;
|
||||||
|
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.tongran.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.tongran.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.tongran.common.core.domain.R;
|
||||||
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
|
import com.tongran.system.api.domain.*;
|
||||||
import com.ruoyi.system.api.domain.RmDeployScriptRemote;
|
import com.tongran.system.api.factory.RemoteRocketMqFallbackFactory;
|
||||||
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
|
|
||||||
import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
|
|
||||||
import com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -56,7 +53,7 @@ public interface RemoteRocketMqService {
|
|||||||
public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网卡接口列表
|
* 绑定业务网卡
|
||||||
* @param rmNetworkInterfaceRemote
|
* @param rmNetworkInterfaceRemote
|
||||||
* @param source
|
* @param source
|
||||||
* @return
|
* @return
|
||||||
@@ -70,7 +67,7 @@ public interface RemoteRocketMqService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
|
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
|
||||||
public R<String> innerIssueSwitchPolicy(Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<String> innerIssueSwitchPolicy(@RequestParam("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
/**
|
/**
|
||||||
* 查询策略信息
|
* 查询策略信息
|
||||||
* @param rmMonitorPolicyRemote
|
* @param rmMonitorPolicyRemote
|
||||||
@@ -95,7 +92,24 @@ public interface RemoteRocketMqService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
|
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
|
||||||
public R<Integer> issueDefaultPolicyByClientId(String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<Integer> issueDefaultPolicyByClientId(@RequestParam("clientId") String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
@PostMapping("policy/addDeployScript")
|
@PostMapping("policy/addDeployScript")
|
||||||
R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
/**
|
||||||
|
* 获取子网卡接口列表
|
||||||
|
* @param rmNetworkInterfaceRemote
|
||||||
|
* @param source
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/networkInterfaceChild/innerGetChildList")
|
||||||
|
public R<List<RmNetworkInterfaceRemote>> innerGetChildList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发TCPDUMP默认策略
|
||||||
|
* @param rmTcpdumpConfigRemote
|
||||||
|
* @param source
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/rmTcpdumpConfig/innerInsertRmTcpdumpConfig")
|
||||||
|
public R<Integer> innerInsertRmTcpdumpConfig(@RequestBody RmTcpdumpConfigRemote rmTcpdumpConfigRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
+10
-10
@@ -1,20 +1,20 @@
|
|||||||
package com.ruoyi.system.api;
|
package com.tongran.system.api;
|
||||||
|
|
||||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
import com.tongran.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.tongran.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.tongran.common.core.domain.R;
|
||||||
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
|
import com.tongran.system.api.domain.EpsInitialTrafficDataRemote;
|
||||||
import com.ruoyi.system.api.domain.NodeBandwidth;
|
import com.tongran.system.api.domain.NodeBandwidth;
|
||||||
import com.ruoyi.system.api.domain.SysUser;
|
import com.tongran.system.api.domain.SysUser;
|
||||||
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
|
import com.tongran.system.api.factory.RemoteUserFallbackFactory;
|
||||||
import com.ruoyi.system.api.model.LoginUser;
|
import com.tongran.system.api.model.LoginUser;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务
|
* 用户服务
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author tongran
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||||
public interface RemoteUserService
|
public interface RemoteUserService
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.tongran.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -9,7 +9,7 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* 所有接口名称对象 all_interface_name
|
* 所有接口名称对象 all_interface_name
|
||||||
*
|
*
|
||||||
* @author gyt
|
* @author tongran
|
||||||
* @date 2025-08-25
|
* @date 2025-08-25
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.tongran.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务脚本管理对象 eps_business_script
|
* 业务脚本管理对象 eps_business_script
|
||||||
*
|
*
|
||||||
* @author gyt
|
* @author tongran
|
||||||
* @date 2025-10-13
|
* @date 2025-10-13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.tongran.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.tongran.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.tongran.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 交换机监控信息对象 initial_switch_info_details
|
* 交换机监控信息对象 initial_switch_info_details
|
||||||
*
|
*
|
||||||
* @author gyt
|
* @author tongran
|
||||||
* @date 2025-08-26
|
* @date 2025-08-26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
+21
-1
@@ -1,9 +1,13 @@
|
|||||||
package com.ruoyi.system.api.domain;
|
package com.tongran.system.api.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class NetworkInfo {
|
public class NetworkInfo {
|
||||||
// 运营商
|
// 运营商
|
||||||
@JsonProperty("carrier")
|
@JsonProperty("carrier")
|
||||||
@@ -17,6 +21,9 @@ public class NetworkInfo {
|
|||||||
// IPv4 地址
|
// IPv4 地址
|
||||||
@JsonProperty("ipv4")
|
@JsonProperty("ipv4")
|
||||||
private String ipv4;
|
private String ipv4;
|
||||||
|
// IPv4 地址
|
||||||
|
@JsonProperty("ipv6")
|
||||||
|
private String ipv6;
|
||||||
// MAC 地址
|
// MAC 地址
|
||||||
@JsonProperty("mac")
|
@JsonProperty("mac")
|
||||||
private String mac;
|
private String mac;
|
||||||
@@ -31,4 +38,17 @@ public class NetworkInfo {
|
|||||||
private String publicIp;
|
private String publicIp;
|
||||||
@JsonProperty("type")
|
@JsonProperty("type")
|
||||||
private String type;
|
private String type;
|
||||||
|
/** 与外网的连通性(0否,1是) */
|
||||||
|
@JsonProperty("status")
|
||||||
|
private String status;
|
||||||
|
// 如果是子接口,存储父接口名称
|
||||||
|
@JsonProperty("parentInterface")
|
||||||
|
private String parentInterface;
|
||||||
|
/** 网卡创建时间 */
|
||||||
|
@JsonProperty("netCreateTime")
|
||||||
|
private Long netCreateTime;
|
||||||
|
|
||||||
|
// 如果是父接口,存储子接口列表
|
||||||
|
@JsonProperty("subInterfaces")
|
||||||
|
private List<NetworkInfo> subInterfaces;
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user