From 582e636863f790f0d21a6817d54ff27f18fc0189 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Wed, 13 Nov 2024 17:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E7=A9=BA=E8=B0=83=E5=AE=9A=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcDeviceController.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) 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");