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 47ae34ad..01f88b6e 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 @@ -28,6 +28,7 @@ import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Parameter; import okhttp3.Response; import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -933,4 +934,37 @@ public class DcDeviceController extends BaseController { // } //} + /*** + * 太阳能板设备定时任务 + */ + @Scheduled(cron = "0 0/5 * * * ?") + public void ConfluenceAreaEarlyWarningDeviceBatteryLowWarning() throws HttpException, IOException, InterruptedException { + DcDevice dcDevice = new DcDevice(); + dcDevice.setDeviceType(UniversalEnum.FIFTEEN.getValue()); + 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.ZERO.getNumber(); i < UniversalEnum.SIX.getNumber(); i++) { + JSONObject function = new JSONObject(); + function.put("functionId", UniversalEnum.A.getValue() + (i + UniversalEnum.ONE.getNumber())); + function.put("params", new JSONObject()); + functions.add(function); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("devices", devices); + jsonObject.put("functions", functions); + batchInvokedFunction(jsonObject); + } + } diff --git a/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java b/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java index 8f865297..b43ba0ce 100644 --- a/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java +++ b/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java @@ -2008,6 +2008,9 @@ public enum UniversalEnum { // 行车诱导功能码 3C THREE_C(0, "3C"), + // 太阳能板功能码 A + A(0, "A"), + // 太阳能板功能码 A1 A_ONE(0, "A1"),