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