Author SHA1 Message Date
gaoyutao 92cf598941 修复列表管理网卡信息不显示问题。
修复多网卡图形监控异常问题。
2025-12-18 15:28:25 +08:00
gaoyutao 343028ade5 1、优化子网卡流量图形展示。
2、优化接口名称存储逻辑,减少死锁。
3、增加cpu利用率内存利用率字段。
2025-12-17 18:18:19 +08:00
gaoyutao 597b5dad01 修复服务器、交换机月收益不展示95值问题。 2025-12-16 20:59:40 +08:00
gaoyutao e818c0319e 修复图形x轴时间跨界问题、交换机月收益不展示95值问题。
ipv4 ipv6增加子网卡统计
2025-12-16 17:56:49 +08:00
gaoyutao 6d3b5201e0 增加存储子网卡信息、修复子网卡流量递增问题
子网卡流量图合并
2025-12-15 19:50:44 +08:00
gaoyutao 9a81408ada 更改业务IP绑定、静态路由添加逻辑。
拓扑管理对端交换机名称处理
2025-12-12 15:43:16 +08:00
gaoyutao f3bdfbc6bf 1、定位并解决收益未自动生成问题。
2、优化服务器列表筛选条件查询速度。
2025-12-11 19:18:59 +08:00
gaoyutao 2eaf62ea82 优化服务器列表查询速度、筛选条件bug修复。
ipv4、ipv6初始流量处理。
增加日志排查收益未自动生成问题。
2025-12-10 18:32:07 +08:00
gaoyutao 13e51c11e1 权限控制优化 2025-12-09 19:25:51 +08:00
gaoyutao 1f133e8c05 权限控制增加
优化ipv4、ipv6流量展示
2025-12-08 19:23:53 +08:00
gaoyutao cd8cafaf3f 优化服务器管理详情 2025-12-05 20:00:38 +08:00
gaoyutao cbf017a8e2 优化排序和查询速度 2025-12-05 19:46:35 +08:00
gaoyutao 802e668d9a 相关接口增加ipv4、ipv6出入流量字段。
服务器管理列表新增字段和排序。
优化监控看板流量统计。
2025-12-05 18:59:02 +08:00
gaoyutao 9dee067a87 服务器流量增加ipv4、ipv6协议区分 2025-12-04 18:26:48 +08:00
gaoyutao a5b5f5b08d 1、mtr探测设备增加并发限制。
2、开发防火墙策略区分ipv4和ipv6。
3、脚本执行策略下发时间优化。
2025-12-03 19:18:12 +08:00
gaoyutao a40a6f344e 优化执行结果查看分页 2025-12-02 18:41:18 +08:00
gaoyutao 7d26d2fb3b 优化mtr探测策略、增加ipv6相关字段 2025-12-01 18:15:46 +08:00
gaoyutao ed6c0a4c80 优化mtr探测策略 2025-11-28 18:44:20 +08:00
gaoyutao 2f8fd79de5 优化mtr探测策略
告警日志增加业务名称、告警推送是否成功字段
2025-11-27 18:36:33 +08:00
gaoyutao 31e1f7f8dc 修复网卡信息有变动saas平台未及时更新、脚本策略下发未返回结果bug。
优化mtr探测策略
2025-11-26 18:13:26 +08:00
gaoyutao afbf1eead0 服务器管理添加标签功能。
优化mtr探测结果存储。
2025-11-25 18:18:51 +08:00
gaoyutao a0b0b57110 初始化README 2025-11-24 16:27:05 +08:00
gaoyutao de49404116 初始化v1.2 2025-11-24 16:19:09 +08:00
gaoyutao c0f51ef007 优化交换机分表、新增丢包率clientId记录 2025-11-24 14:00:49 +08:00
gaoyutao c6e778c74e 交换机流量数据表改为分表 2025-11-21 18:32:03 +08:00
gaoyutao be2d123902 优化mtr探测策略下发 2025-11-21 13:24:57 +08:00
gaoyutao 3391b949c8 测试环境配置、新增mtr探测丢包率结果存储方法 2025-11-20 18:10:17 +08:00
gaoyutao 947d60f788 优化图形补0、null机制,优化监控看板接口
mtr监控策略相关接口
2025-11-19 18:38:35 +08:00
gaoyutao 54fafb90bd 优化服务器管理搜索、监控看板优化 2025-11-19 11:31:43 +08:00
gaoyutao 12ca2b2066 补充mtragent管理初版 2025-11-18 18:22:03 +08:00
gaoyutao c91504912b 优化查看脚本执行结果、mtragent管理初版 2025-11-18 18:21:04 +08:00
gaoyutao bd65b27605 优化监控看板、初始化mtr模块 2025-11-17 18:06:37 +08:00
gaoyutao 68e042d9fc 优化告警日志 2025-11-14 18:50:58 +08:00
gaoyutao 1adc72032a 优化执行结果根据失败关键字筛选
优化告警日志
监控看板概览功能
2025-11-14 18:48:27 +08:00
gaoyutao d9bd70860c 脚本管理页面增加字段、执行结果根据失败关键字筛选
优化菜单点击方法、优化心跳处理
2025-11-13 18:08:05 +08:00
gaoyutao 50d817091e 优化告警日志、消息推送 2025-11-13 13:02:58 +08:00
gaoyutao 2910280746 优化交换机监控策略、交换机管理分页查询 2025-11-13 10:28:17 +08:00
gaoyutao 4da0c86ca4 告警日志、推送消息接口、图形监控排序优化
监控看板相关接口、单点击计数接口开发
2025-11-12 18:05:09 +08:00
gaoyutao 70e943269a 设计消息推送数据表、开发消息推送相关逻辑方法。 2025-11-11 18:03:50 +08:00
gaoyutao 5c3b6df591 优化实时95值计算流量科学计数法、服务器底层流量所有业务网卡流量求和 2025-11-11 10:55:21 +08:00
gaoyutao 80533dc1a3 导出优化、告警日志方法增加 2025-11-10 18:17:59 +08:00
gaoyutao 4137028deb agent更新按最后一次更新时间排序、服务器管理多条件分页查询优化、服务器底层流量科学计数法优化 2025-11-10 12:00:50 +08:00
gaoyutao 4d1503e988 底层bit流量不保留小数、服务器监控策略clientId换行分割 2025-11-07 18:19:51 +08:00
gaoyutao a5b304c809 补0变为补null、单位最小Kb、服务器在线状态优化 2025-11-07 15:27:37 +08:00
gaoyutao ce95462d74 监控项详情展示优化 2025-11-07 10:21:44 +08:00
gaoyutao 7190df25f7 挂载点详情优化。 2025-11-06 18:39:41 +08:00
gaoyutao c4b380437f 优化图形分析根据可选时间补0逻辑、优化流量图形单位可选功能。 2025-11-06 18:09:29 +08:00
gaoyutao 5e5330a924 增加计算服务器平均流量方法、优化95值自动计算方法 2025-11-06 13:47:29 +08:00
gaoyutao b0868dfe2d 优化常用单位、交换机心跳上报优化、agent更新列表优化 2025-11-05 18:04:06 +08:00
gaoyutao d0ac03ffbf 优化常用单位、用户自定义列保存优化、业务流量库优化 2025-11-05 14:48:02 +08:00
gaoyutao e9970b94a9 优化图形分析单位、服务器流量业务表逻辑 2025-11-05 13:02:51 +08:00
gaoyutao 1dc32ec24e 单位换算保留两位小数 2025-11-04 19:27:17 +08:00
gaoyutao 84e003893d 增加计算单位可选方法.
优化图形分析根据可选时间补0逻辑,完成度70%。
优化业务自定义95值计算功能修改相关数据方法。
2025-11-04 19:11:07 +08:00
gaoyutao fe1763386a 优化95值计算单位、实际流量保留两位小数 2025-11-04 13:46:05 +08:00
gaoyutao b38cd83ee1 优化心跳监测 2025-11-04 10:31:44 +08:00
gaoyutao d1db8a5865 增加日志控制、优化金山95值自动计算方法 2025-11-03 18:51:00 +08:00
gaoyutao 841dd84a99 优化交换机心跳监测功能 2025-11-03 14:26:14 +08:00
gaoyutao 07baaf07b0 增加交换机心跳、优化用户自定义列表功能 2025-11-03 13:29:47 +08:00
gaoyutao 01c51b39fe 优化实时95值计算功能、服务器收益功能、用户自定义列展示、交换机基础数据采集 2025-10-31 21:46:17 +08:00
gaoyutao c0f057d7ed 优化实时95值计算功能、服务器收益功能、用户自定义列展示 2025-10-30 21:20:46 +08:00
gaoyutao 15ecd5caaf 实时95值计算功能、优化服务器收益功能 2025-10-29 18:35:44 +08:00
gaoyutao 8c439013e1 交换机收益图形分析、服务器注册优化 2025-10-28 18:51:08 +08:00
gaoyutao 46bf4c4114 获取最新策略增加路由信息方法、交换机带宽收益 2025-10-27 18:16:47 +08:00
gaoyutao 36362e2236 优化交换机数据采集、脚本策略、agent更新优化、注册增加路由信息 2025-10-24 18:55:21 +08:00
gaoyutao 37eff51e48 服务器注册 agent更新 2025-10-24 09:34:32 +08:00
gaoyutao 31d8114c05 增加agent联调,获取最新策略应答功能 2025-10-22 17:54:46 +08:00
gaoyutao 4fdaadee65 服务器自动注册 2025-10-21 18:28:18 +08:00
gaoyutao 52728eba49 snmp采集工具优化,采集数据入库优化。 2025-10-20 18:17:44 +08:00
gaoyutao b0e63880fc 服务器注册接口、snmp采集工具优化、其他bug修复 2025-10-17 18:56:32 +08:00
gaoyutao b3f16d2c8f 交换机监控策略bug修复 2025-10-16 19:05:46 +08:00
gaoyutao c6937eb44b 交换机监控策略、snmp工具 2025-10-16 18:37:33 +08:00
gaoyutao 3019f65515 服务器注册图形监控监控项接口开发 2025-10-15 18:22:16 +08:00
gaoyutao 87824abb77 拓扑管理字段新增,交换机管理接口优化、网卡信息接口新增 2025-10-14 18:17:31 +08:00
gaoyutao 7da5e19cfa 业务脚本管理、业务下发管理、相关数据分页优化 2025-10-13 18:43:04 +08:00
gaoyutao 054b0f1272 交换机管理,图形监控,策略 2025-10-11 17:54:17 +08:00
gaoyutao 6ffdf8d355 金山云服务API调用并入库,交换机管理功能新增 2025-10-10 18:17:53 +08:00
gaoyutao 7b5c782079 底层流量数据改为bit,测试金山云服务器API,准备1.1分支 2025-10-09 17:38:24 +08:00
960 changed files with 39393 additions and 9651 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 若依
Copyright (c) 2020 彤然
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+23 -100
View File
@@ -1,52 +1,29 @@
<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)&nbsp;&nbsp;
## 系统模块
~~~
com.ruoyi
├── ruoyi-ui // 前端框架 [80]
├── ruoyi-gateway // 网关模块 [8080]
├── ruoyi-auth // 认证中心 [9200]
├── ruoyi-api // 接口模块
│ └── ruoyi-api-system // 系统接口
├── ruoyi-common // 通用模块
│ └── ruoyi-common-core // 核心模块
│ └── ruoyi-common-datascope // 权限范围
│ └── ruoyi-common-datasource // 多数据源
│ └── ruoyi-common-log // 日志记录
│ └── ruoyi-common-redis // 缓存服务
│ └── ruoyi-common-seata // 分布式事务
│ └── ruoyi-common-security // 安全模块
│ └── ruoyi-common-sensitive // 数据脱敏
│ └── ruoyi-common-swagger // 系统接口
├── ruoyi-modules // 业务模块
│ └── ruoyi-system // 系统模块 [9201]
│ └── ruoyi-gen // 代码生成 [9202]
│ └── ruoyi-job // 定时任务 [9203]
│ └── ruoyi-file // 文件服务 [9300]
├── ruoyi-visual // 图形化管理模块
│ └── ruoyi-visual-monitor // 监控中心 [9100]
com.tongran
├── tongran-ui // 前端框架 [80]
├── tongran-gateway // 网关模块 [8080]
├── tongran-auth // 认证中心 [9200]
├── tongran-api // 接口模块
│ └── tongran-api-system // 系统接口
├── tongran-common // 通用模块
│ └── tongran-common-core // 核心模块
│ └── tongran-common-datascope // 权限范围
│ └── tongran-common-datasource // 多数据源
│ └── tongran-common-log // 日志记录
│ └── tongran-common-redis // 缓存服务
│ └── tongran-common-seata // 分布式事务
│ └── tongran-common-security // 安全模块
│ └── tongran-common-sensitive // 数据脱敏
│ └── tongran-common-swagger // 系统接口
├── tongran-modules // 业务模块
│ └── tongran-system // 系统模块 [9201]
│ └── tongran-gen // 代码生成 [9202]
│ └── tongran-job // 定时任务 [9203]
│ └── tongran-file // 文件服务 [9300]
├── tongran-visual // 图形化管理模块
│ └── tongran-visual-monitor // 监控中心 [9100]
├──pom.xml // 公共依赖
~~~
@@ -73,57 +50,3 @@ com.ruoyi
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群: [![加入QQ群](https://img.shields.io/badge/已满-42799195-blue.svg)](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [![加入QQ群](https://img.shields.io/badge/已满-170157040-blue.svg)](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [![加入QQ群](https://img.shields.io/badge/已满-130643120-blue.svg)](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [![加入QQ群](https://img.shields.io/badge/已满-225920371-blue.svg)](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [![加入QQ群](https://img.shields.io/badge/已满-201705537-blue.svg)](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [![加入QQ群](https://img.shields.io/badge/已满-236543183-blue.svg)](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) [![加入QQ群](https://img.shields.io/badge/已满-213618602-blue.svg)](https://jq.qq.com/?_wv=1027&k=nw3OiyXs) [![加入QQ群](https://img.shields.io/badge/已满-148794840-blue.svg)](https://jq.qq.com/?_wv=1027&k=kiU5WDls) [![加入QQ群](https://img.shields.io/badge/已满-118752664-blue.svg)](https://jq.qq.com/?_wv=1027&k=MtBy6YfT) [![加入QQ群](https://img.shields.io/badge/已满-101038945-blue.svg)](https://jq.qq.com/?_wv=1027&k=FqImHgH2) [![加入QQ群](https://img.shields.io/badge/已满-128355254-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G4jZ4EtdT50PhnMBudTnEwgonxkXOscJ&authKey=FkGHYfoTKlGE6wHdKdjH9bVoOgQjtLP9WM%2Fj7pqGY1msoqw9uxDiBo39E2mLgzYg&noverify=0&group_code=128355254) [![加入QQ群](https://img.shields.io/badge/已满-179219821-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=irnwcXhbLOQEv1g-TwGifjNTA_f4wZiA&authKey=4bpzEwhcUY%2FvsPDHvzYn6xfoS%2FtOArvZ%2BGXzfr7O0%2FEqLfkKA%2BuCDXlzHIFg8t93&noverify=0&group_code=179219821) [![加入QQ群](https://img.shields.io/badge/已满-158753145-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lx1uEdEDuxeM7rUvF3qmlFdqKqdJ5Z-R&authKey=rgyPW9yhhh4IIURKVFa6NgP3qiqH04WAzrJ0trsgkr3pjzm6sKIOGyA58oOjoj%2FJ&noverify=0&group_code=158753145) [![加入QQ群](https://img.shields.io/badge/112869560-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Kuaw0Xdlw2Nlgn6s8h9elzuquHGxGObD&authKey=cSrQcWQ%2BzQZAFFrwxaR%2BbzcumX4WRduZnd1O6JO1dlclQMiu%2BKwxAy8t2JfNp67V&noverify=0&group_code=112869560) 点击按钮入群。
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Auth工程。
echo [Ϣ] ʹJarAuth̡
echo.
cd %~dp0
cd ../ruoyi-auth/target
cd ../tongran-auth/target
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Gateway工程。
echo [Ϣ] ʹJarGateway̡
echo.
cd %~dp0
cd ../ruoyi-gateway/target
cd ../tongran-gateway/target
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Modules-File工程。
echo [Ϣ] ʹJarModules-File̡
echo.
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
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Modules-Gen工程。
echo [Ϣ] ʹJarModules-Gen̡
echo.
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
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Modules-Job工程。
echo [Ϣ] ʹJarModules-Job̡
echo.
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
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Modules-System工程。
echo [Ϣ] ʹJarModules-System̡
echo.
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
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
pause
+3 -3
View File
@@ -1,14 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Monitor工程。
echo [Ϣ] ʹJarMonitor̡
echo.
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
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
pause
+15 -15
View File
@@ -14,28 +14,28 @@ cp ../sql/ry_config_20250224.sql ./mysql/db
# copy html
echo "begin copy html "
cp -r ../ruoyi-ui/dist/** ./nginx/html/dist
cp -r ../tongran-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 tongran-gateway "
cp ../tongran-gateway/target/tongran-gateway.jar ./tongran/gateway/jar
echo "begin copy ruoyi-auth "
cp ../ruoyi-auth/target/ruoyi-auth.jar ./ruoyi/auth/jar
echo "begin copy tongran-auth "
cp ../tongran-auth/target/tongran-auth.jar ./tongran/auth/jar
echo "begin copy ruoyi-visual "
cp ../ruoyi-visual/ruoyi-monitor/target/ruoyi-visual-monitor.jar ./ruoyi/visual/monitor/jar
echo "begin copy tongran-visual "
cp ../tongran-visual/tongran-monitor/target/tongran-visual-monitor.jar ./tongran/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 tongran-modules-system "
cp ../tongran-modules/tongran-system/target/tongran-modules-system.jar ./tongran/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 tongran-modules-file "
cp ../tongran-modules/tongran-file/target/tongran-modules-file.jar ./tongran/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 tongran-modules-job "
cp ../tongran-modules/tongran-job/target/tongran-modules-job.jar ./tongran/modules/job/jar
echo "begin copy ruoyi-modules-gen "
cp ../ruoyi-modules/ruoyi-gen/target/ruoyi-modules-gen.jar ./ruoyi/modules/gen/jar
echo "begin copy tongran-modules-gen "
cp ../tongran-modules/tongran-gen/target/tongran-modules-gen.jar ./tongran/modules/gen/jar
+2 -2
View File
@@ -26,12 +26,12 @@ port(){
# 启动基础环境(必须)
base(){
docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos
docker-compose up -d tongran-mysql tongran-redis tongran-nacos
}
# 启动程序模块(必须)
modules(){
docker-compose up -d ruoyi-nginx ruoyi-gateway ruoyi-auth ruoyi-modules-system
docker-compose up -d tongran-nginx tongran-gateway tongran-auth tongran-modules-system
}
# 关闭所有环境/模块
+48 -48
View File
@@ -1,7 +1,7 @@
version : '3.8'
services:
ruoyi-nacos:
container_name: ruoyi-nacos
tongran-nacos:
container_name: tongran-nacos
image: nacos/nacos-server
build:
context: ./nacos
@@ -15,9 +15,9 @@ services:
- "9848:9848"
- "9849:9849"
depends_on:
- ruoyi-mysql
ruoyi-mysql:
container_name: ruoyi-mysql
- tongran-mysql
tongran-mysql:
container_name: tongran-mysql
image: mysql:5.7
build:
context: ./mysql
@@ -38,103 +38,103 @@ services:
environment:
MYSQL_DATABASE: 'ry-cloud'
MYSQL_ROOT_PASSWORD: password
ruoyi-redis:
container_name: ruoyi-redis
tongran-redis:
container_name: tongran-redis
image: redis
build:
context: ./redis
ports:
- "6379:6379"
volumes:
- ./redis/conf/redis.conf:/home/ruoyi/redis/redis.conf
- ./redis/conf/redis.conf:/home/tongran/redis/redis.conf
- ./redis/data:/data
command: redis-server /home/ruoyi/redis/redis.conf
ruoyi-nginx:
container_name: ruoyi-nginx
command: redis-server /home/tongran/redis/redis.conf
tongran-nginx:
container_name: tongran-nginx
image: nginx
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./nginx/html/dist:/home/ruoyi/projects/ruoyi-ui
- ./nginx/html/dist:/home/tongran/projects/tongran-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
- tongran-gateway
links:
- ruoyi-gateway
ruoyi-gateway:
container_name: ruoyi-gateway
- tongran-gateway
tongran-gateway:
container_name: tongran-gateway
build:
context: ./ruoyi/gateway
context: ./tongran/gateway
dockerfile: dockerfile
ports:
- "8080:8080"
depends_on:
- ruoyi-redis
- tongran-redis
links:
- ruoyi-redis
ruoyi-auth:
container_name: ruoyi-auth
- tongran-redis
tongran-auth:
container_name: tongran-auth
build:
context: ./ruoyi/auth
context: ./tongran/auth
dockerfile: dockerfile
ports:
- "9200:9200"
depends_on:
- ruoyi-redis
- tongran-redis
links:
- ruoyi-redis
ruoyi-modules-system:
container_name: ruoyi-modules-system
- tongran-redis
tongran-modules-system:
container_name: tongran-modules-system
build:
context: ./ruoyi/modules/system
context: ./tongran/modules/system
dockerfile: dockerfile
ports:
- "9201:9201"
depends_on:
- ruoyi-redis
- ruoyi-mysql
- tongran-redis
- tongran-mysql
links:
- ruoyi-redis
- ruoyi-mysql
ruoyi-modules-gen:
container_name: ruoyi-modules-gen
- tongran-redis
- tongran-mysql
tongran-modules-gen:
container_name: tongran-modules-gen
build:
context: ./ruoyi/modules/gen
context: ./tongran/modules/gen
dockerfile: dockerfile
ports:
- "9202:9202"
depends_on:
- ruoyi-mysql
- tongran-mysql
links:
- ruoyi-mysql
ruoyi-modules-job:
container_name: ruoyi-modules-job
- tongran-mysql
tongran-modules-job:
container_name: tongran-modules-job
build:
context: ./ruoyi/modules/job
context: ./tongran/modules/job
dockerfile: dockerfile
ports:
- "9203:9203"
depends_on:
- ruoyi-mysql
- tongran-mysql
links:
- ruoyi-mysql
ruoyi-modules-file:
container_name: ruoyi-modules-file
- tongran-mysql
tongran-modules-file:
container_name: tongran-modules-file
build:
context: ./ruoyi/modules/file
context: ./tongran/modules/file
dockerfile: dockerfile
ports:
- "9300:9300"
volumes:
- ./ruoyi/uploadPath:/home/ruoyi/uploadPath
ruoyi-visual-monitor:
container_name: ruoyi-visual-monitor
- ./tongran/uploadPath:/home/tongran/uploadPath
tongran-visual-monitor:
container_name: tongran-visual-monitor
build:
context: ./ruoyi/visual/monitor
context: ./tongran/visual/monitor
dockerfile: dockerfile
ports:
- "9100:9100"
+1 -1
View File
@@ -1,7 +1,7 @@
# 基础镜像
FROM mysql:5.7
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 执行sql脚本
ADD ./db/*.sql /docker-entrypoint-initdb.d/
+2 -2
View File
@@ -1,6 +1,6 @@
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.url.0=jdbc:mysql://tongran-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=123456
@@ -16,7 +16,7 @@ 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
server.tomcat.basedir=/home/tongran/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/**
+1 -1
View File
@@ -1,7 +1,7 @@
# 基础镜像
FROM nacos/nacos-server
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 复制conf文件到路径
COPY ./conf/application.properties /home/nacos/conf/application.properties
+2 -2
View File
@@ -15,7 +15,7 @@ http {
server_name localhost;
location / {
root /home/ruoyi/projects/ruoyi-ui;
root /home/tongran/projects/tongran-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
@@ -25,7 +25,7 @@ http {
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/;
proxy_pass http://tongran-gateway:8080/;
}
# 避免actuator暴露
+5 -5
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM nginx
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi/projects/ruoyi-ui
VOLUME /home/tongran/projects/tongran-ui
# 创建目录
RUN mkdir -p /home/ruoyi/projects/ruoyi-ui
RUN mkdir -p /home/tongran/projects/tongran-ui
# 指定路径
WORKDIR /home/ruoyi/projects/ruoyi-ui
WORKDIR /home/tongran/projects/tongran-ui
# 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径
COPY ./html/dist /home/ruoyi/projects/ruoyi-ui
COPY ./html/dist /home/tongran/projects/tongran-ui
+5 -5
View File
@@ -1,13 +1,13 @@
# 基础镜像
FROM redis
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi/redis
VOLUME /home/tongran/redis
# 创建目录
RUN mkdir -p /home/ruoyi/redis
RUN mkdir -p /home/tongran/redis
# 指定路径
WORKDIR /home/ruoyi/redis
WORKDIR /home/tongran/redis
# 复制conf文件到路径
COPY ./conf/redis.conf /home/ruoyi/redis/redis.conf
COPY ./conf/redis.conf /home/tongran/redis/redis.conf
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-auth.jar /home/ruoyi/ruoyi-auth.jar
COPY ./jar/tongran-auth.jar /home/tongran/tongran-auth.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","ruoyi-auth.jar"]
ENTRYPOINT ["java","-jar","tongran-auth.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar
COPY ./jar/tongran-gateway.jar /home/tongran/tongran-gateway.jar
# 启动网关服务
ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"]
ENTRYPOINT ["java","-jar","tongran-gateway.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-modules-file.jar /home/ruoyi/ruoyi-modules-file.jar
COPY ./jar/tongran-modules-file.jar /home/tongran/tongran-modules-file.jar
# 启动文件服务
ENTRYPOINT ["java","-jar","ruoyi-modules-file.jar"]
ENTRYPOINT ["java","-jar","tongran-modules-file.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-modules-gen.jar /home/ruoyi/ruoyi-modules-gen.jar
COPY ./jar/tongran-modules-gen.jar /home/tongran/tongran-modules-gen.jar
# 启动代码生成服务
ENTRYPOINT ["java","-jar","ruoyi-modules-gen.jar"]
ENTRYPOINT ["java","-jar","tongran-modules-gen.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-modules-job.jar /home/ruoyi/ruoyi-modules-job.jar
COPY ./jar/tongran-modules-job.jar /home/tongran/tongran-modules-job.jar
# 启动定时任务服务
ENTRYPOINT ["java","-jar","ruoyi-modules-job.jar"]
ENTRYPOINT ["java","-jar","tongran-modules-job.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-modules-system.jar /home/ruoyi/ruoyi-modules-system.jar
COPY ./jar/tongran-modules-system.jar /home/tongran/tongran-modules-system.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","ruoyi-modules-system.jar"]
ENTRYPOINT ["java","-jar","tongran-modules-system.jar"]
+6 -6
View File
@@ -1,15 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER ruoyi
MAINTAINER tongran
# 挂载目录
VOLUME /home/ruoyi
VOLUME /home/tongran
# 创建目录
RUN mkdir -p /home/ruoyi
RUN mkdir -p /home/tongran
# 指定路径
WORKDIR /home/ruoyi
WORKDIR /home/tongran
# 复制jar文件到路径
COPY ./jar/ruoyi-visual-monitor.jar /home/ruoyi/ruoyi-visual-monitor.jar
COPY ./jar/tongran-visual-monitor.jar /home/tongran/tongran-visual-monitor.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","ruoyi-visual-monitor.jar"]
ENTRYPOINT ["java","-jar","tongran-visual-monitor.jar"]
+42 -43
View File
@@ -4,16 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<groupId>com.tongran</groupId>
<artifactId>tongran</artifactId>
<version>3.6.6</version>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description>
<name>tongran</name>
<description>彤然微服务系统</description>
<properties>
<ruoyi.version>3.6.6</ruoyi.version>
<tongran.version>3.6.6</tongran.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
@@ -184,85 +183,85 @@
<!-- 核心模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-core</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-swagger</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 安全模块 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-security</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 数据脱敏 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-sensitive</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 权限范围 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-datascope</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 多数据源 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-datasource</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 分布式事务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-seata</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-seata</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 日志记录 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-log</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 缓存服务 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-redis</artifactId>
<version>${tongran.version}</version>
</dependency>
<!-- 系统接口 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version>
<groupId>com.tongran</groupId>
<artifactId>tongran-api-system</artifactId>
<version>${tongran.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-auth</module>
<module>ruoyi-gateway</module>
<module>ruoyi-visual</module>
<module>ruoyi-modules</module>
<module>ruoyi-rocketmq</module>
<module>ruoyi-api</module>
<module>ruoyi-common</module>
<module>tongran-auth</module>
<module>tongran-gateway</module>
<module>tongran-visual</module>
<module>tongran-modules</module>
<module>tongran-rocketmq</module>
<module>tongran-api</module>
<module>tongran-common</module>
</modules>
<packaging>pom</packaging>
@@ -1,45 +0,0 @@
package com.ruoyi.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
import com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(contextId = "remoteRocketMqService", value = ServiceNameConstants.ROCKETMQ_SERVICE, fallbackFactory = RemoteRocketMqFallbackFactory.class)
public interface RemoteRocketMqService {
/**
* 发送异步消息
* @param topic
* @param tag
* @param key
* @param value
* @param source
* @return
*/
@PostMapping("/api/rocketMessage/sendAsyncProducerMessage")
public R<Map> sendAsyncProducerMessage(@RequestParam("topic") String topic, @RequestParam("tag") String tag, @RequestParam("key") String key, @RequestParam("value") String value, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询告警记录
*
* @param rmAlarmRecordRemote
* @param source
* @return
*/
@PostMapping("/alarmRecord/getAlarmList")
public R<List<RmAlarmRecordRemote>> getAlarmList(@RequestBody RmAlarmRecordRemote rmAlarmRecordRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 资源告警处理情况
* @param source
* @return
*/
@GetMapping("/alarmRecord/alarmHandlingStatus")
public R<Map> alarmHandlingStatus(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
@@ -1,50 +0,0 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteRocketMqService;
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户服务降级处理
*
* @author ruoyi
*/
@Component
public class RemoteRocketMqFallbackFactory implements FallbackFactory<RemoteRocketMqService>
{
private static final Logger log = LoggerFactory.getLogger(RemoteRocketMqFallbackFactory.class);
@Override
public RemoteRocketMqService create(Throwable throwable)
{
log.error("rocketMq服务调用失败:{}", throwable.getMessage());
return new RemoteRocketMqService()
{
@Override
public R<Map> sendAsyncProducerMessage(String topic, String tag, String key, String value, String source) {
Map<String, Object> errorMap = new HashMap<>();
errorMap.put("msg", "生产者发送消息失败");
errorMap.put("error", throwable.getMessage());
return R.fail(errorMap);
}
@Override
public R<List<RmAlarmRecordRemote>> getAlarmList(RmAlarmRecordRemote rmAlarmRecordRemote, String source) {
return R.fail(throwable.getMessage());
}
@Override
public R<Map> alarmHandlingStatus(String source) {
return R.fail(throwable.getMessage());
}
};
}
}
@@ -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
-30
View File
@@ -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>
@@ -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 +0,0 @@
com.ruoyi.common.datascope.aspect.DataScopeAspect
@@ -1,2 +0,0 @@
com.ruoyi.common.log.service.AsyncLogService
com.ruoyi.common.log.aspect.LogAspect
@@ -1,2 +0,0 @@
com.ruoyi.common.redis.configure.RedisConfig
com.ruoyi.common.redis.service.RedisService
@@ -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);
}
}
}
@@ -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 +0,0 @@
com.ruoyi.common.swagger.config.SpringDocAutoConfiguration
@@ -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>
@@ -1,415 +0,0 @@
package com.ruoyi.system.config;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* 自动生成数据表
*/
@Configuration
@EnableScheduling
@Slf4j
public class TableScheduleConfig {
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
@Autowired
private IEpsNodeBandwidthService epsNodeBandwidthService;
@Autowired
private IAllInterfaceNameService allInterfaceNameService;
@Autowired
private IEpsServerRevenueConfigService epsServerRevenueConfigService;
@Autowired
private IRmEpsTopologyManagementService rmEpsTopologyManagementService;
@Autowired
private IEpsMethodChangeRecordService epsMethodChangeRecordService;
// 每月25号创建下月表
@Scheduled(cron = "0 0 0 25 * ?")
// @Scheduled(initialDelay = 5000, fixedDelay = Long.MAX_VALUE)
public void createNextMonthTables() {
epsInitialTrafficDataService.createNextMonthTables();
}
// 每天0点执行 计算95带宽值/日
@Scheduled(cron = "0 4 0 * * ?", zone = "Asia/Shanghai")
public void calculate95BandwidthDaily() {
// 获取昨天的日期范围(北京时间)
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
// 日
String dayOrMonth = "1";
// 95带宽值/日
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
// 顺序执行链
CompletableFuture.runAsync(() -> executeWithLog("业务带宽1000",
() -> epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000")))
.thenRun(() -> executeWithLog("业务带宽1024",
() -> epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024")))
.thenRun(() -> executeWithLog("交换机带宽1000",
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000")))
.thenRun(() -> executeWithLog("交换机带宽1024",
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024")));
}
// 每月1号0点执行 计算95带宽值/月
@Scheduled(cron = "0 3 0 1 * ?", zone = "Asia/Shanghai")
public void calculateMonthlyBandwidthTasks() {
// 获取上个月的日期范围
LocalDate lastMonth = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusMonths(1);
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
String monthlyStartTime = firstDayOfMonth.atStartOfDay().format(TIME_FORMAT);
String monthlyEndTime = lastDayOfMonth.atTime(23, 59, 59).format(TIME_FORMAT);
// 链式顺序执行(无额外日志封装)
CompletableFuture.runAsync(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.exceptionally(e -> {
log.error("月度带宽计算链执行异常", e); // 仅保留最终异常捕获
return null;
});
}
/**
* 执行任务日志
*/
private void executeWithLog(String taskName, Runnable task) {
log.info("开始执行: {}", taskName);
try {
task.run();
} catch (Exception e) {
log.error("{} 执行失败", taskName, e);
throw e; // 可选:是否终止后续任务
}
log.info("{} 执行完成", taskName);
}
/**
* 计算服务器月95带宽值
*/
private void calculateServerMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月95带宽值...");
try {
String dayOrMonth = "2";
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("服务器月95带宽值计算完成");
} catch (Exception e) {
log.error("计算服务器月95带宽值失败", e);
}
}
/**
* 计算交换机月95带宽值
*/
private void calculateSwitchMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月95带宽值...");
try {
String dayOrMonth = "2";
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
queryParam.setDayOrMonth(dayOrMonth);
initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("交换机月95带宽值计算完成");
} catch (Exception e) {
log.error("计算交换机月95带宽值失败", e);
}
}
/**
* 计算服务器月平均95带宽值
*/
private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
epsNodeBandwidth.setStartTime(monthlyStartTime);
epsNodeBandwidth.setEndTime(monthlyEndTime);
List<AllInterfaceName> snList = allInterfaceNameService.getAllDeviceSn(new AllInterfaceName());
for (AllInterfaceName allInterfaceName : snList) {
processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName, calculationMode);
}
log.info("服务器月平均95带宽值计算完成");
} catch (Exception e) {
log.error("计算服务器月平均95带宽值失败", e);
}
}
/**
* 处理单个服务器的平均带宽计算
*/
private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName, String calculationMode) {
final String deviceSn = allInterfaceName.getDeviceSn();
try {
// 1. 设置基础设备信息
epsNodeBandwidth.setHardwareSn(deviceSn);
// 2. 查询服务器配置
EpsServerRevenueConfig queryConfig = new EpsServerRevenueConfig();
queryConfig.setHardwareSn(deviceSn);
List<EpsServerRevenueConfig> configList = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(queryConfig);
EpsServerRevenueConfig serverConfig = configList.isEmpty() ? new EpsServerRevenueConfig() : configList.get(0);
epsNodeBandwidth.setNodeName(serverConfig.getNodeName());
// 3. 检查是否需要处理业务变更
boolean shouldProcessChange = serverConfig.getUpdateTime() != null
&& epsNodeBandwidth.getStartTime() != null
&& epsNodeBandwidth.getStartTime().length() >= 10
&& "1".equals(serverConfig.getChanged())
&& DateUtils.parseDateToStr("yyyy-MM", serverConfig.getUpdateTime())
.equals(epsNodeBandwidth.getStartTime().substring(0, 7));
// 4. 处理业务变更情况
if (shouldProcessChange) {
// 查询业务变更记录
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setHardwareSn(deviceSn);
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
// 按businessCode分组处理(修复null key问题)
if (!records.isEmpty()) {
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
// 处理每个业务分组
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
String businessCode = entry.getKey();
// 取第一个有效业务名称(同businessCode的业务名称应该相同)
String businessName = entry.getValue().stream()
.filter(r -> r.getBusinessName() != null)
.findFirst()
.map(EpsMethodChangeRecord::getBusinessName)
.orElse("未知业务");
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setHardwareSn(deviceSn);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setNodeName(serverConfig.getNodeName());
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
bandwidthWithBiz.setBusinessId(businessCode);
bandwidthWithBiz.setBusinessName(businessName);
bandwidthWithBiz.setResourceType("1");
// 执行计算
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
}
// 处理businessCode为null的记录(如果有)
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
.filter(record -> record.getBusinessCode() == null)
.collect(Collectors.toList());
if (!nullBusinessRecords.isEmpty()) {
log.warn("服务器 {} 有 {} 条记录的businessCode为null", deviceSn, nullBusinessRecords.size());
// 可以选择记录日志或进行其他处理
}
return; // 业务变更处理完成后直接返回
}
}
// 5. 处理正常情况(无业务变更或无需处理变更)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setHardwareSn(deviceSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setNodeName(serverConfig.getNodeName());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setBusinessId(serverConfig.getBusinessCode());
normalBandwidth.setBusinessName(serverConfig.getBusinessName());
normalBandwidth.setResourceType("1");
epsNodeBandwidthService.calculateAvg(normalBandwidth);
} catch (Exception e) {
log.error("处理服务器 {} 平均带宽失败", deviceSn, e);
}
}
/**
* 计算交换机月平均95带宽值
*/
private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
epsNodeBandwidth.setStartTime(monthlyStartTime);
epsNodeBandwidth.setEndTime(monthlyEndTime);
List<AllInterfaceName> switchSnList = allInterfaceNameService.getAllSwitchSn(new AllInterfaceName());
for (AllInterfaceName switchSnMsg : switchSnList) {
processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg, calculationMode);
}
log.info("交换机月平均95带宽值计算完成");
} catch (Exception e) {
log.error("计算交换机月平均95带宽值失败", e);
}
}
/**
* 处理单个交换机的平均带宽计算
*/
private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg, String calculationMode) {
final String switchSn = switchSnMsg.getSwitchSn();
try {
// 1. 查询交换机拓扑信息
RmEpsTopologyManagement managementQuery = new RmEpsTopologyManagement();
managementQuery.setSwitchSn(switchSn);
List<RmEpsTopologyManagement> topologyList = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(managementQuery);
// 2. 设置基础信息
RmEpsTopologyManagement topology = topologyList.isEmpty() ? new RmEpsTopologyManagement() : topologyList.get(0);
epsNodeBandwidth.setSwitchSn(switchSn);
epsNodeBandwidth.setInterfaceName(topology.getInterfaceName());
// 3. 判断连接设备类型
boolean isServerConnected = "1".equals(topology.getConnectedDeviceType());
// 4. 处理服务器连接的情况
if (isServerConnected && topology.getServerSn() != null) {
String serverSn = topology.getServerSn();
epsNodeBandwidth.setHardwareSn(serverSn);
// 查询服务器配置
EpsServerRevenueConfig queryConfig = new EpsServerRevenueConfig();
queryConfig.setHardwareSn(serverSn);
List<EpsServerRevenueConfig> configList = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(queryConfig);
EpsServerRevenueConfig serverConfig = configList.isEmpty() ? new EpsServerRevenueConfig() : configList.get(0);
epsNodeBandwidth.setNodeName(serverConfig.getNodeName());
// 检查是否需要处理业务变更
boolean shouldProcessChange = serverConfig.getUpdateTime() != null
&& epsNodeBandwidth.getStartTime() != null
&& epsNodeBandwidth.getStartTime().length() >= 10
&& "1".equals(serverConfig.getChanged())
&& DateUtils.parseDateToStr("yyyy-MM", serverConfig.getUpdateTime())
.equals(epsNodeBandwidth.getStartTime().substring(0, 7));
if(shouldProcessChange){
// 查询业务变更记录
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setHardwareSn(serverSn);
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
// 按businessCode分组处理
if (!records.isEmpty()) {
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
// 处理每个业务分组
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
String businessCode = entry.getKey();
List<EpsMethodChangeRecord> businessRecords = entry.getValue();
// 取第一个有效业务名称
String businessName = businessRecords.stream()
.filter(r -> r.getBusinessName() != null)
.findFirst()
.map(EpsMethodChangeRecord::getBusinessName)
.orElse("未知业务");
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setSwitchSn(switchSn);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
bandwidthWithBiz.setHardwareSn(serverSn);
bandwidthWithBiz.setNodeName(topology.getServerName());
bandwidthWithBiz.setUplinkSwitch(topology.getSwitchName());
bandwidthWithBiz.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
bandwidthWithBiz.setBusinessId(businessCode);
bandwidthWithBiz.setBusinessName(businessName);
bandwidthWithBiz.setResourceType("2");
// 执行计算
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
}
// 处理businessCode为null的记录(如果有)
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
.filter(record -> record.getBusinessCode() == null)
.collect(Collectors.toList());
if (!nullBusinessRecords.isEmpty()) {
log.warn("交换机 {} 有 {} 条记录的businessCode为null", switchSn, nullBusinessRecords.size());
// 可以选择记录日志或进行其他处理
}
return; // 业务变更处理完成后直接返回
}
}else{
// 5. 处理普通情况(无变更记录)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setSwitchSn(switchSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setHardwareSn(topology.getServerSn());
normalBandwidth.setNodeName(topology.getServerName());
normalBandwidth.setUplinkSwitch(topology.getSwitchName());
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setBusinessId(serverConfig.getBusinessCode());
normalBandwidth.setBusinessName(serverConfig.getBusinessName());
normalBandwidth.setResourceType("2");
epsNodeBandwidthService.calculateAvg(normalBandwidth);
}
}
// 5. 处理机房出口情况
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setSwitchSn(switchSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setResourceType("2");
epsNodeBandwidthService.calculateAvg(normalBandwidth);
} catch (Exception e) {
log.error("处理交换机 {} 平均带宽失败", switchSn, e);
}
}
}
@@ -1,169 +0,0 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.RmResourceRegistration;
import com.ruoyi.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 资源注册Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/registration")
public class RmResourceRegistrationController extends BaseController
{
@Autowired
private IRmResourceRegistrationService rmResourceRegistrationService;
/**
* 查询资源注册列表
*/
@RequiresPermissions("system:registration:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmResourceRegistration rmResourceRegistration)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmResourceRegistration.getPageNum());
pageDomain.setPageSize(rmResourceRegistration.getPageSize());
startPage(pageDomain);
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
return getDataTable(list);
}
/**
* 导出资源注册列表
*/
@RequiresPermissions("system:registration:export")
@Log(title = "资源注册", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
util.showColumn(rmResourceRegistration.getProperties());
util.exportExcel(response, list, "资源注册数据");
}
/**
* 获取资源注册详细信息
*/
@RequiresPermissions("system:registration:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmResourceRegistrationService.selectRmResourceRegistrationById(id));
}
/**
* 新增资源注册
*/
@RequiresPermissions("system:registration:add")
@Log(title = "资源注册", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmResourceRegistration rmResourceRegistration)
{
int rows = rmResourceRegistrationService.insertRmResourceRegistration(rmResourceRegistration);
if(-1==rows){
return AjaxResult.error(500,"硬件SN不可重复");
}
return toAjax(rows);
}
/**
* 修改资源注册
*/
@RequiresPermissions("system:registration:edit")
@Log(title = "资源注册", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.updateRmResourceRegistration(rmResourceRegistration));
}
/**
* 资源注册-注册
*/
@RequiresPermissions("system:registration:edit")
@Log(title = "资源注册-注册", businessType = BusinessType.UPDATE)
@PostMapping("/register")
public AjaxResult register(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.register(rmResourceRegistration));
}
/**
* 查询所有资源名称(包含设备使用)
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@GetMapping("/selectAllResourceName")
public List<Map> selectAllResourceName()
{
List<Map> list = rmResourceRegistrationService.selectAllResourceName();
return list;
}
/**
* 查询所有资源名称
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@PostMapping("/selectAllResourceNameByType")
public List<Map> selectAllResourceNameByType(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<Map> list = rmResourceRegistrationService.selectAllResourceNameByType(rmResourceRegistration);
return list;
}
/**
* 检测到服务器离线,修改状态为离线
* @param rmResourceRegistration
* @return
*/
@InnerAuth
@PostMapping("/updateStatusByResource")
public R<String> updateStatusByResource(@RequestBody RmResourceRegistration rmResourceRegistration)
{
R<String> rows = rmResourceRegistrationService.updateStatusByResource(rmResourceRegistration);
return rows;
}
/**
* 根据id查询资源信息
* @param ids
* @return
*/
@PostMapping("/getRegistrationByIds")
public R<List<RmResourceRegistration>> getRegistrationByIds(@RequestBody String[] ids)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.getRegistrationByIds(ids);
return R.ok(list);
}
/**
* 查询资源注册列表
*/
@InnerAuth
@PostMapping("/getListByHardwareSn")
public R<RmResourceRegistration> getListByHardwareSn(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
return R.ok(list.get(0));
}
}
@@ -1,133 +0,0 @@
package com.ruoyi.system.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 资源注册对象 rm_resource_registration
*
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmResourceRegistration extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 资源类型
* 1 服务器,2 交换机*/
@Excel(name = "资源类型",readConverterExp = "1=服务器,2=交换机")
private String resourceType;
/** 资源名称 */
@Excel(name = "资源名称")
private String resourceName;
/** IP地址 */
@Excel(name = "IP地址")
private String ipAddress;
/** 端口1.162(SNMP),2.其他 */
@Excel(name = "端口")
private String resourcePort;
/**其他端口名称 */
private String otherPortName;
/** agent版本 */
@Excel(name = "agent版本")
private String agentVersion;
/** 协议 1.TCP,2.UDP */
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
private String protocol;
/** SNMP探测 0=否,1=是 */
@Excel(name = "",readConverterExp = "0=否,1=是")
private String snmpDetect;
/** 版本(1.SNMPv2,2.SNMPv3) */
@Excel(name = "SNMP版本",readConverterExp = "1=华为SNMPv2c,2=华为SNMPv3")
private String resourceVersion;
/** 读写权限(1.RW,2.ReadOnly) */
@Excel(name = "读写权限",readConverterExp = "1=只读,2=可读可写")
private String rwPermission;
/** 团体名称 */
@Excel(name = "团体名称")
private String teamName;
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpCollectAddr;
/** SNMP采集端口 */
@Excel(name = "SNMP采集端口")
private String snmpCollectPort;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
private String securityLevel;
/** 加密方式 1.md5,2.SHA */
@Excel(name = "加密方式",readConverterExp = "1=MD5,2=SHA")
private String encryption;
/** 用户名 */
@Excel(name = "用户名")
private String resourceUserName;
/** 密码 */
@Excel(name = "密码")
private String resourcePwd;
/** 注册状态 0-未注册,1-已注册 */
@Excel(name = "注册状态",readConverterExp = "0=未注册,1=已注册")
private String registrationStatus;
/** 在线状态 0-离线,1-在线 */
@Excel(name = "在线状态",readConverterExp = "0=离线,1=在线")
private String onlineStatus;
@Excel(name = "交换机在线状态",readConverterExp = "0=离线,1=在线")
private String switchOnlineStatus;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 设备业务客户id */
private Long customerId;
/** 设备业务客户名称 */
@Excel(name = "设备业务客户")
private String customerName;
/** 业务号 */
@Excel(name = "业务号")
private String serviceNumber;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
/** 监控项 */
private String monitorItems;
/** 自动发现项 */
private String discoveryRules;
/** 查询名称 */
private String queryName;
}
@@ -1,106 +0,0 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.AllInterfaceName;
import com.ruoyi.system.mapper.AllInterfaceNameMapper;
import com.ruoyi.system.service.IAllInterfaceNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 所有接口名称Service业务层处理
*
* @author gyt
* @date 2025-08-25
*/
@Service
public class AllInterfaceNameServiceImpl implements IAllInterfaceNameService
{
@Autowired
private AllInterfaceNameMapper allInterfaceNameMapper;
/**
* 查询所有接口名称
*
* @param id 所有接口名称主键
* @return 所有接口名称
*/
@Override
public AllInterfaceName selectAllInterfaceNameById(Long id)
{
return allInterfaceNameMapper.selectAllInterfaceNameById(id);
}
/**
* 查询所有接口名称列表
*
* @param allInterfaceName 所有接口名称
* @return 所有接口名称
*/
@Override
public List<AllInterfaceName> selectAllInterfaceNameList(AllInterfaceName allInterfaceName)
{
return allInterfaceNameMapper.selectAllInterfaceNameList(allInterfaceName);
}
/**
* 新增所有接口名称
*
* @param allInterfaceName 所有接口名称
* @return 结果
*/
@Override
public int insertAllInterfaceName(AllInterfaceName allInterfaceName)
{
allInterfaceName.setCreateTime(DateUtils.getNowDate());
return allInterfaceNameMapper.insertAllInterfaceName(allInterfaceName);
}
/**
* 修改所有接口名称
*
* @param allInterfaceName 所有接口名称
* @return 结果
*/
@Override
public int updateAllInterfaceName(AllInterfaceName allInterfaceName)
{
allInterfaceName.setUpdateTime(DateUtils.getNowDate());
return allInterfaceNameMapper.updateAllInterfaceName(allInterfaceName);
}
/**
* 批量删除所有接口名称
*
* @param ids 需要删除的所有接口名称主键
* @return 结果
*/
@Override
public int deleteAllInterfaceNameByIds(Long[] ids)
{
return allInterfaceNameMapper.deleteAllInterfaceNameByIds(ids);
}
/**
* 删除所有接口名称信息
*
* @param id 所有接口名称主键
* @return 结果
*/
@Override
public int deleteAllInterfaceNameById(Long id)
{
return allInterfaceNameMapper.deleteAllInterfaceNameById(id);
}
@Override
public List<AllInterfaceName> getAllDeviceSn(AllInterfaceName interfaceName) {
return allInterfaceNameMapper.getAllDeviceSn(interfaceName);
}
@Override
public List<AllInterfaceName> getAllSwitchSn(AllInterfaceName allInterfaceName){
return allInterfaceNameMapper.getAllSwitchSn(allInterfaceName);
}
}
@@ -1,703 +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.system.domain.*;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
import com.ruoyi.system.util.CalculateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
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.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 交换机监控信息Service业务层处理
*
* @author gyt
* @date 2025-08-26
*/
@Service
@Slf4j
public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDetailsService
{
@Autowired
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
@Autowired
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
@Autowired
private AllInterfaceNameMapper allInterfaceNameMapper;
@Autowired
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
@Autowired
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
@Autowired
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
/**
* 查询交换机监控信息
*
* @param id 交换机监控信息主键
* @return 交换机监控信息
*/
@Override
public InitialSwitchInfoDetails selectInitialSwitchInfoDetailsById(Long id)
{
return initialSwitchInfoDetailsMapper.selectInitialSwitchInfoDetailsById(id);
}
/**
* 查询交换机监控信息列表
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 交换机监控信息
*/
@Override
public List<InitialSwitchInfoDetails> selectInitialSwitchInfoDetailsList(InitialSwitchInfoDetails initialSwitchInfoDetails)
{
return initialSwitchInfoDetailsMapper.selectInitialSwitchInfoDetailsList(initialSwitchInfoDetails);
}
/**
* 新增交换机监控信息
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 结果
*/
@Override
public int insertInitialSwitchInfoDetails(InitialSwitchInfoDetails initialSwitchInfoDetails)
{
initialSwitchInfoDetails.setCreateTime(DateUtils.getNowDate());
return initialSwitchInfoDetailsMapper.insertInitialSwitchInfoDetails(initialSwitchInfoDetails);
}
/**
* 修改交换机监控信息
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 结果
*/
@Override
public int updateInitialSwitchInfoDetails(InitialSwitchInfoDetails initialSwitchInfoDetails)
{
initialSwitchInfoDetails.setUpdateTime(DateUtils.getNowDate());
return initialSwitchInfoDetailsMapper.updateInitialSwitchInfoDetails(initialSwitchInfoDetails);
}
/**
* 批量删除交换机监控信息
*
* @param ids 需要删除的交换机监控信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchInfoDetailsByIds(Long[] ids)
{
return initialSwitchInfoDetailsMapper.deleteInitialSwitchInfoDetailsByIds(ids);
}
/**
* 删除交换机监控信息信息
*
* @param id 交换机监控信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchInfoDetailsById(Long id)
{
return initialSwitchInfoDetailsMapper.deleteInitialSwitchInfoDetailsById(id);
}
/**
* 保存交换机流量信息
* @param initialSwitchInfoDetails
*/
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public R<String> autoSaveSwitchTraffic(InitialSwitchInfoDetails initialSwitchInfoDetails) {
// 查询初始流量数据
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper.getAllSwitchInfoMsg(initialSwitchInfoDetails);
List<InitialSwitchInfoDetails> batchList = new ArrayList<>();
if(!dataList.isEmpty()){
for (InitialSwitchInfoDetails details : dataList) {
// id自增
details.setId(null);
// 根据接口名称查询交换机信息
String interfaceName = details.getName();
String switchSn = details.getSwitchSn();
RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement();
rmEpsTopologyManagement.setInterfaceName(interfaceName);
rmEpsTopologyManagement.setSwitchSn(switchSn);
List<RmEpsTopologyManagement> managements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
// 赋值
if(!managements.isEmpty()){
for (RmEpsTopologyManagement management : managements) {
if("1".equals(management.getConnectedDeviceType())){
details.setOutSpeed(null);
}else{
details.setInSpeed(null);
}
details.setSwitchSn(management.getSwitchSn());
details.setSwitchName(management.getSwitchName());
details.setInterfaceDeviceType(management.getConnectedDeviceType());
details.setServerName(management.getServerName());
details.setServerPort(management.getServerPort());
details.setServerSn(management.getServerSn());
// 根据服务器sn查询业务
if(management.getServerSn() != null){
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
epsServerRevenueConfig.setHardwareSn(management.getServerSn());
List<EpsServerRevenueConfig> businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
if(!businessList.isEmpty()){
EpsServerRevenueConfig revenueConfig = businessList.get(0);
details.setBusinessName(revenueConfig.getBusinessName());
details.setBusinessCode(revenueConfig.getBusinessCode());
}
}else {
details.setBusinessCode(null);
details.setBusinessName(null);
}
batchList.add(details);
}
}else{
batchList.add(details);
}
}
}
initialSwitchInfoDetails.setDataList(batchList);
if(batchList.isEmpty()){
return R.fail("交换机流量数据为空");
}else{
// 流量相关数据入库
try {
initialSwitchInfoDetailsMapper.saveBatchSwitchTraffic(initialSwitchInfoDetails);
log.info("交换机流量数据批量入库成功,数据量:{}", batchList.size());
// 接口名称保存
processSwitchInterfaceNames(batchList);
return R.ok("数据保存成功");
} catch (Exception e) {
log.error("交换机流量数据入库失败,数据量:{},错误原因:{}",
batchList.size(), e.getMessage(), e);
return R.fail("数据保存失败:" + e.getMessage());
}
}
}
/**
* 批量处理接口名称
*/
private void processSwitchInterfaceNames(List<InitialSwitchInfoDetails> initialSwitchInfoDetails) {
// 分类处理:新增列表 vs 更新列表
List<AllInterfaceName> namesToInsert = new ArrayList<>();
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
initialSwitchInfoDetails.forEach(data -> {
String name = data.getName();
String ip = data.getSwitchIp();
String clientId = data.getClientId();
if (StringUtils.isBlank(name) || StringUtils.isBlank(ip) || StringUtils.isBlank(clientId)) {
return;
}
AllInterfaceName record = new AllInterfaceName();
record.setInterfaceName(name);
record.setClientId(data.getClientId());
record.setResourceType("2");
record.setDeviceSn(data.getServerSn());
record.setNodeName(data.getServerName());
record.setServerPort(data.getServerPort());
record.setInterfaceDeviceType(data.getInterfaceDeviceType());
record.setSwitchName(data.getSwitchName());
record.setSwitchSn(data.getSwitchSn());
record.setSwitchIp(data.getSwitchIp());
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(record);
// 根据服务器sn查询业务
if(data.getServerSn() != null){
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
epsServerRevenueConfig.setHardwareSn(data.getServerSn());
List<EpsServerRevenueConfig> businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
if(!businessList.isEmpty()){
EpsServerRevenueConfig revenueConfig = businessList.get(0);
record.setBusinessName(revenueConfig.getBusinessName());
record.setBusinessCode(revenueConfig.getBusinessCode());
}
}else {
record.setBusinessCode(null);
record.setBusinessName(null);
}
// 判断是否需要更新
if (!existingNames.isEmpty()) {
for (AllInterfaceName existingName : existingNames) {
if(isRecordChanged(existingName,record)){
record.setId(existingName.getId()); // 保留原ID
// 检查是否已经存在于更新列表中
boolean alreadyInUpdateList = namesToUpdate.stream()
.anyMatch(item -> item.getId() != null && item.getId().equals(existingName.getId()));
if (!alreadyInUpdateList) {
namesToUpdate.add(record);
}
}
}
} else {
// 检查namesToInsert中是否已有相同记录
boolean alreadyInInsertList = namesToInsert.stream()
.anyMatch(item -> item.getInterfaceName().equals(name)
&& item.getClientId().equals(clientId)
&& item.getSwitchIp().equals(ip));
if (!alreadyInInsertList) {
namesToInsert.add(record);
}
}
});
// 批量操作数据库
if (!namesToInsert.isEmpty()) {
try {
allInterfaceNameMapper.batchInsert(namesToInsert);
log.info("新增接口名称数量:{}", namesToInsert.size());
} catch (DuplicateKeyException e) {
// 如果批量插入出现重复,转为逐条插入(带异常处理)
log.warn("批量插入出现重复,转为逐条处理");
namesToInsert.forEach(record -> {
try {
allInterfaceNameMapper.insertAllInterfaceName(record);
} catch (DuplicateKeyException ex) {
// 重复记录转为更新
AllInterfaceName query = new AllInterfaceName();
query.setInterfaceName(record.getInterfaceName());
query.setClientId(record.getClientId());
query.setServerIp(record.getServerIp());
List<AllInterfaceName> existing = allInterfaceNameMapper.selectByNames(query);
if (!existing.isEmpty()) {
record.setId(existing.get(0).getId());
allInterfaceNameMapper.updateAllInterfaceName(record);
}
}
});
}
}
if (!namesToUpdate.isEmpty()) {
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.getServerPort(), newRecord.getServerPort()) ||
!Objects.equals(oldRecord.getInterfaceDeviceType(), newRecord.getInterfaceDeviceType()) ||
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn()) ||
!Objects.equals(oldRecord.getSwitchIp(), newRecord.getSwitchIp());
}
public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime,
String dailyEndTime, String calculationMode) {
// 查询所有的交换机SN列表
AllInterfaceName allInterfaceName = new AllInterfaceName();
List<AllInterfaceName> switchSnList = allInterfaceNameMapper.getAllSwitchSn(allInterfaceName);
// 遍历处理每个交换机
switchSnList.forEach(interfaceName -> {
queryParam.setSwitchSn(interfaceName.getSwitchSn());
queryParam.setSwitchIp(interfaceName.getSwitchIp());
processSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
});
}
/**
* 重新计算交换机95带宽值
* @param epsNodeBandwidth 95带宽值收益详情
* @param dailyStartTime 开始时间
* @param dailyEndTime 结束时间
*/
@Override
public void recalculateSwitch95Bandwidth(EpsNodeBandwidth epsNodeBandwidth, String dailyStartTime,
String dailyEndTime, String calculationMode) {
InitialSwitchInfoDetails switchInfoDetails = new InitialSwitchInfoDetails();
switchInfoDetails.setStartTime(dailyStartTime);
switchInfoDetails.setEndTime(dailyEndTime);
switchInfoDetails.setSwitchSn(epsNodeBandwidth.getSwitchSn());
switchInfoDetails.setSwitchName(epsNodeBandwidth.getUplinkSwitch());
switchInfoDetails.setServerSn(epsNodeBandwidth.getHardwareSn());
switchInfoDetails.setInterfaceDeviceType(epsNodeBandwidth.getInterfaceLinkDeviceType());
switchInfoDetails.setName(epsNodeBandwidth.getInterfaceName());
switchInfoDetails.setBusinessCode(epsNodeBandwidth.getBusinessId());
switchInfoDetails.setBusinessName(epsNodeBandwidth.getBusinessName());
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
.selectInitialSwitchInfoDetailsList(switchInfoDetails);
if(!dataList.isEmpty()){
// 1. 提取并转换带宽值
List<BigDecimal> speedsInMbps = dataList.stream()
.map(data -> {
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
String speed = "1".equals(data.getInterfaceDeviceType())
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
// 如果 speed 是纯数字,补充单位 "B/S"Bytes/s
if (speed.matches("^\\d+(\\.\\d+)?$")) {
speed += " B/S";
}
return CalculateUtil.parseSpeedToMbps(speed, calculationMode);
})
.sorted()
.collect(Collectors.toList());
// 2. 计算95百分位
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
// 3. 保存结果
InitialSwitchInfoDetails switchInfo = dataList.get(0);
switchInfo.setResourceType("2");
switchInfo.setBandwidthType(epsNodeBandwidth.getBandwidthType());
saveSwitchBandwidthResult(switchInfo, percentile95, dailyStartTime, calculationMode);
}
}
/**
* 交换机相关数据
* @param epsNodeBandwidth
* @param dailyStartTime
* @param dailyEndTime
* @return
*/
@Override
public List<InitialSwitchInfoDetails> getRelevantSwitch(EpsNodeBandwidth epsNodeBandwidth, String dailyStartTime, String dailyEndTime) {
InitialSwitchInfoDetails switchInfoDetails = new InitialSwitchInfoDetails();
switchInfoDetails.setStartTime(dailyStartTime);
switchInfoDetails.setEndTime(dailyEndTime);
switchInfoDetails.setSwitchSn(epsNodeBandwidth.getSwitchSn());
switchInfoDetails.setSwitchName(epsNodeBandwidth.getUplinkSwitch());
switchInfoDetails.setServerSn(epsNodeBandwidth.getHardwareSn());
switchInfoDetails.setInterfaceDeviceType(epsNodeBandwidth.getInterfaceLinkDeviceType());
switchInfoDetails.setName(epsNodeBandwidth.getInterfaceName());
switchInfoDetails.setBusinessCode(epsNodeBandwidth.getBusinessId());
switchInfoDetails.setBusinessName(epsNodeBandwidth.getBusinessName());
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
.selectInitialSwitchInfoDetailsList(switchInfoDetails);
return dataList;
}
@Override
public BigDecimal sumTrafficBySwitch() {
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 结束时间
LocalDateTime endTime = now.minusSeconds(1);
// 开始时间
LocalDateTime startTime = now.minusMinutes(5);
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化为字符串
String dailyStartTime = startTime.format(formatter);
String dailyEndTime = endTime.format(formatter);
BigDecimal total = BigDecimal.ZERO;
InitialSwitchInfoDetails switchInfoDetails = new InitialSwitchInfoDetails();
switchInfoDetails.setStartTime(dailyStartTime);
switchInfoDetails.setEndTime(dailyEndTime);
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
.selectInitialSwitchInfoDetailsList(switchInfoDetails);
if(!dataList.isEmpty()){
for (InitialSwitchInfoDetails initialSwitchInfoDetails : dataList) {
// 交换机接收带宽流量
String speed = initialSwitchInfoDetails.getInSpeed() != null ? initialSwitchInfoDetails.getInSpeed().toString() : BigDecimal.ZERO.toString();
// 如果 speed 是纯数字,补充单位 "B/S"Bytes/s
if (speed.matches("^\\d+(\\.\\d+)?$")) {
speed += " B/S";
}
BigDecimal inSpeed = CalculateUtil.parseSpeedToMbps(speed, "1000");
total = total.add(inSpeed);
}
}
return total.setScale(0, RoundingMode.HALF_UP);
}
/**
* 处理单个交换机的带宽计算
*/
private void processSwitchBandwidth(InitialSwitchInfoDetails queryParam,
String dailyStartTime,
String dailyEndTime, String calculationMode) {
// 根据交换机sn查询连接的服务器sn
RmEpsTopologyManagement management = new RmEpsTopologyManagement();
management.setSwitchSn(queryParam.getSwitchSn());
management.setSwitchIpAddress(queryParam.getSwitchIp());
List<RmEpsTopologyManagement> serverSnList = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(management);
if(!serverSnList.isEmpty()){
for (RmEpsTopologyManagement rmEpsTopologyManagement : serverSnList) {
queryParam.setName(rmEpsTopologyManagement.getInterfaceName());
if("1".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
queryParam.setServerSn(rmEpsTopologyManagement.getServerSn());
// 检查交换机连接的服务器是否有业务变更(如果有相关配置)
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
revenueConfig.setHardwareSn(rmEpsTopologyManagement.getServerSn());
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper
.selectEpsServerRevenueConfigList(revenueConfig);
// 根据业务变更情况选择计算方式
if (hasTrafficMethodChanged(changedList)) {
calculateChangedSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
} else {
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
}
}
if("2".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
queryParam.setServerSn(null);
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
}
}
}
}
/**
* 判断是否为流量型业务变更
*/
private boolean hasTrafficMethodChanged(List<EpsServerRevenueConfig> changedList) {
return !changedList.isEmpty() &&
"1".equals(changedList.get(0).getChanged()) &&
"1".equals(changedList.get(0).getRevenueMethod());
}
/**
* 计算有业务变更交换机的带宽
*/
private void calculateChangedSwitchBandwidth(InitialSwitchInfoDetails queryParam,
String dailyStartTime,
String dailyEndTime, String calculationMode) {
// 获取业务变更记录(按时间降序)
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setHardwareSn(queryParam.getServerSn());
changeQuery.setStartTime(dailyStartTime);
changeQuery.setEndTime(dailyEndTime);
List<EpsMethodChangeRecord> records = epsMethodChangeRecordMapper
.selectEpsMethodChangeRecordList(changeQuery);
if (!records.isEmpty()) {
// 确保按时间降序排列
records.sort((r1, r2) -> r2.getCreateTime().compareTo(r1.getCreateTime()));
// 计算各时间段95值
calculateSwitchTimeSegments95(queryParam, records, dailyStartTime, dailyEndTime, calculationMode);
}else {
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
}
}
/**
* 计算无业务变更交换机的带宽
*/
private void calculateNormalSwitchBandwidth(InitialSwitchInfoDetails queryParam,
String dailyStartTime,
String dailyEndTime, String calculationMode) {
queryParam.setStartTime(dailyStartTime);
queryParam.setEndTime(dailyEndTime);
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
.selectInitialSwitchInfoDetailsList(queryParam);
if (!dataList.isEmpty()) {
calculateAndSaveSwitch95Bandwidth(dataList, dailyStartTime, queryParam.getDayOrMonth(), calculationMode);
}
}
/**
* 计算并保存交换机95带宽值
*/
private void calculateAndSaveSwitch95Bandwidth(List<InitialSwitchInfoDetails> dataList, String dateTime,
String dayOrMonth, String calculationMode) {
boolean eff = false;
if(!dataList.isEmpty()){
if(dataList.size()<288){
eff = true;
}
// 1. 提取并转换带宽值
List<BigDecimal> speedsInMbps = dataList.stream()
.map(data -> {
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
String speed = "1".equals(data.getInterfaceDeviceType())
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
// 如果 speed 是纯数字,补充单位 "B/S"Bytes/s
if (speed.matches("^\\d+(\\.\\d+)?$")) {
speed += " B/S";
}
return CalculateUtil.parseSpeedToMbps(speed, calculationMode);
})
.sorted()
.collect(Collectors.toList());
// 2. 计算95百分位
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
// 3. 保存结果
InitialSwitchInfoDetails switchInfo = dataList.get(0);
switchInfo.setResourceType("2");
if("1".equals(dayOrMonth)){
if(eff){
switchInfo.setBandwidthType("5");
}else{
switchInfo.setBandwidthType("1");
}
}
if("2".equals(dayOrMonth)){
if(eff){
switchInfo.setBandwidthType("6");
}else{
switchInfo.setBandwidthType("2");
}
}
saveSwitchBandwidthResult(switchInfo, percentile95, dateTime, calculationMode);
}
}
/**
* 计算交换机各时间段的95带宽值
*/
private void calculateSwitchTimeSegments95(InitialSwitchInfoDetails queryParam,
List<EpsMethodChangeRecord> records,
String dailyStartTime,
String dailyEndTime, String calculationMode) {
// 1. 处理变更时间段(从最新到最早)
String endTime = records.get(0).getCreateTime() + "";
for (int i = 1; i < records.size(); i++) {
String startTime = records.get(i).getCreateTime() + "";
calculateSwitchSegment95(queryParam, startTime, endTime, calculationMode);
endTime = startTime; // 移动时间窗口
}
// 2. 处理最早变更前的时间段(昨天00:00:00 ~ 最早变更时间)
String earliestChangeTime = records.get(records.size()-1).getCreateTime() + "";
calculateSwitchSegment95(queryParam, dailyStartTime, earliestChangeTime, calculationMode);
// 3. 处理最后变更后的时间段(最新变更时间 ~ 昨天23:59:59)
calculateSwitchSegment95(queryParam, endTime, dailyEndTime, calculationMode);
}
/**
* 计算交换机单个时间段的95带宽值
*/
private void calculateSwitchSegment95(InitialSwitchInfoDetails queryParam, String startTime, String endTime, String calculationMode) {
queryParam.setStartTime(startTime);
queryParam.setEndTime(endTime);
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
.selectInitialSwitchInfoDetailsList(queryParam);
if (!dataList.isEmpty()) {
calculateSwitch95BandwidthDaily(dataList, startTime, queryParam.getDayOrMonth(), calculationMode);
}
}
/**
* 计算交换机日95带宽值
*/
private void calculateSwitch95BandwidthDaily(List<InitialSwitchInfoDetails> dataList,
String startTime, String dayOrMonth, String calculationMode) {
// 1. 提取并转换带宽值
List<BigDecimal> speedsInMbps = dataList.stream()
.map(data -> {
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
String speed = "1".equals(data.getInterfaceDeviceType())
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
if (speed.matches("^\\d+(\\.\\d+)?$")) {
speed += " B/S";
}
return CalculateUtil.parseSpeedToMbps(speed, calculationMode);
})
.sorted()
.collect(Collectors.toList());
// 2. 计算95百分位
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
BigDecimal dailyResult = percentile95.setScale(2, RoundingMode.HALF_UP);
// 3. 保存结果
InitialSwitchInfoDetails switchInfo = dataList.get(0);
switchInfo.setResourceType("2");
if(CalculateUtil.isEff(dataList)){
if("1".equals(dayOrMonth)){
switchInfo.setBandwidthType("5");
}
if("2".equals(dayOrMonth)){
switchInfo.setBandwidthType("6");
}
}else {
if("1".equals(dayOrMonth)){
switchInfo.setBandwidthType("1");
}
if("2".equals(dayOrMonth)){
switchInfo.setBandwidthType("2");
}
}
saveSwitchBandwidthResult(switchInfo, dailyResult, startTime, calculationMode);
}
/**
* 保存交换机带宽结果
*/
private void saveSwitchBandwidthResult(InitialSwitchInfoDetails data,
BigDecimal result,
String dateTime, String calculationMode) {
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
bandwidth.setBusinessName(data.getBusinessName());
bandwidth.setBusinessId(data.getBusinessCode());
bandwidth.setHardwareSn(data.getServerSn());
bandwidth.setCalculationMode(calculationMode);
bandwidth.setSwitchSn(data.getSwitchSn());
bandwidth.setNodeName(data.getServerName());
bandwidth.setUplinkSwitch(data.getSwitchName());
bandwidth.setInterfaceName(data.getName());
bandwidth.setResourceType(data.getResourceType());
bandwidth.setBandwidthType(data.getBandwidthType());
bandwidth.setInterfaceLinkDeviceType(data.getInterfaceDeviceType());
bandwidth.setCreateTime(DateUtils.parseDate(dateTime));
// 查询此条数据是否存在
List<EpsNodeBandwidth> exitsList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidth);
bandwidth.setBandwidthResult(result);
switch (data.getBandwidthType()){
case "1":
bandwidth.setBandwidth95Daily(result);
break;
case "2":
bandwidth.setBandwidth95Monthly(result);
break;
case "3":
bandwidth.setPackageBandwidthDaily(result);
break;
case "4":
bandwidth.setAvgMonthlyBandwidth95(result);
break;
case "5":
bandwidth.setEffectiveBandwidth95Daily(result);
break;
case "6":
bandwidth.setEffectiveBandwidth95Monthly(result);
break;
case "7":
bandwidth.setEffectiveAvgMonthlyBandwidth95(result);
break;
default:
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
}
if(!exitsList.isEmpty()){
bandwidth.setUpdateTime(DateUtils.getNowDate());
bandwidth.setId(exitsList.get(0).getId());
epsNodeBandwidthMapper.updateEpsNodeBandwidth(bandwidth);
}else{
bandwidth.setUpdateTime(DateUtils.getNowDate());
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
}
}
}
@@ -1,354 +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.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteRocketMqService;
import com.ruoyi.system.domain.EpsNodeBandwidth;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
import com.ruoyi.system.domain.RmEpsTopologyManagement;
import com.ruoyi.system.domain.RmResourceRegistration;
import com.ruoyi.system.domain.vo.MessageVo;
import com.ruoyi.system.domain.vo.ResourceVo;
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
import com.ruoyi.system.mapper.RmEpsTopologyManagementMapper;
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
import com.ruoyi.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 资源注册Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
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;
/**
* 查询资源注册
*
* @param id 资源注册主键
* @return 资源注册
*/
@Override
public RmResourceRegistration selectRmResourceRegistrationById(Long id)
{
return rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
}
/**
* 查询资源注册列表
*
* @param rmResourceRegistration 资源注册
* @return 资源注册
*/
@Override
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
return rmResourceRegistrationList;
}
/**
* 新增资源注册
*
* @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);
}
}
@@ -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>
@@ -1,246 +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(100) 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 '接收带宽(Mbps)',
`out_speed` varchar(50) COMMENT '发送带宽(Mbps)',
`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(100) 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)',
`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>
<!-- 单条插入语句 -->
<insert id="insert">
INSERT INTO ${tableName} (
`name`,
`mac`,
`status`,
`type`,
ipV4,
`in_dropped`,
`out_dropped`,
`in_speed`,
`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},
#{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`,
`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.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
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,
`speed` AS speed,
`duplex` AS duplex,
business_id AS businessId,
business_name AS businessName,
service_sn AS serviceSn,
node_name AS nodeName,
revenue_method AS revenueMethod,
package_bandwidth AS packageBandwidth,
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="serviceSn != '' and serviceSn != null">
and service_sn = #{serviceSn}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
<if test="revenueMethod != null">
and revenue_method = #{revenueMethod}
</if>
</where>
ORDER BY 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,
`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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
ORDER BY create_time desc
</select>
</mapper>
@@ -1,294 +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.InitialSwitchInfoDetailsMapper">
<resultMap type="InitialSwitchInfoDetails" id="InitialSwitchInfoDetailsResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="name" column="name" />
<result property="inBytes" column="in_bytes" />
<result property="outBytes" column="out_bytes" />
<result property="status" column="status" />
<result property="type" column="type" />
<result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="switchName" column="switch_name" />
<result property="interfaceDeviceType" column="interface_device_type" />
<result property="serverName" column="server_name" />
<result property="serverPort" column="server_port" />
<result property="serverSn" column="server_sn" />
<result property="switchSn" column="switch_sn" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="ifSpeed" column="if_speed" />
<result property="ifInDiscards" column="if_in_discards" />
<result property="ifOutDiscards" column="if_out_discards" />
<result property="ifInErrors" column="if_in_errors" />
<result property="ifOutErrors" column="if_out_errors" />
<result property="ifIndex" column="if_index" />
</resultMap>
<sql id="selectInitialSwitchInfoDetailsVo">
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name, if_speed, if_in_discards, if_out_discards, if_in_errors, if_out_errors, if_index from initial_switch_info_details
</sql>
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
<include refid="selectInitialSwitchInfoDetailsVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="name != null and name != ''"> and name = #{name}</if>
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectInitialSwitchInfoDetailsById" parameterType="Long" resultMap="InitialSwitchInfoDetailsResult">
<include refid="selectInitialSwitchInfoDetailsVo"/>
where id = #{id}
</select>
<insert id="insertInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails" useGeneratedKeys="true" keyProperty="id">
insert into initial_switch_info_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="inBytes != null">in_bytes,</if>
<if test="outBytes != null">out_bytes,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverName != null">server_name,</if>
<if test="serverPort != null">server_port,</if>
<if test="serverSn != null">server_sn,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if>
<if test="ifSpeed != null">if_speed,</if>
<if test="ifInDiscards != null">if_in_discards,</if>
<if test="ifOutDiscards != null">if_out_discards,</if>
<if test="ifInErrors != null">if_in_errors,</if>
<if test="ifOutErrors != null">if_out_errors,</if>
<if test="ifIndex != null and ifIndex != ''">if_index,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="inBytes != null">#{inBytes},</if>
<if test="outBytes != null">#{outBytes},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverName != null">#{serverName},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="serverSn != null">#{serverSn},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if>
<if test="ifSpeed != null">#{ifSpeed},</if>
<if test="ifInDiscards != null">#{ifInDiscards},</if>
<if test="ifOutDiscards != null">#{ifOutDiscards},</if>
<if test="ifInErrors != null">#{ifInErrors},</if>
<if test="ifOutErrors != null">#{ifOutErrors},</if>
<if test="ifIndex != null and ifIndex != ''">#{ifIndex},</if>
</trim>
</insert>
<update id="updateInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails">
update initial_switch_info_details
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="inBytes != null">in_bytes = #{inBytes},</if>
<if test="outBytes != null">out_bytes = #{outBytes},</if>
<if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverName != null">server_name = #{serverName},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="serverSn != null">server_sn = #{serverSn},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="ifSpeed != null">if_speed = #{ifSpeed},</if>
<if test="ifInDiscards != null">if_in_discards = #{ifInDiscards},</if>
<if test="ifOutDiscards != null">if_out_discards = #{ifOutDiscards},</if>
<if test="ifInErrors != null">if_in_errors = #{ifInErrors},</if>
<if test="ifOutErrors != null">if_out_errors = #{ifOutErrors},</if>
<if test="ifIndex != null and ifIndex != ''">if_index = #{ifIndex},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInitialSwitchInfoDetailsById" parameterType="Long">
delete from initial_switch_info_details where id = #{id}
</delete>
<delete id="deleteInitialSwitchInfoDetailsByIds" parameterType="String">
delete from initial_switch_info_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 查询交换机信息-->
<select id="getAllSwitchInfoMsg" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
SELECT
id,
client_id AS clientId,
`name`,
in_bytes AS inBytes,
out_bytes AS outBytes,
status,
`type`,
in_speed AS inSpeed,
out_speed AS outSpeed,
switch_ip AS switchIp,
if_index AS ifIndex,
if_speed AS ifSpeed,
if_in_discards AS ifInDiscards,
if_out_discards AS ifOutDiscards,
if_in_errors AS ifInErrors,
if_out_errors AS ifOutErrors,
create_by AS createBy,
update_by AS updateBy,
create_time AS createTime,
update_time AS updateTime
FROM
initial_switch_info
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
ORDER BY create_time DESC
</select>
<insert id="saveBatchSwitchTraffic" parameterType="InitialSwitchInfoDetails">
INSERT IGNORE INTO initial_switch_info_details
(
client_id,
`name`,
in_bytes,
out_bytes,
status,
`type`,
in_speed,
out_speed,
switch_ip,
if_index,
if_speed,
if_in_discards,
if_out_discards,
if_in_errors,
if_out_errors,
switch_name,
interface_device_type,
`server_name`,
server_port,
server_sn,
switch_sn,
business_code,
business_name,
create_by,
update_by,
create_time,
update_time
)
VALUES
<foreach collection="dataList" item="item" separator=",">
(
#{item.clientId},
#{item.name},
#{item.inBytes},
#{item.outBytes},
#{item.status},
#{item.type},
#{item.inSpeed},
#{item.outSpeed},
#{item.switchIp},
#{item.ifIndex},
#{item.ifSpeed},
#{item.ifInDiscards},
#{item.ifOutDiscards},
#{item.ifInErrors},
#{item.ifOutErrors},
#{item.switchName},
#{item.interfaceDeviceType},
#{item.serverName},
#{item.serverPort},
#{item.serverSn},
#{item.switchSn},
#{item.businessCode},
#{item.businessName},
#{item.createBy},
#{item.updateBy},
<choose>
<when test="item.createTime != null">
#{item.createTime}
</when>
<otherwise>
NOW()
</otherwise>
</choose>,
<choose>
<when test="item.updateTime != null">
#{item.updateTime}
</when>
<otherwise>
NOW()
</otherwise>
</choose>
)
</foreach>
</insert>
</mapper>
@@ -1,292 +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" />
</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 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>
</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>
</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>
</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>
</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 resourceName,ip_address ipAddress,hardware_sn 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>
</trim>
where hardware_sn = #{hardwareSn}
</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>
</mapper>
@@ -1,105 +0,0 @@
package com.ruoyi.rocketmq.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.rocketmq.domain.InitialSystemOtherCollectData;
import com.ruoyi.rocketmq.service.IInitialSystemOtherCollectDataService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 交换机系统其他信息采集数据Controller
*
* @author gyt
* @date 2025-09-23
*/
@RestController
@RequestMapping("/systemOtherCollectData")
public class InitialSystemOtherCollectDataController extends BaseController
{
@Autowired
private IInitialSystemOtherCollectDataService initialSystemOtherCollectDataService;
/**
* 查询交换机系统其他信息采集数据列表
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:list")
@GetMapping("/list")
public TableDataInfo list(InitialSystemOtherCollectData initialSystemOtherCollectData)
{
startPage();
List<InitialSystemOtherCollectData> list = initialSystemOtherCollectDataService.selectInitialSystemOtherCollectDataList(initialSystemOtherCollectData);
return getDataTable(list);
}
/**
* 导出交换机系统其他信息采集数据列表
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:export")
@Log(title = "交换机系统其他信息采集数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InitialSystemOtherCollectData initialSystemOtherCollectData)
{
List<InitialSystemOtherCollectData> list = initialSystemOtherCollectDataService.selectInitialSystemOtherCollectDataList(initialSystemOtherCollectData);
ExcelUtil<InitialSystemOtherCollectData> util = new ExcelUtil<InitialSystemOtherCollectData>(InitialSystemOtherCollectData.class);
util.exportExcel(response, list, "交换机系统其他信息采集数据数据");
}
/**
* 获取交换机系统其他信息采集数据详细信息
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(initialSystemOtherCollectDataService.selectInitialSystemOtherCollectDataById(id));
}
/**
* 新增交换机系统其他信息采集数据
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:add")
@Log(title = "交换机系统其他信息采集数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InitialSystemOtherCollectData initialSystemOtherCollectData)
{
return toAjax(initialSystemOtherCollectDataService.insertInitialSystemOtherCollectData(initialSystemOtherCollectData));
}
/**
* 修改交换机系统其他信息采集数据
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:edit")
@Log(title = "交换机系统其他信息采集数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InitialSystemOtherCollectData initialSystemOtherCollectData)
{
return toAjax(initialSystemOtherCollectDataService.updateInitialSystemOtherCollectData(initialSystemOtherCollectData));
}
/**
* 删除交换机系统其他信息采集数据
*/
@RequiresPermissions("rocketmq:systemOtherCollectData:remove")
@Log(title = "交换机系统其他信息采集数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(initialSystemOtherCollectDataService.deleteInitialSystemOtherCollectDataByIds(ids));
}
}
@@ -1,36 +0,0 @@
package com.ruoyi.rocketmq.controller;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.rocketmq.domain.RmResourceRemote;
import com.ruoyi.rocketmq.service.IRmResourceRemoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 资源远程管理Controller
*
* @author gyt
* @date 2025-09-15
*/
@RestController
@RequestMapping("/remote")
public class RmResourceRemoteController extends BaseController
{
@Autowired
private IRmResourceRemoteService rmResourceRemoteService;
/**
* 获取资源远程管理详细信息
*/
@RequiresPermissions("rocketmq:remote:query")
@PostMapping(value = "/getScriptResultBySn")
public AjaxResult getScriptResultBySn(@RequestBody RmResourceRemote rmResourceRemote)
{
return success(rmResourceRemoteService.getScriptResultBySn(rmResourceRemote));
}
}
@@ -1,133 +0,0 @@
package com.ruoyi.rocketmq.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 挂载点监控信息对象 initial_mount_point_info
*
* @author gyt
* @date 2025-08-25
*/
public class InitialMountPointInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增主键ID */
private Long id;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
/** 挂载点路径(如"/"、"/data"等) */
@Excel(name = "挂载点路径")
private String mount;
/** 文件系统类型(如ext4、xfs、ntfs等) */
@Excel(name = "文件系统类型")
private String vfsType;
/** 可用空间(字节) */
@Excel(name = "可用空间")
private Long vfsFree;
/** 总空间(字节) */
@Excel(name = "总空间")
private Long vfsTotal;
/** 空间利用率(%) */
@Excel(name = "空间利用率")
private BigDecimal vfsUtil;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setMount(String mount)
{
this.mount = mount;
}
public String getMount()
{
return mount;
}
public void setVfsType(String vfsType)
{
this.vfsType = vfsType;
}
public String getVfsType()
{
return vfsType;
}
public void setVfsFree(Long vfsFree)
{
this.vfsFree = vfsFree;
}
public Long getVfsFree()
{
return vfsFree;
}
public void setVfsTotal(Long vfsTotal)
{
this.vfsTotal = vfsTotal;
}
public Long getVfsTotal()
{
return vfsTotal;
}
public void setVfsUtil(BigDecimal vfsUtil)
{
this.vfsUtil = vfsUtil;
}
public BigDecimal getVfsUtil()
{
return vfsUtil;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("clientId", getClientId())
.append("mount", getMount())
.append("vfsType", getVfsType())
.append("vfsFree", getVfsFree())
.append("vfsTotal", getVfsTotal())
.append("vfsUtil", getVfsUtil())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -1,147 +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;
/**
* MPU信息对象 initial_switch_mpu_info
*
* @author gyt
* @date 2025-09-22
*/
public class InitialSwitchMpuInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** MPU索引 */
@Excel(name = "MPU索引")
private String mpuEntIndex;
/** MPU名称 */
@Excel(name = "MPU名称")
private String mpuName;
/** MPU的CPU使用率(%) */
@Excel(name = "MPU的CPU使用率(%)")
private BigDecimal mpuEntityCpuUsage;
/** MPU的内存使用率(%) */
@Excel(name = "MPU的内存使用率(%)")
private BigDecimal mpuEntityMemUsage;
/** MPU的操作系统 */
@Excel(name = "MPU的操作系统")
private String mpuPhysicalSoftwareRev;
/** MPU的温度(℃) */
@Excel(name = "MPU的温度(℃)")
private BigDecimal mpuEntityTemperature;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMpuEntIndex(String mpuEntIndex)
{
this.mpuEntIndex = mpuEntIndex;
}
public String getMpuEntIndex()
{
return mpuEntIndex;
}
public void setMpuName(String mpuName)
{
this.mpuName = mpuName;
}
public String getMpuName()
{
return mpuName;
}
public void setMpuEntityCpuUsage(BigDecimal mpuEntityCpuUsage)
{
this.mpuEntityCpuUsage = mpuEntityCpuUsage;
}
public BigDecimal getMpuEntityCpuUsage()
{
return mpuEntityCpuUsage;
}
public void setMpuEntityMemUsage(BigDecimal mpuEntityMemUsage)
{
this.mpuEntityMemUsage = mpuEntityMemUsage;
}
public BigDecimal getMpuEntityMemUsage()
{
return mpuEntityMemUsage;
}
public void setMpuPhysicalSoftwareRev(String mpuPhysicalSoftwareRev)
{
this.mpuPhysicalSoftwareRev = mpuPhysicalSoftwareRev;
}
public String getMpuPhysicalSoftwareRev()
{
return mpuPhysicalSoftwareRev;
}
public void setMpuEntityTemperature(BigDecimal mpuEntityTemperature)
{
this.mpuEntityTemperature = mpuEntityTemperature;
}
public BigDecimal getMpuEntityTemperature()
{
return mpuEntityTemperature;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("mpuEntIndex", getMpuEntIndex())
.append("mpuName", getMpuName())
.append("mpuEntityCpuUsage", getMpuEntityCpuUsage())
.append("mpuEntityMemUsage", getMpuEntityMemUsage())
.append("mpuPhysicalSoftwareRev", getMpuPhysicalSoftwareRev())
.append("mpuEntityTemperature", getMpuEntityTemperature())
.append("clientId", getClientId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,147 +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_switch_optical_module
*
* @author gyt
* @date 2025-09-22
*/
public class InitialSwitchOpticalModule extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 光模块端口索引 */
@Excel(name = "光模块端口索引")
private String fiberEntIndex;
/** 光模块端口名称 */
@Excel(name = "光模块端口名称")
private String fiberPortName;
/** 光模块发送光衰阈值(dBm) */
@Excel(name = "光模块发送光衰阈值(dBm)")
private BigDecimal hwEntityOpticalTxLowThreshold;
/** 光模块接收光衰阈值(dBm) */
@Excel(name = "光模块接收光衰阈值(dBm)")
private BigDecimal hwEntityOpticalRxLowThreshold;
/** 光模块接收功率(dBm) */
@Excel(name = "光模块接收功率(dBm)")
private BigDecimal hwEntityOpticalRxPower;
/** 光模块发送功率(dBm) */
@Excel(name = "光模块发送功率(dBm)")
private BigDecimal hwEntityOpticalTxPower;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFiberEntIndex(String fiberEntIndex)
{
this.fiberEntIndex = fiberEntIndex;
}
public String getFiberEntIndex()
{
return fiberEntIndex;
}
public void setFiberPortName(String fiberPortName)
{
this.fiberPortName = fiberPortName;
}
public String getFiberPortName()
{
return fiberPortName;
}
public void setHwEntityOpticalTxLowThreshold(BigDecimal hwEntityOpticalTxLowThreshold)
{
this.hwEntityOpticalTxLowThreshold = hwEntityOpticalTxLowThreshold;
}
public BigDecimal getHwEntityOpticalTxLowThreshold()
{
return hwEntityOpticalTxLowThreshold;
}
public void setHwEntityOpticalRxLowThreshold(BigDecimal hwEntityOpticalRxLowThreshold)
{
this.hwEntityOpticalRxLowThreshold = hwEntityOpticalRxLowThreshold;
}
public BigDecimal getHwEntityOpticalRxLowThreshold()
{
return hwEntityOpticalRxLowThreshold;
}
public void setHwEntityOpticalRxPower(BigDecimal hwEntityOpticalRxPower)
{
this.hwEntityOpticalRxPower = hwEntityOpticalRxPower;
}
public BigDecimal getHwEntityOpticalRxPower()
{
return hwEntityOpticalRxPower;
}
public void setHwEntityOpticalTxPower(BigDecimal hwEntityOpticalTxPower)
{
this.hwEntityOpticalTxPower = hwEntityOpticalTxPower;
}
public BigDecimal getHwEntityOpticalTxPower()
{
return hwEntityOpticalTxPower;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("fiberEntIndex", getFiberEntIndex())
.append("fiberPortName", getFiberPortName())
.append("hwEntityOpticalTxLowThreshold", getHwEntityOpticalTxLowThreshold())
.append("hwEntityOpticalRxLowThreshold", getHwEntityOpticalRxLowThreshold())
.append("hwEntityOpticalRxPower", getHwEntityOpticalRxPower())
.append("hwEntityOpticalTxPower", getHwEntityOpticalTxPower())
.append("clientId", getClientId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,86 +0,0 @@
package com.ruoyi.rocketmq.domain;
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_switch_other_collect_data
*
* @author gyt
* @date 2025-09-23
*/
public class InitialSwitchOtherCollectData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
/** 采集类型 */
@Excel(name = "采集类型")
private String collectType;
/** 采集值 */
@Excel(name = "采集值")
private String collectValue;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setCollectType(String collectType)
{
this.collectType = collectType;
}
public String getCollectType()
{
return collectType;
}
public void setCollectValue(String collectValue)
{
this.collectValue = collectValue;
}
public String getCollectValue()
{
return collectValue;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("clientId", getClientId())
.append("collectType", getCollectType())
.append("collectValue", getCollectValue())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,131 +0,0 @@
package com.ruoyi.rocketmq.domain;
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_switch_power_supply
*
* @author gyt
* @date 2025-09-22
*/
public class InitialSwitchPowerSupply extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 电源索引 */
@Excel(name = "电源索引")
private String pwrEntIndex;
/** 电源名称 */
@Excel(name = "电源名称")
private String pwrName;
/** 电源状态 */
@Excel(name = "电源状态")
private String pwrEntityPwrState;
/** 电源电流(mA) */
@Excel(name = "电源电流(mA)")
private Long pwrEntityPwrCurrent;
/** 电源电压(mV) */
@Excel(name = "电源电压(mV)")
private Long pwrEntityPwrVoltage;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPwrEntIndex(String pwrEntIndex)
{
this.pwrEntIndex = pwrEntIndex;
}
public String getPwrEntIndex()
{
return pwrEntIndex;
}
public void setPwrName(String pwrName)
{
this.pwrName = pwrName;
}
public String getPwrName()
{
return pwrName;
}
public void setPwrEntityPwrState(String pwrEntityPwrState)
{
this.pwrEntityPwrState = pwrEntityPwrState;
}
public String getPwrEntityPwrState()
{
return pwrEntityPwrState;
}
public void setPwrEntityPwrCurrent(Long pwrEntityPwrCurrent)
{
this.pwrEntityPwrCurrent = pwrEntityPwrCurrent;
}
public Long getPwrEntityPwrCurrent()
{
return pwrEntityPwrCurrent;
}
public void setPwrEntityPwrVoltage(Long pwrEntityPwrVoltage)
{
this.pwrEntityPwrVoltage = pwrEntityPwrVoltage;
}
public Long getPwrEntityPwrVoltage()
{
return pwrEntityPwrVoltage;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("pwrEntIndex", getPwrEntIndex())
.append("pwrName", getPwrName())
.append("pwrEntityPwrState", getPwrEntityPwrState())
.append("pwrEntityPwrCurrent", getPwrEntityPwrCurrent())
.append("pwrEntityPwrVoltage", getPwrEntityPwrVoltage())
.append("clientId", getClientId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,149 +0,0 @@
package com.ruoyi.rocketmq.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 告警记录对象 rm_alarm_record
*
* @author gyt
* @date 2025-09-12
*/
public class RmAlarmRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 客户端ID/设备ID */
@Excel(name = "客户端ID/设备ID")
private String clientId;
/** 资源名称 */
@Excel(name = "资源名称")
private String resourceName;
/** 源IP地址 */
@Excel(name = "源IP地址")
private String sourceIp;
/** 告警发生时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "告警发生时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date occurTime;
/** 告警详细内容 */
@Excel(name = "告警详细内容")
private String content;
/** 重复告警次数 */
@Excel(name = "重复告警次数")
private Long repeatCount;
/** 状态:0-未处理,1-已处理 */
@Excel(name = "状态:0-未处理,1-已处理")
private String status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setResourceName(String resourceName)
{
this.resourceName = resourceName;
}
public String getResourceName()
{
return resourceName;
}
public void setSourceIp(String sourceIp)
{
this.sourceIp = sourceIp;
}
public String getSourceIp()
{
return sourceIp;
}
public void setOccurTime(Date occurTime)
{
this.occurTime = occurTime;
}
public Date getOccurTime()
{
return occurTime;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setRepeatCount(Long repeatCount)
{
this.repeatCount = repeatCount;
}
public Long getRepeatCount()
{
return repeatCount;
}
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("id", getId())
.append("clientId", getClientId())
.append("resourceName", getResourceName())
.append("sourceIp", getSourceIp())
.append("occurTime", getOccurTime())
.append("content", getContent())
.append("repeatCount", getRepeatCount())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,24 +0,0 @@
package com.ruoyi.rocketmq.domain.vo;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class SwitchOidVo {
private Map<String, String> netOID;
private Map<String, String> moduleOID;
private Map<String, String> mpuOID;
private Map<String, String> pwrOID;
private Map<String, String> fanOID;
private Map<String, String> otherOID;
/** 团体名 */
private String community;
/** ip地址 */
private String ip;
/** 端口 */
private Integer port;
/** 过滤值 */
private Map<String, List<String>> filters;
}
@@ -1,61 +0,0 @@
package com.ruoyi.rocketmq.service;
import java.util.List;
import com.ruoyi.rocketmq.domain.InitialSystemOtherCollectData;
/**
* 交换机系统其他信息采集数据Service接口
*
* @author gyt
* @date 2025-09-23
*/
public interface IInitialSystemOtherCollectDataService
{
/**
* 查询交换机系统其他信息采集数据
*
* @param id 交换机系统其他信息采集数据主键
* @return 交换机系统其他信息采集数据
*/
public InitialSystemOtherCollectData selectInitialSystemOtherCollectDataById(Long id);
/**
* 查询交换机系统其他信息采集数据列表
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 交换机系统其他信息采集数据集合
*/
public List<InitialSystemOtherCollectData> selectInitialSystemOtherCollectDataList(InitialSystemOtherCollectData initialSystemOtherCollectData);
/**
* 新增交换机系统其他信息采集数据
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
public int insertInitialSystemOtherCollectData(InitialSystemOtherCollectData initialSystemOtherCollectData);
/**
* 修改交换机系统其他信息采集数据
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
public int updateInitialSystemOtherCollectData(InitialSystemOtherCollectData initialSystemOtherCollectData);
/**
* 批量删除交换机系统其他信息采集数据
*
* @param ids 需要删除的交换机系统其他信息采集数据主键集合
* @return 结果
*/
public int deleteInitialSystemOtherCollectDataByIds(Long[] ids);
/**
* 删除交换机系统其他信息采集数据信息
*
* @param id 交换机系统其他信息采集数据主键
* @return 结果
*/
public int deleteInitialSystemOtherCollectDataById(Long id);
}
@@ -1,254 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
import com.ruoyi.rocketmq.utils.EchartsDataUtils;
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.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());
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);
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
extractors.put("inSpeedData", info -> safeConvertToKB(info.getInSpeed()));
extractors.put("outSpeedData", info -> safeConvertToKB(info.getOutSpeed()));
return EchartsDataUtils.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
}
// 安全转换方法(处理可能的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.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
}
}
@@ -1,147 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.InitialSwitchInfo;
import com.ruoyi.rocketmq.mapper.InitialSwitchInfoMapper;
import com.ruoyi.rocketmq.service.IInitialSwitchInfoService;
import com.ruoyi.rocketmq.utils.EchartsDataUtils;
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 InitialSwitchInfoServiceImpl implements IInitialSwitchInfoService
{
@Autowired
private InitialSwitchInfoMapper initialSwitchInfoMapper;
/**
* 查询交换机流量监控信息
*
* @param id 交换机流量监控信息主键
* @return 交换机流量监控信息
*/
@Override
public InitialSwitchInfo selectInitialSwitchInfoById(Long id)
{
return initialSwitchInfoMapper.selectInitialSwitchInfoById(id);
}
/**
* 查询交换机流量监控信息列表
*
* @param initialSwitchInfo 交换机流量监控信息
* @return 交换机流量监控信息
*/
@Override
public List<InitialSwitchInfo> selectInitialSwitchInfoList(InitialSwitchInfo initialSwitchInfo)
{
return initialSwitchInfoMapper.selectInitialSwitchInfoList(initialSwitchInfo);
}
/**
* 新增交换机流量监控信息
*
* @param initialSwitchInfo 交换机流量监控信息
* @return 结果
*/
@Override
public int insertInitialSwitchInfo(InitialSwitchInfo initialSwitchInfo)
{
initialSwitchInfo.setCreateTime(DateUtils.getNowDate());
return initialSwitchInfoMapper.insertInitialSwitchInfo(initialSwitchInfo);
}
/**
* 修改交换机流量监控信息
*
* @param initialSwitchInfo 交换机流量监控信息
* @return 结果
*/
@Override
public int updateInitialSwitchInfo(InitialSwitchInfo initialSwitchInfo)
{
initialSwitchInfo.setUpdateTime(DateUtils.getNowDate());
return initialSwitchInfoMapper.updateInitialSwitchInfo(initialSwitchInfo);
}
/**
* 批量删除交换机流量监控信息
*
* @param ids 需要删除的交换机流量监控信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchInfoByIds(Long[] ids)
{
return initialSwitchInfoMapper.deleteInitialSwitchInfoByIds(ids);
}
/**
* 删除交换机流量监控信息信息
*
* @param id 交换机流量监控信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchInfoById(Long id)
{
return initialSwitchInfoMapper.deleteInitialSwitchInfoById(id);
}
/**
* 批量新增交换机流量监控信息
*
* @param list 交换机流量监控信息集合
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int batchInsertInitialSwitchInfo(List<InitialSwitchInfo> list) {
try {
return initialSwitchInfoMapper.batchInsertInitialSwitchInfo(list);
}catch (Exception e){
log.error("批量插入交换机信息失败,失败数量:{}", list.size(), e);
throw new RuntimeException("批量保存失败",e);
}
}
/**
* 获取交换机网络端口的基础信息
* @param initialSwitchInfo
* @return
*/
@Override
public InitialSwitchInfo getSwitchNetDetailsMsg(InitialSwitchInfo initialSwitchInfo) {
return initialSwitchInfoMapper.getSwitchNetDetailsMsg(initialSwitchInfo);
}
/**
* 获取交换机网口网络速率
* @param initialSwitchInfo
* @return
*/
@Override
public Map<String, Object> switchNetSpeedEcharts(InitialSwitchInfo initialSwitchInfo) {
List<InitialSwitchInfo> list = initialSwitchInfoMapper.selectInitialSwitchInfoList(initialSwitchInfo);
Map<String, Function<InitialSwitchInfo, ?>> extractors = new LinkedHashMap<>();
extractors.put("netInSpeedData", info -> info.getInSpeed());
extractors.put("netOutSpeedData", info -> info.getOutSpeed());
return EchartsDataUtils.buildEchartsData(list, InitialSwitchInfo::getCreateTime, extractors);
}
}
@@ -1,106 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.InitialSwitchMpuInfo;
import com.ruoyi.rocketmq.mapper.InitialSwitchMpuInfoMapper;
import com.ruoyi.rocketmq.service.IInitialSwitchMpuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* MPU信息Service业务层处理
*
* @author gyt
* @date 2025-09-22
*/
@Service
public class InitialSwitchMpuInfoServiceImpl implements IInitialSwitchMpuInfoService
{
@Autowired
private InitialSwitchMpuInfoMapper initialSwitchMpuInfoMapper;
/**
* 查询MPU信息
*
* @param id MPU信息主键
* @return MPU信息
*/
@Override
public InitialSwitchMpuInfo selectInitialSwitchMpuInfoById(Long id)
{
return initialSwitchMpuInfoMapper.selectInitialSwitchMpuInfoById(id);
}
/**
* 查询MPU信息列表
*
* @param initialSwitchMpuInfo MPU信息
* @return MPU信息
*/
@Override
public List<InitialSwitchMpuInfo> selectInitialSwitchMpuInfoList(InitialSwitchMpuInfo initialSwitchMpuInfo)
{
return initialSwitchMpuInfoMapper.selectInitialSwitchMpuInfoList(initialSwitchMpuInfo);
}
/**
* 新增MPU信息
*
* @param initialSwitchMpuInfo MPU信息
* @return 结果
*/
@Override
public int insertInitialSwitchMpuInfo(InitialSwitchMpuInfo initialSwitchMpuInfo)
{
return initialSwitchMpuInfoMapper.insertInitialSwitchMpuInfo(initialSwitchMpuInfo);
}
/**
* 修改MPU信息
*
* @param initialSwitchMpuInfo MPU信息
* @return 结果
*/
@Override
public int updateInitialSwitchMpuInfo(InitialSwitchMpuInfo initialSwitchMpuInfo)
{
initialSwitchMpuInfo.setUpdateTime(DateUtils.getNowDate());
return initialSwitchMpuInfoMapper.updateInitialSwitchMpuInfo(initialSwitchMpuInfo);
}
/**
* 批量删除MPU信息
*
* @param ids 需要删除的MPU信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchMpuInfoByIds(Long[] ids)
{
return initialSwitchMpuInfoMapper.deleteInitialSwitchMpuInfoByIds(ids);
}
/**
* 删除MPU信息信息
*
* @param id MPU信息主键
* @return 结果
*/
@Override
public int deleteInitialSwitchMpuInfoById(Long id)
{
return initialSwitchMpuInfoMapper.deleteInitialSwitchMpuInfoById(id);
}
/**
* 批量新增mpu信息
* @param list
* @return
*/
@Override
public int insertBatchInitialSwitchMpuInfo(List<InitialSwitchMpuInfo> list) {
return initialSwitchMpuInfoMapper.insertBatchInitialSwitchMpuInfo(list);
}
}
@@ -1,96 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.InitialSwitchOtherCollectData;
import com.ruoyi.rocketmq.mapper.InitialSwitchOtherCollectDataMapper;
import com.ruoyi.rocketmq.service.IInitialSwitchOtherCollectDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 交换机系统其他信息采集数据Service业务层处理
*
* @author gyt
* @date 2025-09-23
*/
@Service
public class InitialSwitchOtherCollectDataServiceImpl implements IInitialSwitchOtherCollectDataService
{
@Autowired
private InitialSwitchOtherCollectDataMapper initialSwitchOtherCollectDataMapper;
/**
* 查询交换机系统其他信息采集数据
*
* @param id 交换机系统其他信息采集数据主键
* @return 交换机系统其他信息采集数据
*/
@Override
public InitialSwitchOtherCollectData selectInitialSwitchOtherCollectDataById(Long id)
{
return initialSwitchOtherCollectDataMapper.selectInitialSwitchOtherCollectDataById(id);
}
/**
* 查询交换机系统其他信息采集数据列表
*
* @param initialSwitchOtherCollectData 交换机系统其他信息采集数据
* @return 交换机系统其他信息采集数据
*/
@Override
public List<InitialSwitchOtherCollectData> selectInitialSwitchOtherCollectDataList(InitialSwitchOtherCollectData initialSwitchOtherCollectData)
{
return initialSwitchOtherCollectDataMapper.selectInitialSwitchOtherCollectDataList(initialSwitchOtherCollectData);
}
/**
* 新增交换机系统其他信息采集数据
*
* @param initialSwitchOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
@Override
public int insertInitialSwitchOtherCollectData(InitialSwitchOtherCollectData initialSwitchOtherCollectData)
{
return initialSwitchOtherCollectDataMapper.insertInitialSwitchOtherCollectData(initialSwitchOtherCollectData);
}
/**
* 修改交换机系统其他信息采集数据
*
* @param initialSwitchOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
@Override
public int updateInitialSwitchOtherCollectData(InitialSwitchOtherCollectData initialSwitchOtherCollectData)
{
initialSwitchOtherCollectData.setUpdateTime(DateUtils.getNowDate());
return initialSwitchOtherCollectDataMapper.updateInitialSwitchOtherCollectData(initialSwitchOtherCollectData);
}
/**
* 批量删除交换机系统其他信息采集数据
*
* @param ids 需要删除的交换机系统其他信息采集数据主键
* @return 结果
*/
@Override
public int deleteInitialSwitchOtherCollectDataByIds(Long[] ids)
{
return initialSwitchOtherCollectDataMapper.deleteInitialSwitchOtherCollectDataByIds(ids);
}
/**
* 删除交换机系统其他信息采集数据信息
*
* @param id 交换机系统其他信息采集数据主键
* @return 结果
*/
@Override
public int deleteInitialSwitchOtherCollectDataById(Long id)
{
return initialSwitchOtherCollectDataMapper.deleteInitialSwitchOtherCollectDataById(id);
}
}
@@ -1,96 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.InitialSystemOtherCollectData;
import com.ruoyi.rocketmq.mapper.InitialSystemOtherCollectDataMapper;
import com.ruoyi.rocketmq.service.IInitialSystemOtherCollectDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 交换机系统其他信息采集数据Service业务层处理
*
* @author gyt
* @date 2025-09-23
*/
@Service
public class InitialSystemOtherCollectDataServiceImpl implements IInitialSystemOtherCollectDataService
{
@Autowired
private InitialSystemOtherCollectDataMapper initialSystemOtherCollectDataMapper;
/**
* 查询交换机系统其他信息采集数据
*
* @param id 交换机系统其他信息采集数据主键
* @return 交换机系统其他信息采集数据
*/
@Override
public InitialSystemOtherCollectData selectInitialSystemOtherCollectDataById(Long id)
{
return initialSystemOtherCollectDataMapper.selectInitialSystemOtherCollectDataById(id);
}
/**
* 查询交换机系统其他信息采集数据列表
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 交换机系统其他信息采集数据
*/
@Override
public List<InitialSystemOtherCollectData> selectInitialSystemOtherCollectDataList(InitialSystemOtherCollectData initialSystemOtherCollectData)
{
return initialSystemOtherCollectDataMapper.selectInitialSystemOtherCollectDataList(initialSystemOtherCollectData);
}
/**
* 新增交换机系统其他信息采集数据
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
@Override
public int insertInitialSystemOtherCollectData(InitialSystemOtherCollectData initialSystemOtherCollectData)
{
return initialSystemOtherCollectDataMapper.insertInitialSystemOtherCollectData(initialSystemOtherCollectData);
}
/**
* 修改交换机系统其他信息采集数据
*
* @param initialSystemOtherCollectData 交换机系统其他信息采集数据
* @return 结果
*/
@Override
public int updateInitialSystemOtherCollectData(InitialSystemOtherCollectData initialSystemOtherCollectData)
{
initialSystemOtherCollectData.setUpdateTime(DateUtils.getNowDate());
return initialSystemOtherCollectDataMapper.updateInitialSystemOtherCollectData(initialSystemOtherCollectData);
}
/**
* 批量删除交换机系统其他信息采集数据
*
* @param ids 需要删除的交换机系统其他信息采集数据主键
* @return 结果
*/
@Override
public int deleteInitialSystemOtherCollectDataByIds(Long[] ids)
{
return initialSystemOtherCollectDataMapper.deleteInitialSystemOtherCollectDataByIds(ids);
}
/**
* 删除交换机系统其他信息采集数据信息
*
* @param id 交换机系统其他信息采集数据主键
* @return 结果
*/
@Override
public int deleteInitialSystemOtherCollectDataById(Long id)
{
return initialSystemOtherCollectDataMapper.deleteInitialSystemOtherCollectDataById(id);
}
}
@@ -1,190 +0,0 @@
package com.ruoyi.rocketmq.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.enums.MsgEnum;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rocketmq.domain.DeviceMessage;
import com.ruoyi.rocketmq.domain.RmAgentManagement;
import com.ruoyi.rocketmq.domain.vo.AgentUpdateVo;
import com.ruoyi.rocketmq.mapper.RmAgentManagementMapper;
import com.ruoyi.rocketmq.model.ProducerMode;
import com.ruoyi.rocketmq.producer.MessageProducer;
import com.ruoyi.rocketmq.service.IRmAgentManagementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Agent管理Service业务层处理
*
* @author gyt
* @date 2025-09-15
*/
@Service
@Slf4j
public class RmAgentManagementServiceImpl implements IRmAgentManagementService
{
@Autowired
private RmAgentManagementMapper rmAgentManagementMapper;
@Value("${fileDictory.filePath}")
private String filePath;
// private static String COMMAND = "nohup /usr/local/tongran/deploy.sh restart > /dev/null 2>&1 &";
private static String COMMAND = "nohup /data/saas-income/houduan/tr-client-test/deploy.sh restart > /dev/null 2>&1 &";
@Autowired
private ProducerMode producerMode;
/**
* 查询Agent管理
*
* @param id Agent管理主键
* @return Agent管理
*/
@Override
public RmAgentManagement selectRmAgentManagementById(Long id)
{
return rmAgentManagementMapper.selectRmAgentManagementById(id);
}
/**
* 查询Agent管理列表
*
* @param rmAgentManagement Agent管理
* @return Agent管理
*/
@Override
public List<RmAgentManagement> selectRmAgentManagementList(RmAgentManagement rmAgentManagement)
{
return rmAgentManagementMapper.selectRmAgentManagementList(rmAgentManagement);
}
/**
* 新增Agent管理
*
* @param rmAgentManagement Agent管理
* @return 结果
*/
@Override
public int insertRmAgentManagement(RmAgentManagement rmAgentManagement)
{
rmAgentManagement.setCreateTime(DateUtils.getNowDate());
return rmAgentManagementMapper.insertRmAgentManagement(rmAgentManagement);
}
/**
* 修改Agent管理
*
* @param rmAgentManagement Agent管理
* @return 结果
*/
@Override
public int updateRmAgentManagement(RmAgentManagement rmAgentManagement)
{
rmAgentManagement.setUpdateTime(DateUtils.getNowDate());
processAgentUpdateData(rmAgentManagement);
return 1;
}
/**
* 保存最后更新结果
*
* @param rmAgentManagement Agent管理
* @return 结果
*/
public void updateRmAgentManagementByHardwareSn(RmAgentManagement rmAgentManagement){
rmAgentManagementMapper.updateRmAgentManagementBySn(rmAgentManagement);
}
/**
* 批量删除Agent管理
*
* @param ids 需要删除的Agent管理主键
* @return 结果
*/
@Override
public int deleteRmAgentManagementByIds(Long[] ids)
{
return rmAgentManagementMapper.deleteRmAgentManagementByIds(ids);
}
/**
* 删除Agent管理信息
*
* @param id Agent管理主键
* @return 结果
*/
@Override
public int deleteRmAgentManagementById(Long id)
{
return rmAgentManagementMapper.deleteRmAgentManagementById(id);
}
/**
* 配置更新策略
* @param rmAgentManagement
* @return
*/
@Override
public int addRmAgentManagement(RmAgentManagement rmAgentManagement) {
processAgentUpdateData(rmAgentManagement);
return 1;
}
/**
* 处理agen更新数据
* @param rmAgentManagement
*/
public void processAgentUpdateData(RmAgentManagement rmAgentManagement){
// 查询该资源是否已经配置
RmAgentManagement agentQueryParam = new RmAgentManagement();
agentQueryParam.setHardwareSn(rmAgentManagement.getHardwareSn());
List<RmAgentManagement> agentManagements = rmAgentManagementMapper.selectRmAgentManagementList(agentQueryParam);
if(!agentManagements.isEmpty()){
// 如果存在,修改
rmAgentManagement.setLastUpdateTime(DateUtils.getNowDate());
if("0".equals(rmAgentManagement.getMethod())){
rmAgentManagement.setScheduledUpdateTime(null);
}
rmAgentManagementMapper.updateRmAgentManagementBySn(rmAgentManagement);
}else{
// 如果不存在,添加
rmAgentManagement.setLastUpdateTime(DateUtils.getNowDate());
if("0".equals(rmAgentManagement.getMethod())){
rmAgentManagement.setScheduledUpdateTime(null);
}
rmAgentManagementMapper.insertRmAgentManagement(rmAgentManagement);
}
// 构建更新策略
AgentUpdateVo agentUpdateVo = new AgentUpdateVo();
agentUpdateVo.setFileUrl(rmAgentManagement.getFileUrl());
agentUpdateVo.setFilePath(filePath);
List<String> commandList = new ArrayList<>();
commandList.add(COMMAND);
agentUpdateVo.setCommands(JSONObject.toJSONString(commandList));
agentUpdateVo.setMethod(rmAgentManagement.getMethod());
if(rmAgentManagement.getMethod() == 1){
Date scheduledUpdateTime = rmAgentManagement.getScheduledUpdateTime();
long scheduledTime = scheduledUpdateTime.toInstant().getEpochSecond();
agentUpdateVo.setPolicyTime(scheduledTime);
}
try {
DeviceMessage deviceMessage = new DeviceMessage();
deviceMessage.setClientId(rmAgentManagement.getHardwareSn());
deviceMessage.setDataType(MsgEnum.Agent版本更新.getValue());
deviceMessage.setData(JSONObject.toJSONString(agentUpdateVo));
MessageProducer messageProducer = new MessageProducer();
messageProducer.sendAsyncProducerMessage(
producerMode.getAgentTopic(),
"",
"",
JSONObject.toJSONString(deviceMessage)
);
} catch (Exception e) {
log.error("发送设备配置失败,deviceId: {}", rmAgentManagement.getHardwareSn(), e);
}
}
}
@@ -1,143 +0,0 @@
package com.ruoyi.rocketmq.utils;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
import com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper;
import com.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper;
import com.ruoyi.system.api.RemoteRevenueConfigService;
import com.ruoyi.system.api.domain.RmResourceGroupRemote;
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Component
public class DataProcessUtil {
@Autowired
private RmTemplateLinuxMapper rmTemplateLinuxMapper;
@Autowired
private RmTemplateSwitchMapper rmTemplateSwitchMapper;
@Autowired
private RemoteRevenueConfigService remoteRevenueConfigService;
/**
* 补充资源组信息
*/
public String getResourceGroupNameById(Long resourceGroupId) {
try {
R<RmResourceGroupRemote> resourceGroupResponse = remoteRevenueConfigService
.getResourceGroupMsgById(resourceGroupId, SecurityConstants.INNER);
if (resourceGroupResponse != null && resourceGroupResponse.getData() != null) {
return resourceGroupResponse.getData().getGroupName();
}
} catch (Exception e) {
log.error("获取资源组信息失败,resourceGroupId: {}", resourceGroupId, e);
}
return null;
}
/**
* 资源组信息
*/
public RmResourceGroupRemote getResourceMsgById(Long resourceGroupId) {
try {
R<RmResourceGroupRemote> resourceGroupResponse = remoteRevenueConfigService
.getResourceGroupMsgById(resourceGroupId, SecurityConstants.INNER);
if (resourceGroupResponse != null && resourceGroupResponse.getData() != null) {
return resourceGroupResponse.getData();
}
} catch (Exception e) {
log.error("获取资源信息失败,resourceGroupId: {}", resourceGroupId, e);
}
return null;
}
/**
* 处理Linux模板数据
*/
public void processLinuxTemplateData(Long templateId, Map<String, Object> result) {
RmTemplateLinux query = new RmTemplateLinux();
query.setTemplateId(templateId);
List<RmTemplateLinux> linuxItems = rmTemplateLinuxMapper.selectRmTemplateLinuxList(query);
if (!linuxItems.isEmpty()) {
Map<String, List<RmTemplateLinux>> linuxData = new HashMap<>();
linuxData.put("cpu", filterItemsByDataType(linuxItems, "CPU"));
linuxData.put("other", filterItemsByDataType(linuxItems, "OTHER"));
linuxData.put("vfs", filterItemsByDataType(linuxItems, "POINT"));
linuxData.put("net", filterItemsByDataType(linuxItems, "NET"));
linuxData.put("disk", filterItemsByDataType(linuxItems, "DISK"));
linuxData.put("docker", filterItemsByDataType(linuxItems, "DOCKER"));
result.put("linux", linuxData);
result.put("resourceType", "linux");
}
}
/**
* 处理Switch模板数据
*/
public void processSwitchTemplateData(Long templateId, Map<String, Object> result) {
RmTemplateSwitch query = new RmTemplateSwitch();
query.setTemplateId(templateId);
List<RmTemplateSwitch> switchItems = rmTemplateSwitchMapper.selectRmTemplateSwitchList(query);
if (!switchItems.isEmpty()) {
Map<String, List<RmTemplateSwitch>> switchData = new HashMap<>();
switchData.put("switchOther", filterItemsByDataType(switchItems, "SYSTEM"));
switchData.put("switchMpu", filterItemsByDataType(switchItems, "MPU"));
switchData.put("switchPwr", filterItemsByDataType(switchItems, "POWERSOURCE"));
switchData.put("switchNet", filterItemsByDataType(switchItems, "NETPORT"));
switchData.put("switchModule", filterItemsByDataType(switchItems, "LIGHTMODULE"));
switchData.put("switchFan", filterItemsByDataType(switchItems, "FAN"));
result.put("switch", switchData);
result.put("resourceType", "switch");
}
}
/**
* 通用过滤方法
*/
public static <T> List<T> filterItemsByDataType(List<T> items, String dataType) {
return items.stream()
.filter(item -> {
try {
Field dataTypeField = item.getClass().getDeclaredField("dataType");
dataTypeField.setAccessible(true);
return dataType.equals(dataTypeField.get(item));
} catch (Exception e) {
return false;
}
})
.collect(Collectors.toList());
}
/**
* 获取资源设备列表
*/
public List<RmResourceRegistrationRemote> getResourceDevices(Long resourceGroupId) {
R<RmResourceGroupRemote> groupResponse = remoteRevenueConfigService
.getResourceGroupMsgById(resourceGroupId, SecurityConstants.INNER);
if (groupResponse == null || groupResponse.getData() == null
|| StringUtils.isEmpty(groupResponse.getData().getIncludedDevicesId())) {
log.error("资源组信息不完整,resourceGroupId: {}", resourceGroupId);
return Collections.emptyList();
}
String[] deviceIds = groupResponse.getData().getIncludedDevicesId().split(",");
R<List<RmResourceRegistrationRemote>> devicesResponse = remoteRevenueConfigService
.getRegistrationByIds(deviceIds, SecurityConstants.INNER);
return devicesResponse != null ? devicesResponse.getData() : Collections.emptyList();
}
}
@@ -1,53 +0,0 @@
package com.ruoyi.rocketmq.utils;
import com.ruoyi.common.core.utils.DateUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
public class EchartsDataUtils {
/**
* 构建ECharts图表数据
* @param list 原始数据列表
* @param timeExtractor 时间字段提取函数
* @param dataExtractors 数据提取器Map (key: 数据名称, value: 数据提取函数)
* @param <T> 数据类型泛型
* @return 包含xData和yData的Map
*/
public static <T> Map<String, Object> buildEchartsData(
List<T> list,
Function<T, Date> timeExtractor,
Map<String, Function<T, ?>> dataExtractors) {
// 按时间排序
List<T> sortedList = list.stream()
.sorted(Comparator.comparing(timeExtractor))
.collect(Collectors.toList());
// 准备X轴数据
List<String> xAxisData = sortedList.stream()
.map(item -> DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", timeExtractor.apply(item)))
.collect(Collectors.toList());
// 准备Y轴数据
Map<String, Object> yData = new LinkedHashMap<>();
dataExtractors.forEach((name, extractor) -> {
yData.put(name, sortedList.stream().map(extractor).collect(Collectors.toList()));
});
// 构建返回结果
Map<String, Object> result = new HashMap<>();
result.put("xData", xAxisData);
result.put("yData", yData);
return result;
}
/**
* 微秒转秒
*/
public static double convertMicrosecondsToSeconds(long microseconds) {
return microseconds / 1_000_000.0;
}
}
@@ -1,25 +0,0 @@
package com.ruoyi.testrocketmq;
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 RocketMQApplication
{
public static void main(String[] args)
{
SpringApplication.run(RocketMQApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ RocketMQ模块启动成功 ლ(´ڡ`ლ)゙");
}
}
@@ -1,27 +0,0 @@
package com.ruoyi.testrocketmq.config;
/**
* @author yz
*/
public class MessageConfig {
private Class<?> messageClass;
private boolean orderlyMessage;
public Class<?> getMessageClass() {
return messageClass;
}
public void setMessageClass(Class<?> messageClass) {
this.messageClass = messageClass;
}
public boolean isOrderlyMessage() {
return orderlyMessage;
}
public void setOrderlyMessage(boolean orderlyMessage) {
this.orderlyMessage = orderlyMessage;
}
}
@@ -1,100 +0,0 @@
package com.ruoyi.testrocketmq.consumer;
import com.ruoyi.testrocketmq.enums.MessageCodeEnum;
import com.ruoyi.testrocketmq.producer.ConsumeException;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 消息监听
*/
@Slf4j
@Component
public class RocketMsgListener implements MessageListenerConcurrently {
/**
* 消费消息
*
* @param list msgs.size() >= 1
* DefaultMQPushConsumer.consumeMessageBatchMaxSize=1you can modify here
* 这里只设置为1,当设置为多个时,list中只要有一条消息消费失败,就会整体重试
* @param consumeConcurrentlyContext 上下文信息
* @return 消费状态 成功(CONSUME_SUCCESS)或者 重试 (RECONSUME_LATER)
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
if (!CollectionUtils.isEmpty(list)) {
for (MessageExt messageExt : list) {
// 消息内容
String body = new String(messageExt.getBody());
log.info("接受到的消息为:{}", body);
String tags = messageExt.getTags();
String topic = messageExt.getTopic();
String msgId = messageExt.getMsgId();
String keys = messageExt.getKeys();
int reConsume = messageExt.getReconsumeTimes();
// 消息已经重试了3次,如果不需要再次消费,则返回成功
if (reConsume == 3) {
// TODO 补偿信息
//smsLogService.insertLog(topic, tags, msgId, keys, body, "【" + EnumUtil.getStrMsgByCode(tags, TagsCodeEnum.class) + "】消费失败");
log.error("消息重试超过3次,消费失败!");
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
// 订单超时处理
if (MessageCodeEnum.ORDER_MESSAGE.getCode().equals(topic)) {
if (MessageCodeEnum.ORDER_TIMEOUT_TAG.getCode().equals(tags)) {
// //获取订单
// DealUserOrder dealUserOrder = pcRemoteDealUserOrderService.selectDealUserOrderByOrderNumber(keys);
// if (dealUserOrder != null) {
// //订单状态超时未支付关闭订单 处理
// if (dealUserOrder.getStatus().equals("1")) {
// DealUserOrder dealUserOrders = new DealUserOrder();
// dealUserOrders.setOrderId(dealUserOrder.getOrderId());
// dealUserOrders.setStatus("4");
// pcRemoteDealUserOrderService.updateDealUserOrder(dealUserOrders);
// return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
// }
// log.info("Order does not exist.");
// }
log.info("Consumption success" + body);
DateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.info("Consumption time{}", format.format(new Date()));
} else {
log.info("未匹配到Tag【{}】" + tags);
}
}
}
}
// 消息消费成功
//ConsumeConcurrentlyStatus.RECONSUME_LATER broker会根据设置的messageDelayLevel发起重试,默认16次
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
/**
* 异常处理
*
* @param e 捕获的异常
* @return 消息消费结果
*/
private static ConsumeConcurrentlyStatus handleException(final Exception e) {
Class exceptionClass = e.getClass();
if (exceptionClass.equals(UnsupportedEncodingException.class)) {
log.error(e.getMessage());
} else if (exceptionClass.equals(ConsumeException.class)) {
log.error(e.getMessage());
}
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
}
@@ -1,60 +0,0 @@
package com.ruoyi.testrocketmq.enums;
import lombok.Getter;
@Getter
public enum MessageCodeEnum {
/**
* 消息模块主题
*/
MESSAGE_TOPIC("elink-message","消息服务模块topic名称"),
/**
* 系统消息
*/
NOTE_MESSAGE("system-message","系统消息服务模块topic名称"),
/**
* 用户消息
*/
USER_MESSAGE("user-message","用户消息服务模块topic名称"),
/**
* 订单消息
*/
ORDER_MESSAGE("order-message","订单消息服务模块topic名称"),
/**
* 平台编号
*/
USER_MESSAGE_TAG("user_message_tag","用户消息推送"),
NOTE_MESSAGE_TAG("system_message_tag","系统消息推送"),
ORDER_MESSAGE_TAG("order_message_tag","订单消息推送"),
/**
* 订单处理编号
*/
//订单超时处理
ORDER_TIMEOUT_TAG("order_timeout_tag","订单超时处理");
private final String code;
private final String msg;
MessageCodeEnum(String code, String msg){
this.code = code;
this.msg = msg;
}
public static String valuesOfType(String code) {
String value = "";
for (MessageCodeEnum e : MessageCodeEnum.values()) {
if (code.equals(e.code)) {
value = e.msg;
}
}
return value;
}
}
@@ -1,47 +0,0 @@
package com.ruoyi.testrocketmq.producer;
import com.ruoyi.testrocketmq.config.ProducerConfig;
import org.springframework.beans.factory.annotation.Autowired;
public class AsyncProducer {
@Autowired
private ProducerConfig producerConfig;
/**
* 发送异步的消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key,根据业务来定
* @param value 消息的内容
* @return org.apache.rocketmq.client.producer.SendResult
*/
// public SendResult sendAsyncProducerMessage(String topic, String tag, String key, String value) throws UnsupportedEncodingException {
//
// try {
// DefaultMQProducer defaultMQProducer = producerConfig.producer;
// //Create a message instance, specifying topic, tag and message body.
// Message msg = new Message(topic, tag, key,value.getBytes(RemotingHelper.DEFAULT_CHARSET));
// defaultMQProducer.send(msg, new SendCallback() {
// // 异步回调的处理
// @Override
// public void onSuccess(SendResult sendResult) {
// System.out.printf("%-10d 异步发送消息成功 %s %n", msg, sendResult.getMsgId());
// }
//
// @Override
// public void onException(Throwable e) {
// System.out.printf("%-10d 异步发送消息失败 %s %n", msg, e);
// e.printStackTrace();
// }
// });
// } catch (MQClientException e) {
// e.printStackTrace();
// } catch (RemotingException e) {
// e.printStackTrace();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// return null;
// }
}
@@ -1,34 +0,0 @@
package com.ruoyi.testrocketmq.producer;
import lombok.Data;
import lombok.ToString;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.common.message.MessageQueue;
/**
* 消费时,当前所消费的消息的上下文信息
*
* @author jolly
*/
@ToString
@Data
public final class MessageContext {
/**
* 所消费消息所在的消息队列
*
* @see MessageQueue
*/
private MessageQueue messageQueue;
/**
* 所消费的消息的扩展属性
*
* @see MessageExt
*/
private MessageExt messageExt;
}
@@ -1,110 +0,0 @@
package com.ruoyi.testrocketmq.producer;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.exception.RemotingException;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static com.ruoyi.rocketmq.config.ProducerConfig.producer;
/**
* 消息发送
*/
@Slf4j
public class MessageProducer {
/**
* 同步发送消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key,根据业务来定
* @param value 消息的内容
* @return org.apache.rocketmq.client.producer.SendResult
*/
public SendResult sendSynchronizeMessage(String topic, String tag, String key, String value){
String body = "topic:【"+topic+"】, tag:【"+tag+"】, key:【"+key+"】, value:【"+value+"";
try {
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
SendResult result = producer.send(msg);
return result;
} catch (UnsupportedEncodingException e) {
log.error("消息初始化失败!body{}",body);
} catch (MQClientException | InterruptedException | RemotingException | MQBrokerException e) {
log.error("消息发送失败! body{}",body);
}
return null;
}
/**
* 发送有序的消息
* @param messagesList Message集合
* @param messageQueueNumber 消息队列编号
* @return org.apache.rocketmq.client.producer.SendResult
*/
public SendResult sendOrderlyMessage(List<Message> messagesList, int messageQueueNumber) {
SendResult result = null;
for (Message message : messagesList) {
try {
// DefaultMQProducer defaultMQProducer = ProducerConfig.producer.send(message);
// System.out.println(defaultMQProducer);
result = producer.send(message, (list, msg, arg) -> {
Integer queueNumber = (Integer) arg;
return list.get(queueNumber);
}, messageQueueNumber);
} catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
log.error("发送有序消息失败");
return result;
}
}
return result;
}
/**
* 推送延迟消息
* @param topic
* @param tag
* @param key
* @return boolean
*/
public SendResult sendDelayMessage(String topic, String tag, String key, String value)
{
SendResult result = null;
try
{
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
//设置消息延迟级别,我这里设置5,对应就是延时一分钟
// "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h"
msg.setDelayTimeLevel(4);
// 发送消息到一个Broker
result = producer.send(msg);
// 通过sendResult返回消息是否成功送达
log.info("发送延迟消息结果:======sendResult{}", result);
DateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.info("发送时间:{}", format.format(new Date()));
return result;
}
catch (Exception e)
{
e.printStackTrace();
log.error("延迟消息队列推送消息异常:{},推送内容:{}", e.getMessage(), result);
}
return result;
}
}
@@ -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>
+15 -15
View File
@@ -25,16 +25,16 @@ create table sys_dept (
-- ----------------------------
-- 初始化-部门表数据
-- ----------------------------
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);
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);
-- ----------------------------
@@ -68,8 +68,8 @@ create table sys_user (
-- ----------------------------
-- 初始化-用户信息表数据
-- ----------------------------
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, '测试员');
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, '测试员');
-- ----------------------------
@@ -164,7 +164,7 @@ create table sys_menu (
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('4', '彤然官网', '0', '4', 'http://tongran.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, '角色管理菜单');
@@ -635,8 +635,8 @@ create table sys_notice (
-- ----------------------------
-- 初始化-公告信息表数据
-- ----------------------------
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, '管理员');
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, '管理员');
-- ----------------------------
+8 -8
View File
@@ -34,14 +34,14 @@ CREATE TABLE `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,'');
(2,'tongran-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: tongran-auth\n uri: lb://tongran-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestBody\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: tongran-gen\n uri: lb://tongran-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: tongran-job\n uri: lb://tongran-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: tongran-system\n uri: lb://tongran-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: tongran-file\n uri: lb://tongran-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,'tongran-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,'tongran-monitor-dev.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: tongran\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,'tongran-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: tongran\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.tongran.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: tongran\n url: https://tongran.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,'tongran-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.tongran.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: tongran\n url: https://tongran.vip\n\n# 代码生成\ngen:\n # 作者\n author: tongran\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: com.tongran.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,'tongran-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.tongran.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: tongran\n url: https://tongran.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,'tongran-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://127.0.0.1:9300\r\n path: D:/tongran/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-tongran-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"tongran-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\": \"tongran-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\": \"tongran-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\": \"tongran-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,'');
/******************************************/
+5 -5
View File
@@ -2,21 +2,21 @@
<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>
<groupId>com.tongran</groupId>
<artifactId>tongran</artifactId>
<version>3.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>ruoyi-api-system</module>
<module>tongran-api-system</module>
</modules>
<artifactId>ruoyi-api</artifactId>
<artifactId>tongran-api</artifactId>
<packaging>pom</packaging>
<description>
ruoyi-api系统接口
tongran-api系统接口
</description>
</project>
@@ -3,24 +3,24 @@
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-api</artifactId>
<groupId>com.tongran</groupId>
<artifactId>tongran-api</artifactId>
<version>3.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-api-system</artifactId>
<artifactId>tongran-api-system</artifactId>
<description>
ruoyi-api-system系统接口模块
tongran-api-system系统接口模块
</description>
<dependencies>
<!-- RuoYi Common Core-->
<!-- tongran Common Core-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
<groupId>com.tongran</groupId>
<artifactId>tongran-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@@ -1,4 +1,4 @@
package com.ruoyi.system.api;
package com.tongran.system.api;
import org.springframework.cloud.openfeign.FeignClient;
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.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
import com.tongran.common.core.constant.ServiceNameConstants;
import com.tongran.common.core.domain.R;
import com.tongran.system.api.domain.SysFile;
import com.tongran.system.api.factory.RemoteFileFallbackFactory;
/**
* 文件服务
*
* @author ruoyi
* @author tongran
*/
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService
@@ -1,20 +1,20 @@
package com.ruoyi.system.api;
package com.tongran.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysLogininfor;
import com.ruoyi.system.api.domain.SysOperLog;
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
import com.tongran.common.core.constant.SecurityConstants;
import com.tongran.common.core.constant.ServiceNameConstants;
import com.tongran.common.core.domain.R;
import com.tongran.system.api.domain.SysLogininfor;
import com.tongran.system.api.domain.SysOperLog;
import com.tongran.system.api.factory.RemoteLogFallbackFactory;
/**
* 日志服务
*
* @author ruoyi
* @author tongran
*/
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
@@ -1,22 +1,20 @@
package com.ruoyi.system.api;
package com.tongran.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.system.api.domain.*;
import com.ruoyi.system.api.factory.RemoteRevenueConfigFallbackFactory;
import com.tongran.common.core.constant.SecurityConstants;
import com.tongran.common.core.constant.ServiceNameConstants;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.system.api.domain.*;
import com.tongran.system.api.factory.RemoteRevenueConfigFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 用户服务
*
* @author ruoyi
* @author tongran
*/
@FeignClient(contextId = "remoteRevenueConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteRevenueConfigFallbackFactory.class)
public interface RemoteRevenueConfigService
@@ -89,4 +87,50 @@ public interface RemoteRevenueConfigService
@PostMapping("/registration/getListByHardwareSn")
public R<RmResourceRegistrationRemote> getListByHardwareSn(@RequestBody RmResourceRegistrationRemote rmResourceRegistrationRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 根据clientId获取交换机名称信息
* @param rmSwitchManagementRemote
* @param source
* @return
*/
@PostMapping("/switchManagement/getSwitchNameByClientId")
public R<List<RmSwitchManagementRemote>> getSwitchNameByClientId(@RequestBody RmSwitchManagementRemote rmSwitchManagementRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 根据clientId修改交换机在线状态
* @param rmSwitchManagementRemote
* @param source
* @return
*/
@PostMapping("/switchManagement/updateSwitchMsgByClientId")
public R<Integer> updateSwitchMsgByClientId(@RequestBody RmSwitchManagementRemote rmSwitchManagementRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 自动注册
* @param rmRegisterMsgRemote
* @param source
* @return
*/
@PostMapping("/registration/innerAddRegist")
public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmRegisterMsgRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 添加节点标识
* @param rmResourceRegistrationRemote
* @param source
* @return
*/
@PostMapping("/registration/innerUpdateRegist")
public R<Integer> innerUpdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistrationRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 获取95值列表
* @param epsNodeBandwidthRemote
* @param source
* @return
*/
@PostMapping("/bandwidth/getEpsNodeBandWidthList")
public R<List<EpsNodeBandwidthRemote>> getEpsNodeBandWidthList(@RequestBody EpsNodeBandwidthRemote epsNodeBandwidthRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@GetMapping("/businessScript/inner/{id}")
public R<EpsBusinessScriptRemote> getBusinessScriptMsgByScriptId(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
@@ -0,0 +1,109 @@
package com.tongran.system.api;
import com.tongran.common.core.constant.SecurityConstants;
import com.tongran.common.core.constant.ServiceNameConstants;
import com.tongran.common.core.domain.R;
import com.tongran.system.api.domain.RmAlarmRecordRemote;
import com.tongran.system.api.domain.RmDeployScriptRemote;
import com.tongran.system.api.domain.RmMonitorPolicyRemote;
import com.tongran.system.api.domain.RmNetworkInterfaceRemote;
import com.tongran.system.api.factory.RemoteRocketMqFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(contextId = "remoteRocketMqService", value = ServiceNameConstants.ROCKETMQ_SERVICE, fallbackFactory = RemoteRocketMqFallbackFactory.class)
public interface RemoteRocketMqService {
/**
* 发送异步消息
* @param topic
* @param tag
* @param key
* @param value
* @param source
* @return
*/
@PostMapping("/api/rocketMessage/sendAsyncProducerMessage")
public R<Map> sendAsyncProducerMessage(@RequestParam("topic") String topic, @RequestParam("tag") String tag, @RequestParam("key") String key, @RequestParam("value") String value, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询告警记录
*
* @param rmAlarmRecordRemote
* @param source
* @return
*/
@PostMapping("/alarmRecord/getAlarmList")
public R<List<RmAlarmRecordRemote>> getAlarmList(@RequestBody RmAlarmRecordRemote rmAlarmRecordRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 资源告警处理情况
* @param source
* @return
*/
@GetMapping("/alarmRecord/alarmHandlingStatus")
public R<Map> alarmHandlingStatus(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 获取网卡接口列表
* @param rmNetworkInterfaceRemote
* @param source
* @return
*/
@PostMapping("/networkInterface/getNetworkInterfaceList")
public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 绑定业务网卡
* @param rmNetworkInterfaceRemote
* @param source
* @return
*/
@PostMapping("/networkInterface/bindPublicIp")
public R<Integer> bindPublicIp(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 下发策略
* @param id
* @param source
* @return
*/
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
public R<String> innerIssueSwitchPolicy(@RequestParam("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询策略信息
* @param rmMonitorPolicyRemote
* @param source
* @return
*/
@PostMapping("/monitorPolicy/getPolicyMsgInner")
public R<List<RmMonitorPolicyRemote>> getPolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 策略添加新设备
* @param rmMonitorPolicyRemote
* @param source
* @return
*/
@PostMapping("/monitorPolicy/updatePolicyMsgInner")
public R<Integer> updatePolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 下发优先级为0的策略
* @param clientId
* @param source
* @return
*/
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
public R<Integer> issueDefaultPolicyByClientId(@RequestParam("clientId") String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("policy/addDeployScript")
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);
}
@@ -1,20 +1,20 @@
package com.ruoyi.system.api;
package com.tongran.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
import com.ruoyi.system.api.domain.NodeBandwidth;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
import com.tongran.common.core.constant.SecurityConstants;
import com.tongran.common.core.constant.ServiceNameConstants;
import com.tongran.common.core.domain.R;
import com.tongran.system.api.domain.EpsInitialTrafficDataRemote;
import com.tongran.system.api.domain.NodeBandwidth;
import com.tongran.system.api.domain.SysUser;
import com.tongran.system.api.factory.RemoteUserFallbackFactory;
import com.tongran.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* 用户服务
*
* @author ruoyi
* @author tongran
*/
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
@@ -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.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Set;
@@ -0,0 +1,35 @@
package com.tongran.system.api.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 业务脚本管理对象 eps_business_script
*
* @author gyt
* @date 2025-10-13
*/
@Data
public class EpsBusinessScriptRemote extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 脚本名称 */
@Excel(name = "脚本名称")
private String scriptName;
/** 脚本文件地址 */
@Excel(name = "脚本文件地址")
private String scriptPath;
/** 脚本默认参数 */
@Excel(name = "脚本默认参数")
private String defaultParams;
/** 结果失败判断关键字 */
@Excel(name = "结果失败判断关键字")
private String failedKeywords;
}
@@ -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.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
@@ -0,0 +1,136 @@
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class EpsNodeBandwidthRemote extends BaseEntity {
/** id */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 带宽值类型
* 1-95带宽值Mbps/日
* 2-95带宽值Mbps/月
* 3-包端带宽值Mbps/日
* 4-月均日95值Mbps
* 5-有效-95带宽值Mbps/日
* 6-有效-95带宽值Mbps/月
* 7-有效-月均日95值
* */
private String bandwidthType;
/** 带宽值结果 */
private BigDecimal bandwidthResult;
/** 95带宽值Mbps/日 */
@Excel(name = "95带宽值Mbps/日")
private BigDecimal bandwidth95Daily;
/** 95带宽值Mbps/月 */
@Excel(name = "95带宽值Mbps/月")
private BigDecimal bandwidth95Monthly;
/** 月均日95值 */
@Excel(name = "月均日95值")
private BigDecimal avgMonthlyBandwidth95;
/** 包端带宽值Mbps/日 */
@Excel(name = "包端带宽值Mbps/日")
private BigDecimal packageBandwidthDaily;
/** 有效-95带宽值Mbps/日 */
@Excel(name = "有效-95带宽值Mbps/日")
private BigDecimal effectiveBandwidth95Daily;
/** 有效-95带宽值Mbps/月 */
@Excel(name = "有效-95带宽值Mbps/月")
private BigDecimal effectiveBandwidth95Monthly;
/** 有效-月均95值 */
@Excel(name = "有效-月均95值")
private BigDecimal effectiveAvgMonthlyBandwidth95;
/** 金山流量Mbps/日 */
private BigDecimal machineFlow;
/** 设备业务客户id */
@Excel(name = "设备业务客户id")
private String customerId;
/** 设备业务客户名称 */
@Excel(name = "设备业务客户名称")
private String customerName;
/** 业务号 */
@Excel(name = "业务号")
private String serviceNumber;
/** 上联交换机 */
@Excel(name = "上联交换机")
private String uplinkSwitch;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** 交换机sn */
@Excel(name = "交换机sn")
private String switchSn;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 资源类型(1服务器,2交换机) */
@Excel(name = "资源类型")
private String resourceType;
/** 接口连接设备类型(1服务器,2机房出口) */
@Excel(name = "接口连接设备类型")
private String interfaceLinkDeviceType;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessId;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 月份 */
private String monthTime;
/** 备注 */
private String remark1;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDatetime;
private List<String> nodeNames;
private List<String> switchNames;
/** 计算方式 */
private String calculationMode;
/** 客户端id */
private String clientId;
}
@@ -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.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
@@ -0,0 +1,46 @@
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class NetworkInfo {
// 运营商
@JsonProperty("carrier")
private String carrier;
// 市
@JsonProperty("city")
private String city;
// 网关
@JsonProperty("gateway")
private String gateway;
// IPv4 地址
@JsonProperty("ipv4")
private String ipv4;
// IPv4 地址
@JsonProperty("ipv6")
private String ipv6;
// MAC 地址
@JsonProperty("mac")
private String mac;
// 接口名称:eth0, enp3s0
@JsonProperty("name")
private String name;
// 省
@JsonProperty("province")
private String province;
// 公网 IP
@JsonProperty("publicIp")
private String publicIp;
@JsonProperty("type")
private String type;
// 如果是子接口,存储父接口名称
@JsonProperty("parentInterface")
private String parentInterface;
// 如果是父接口,存储子接口列表
@JsonProperty("subInterfaces")
private List<NetworkInfo> subInterfaces;
}
@@ -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.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -1,8 +1,8 @@
package com.ruoyi.system.api.domain;
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -1,23 +1,13 @@
package com.ruoyi.rocketmq.domain;
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 服务器脚本策略对象 rm_deployment_policy
*
* @author gyt
* @date 2025-09-15
*/
@Data
public class RmDeploymentPolicy extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class RmDeployScriptRemote {
/** 策略ID */
private Long id;
@@ -81,4 +71,14 @@ public class RmDeploymentPolicy extends BaseEntity
private String resourceGroupName;
/** 资源组置空 */
private Boolean resourceGroupIdNull;
/** 部署设备 */
private String deployDevice;
/** 业务脚本名称 */
private String scriptName;
/** 业务脚本文件地址 */
private String scriptPath;
/** 业务脚本参数 */
private String defaultParams;
/** 业务下发名称 */
private String taskName;
}
@@ -0,0 +1,61 @@
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
@Data
public class RmMonitorPolicyRemote extends BaseEntity {
/** 主键ID */
private Long id;
/** 策略名称 */
@Excel(name = "策略名称")
private String policyName;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 资源组ID */
private Long resourceGroupId;
/** 资源组名称 */
@Excel(name = "关联资源组")
private String resourceGroupName;
/** 模板ID */
private Long templateId;
/** 模板名称 */
@Excel(name = "关联监控模板")
private String templateName;
/** 状态:0-待下发,1-已下发 */
@Excel(name = "策略状态", readConverterExp = "0=待下发,1=已下发")
private String status;
/** 下发策略时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "下发策略时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date deployTime;
/** 资源类型,linux switch */
private String resourceType;
/** 查询条件名称 */
private String queryName;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间")
private Date createTime;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修改时间")
private Date updateTime;
/** 交换机类型 */
private String switchType;
/** 部署设备 */
private String deployDevice;
/** 优先级 */
private String priority;
}
@@ -0,0 +1,64 @@
package com.tongran.system.api.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
@Data
public class RmNetworkInterfaceRemote extends BaseEntity {
/** 主键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;
/** IPv6地址 */
private String ipv6Address;
/** 网关 */
@Excel(name = "网关")
private String gateway;
/** 绑定ip 1业务IP2管理ip */
private String bindIp;
/** 新旧标识 */
private Integer newFlag;
/** 查询业务网卡或单个网卡的clientId集合 */
private String clientIds;
/** 查询所有网卡的clientId集合 */
private String allClientIds;
// 如果是子接口,存储父接口名称
private String parentInterface;
}
@@ -0,0 +1,23 @@
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class RmRegisterMsgRemote {
@JsonProperty("clientId")
private String clientId;
@JsonProperty("sn")
private String sn;
@JsonProperty("networkInfo")
private List<NetworkInfo> networkInfo;
@JsonProperty("timestamp")
private long timestamp;
}
@@ -1,8 +1,8 @@
package com.ruoyi.system.api.domain;
package com.tongran.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
@@ -1,9 +1,12 @@
package com.ruoyi.system.api.domain;
package com.tongran.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 资源注册对象 rm_resource_registration
*
@@ -127,5 +130,53 @@ public class RmResourceRegistrationRemote extends BaseEntity
private String monitorItems;
/** 自动发现项 */
private String discoveryRules;
/**
* 客户端ID
*/
private String clientId;
/**
* 运营商
*/
private String operator;
/**
*
*/
private String province;
/**
* 公网IP
*/
private String publicIp;
/**
* 业务名称
*/
private String businessName;
/**
* 逻辑节点标识
*/
private String logicalNodeId;
/**
* 多公网IP状态
*/
private String multiPublicIpStatus;
/**
* 心跳次数
*/
private Integer heartbeatCount;
/**
* 心跳周期单位
*/
private Integer heartbeatInterval;
/** 上机时间 */
@Excel(name = "上机时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date onboardTime;
}
@@ -0,0 +1,74 @@
package com.tongran.system.api.domain;
import com.tongran.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class RmSwitchManagementRemote {
/** 主键ID */
private Long id;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 硬件SN序列号 */
@Excel(name = "硬件SN序列号")
private String hardwareSn;
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpAddress;
/** SNMP采集端口 */
@Excel(name = "SNMP采集端口")
private Long snmpPort;
/** 在线状态(0-离线,1-在线) */
@Excel(name = "在线状态(0-离线,1-在线)")
private String onlineStatus;
/** 上机时间 */
private Date upTime;
/** 心跳监测次数 */
@Excel(name = "心跳监测次数")
private String heartbeatCount;
/** 心跳监测周期(秒) */
@Excel(name = "心跳监测周期(秒)")
private String heartbeatInterval;
/** 心跳检测OID */
@Excel(name = "心跳检测OID")
private String heartbeatOid;
/** SNMP版本(v1/v2c/v3) */
@Excel(name = "SNMP版本(v1/v2c/v3)")
private String snmpVersion;
/** 读写权限 */
@Excel(name = "读写权限")
private String readWritePermission;
/** 安全级别 */
@Excel(name = "安全级别")
private String securityLevel;
/** 加密方式 */
@Excel(name = "加密方式")
private String encryptionMethod;
/** 团体名称 */
@Excel(name = "团体名称")
private String communityName;
/** 密码 */
@Excel(name = "密码")
private String switchPassword;
/** 交换机类型 */
private String switchType;
/** 用户名 */
private String switchUser;
/** 自动生成客户端id(uuid) */
private String clientId;
}
@@ -0,0 +1,12 @@
package com.tongran.system.api.domain;
import lombok.Data;
@Data
public class RouteMsg {
/** 网卡名称 */
private String name;
/** 网关地址 */
private String gateway;
}

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