修复列表管理网卡信息不显示问题。

修复多网卡图形监控异常问题。
This commit is contained in:
gaoyutao
2025-12-18 15:28:25 +08:00
parent 343028ade5
commit 92cf598941
7 changed files with 28 additions and 17 deletions
@@ -255,7 +255,7 @@ public class RmResourceRegistration extends BaseEntity
/** 日95带宽值利用率 */
@Excel(name = "日95带宽值利用率")
private String bandwidthRate;
/** 昨日95值排序 1正序 2倒叙 3不排序 */
/** 昨日95值排序 1正序 2倒叙 3不排序 4 cpu内存倒叙*/
private Integer bandwidthResultSort;
/** cpu利用率 */
private BigDecimal cpuUtil;
@@ -81,11 +81,11 @@ public class AllInterfaceNameServiceImpl implements IAllInterfaceNameService
return nonSubInterfaces;
}
// 缓存匹配结果,避免重复计算
Map<AllInterfaceName, Boolean> matchStatusMap = new HashMap<>();
// 使用ID作为键,避免对象相等性问题
Map<Long, Boolean> matchStatusMap = new HashMap<>();
for (AllInterfaceName interfaceName : nonSubInterfaces) {
boolean isMatched = isInterfaceMatched(interfaceName);
matchStatusMap.put(interfaceName, isMatched);
matchStatusMap.put(interfaceName.getId(), isMatched);
// 只设置服务器类型的businessFlag
if ("1".equals(interfaceName.getResourceType())) {
@@ -96,12 +96,12 @@ public class AllInterfaceNameServiceImpl implements IAllInterfaceNameService
// 使用自定义排序
return nonSubInterfaces.stream()
.sorted((a, b) -> {
boolean aMatched = matchStatusMap.get(a);
boolean bMatched = matchStatusMap.get(b);
Boolean aMatched = matchStatusMap.get(a.getId());
Boolean bMatched = matchStatusMap.get(b.getId());
if (aMatched && !bMatched) {
if (Boolean.TRUE.equals(aMatched) && !Boolean.TRUE.equals(bMatched)) {
return -1;
} else if (!aMatched && bMatched) {
} else if (!Boolean.TRUE.equals(aMatched) && Boolean.TRUE.equals(bMatched)) {
return 1;
} else {
return 0;
@@ -354,7 +354,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
CompletableFuture<List<RmNetworkInterfaceRemote>> networkFuture = CompletableFuture
.supplyAsync(() -> {
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
queryParam.setClientIds(clientIdsStr);
queryParam.setAllClientIds(clientIdsStr);
queryParam.setNewFlag(1);
R<List<RmNetworkInterfaceRemote>> result = remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER);
return result != null ? result.getData() : Collections.emptyList();
@@ -362,9 +362,9 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
CompletableFuture.allOf(cpuFuture, memFuture, networkFuture).join();
List<RmResourceRegistration> cpuUtilList = cpuFuture.get();
List<RmResourceRegistration> memUtilList = memFuture.get();
List<RmNetworkInterfaceRemote> networkList = networkFuture.get();
List<RmResourceRegistration> cpuUtilList = cpuFuture.get() == null ? new ArrayList<>() : cpuFuture.get();
List<RmResourceRegistration> memUtilList = memFuture.get() == null ? new ArrayList<>() : memFuture.get();
List<RmNetworkInterfaceRemote> networkList = networkFuture.get() == null ? new ArrayList<>() : networkFuture.get();
// 构建查找Map
Map<String, BigDecimal> cpuUtilMap = cpuUtilList.stream()
@@ -433,6 +433,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
int businessIpCount = 1;
for (RmNetworkInterfaceRemote network : networkList) {
if ("1".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
// 业务IP处理
if (businessIpCount > 3) {