diff --git a/zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java b/zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java new file mode 100644 index 00000000..ec1c4e94 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java @@ -0,0 +1,42 @@ +package com.zc.business.enums; + +/** + * 设备类型 + * @author wangjiabao + */ +public enum DeviceTypeEnum { + + CAMERA(1, "摄像机"), + VARIABLE_INFORMATION_FLAG(2, "可变信息标志"), + METEOROLOGICAL_DETECTOR(3, "气象检测器"), + EXPORT_INDUCTION_LIGHT(4, "出口诱导灯"), + ROAD_SECTION_VOICE_BROADCASTING(5, "路段语音广播"), + COLLISION_OF_GUARDRAILS(6, "护栏碰撞"), + MILLIMETER_WAVE_RADAR(7, "毫米波雷达"), + CONFLUENCE_AREA_WARNING(8, "合流区预警"), + SMART_CONE_BUCKET(9, "智慧锥桶"), + LASER_FATIGUE_AWAKENING(10, "激光疲劳唤醒"), + CLASS_I_COMMUNICATION_STATION(11, "一类交流站"), + DRIVING_GUIDANCE(12, "行车诱导"), + SMART_DEVICE_BOX(13, "智能设备箱"), + ONLINE_MONITORING_OF_LIGHT(14, "光线在线监测"); + private final int code; + private final String info; + + DeviceTypeEnum(int code, String info) + { + this.code = code; + this.info = info; + } + + public int getCode() + { + return code; + } + + public String getInfo() + { + return info; + } + +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 8975d0f0..c570691e 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -620,16 +620,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { String controlModel = otherConfig.get("controlModel").toString(); props.put("onWorkStatus", otherConfig.get("state").toString()); props.put("inWorkStatus", otherConfig.get("state").toString()); - if (controlModel.equals("1")) { - props.put("mode", "00"); - } else if (controlModel.equals("2")) { + props.put("mode", controlModel); + if (controlModel.equals("01")) { String startTime = otherConfig.get("startTime").toString(); String endTime = otherConfig.get("endTime").toString(); props.put("mode", "01"); props.put("startDisplayTime", startTime); props.put("endDisplayTime", endTime); - } else { - props.put("mode", "02"); } AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); @@ -893,7 +890,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { // 设备类型 数据处理 String deviceType = dcExecuteActionOperationList.stream() .map(DcExecuteAction::getDeviceType) - .map(String::valueOf) + .distinct() + .map(type -> Arrays.stream(DeviceTypeEnum.values()) + .filter(deviceTypeEnum -> deviceTypeEnum.getCode() == type) + .findFirst() + .map(DeviceTypeEnum::getInfo) + .orElse("类型异常") + ) .collect(Collectors.joining(",")); dcEmergencyPlans.setDeviceType(deviceType); // 可控设备 数据处理 @@ -906,7 +909,30 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { dcEmergencyPlans.setControllableDevice(controllableDevice); // 控制指令 数据处理 List otherConfigList = dcExecuteActionOperationList.stream() - .map(DcExecuteAction::getOtherConfig) + .map(dcExecuteAction -> { + JSONObject config = new JSONObject(); + String otherConfig = dcExecuteAction.getOtherConfig(); + JSONObject jsonObject = JSON.parseObject(otherConfig); + if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.DRIVING_GUIDANCE) { + // 行车诱导 + config.put("controlModelName",jsonObject.get("controlModelName")); + config.put("name",jsonObject.get("name")); + if (jsonObject.get("controlModel").toString().equals("01")) { + config.put("time",jsonObject.get("startTime").toString() +"-"+jsonObject.get("endTime").toString()); + } + + }else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG || + dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) { + // 情报板/语音广播 + config.put("content",jsonObject.get("content")); + } + else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.LASER_FATIGUE_AWAKENING) { + // 激光疲劳唤醒 + config.put("name",jsonObject.get("name")); + config.put("operationDuration",jsonObject.get("operationDuration")+"分钟"); + } + return JSON.toJSONString(config); + }) .collect(Collectors.toList()); List otherConfigStringList = otherConfigList.stream()