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