diff --git a/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java b/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java index 85e57e8a..48596918 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java +++ b/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java @@ -61,10 +61,15 @@ public class DeviceStatus { for (DcDevice device : deviceList) { Callable task = () -> { if (Objects.equals(device.getDeviceType(), UniversalEnum.EIGHT.getValue()) || Objects.equals(device.getDeviceType(), UniversalEnum.FIFTEEN.getValue())) { - AjaxResult deviceByIotDeviceId = deviceService.getDeviceByIotDeviceId(device.getIotDeviceId()); - String deviceState = ((JSONObject) JSON.toJSON(deviceByIotDeviceId.get("data"))).getString("deviceState"); - if (Objects.equals(deviceState, UniversalEnum.ON_LINE.getValue())) { - extracted(statusService, device, true, UniversalEnum.ZERO_PERCENT.getValue()); + String iotDeviceId = device.getIotDeviceId(); + AjaxResult deviceByIotDeviceId = deviceService.getDeviceByIotDeviceId(iotDeviceId); + if (Objects.equals(String.valueOf(deviceByIotDeviceId.get("code")), UniversalEnum.TWO_HUNDRED.getValue())) { + String deviceState = ((JSONObject) JSON.toJSON(deviceByIotDeviceId.get("data"))).getString("deviceState"); + if (Objects.equals(deviceState, UniversalEnum.ON_LINE.getValue())) { + extracted(statusService, device, true, UniversalEnum.ZERO_PERCENT.getValue()); + } else { + extracted(statusService, device, false, UniversalEnum.ONE_HUNDRED_PERCENT.getValue()); + } } else { extracted(statusService, device, false, UniversalEnum.ONE_HUNDRED_PERCENT.getValue()); } @@ -104,6 +109,7 @@ public class DeviceStatus { status.setStartTime(startTime); statusService.delStatusByTime(status); } + private void extracted(StatusService statusService, DcDevice device, boolean reachable, String packetLossRate) { Status status = new Status(); status.setDeviceNo(device.getStakeMark());