Browse Source

同步摄像头优化

develop
wangsixiang 3 months ago
parent
commit
bc2280e4f4
  1. 25
      zc-business/src/main/java/com/zc/business/controller/VideoController.java

25
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -262,6 +262,9 @@ public class VideoController extends BaseController {
}); });
JSONObject arrayJSONObject = array.getJSONObject(1);//扩建 JSONObject arrayJSONObject = array.getJSONObject(1);//扩建
JSONArray jiHeYunGuanG35 = arrayJSONObject.getJSONArray("children"); JSONArray jiHeYunGuanG35 = arrayJSONObject.getJSONArray("children");
for (int i = 0; i < objects.size(); i++) {
jiHeYunGuanG35.add(objects.get(i));
}
List<DcDevice> list = new ArrayList<>(); List<DcDevice> list = new ArrayList<>();
for (Object json : jiHeYunGuanG35) { for (Object json : jiHeYunGuanG35) {
JSONObject item = JSONObject.parseObject(json.toString()); JSONObject item = JSONObject.parseObject(json.toString());
@ -274,17 +277,17 @@ public class VideoController extends BaseController {
device.setIotDeviceId(item.get("camId").toString()); device.setIotDeviceId(item.get("camId").toString());
list.add(device); list.add(device);
} }
for (Object json : objects) { // for (Object json : objects) {
JSONObject item = JSONObject.parseObject(json.toString()); // JSONObject item = JSONObject.parseObject(json.toString());
DcDevice device = new DcDevice(); // DcDevice device = new DcDevice();
if (item.get("status").equals(UniversalEnum.ZERO.getValue())) { // if (item.get("status").equals(UniversalEnum.ZERO.getValue())) {
device.setDeviceState(UniversalEnum.ONE.getValue()); // device.setDeviceState(UniversalEnum.ONE.getValue());
} else { // } else {
device.setDeviceState(UniversalEnum.ZERO.getValue()); // device.setDeviceState(UniversalEnum.ZERO.getValue());
} // }
device.setIotDeviceId(item.get("camId").toString()); // device.setIotDeviceId(item.get("camId").toString());
list.add(device); // list.add(device);
} // }
iDcDeviceService.batchUpdate(list); iDcDeviceService.batchUpdate(list);
//更新中间库的设备状态 //更新中间库的设备状态

Loading…
Cancel
Save