diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 2e373453..9aae11bf 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -1535,7 +1535,43 @@ private VideoController videoController; jsonObject.put("functions", functions); return batchInvokedFunction2(jsonObject); } + //一体机柜空调定时调用,采数据 + //@PostMapping("/integratedCabinetAir2") + @Scheduled(cron = "0 7 * * * *") + public AjaxResult airConditioning() throws InterruptedException, IOException, HttpException { + DcDevice dcDevice = new DcDevice(); + dcDevice.setDeviceType(UniversalEnum.EIGHTEEN.getValue()); + dcDevice.setDeviceState(UniversalEnum.ONE.getValue()); + IDcDeviceService dcDeviceService = SpringUtils.getBean(IDcDeviceService.class); + List dcDeviceList = dcDeviceService.listDevice(dcDevice); + ArrayList devices = new ArrayList<>(); + for (DcDevice device : dcDeviceList) { + String iotDeviceId = device.getIotDeviceId(); + if (iotDeviceId != null && !iotDeviceId.equals(UniversalEnum.EMPTY_STRING.getValue())) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("id", device.getId()); + jsonObject.put("iotDeviceId", device.getIotDeviceId()); + jsonObject.put("deviceType", device.getDeviceType()); + devices.add(jsonObject); + } + } + ArrayList functions = new ArrayList(); + for (int i = UniversalEnum.ONE.getNumber(); i <= UniversalEnum.THREE.getNumber(); i++) { + JSONObject function = new JSONObject(); + if (i == 2) { + continue; + } + String valueOf = String.valueOf(i); + function.put("functionId", "0" + valueOf); + function.put("params", new JSONObject()); + functions.add(function); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("devices", devices); + jsonObject.put("functions", functions); + return batchInvokedFunction2(jsonObject); + } public AjaxResult batchInvokedFunction2(@RequestBody Map props) throws HttpException, IOException, InterruptedException { ArrayList devices = (ArrayList) props.get("devices"); ArrayList functions = (ArrayList) props.get("functions");