Browse Source

优化诊断文字

develop
wangsixiang 3 weeks ago
parent
commit
5c3373a034
  1. 12
      zc-business/src/main/java/com/zc/business/service/impl/DcSwitchServiceImpl.java

12
zc-business/src/main/java/com/zc/business/service/impl/DcSwitchServiceImpl.java

@ -208,19 +208,19 @@ public class DcSwitchServiceImpl extends ServiceImpl<DcSwitchMapper, DcSwitch> i
.filter(dcSwitch -> dcSwitch.getDeviceList().contains(deviceIdString))
.findFirst().map(DcSwitch::getSwitchIp).orElse(null);
if (StringUtils.isBlank(switchIp)){ //switchIp为空不存在交换机ip
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"未查询到相关的二层交换机",2, TimeUnit.MINUTES);
return AjaxResult.success("未查询到相关的二层交换机");
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"未查询到相关的交换机",2, TimeUnit.MINUTES);
return AjaxResult.success("未查询到相关的交换机");
}
List<DcSwitch> switchList = dcSwitchMapper.getSwitchName(switchIp);
if (switchList.size()!=1){
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"二层交换机IP存在冲突",2, TimeUnit.MINUTES);
return AjaxResult.success("二层交换机IP存在冲突");
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"交换机IP存在冲突",2, TimeUnit.MINUTES);
return AjaxResult.success("交换机IP存在冲突");
}else {
for (DcSwitch switchListValue:switchList) {
InetAddress newSwitchIp = InetAddress.getByName(switchIp);
if (!newSwitchIp.isReachable(UniversalEnum.FIVE_THOUSAND.getNumber())) {
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"设备二层交换机"+switchListValue.getSwitchName()+"网络异常",2, TimeUnit.MINUTES);
return AjaxResult.success("设备二层交换机"+switchListValue.getSwitchName()+"网络异常");
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"设备交换机"+switchListValue.getSwitchName()+"网络异常",2, TimeUnit.MINUTES);
return AjaxResult.success("设备交换机"+switchListValue.getSwitchName()+"网络异常");
}
}
}

Loading…
Cancel
Save