|
|
@ -9,6 +9,7 @@ import com.ruoyi.common.utils.spring.SpringUtils; |
|
|
|
import com.zc.business.constant.RedisKeyConstants; |
|
|
|
import com.zc.business.controller.DcDeviceController; |
|
|
|
import com.zc.business.domain.DcDevice; |
|
|
|
import com.zc.business.domain.DcDeviceOfflineRecord; |
|
|
|
import com.zc.business.domain.DcSwitch; |
|
|
|
import com.zc.business.domain.Device; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
@ -176,8 +177,9 @@ public class DcSwitchServiceImpl extends ServiceImpl<DcSwitchMapper, DcSwitch> i |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public AjaxResult deviceDiagnostics(Device device) throws Exception { |
|
|
|
public AjaxResult deviceDiagnostics(DcDeviceOfflineRecord device) throws Exception { |
|
|
|
String deviceIp = device.getDeviceIp(); |
|
|
|
String deviceType = device.getDeviceType(); |
|
|
|
RedisCache redisCache = SpringUtils.getBean(RedisCache.class); |
|
|
|
String cacheObject = redisCache.getCacheObject(DEVICEDIAGNOSTICS+deviceIp);//获取缓存是否存在诊断结果
|
|
|
|
if (StringUtils.isNotBlank(cacheObject)){ //存在即返回
|
|
|
@ -191,13 +193,13 @@ public class DcSwitchServiceImpl extends ServiceImpl<DcSwitchMapper, DcSwitch> i |
|
|
|
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"设备网关网络异常",2, TimeUnit.MINUTES); |
|
|
|
return AjaxResult.success("设备网关网络异常"); |
|
|
|
} |
|
|
|
List<DcDevice> dcDeviceId = dcSwitchMapper.getDcDeviceId(deviceIp);//查询设备id
|
|
|
|
List<DcDeviceOfflineRecord> dcDeviceId = dcSwitchMapper.getDcDeviceId(deviceIp,deviceType);//查询设备id
|
|
|
|
DcDevice dcDevice = new DcDevice();//存放设备id
|
|
|
|
if (dcDeviceId.size()>1){ |
|
|
|
redisCache.setCacheObject(DEVICEDIAGNOSTICS+deviceIp,"设备IP存在冲突",2, TimeUnit.MINUTES); |
|
|
|
return AjaxResult.success("设备IP存在冲突"); |
|
|
|
}else { |
|
|
|
for (DcDevice dcDeviceValue:dcDeviceId){ |
|
|
|
for (DcDeviceOfflineRecord dcDeviceValue:dcDeviceId){ |
|
|
|
dcDevice.setId(dcDeviceValue.getId());//存入设备id
|
|
|
|
} |
|
|
|
} |
|
|
|