Browse Source

修改新增事件预案接口

develop
Mr.Wang 9 months ago
parent
commit
8f40640b20
  1. 42
      zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java
  2. 40
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

42
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;
}
}

40
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(); String controlModel = otherConfig.get("controlModel").toString();
props.put("onWorkStatus", otherConfig.get("state").toString()); props.put("onWorkStatus", otherConfig.get("state").toString());
props.put("inWorkStatus", otherConfig.get("state").toString()); props.put("inWorkStatus", otherConfig.get("state").toString());
if (controlModel.equals("1")) { props.put("mode", controlModel);
props.put("mode", "00"); if (controlModel.equals("01")) {
} else if (controlModel.equals("2")) {
String startTime = otherConfig.get("startTime").toString(); String startTime = otherConfig.get("startTime").toString();
String endTime = otherConfig.get("endTime").toString(); String endTime = otherConfig.get("endTime").toString();
props.put("mode", "01"); props.put("mode", "01");
props.put("startDisplayTime", startTime); props.put("startDisplayTime", startTime);
props.put("endDisplayTime", endTime); props.put("endDisplayTime", endTime);
} else {
props.put("mode", "02");
} }
AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
@ -893,7 +890,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 设备类型 数据处理 // 设备类型 数据处理
String deviceType = dcExecuteActionOperationList.stream() String deviceType = dcExecuteActionOperationList.stream()
.map(DcExecuteAction::getDeviceType) .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(",")); .collect(Collectors.joining(","));
dcEmergencyPlans.setDeviceType(deviceType); dcEmergencyPlans.setDeviceType(deviceType);
// 可控设备 数据处理 // 可控设备 数据处理
@ -906,7 +909,30 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
dcEmergencyPlans.setControllableDevice(controllableDevice); dcEmergencyPlans.setControllableDevice(controllableDevice);
// 控制指令 数据处理 // 控制指令 数据处理
List<String> otherConfigList = dcExecuteActionOperationList.stream() List<String> 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()); .collect(Collectors.toList());
List<String> otherConfigStringList = otherConfigList.stream() List<String> otherConfigStringList = otherConfigList.stream()

Loading…
Cancel
Save