1、优化服务器管理列表ip分页展示。

2、集成rustfs SDK。
3、测试交换机数据IoTDB入库。
This commit is contained in:
gaoyutao
2026-02-11 18:02:55 +08:00
parent 8cc321bf14
commit 3c1edfcd2e
14 changed files with 1104 additions and 216 deletions
@@ -524,14 +524,19 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
if (businessIpCount > 3) {
continue; // 最多只处理3个业务IP
}
// 设置业务IP字段
switch (businessIpCount) {
case 1:
registration.setIp1Isp(network.getIsp());
registration.setIp1Province(network.getProvince());
if (network.getIsp() != null) {
registration.setIp1Isp(network.getIsp());
}
if (network.getProvince() != null) {
registration.setIp1Province(network.getProvince());
}
registration.setIp1City(network.getCity());
registration.setIp1PublicIp(network.getPublicIp());
if (network.getPublicIp() != null) {
registration.setIp1PublicIp(network.getPublicIp());
}
registration.setIp1InterfaceName(network.getInterfaceName());
registration.setIp1MacAddress(network.getMacAddress());
registration.setIp1InterfaceType(network.getInterfaceType());
@@ -579,53 +584,6 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
if(registration.getIp1Province() == null && network.getProvince() != null){
registration.setIp1Province(network.getProvince());
}
// 如果还有字段为null,再尝试从子网卡中获取
if(registration.getIp1PublicIp() == null || registration.getIp1Isp() == null || registration.getIp1Province() == null){
// 查询子网卡信息
RmNetworkInterfaceRemote query = new RmNetworkInterfaceRemote();
query.setClientId(registration.getClientId());
query.setIpv4Flag(true);
R<List<RmNetworkInterfaceRemote>> children = remoteRocketMqService.innerGetChildList(query, SecurityConstants.INNER);
if(children != null && children.getData() != null && !children.getData().isEmpty()){
// 按ip最后一位排序取最小的
RmNetworkInterfaceRemote minIpChild = null;
int minLastOctet = Integer.MAX_VALUE;
for (RmNetworkInterfaceRemote child : children.getData()) {
if (child.getIpv4Address() != null && !child.getIpv4Address().isEmpty()) {
String ip = child.getIpv4Address();
String[] ipParts = ip.split("\\.");
if (ipParts.length == 4) {
try {
int lastOctet = Integer.parseInt(ipParts[3]);
if (lastOctet < minLastOctet) {
minLastOctet = lastOctet;
minIpChild = child;
}
} catch (NumberFormatException e) {
// 忽略格式错误的IP
}
}
}
}
if (minIpChild != null) {
// 只设置还为空的值
if(registration.getIp1PublicIp() == null){
registration.setIp1PublicIp(minIpChild.getPublicIp());
}
if(registration.getIp1Isp() == null){
registration.setIp1Isp(minIpChild.getIsp());
}
if(registration.getIp1Province() == null){
registration.setIp1Province(minIpChild.getProvince());
}
}
}
}
// 管理网IP处理
registration.setMgmtIsp(network.getIsp());
registration.setMgmtProvince(network.getProvince());
@@ -639,6 +597,52 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
registration.setMgmtGateway(network.getGateway());
}
}
// 如果还有字段为null,再尝试从子网卡中获取
if(registration.getIp1PublicIp() == null || registration.getIp1Isp() == null || registration.getIp1Province() == null){
// 查询子网卡信息
RmNetworkInterfaceRemote query = new RmNetworkInterfaceRemote();
query.setClientId(registration.getClientId());
query.setIpv4Flag(true);
R<List<RmNetworkInterfaceRemote>> children = remoteRocketMqService.innerGetChildList(query, SecurityConstants.INNER);
if(children != null && children.getData() != null && !children.getData().isEmpty()){
// 按ip最后一位排序取最小的
RmNetworkInterfaceRemote minIpChild = null;
int minLastOctet = Integer.MAX_VALUE;
for (RmNetworkInterfaceRemote child : children.getData()) {
if (child.getIpv4Address() != null && !child.getIpv4Address().isEmpty()) {
String ip = child.getIpv4Address();
String[] ipParts = ip.split("\\.");
if (ipParts.length == 4) {
try {
int lastOctet = Integer.parseInt(ipParts[3]);
if (lastOctet < minLastOctet) {
minLastOctet = lastOctet;
minIpChild = child;
}
} catch (NumberFormatException e) {
// 忽略格式错误的IP
}
}
}
}
if (minIpChild != null) {
// 只设置还为空的值
if(registration.getIp1PublicIp() == null){
registration.setIp1PublicIp(minIpChild.getPublicIp());
}
if(registration.getIp1Isp() == null){
registration.setIp1Isp(minIpChild.getIsp());
}
if(registration.getIp1Province() == null){
registration.setIp1Province(minIpChild.getProvince());
}
}
}
}
}
@@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
`name` VARCHAR(255) COMMENT '接口名称',
`mac` VARCHAR(20) COMMENT 'MAC地址',
`mac` VARCHAR(255) COMMENT 'MAC地址',
`status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址',