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

修复多网卡图形监控异常问题。
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
@@ -54,8 +54,10 @@ public class RmNetworkInterfaceRemote extends BaseEntity {
private String bindIp;
/** 新旧标识 */
private Integer newFlag;
/** 服务器clientId集合 */
/** 查询业务网卡或单个网卡的clientId集合 */
private String clientIds;
/** 查询所有网卡的clientId集合 */
private String allClientIds;
// 如果是子接口,存储父接口名称
private String parentInterface;
@@ -8,12 +8,12 @@ public class ConvertOtherTypeUtil {
*/
public static String getInterfaceTypeName(int typeCode) {
switch (typeCode) {
case 1: return "other";
case 1: return "其他";
case 2: return "regular1822";
case 3: return "hdh1822";
case 4: return "ddnX25";
case 5: return "rfc877x25";
case 6: return "ethernetCsmacd";
case 6: return "以太网";
case 7: return "iso88023Csmacd";
case 8: return "iso88024TokenBus";
case 9: return "iso88025TokenRing";
@@ -31,7 +31,7 @@ public class ConvertOtherTypeUtil {
case 21: return "primaryISDN";
case 22: return "propPointToPointSerial";
case 23: return "ppp";
case 24: return "softwareLoopback";
case 24: return "软件环回";
case 25: return "eon";
case 26: return "ethernet3Mbit";
case 27: return "nsip";
@@ -60,7 +60,7 @@ public class ConvertOtherTypeUtil {
case 50: return "sonetPath";
case 51: return "sonetVT";
case 52: return "smdsIcip";
case 53: return "propVirtual";
case 53: return "专有虚拟";
case 54: return "propMultiplexor";
case 55: return "ieee80212";
case 56: return "fibreChannel";
@@ -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) {
@@ -65,5 +65,7 @@ public class RmNetworkInterface extends BaseEntity
private Integer newFlag;
/** 服务器clientId集合 */
private String clientIds;
/** 查询所有网卡的clientId集合 */
private String allClientIds;
}
@@ -51,6 +51,12 @@
#{clientId}
</foreach>
</if>
<if test="allClientIds != '' and allClientIds != null">
and client_id in
<foreach collection="allClientIds.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
</foreach>
</if>
</where>
</select>