From 1ecd254af197f9a7b4f286b442ddbcc4c2402772 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Thu, 31 Oct 2024 15:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E6=9F=9C=E5=AE=9A=E6=97=B6=E8=8F=9C?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE?= 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 15399965..dd848952 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 @@ -1426,6 +1426,42 @@ public class DcDeviceController extends BaseController { jsonObject.put("functions", functions); return batchInvokedFunction2(jsonObject); } + //一体机柜空调定时调用,采数据 + @Scheduled(cron = "0 11/10 * * * ?") + public AjaxResult integratedCabinetAirConditioner() throws InterruptedException, IOException, HttpException { + DcDevice dcDevice = new DcDevice(); + dcDevice.setDeviceType(UniversalEnum.SEVENTEEN.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");