|
|
@ -12,21 +12,17 @@ import com.zc.business.constant.DeviceFunctionIdConstants; |
|
|
|
import com.zc.business.constant.DeviceTypeConstants; |
|
|
|
import com.zc.business.controller.DcDeviceController; |
|
|
|
import com.zc.business.domain.*; |
|
|
|
import com.zc.business.enums.EventTypeEnum; |
|
|
|
import com.zc.business.enums.*; |
|
|
|
import com.zc.business.mapper.DcEmergencyPlansMapper; |
|
|
|
import com.zc.business.mapper.EventPlanAssocMapper; |
|
|
|
import com.zc.business.service.DcEmergencyPlansService; |
|
|
|
import com.zc.business.service.DcExecuteActionService; |
|
|
|
import com.zc.business.service.IDcDeviceService; |
|
|
|
import com.zc.common.core.httpclient.exception.HttpException; |
|
|
|
import org.apache.commons.lang3.StringEscapeUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.script.ScriptEngine; |
|
|
|
import javax.script.ScriptEngineManager; |
|
|
|
import javax.script.ScriptException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
@ -70,9 +66,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据事件类型查询事件预案 |
|
|
|
* 交通事件 - 根据事件类型查询事件预案 |
|
|
|
* |
|
|
|
* @param event 事件 |
|
|
|
* @param event 交通事件 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
@ -81,175 +77,226 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
|
|
|
|
int eventType = Integer.parseInt(event.getEventType().toString()); |
|
|
|
|
|
|
|
if (eventType == EventTypeEnum.TRAFFIC_ACCIDENT.getCode()) { |
|
|
|
if (eventType == EventTypeEnum.TRAFFIC_ACCIDENT.getCode() || |
|
|
|
eventType == EventTypeEnum.ABNORMAL_WEATHER.getCode() || |
|
|
|
eventType == EventTypeEnum.ILLEGAL_ROAD_USE.getCode() || |
|
|
|
eventType == EventTypeEnum.TRAFFIC_JAM.getCode() || |
|
|
|
eventType == EventTypeEnum.SERVICE_AREA_ABNORMALITY.getCode() || |
|
|
|
eventType == EventTypeEnum.ROADBLOCK_CLEARANCE.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
int eventLevel = Integer.parseInt(triggerJson.get("eventLevel").toString()); |
|
|
|
return eventLevel == event.getEventLevel(); |
|
|
|
String eventSubclass = triggerJson.get("eventSubclass").toString(); |
|
|
|
return eventSubclass.equals(event.getEventSubclass()); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.VEHICLE_MALFUNCTION.getCode()) { |
|
|
|
// 车辆故障
|
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
String[] lane = event.getLang().split(","); |
|
|
|
int[] intArray = Arrays.stream(lane) |
|
|
|
.mapToInt(Integer::parseInt) |
|
|
|
.toArray(); |
|
|
|
JSONArray eventLevel = JSONArray.parseArray(triggerJson.get("roadOccupancy").toString()); |
|
|
|
return Arrays.stream(intArray).anyMatch(Arrays.asList(eventLevel.toArray())::contains); |
|
|
|
String locationType = triggerJson.get("locationType").toString(); |
|
|
|
DcEventVehicleAccident dcEventVehicleAccident = event.getDcEventVehicleAccident(); |
|
|
|
String eventLocationType =dcEventVehicleAccident.getLocationType().toString(); |
|
|
|
return locationType.equals(eventLocationType); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.TRAFFIC_CONTROL.getCode()) { |
|
|
|
// 交通管制
|
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
// 管制分类
|
|
|
|
Integer controlType = Integer.parseInt(triggerJson.get("controlType").toString()); |
|
|
|
// 分类
|
|
|
|
Integer classify = Integer.parseInt(triggerJson.get("classify").toString()); |
|
|
|
// 分类原因
|
|
|
|
Integer controlCause = Integer.parseInt(triggerJson.get("controlCause").toString()); |
|
|
|
// 事件--交通管制数据
|
|
|
|
DcEventTrafficControl dcEventTrafficControl = event.getDcEventTrafficControl(); |
|
|
|
Integer eventControlType = Integer.parseInt(dcEventTrafficControl.getControlType().toString()); |
|
|
|
Integer eventClassify = Integer.parseInt(dcEventTrafficControl.getClassify().toString()); |
|
|
|
Integer eventControlCause = Integer.parseInt(dcEventTrafficControl.getControlCause().toString()); |
|
|
|
return controlType.equals(eventControlType) && classify.equals(eventClassify) && controlCause.equals(eventControlCause); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.TRAFFIC_JAM.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
// 拥堵原因
|
|
|
|
Integer congestionCause = Integer.parseInt(triggerJson.get("congestionCause").toString()); |
|
|
|
// 详细原因
|
|
|
|
Integer detailedReasons = Integer.parseInt(triggerJson.get("detailedReasons").toString()); |
|
|
|
// 事件--交通拥堵数据
|
|
|
|
DcEventTrafficCongestion dcEventTrafficCongestion = event.getDcEventTrafficCongestion(); |
|
|
|
Integer eventCongestionCause = Integer.parseInt(dcEventTrafficCongestion.getCongestionCause().toString()); |
|
|
|
Integer eventDetailedReasons = Integer.parseInt(dcEventTrafficCongestion.getDetailedReasons().toString()); |
|
|
|
return congestionCause.equals(eventCongestionCause) && detailedReasons.equals(eventDetailedReasons); |
|
|
|
return classify.equals(eventClassify); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.ILLEGAL_ROAD_USE.getCode() || eventType == EventTypeEnum.ROADBLOCK_CLEARANCE.getCode()) { |
|
|
|
} else { |
|
|
|
// 施工建设
|
|
|
|
return dcEmergencyPlansList; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 感知事件 - 根据事件类型查询事件预案 |
|
|
|
* |
|
|
|
* @param dcWarning 感知事件 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DcEmergencyPlans> selectDcEmergencyPlansByWarningType(DcWarning dcWarning) { |
|
|
|
int eventType = ValueConverter.convertValueHost(dcWarning.getWarningType()); |
|
|
|
List<DcEmergencyPlans> dcEmergencyPlansList = dcEmergencyPlansMapper.selectDcEmergencyPlansByWarningType(eventType); |
|
|
|
|
|
|
|
int warningType = Integer.parseInt(dcWarning.getWarningType().toString()); |
|
|
|
|
|
|
|
if (warningType == WarningTypeEnum.UNUSUAL_WEATHER.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
String eventSubclass = triggerJson.get("eventSubclass").toString(); |
|
|
|
// 事件--非法上路/路障清除 数据
|
|
|
|
String subclass = event.getEventSubclass(); |
|
|
|
return eventSubclass.equals(subclass); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.CONSTRUCTION_AND_CONSTRUCTION.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
String subclass = triggerJson.get("eventSubclass").toString(); |
|
|
|
Integer controlMode = Integer.parseInt(triggerJson.get("controlMode").toString()); |
|
|
|
JSONArray lane = JSONArray.parseArray(triggerJson.get("lane").toString()); |
|
|
|
// 事件--施工建设数据
|
|
|
|
DcEventConstruction dcEventConstruction = event.getDcEventConstruction(); |
|
|
|
String eventSubclass = event.getEventSubclass(); |
|
|
|
Integer eventControlMode = Integer.parseInt(dcEventConstruction.getControlMode().toString()); |
|
|
|
String[] eventLane = event.getLang().split(","); |
|
|
|
int[] eventLaneInt = Arrays.stream(eventLane) |
|
|
|
.mapToInt(Integer::parseInt) |
|
|
|
.toArray(); |
|
|
|
return subclass.equals(eventSubclass) && controlMode.equals(eventControlMode) |
|
|
|
&& Arrays.stream(eventLaneInt).anyMatch(Arrays.asList(lane.toArray())::contains); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.SERVICE_AREA_ABNORMALITY.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
Integer facilityId = Integer.parseInt(triggerJson.get("facilityId").toString()); |
|
|
|
Integer disableFacility = Integer.parseInt(triggerJson.get("disableFacility").toString()); |
|
|
|
|
|
|
|
// 事件--服务区异常数据
|
|
|
|
DcEventServiceArea dcEventServiceArea = event.getDcEventServiceArea(); |
|
|
|
Integer eventFacilityId = Integer.parseInt(dcEventServiceArea.getFacilityId().toString()); |
|
|
|
Integer eventDisableFacility = Integer.parseInt(dcEventServiceArea.getDisableFacility().toString()); |
|
|
|
return facilityId.equals(eventFacilityId) && disableFacility.equals(eventDisableFacility); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else if (eventType == EventTypeEnum.ABNORMAL_WEATHER.getCode()) { |
|
|
|
return dcEmergencyPlansList.stream() |
|
|
|
.filter(dcEmergencyPlans -> { |
|
|
|
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism(); |
|
|
|
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism); |
|
|
|
String unusualWeather = triggerJson.get("unusualWeather").toString(); |
|
|
|
// 条件
|
|
|
|
JSONArray conditions = JSON.parseArray(triggerJson.get("conditions").toString()); |
|
|
|
|
|
|
|
// 事件--异常天气数据
|
|
|
|
DcEventAbnormalWeather dcEventAbnormalWeather = event.getDcEventAbnormalWeather(); |
|
|
|
String weatherSituation = dcEventAbnormalWeather.getWeatherSituation(); |
|
|
|
// 异常天气数据
|
|
|
|
Integer numericalValue = Integer.parseInt(dcEventAbnormalWeather.getNumericalValue()); |
|
|
|
String conditionString = conditions.stream().map(condition -> { |
|
|
|
JSONObject conditionJSON = JSON.parseObject(condition.toString()); |
|
|
|
String comparisonOperator = StringEscapeUtils.unescapeXml(conditionJSON.get("comparisonOperator").toString()); |
|
|
|
String thresholdValue = conditionJSON.get("thresholdValue").toString(); |
|
|
|
return numericalValue + comparisonOperator + thresholdValue; |
|
|
|
}).collect(Collectors.joining(" && ")); |
|
|
|
|
|
|
|
ScriptEngineManager manager = new ScriptEngineManager(); |
|
|
|
ScriptEngine engine = manager.getEngineByName("js"); |
|
|
|
boolean result = false; |
|
|
|
try { |
|
|
|
result = (boolean) engine.eval(conditionString); |
|
|
|
} catch (ScriptException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
String warningSubclass = ValueConverter.convertValueSon(dcWarning.getWarningSubclass()); |
|
|
|
|
|
|
|
return unusualWeather.equals(weatherSituation) && result; |
|
|
|
return eventSubclass.equals(warningSubclass); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
return dcEmergencyPlansList; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 事件确定 |
|
|
|
* 交通事件确定 |
|
|
|
* |
|
|
|
* @param dcEventAnDcEmergencyPlans 事件数据 和 事件预案数据 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { |
|
|
|
// 获取事件数据
|
|
|
|
DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent(); |
|
|
|
// 方向
|
|
|
|
String direction = dcEvent.getDirection(); |
|
|
|
// 事件编号
|
|
|
|
String id = dcEvent.getId(); |
|
|
|
return executionConfirmation(dcEventAnDcEmergencyPlans,dcEvent.getStakeMark(),direction,id); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 感知事件-情报板自动生成 |
|
|
|
* @param dcEventAnDcEmergencyPlans |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DcInfoBoardTemplate warningAutomaticGeneration(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { |
|
|
|
// 根据感知事件类型等、生成情报板的内容
|
|
|
|
DcWarning dcWarning = dcEventAnDcEmergencyPlans.getDcWarning(); |
|
|
|
DcInfoBoardTemplate dcInfoBoardTemplate = dcEventAnDcEmergencyPlans.getDcInfoBoardTemplate(); |
|
|
|
Integer warningType = dcWarning.getWarningType(); |
|
|
|
if (warningType.equals(WarningTypeEnum.TRAFFIC_JAM.getCode())) { |
|
|
|
// 交通拥堵
|
|
|
|
dcInfoBoardTemplate.setContent("前方"+WarningTypeEnum.TRAFFIC_JAM.getInfo()+"请谨慎驾驶"); |
|
|
|
}else if (warningType.equals(WarningTypeEnum.NON_MOTOR_VEHICLE.getCode())) { |
|
|
|
dcInfoBoardTemplate.setContent("前方出现"+WarningTypeEnum.NON_MOTOR_VEHICLE.getInfo()+"请注意避让"); |
|
|
|
}else if (warningType.equals(WarningTypeEnum.PEDESTRIAN.getCode())) { |
|
|
|
dcInfoBoardTemplate.setContent("前方出现"+WarningTypeEnum.PEDESTRIAN.getInfo()+"请注意避让"); |
|
|
|
}else if (warningType.equals(WarningTypeEnum.FIREWORKS.getCode())) { |
|
|
|
dcInfoBoardTemplate.setContent("前方出现"+WarningTypeEnum.FIREWORKS.getInfo()+"请注意避让"); |
|
|
|
}else if (warningType.equals(WarningTypeEnum.OUTFALL.getCode())) { |
|
|
|
dcInfoBoardTemplate.setContent("前方出现"+WarningTypeEnum.OUTFALL.getInfo()+"请注意避让"); |
|
|
|
} else if (warningType.equals(WarningTypeEnum.VEHICLE_CONVERSE_RUNNING.getCode())) { |
|
|
|
dcInfoBoardTemplate.setContent("前方出现"+WarningTypeEnum.OUTFALL.getInfo()+"请注意避让"); |
|
|
|
} |
|
|
|
|
|
|
|
return dcInfoBoardTemplate; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 交通事件-情报板自动生成 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DcInfoBoardTemplate eventAutomaticGeneration(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { |
|
|
|
// 根据交通事件的事件类型,生成相应的情报板内容
|
|
|
|
DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent(); |
|
|
|
DcInfoBoardTemplate dcInfoBoardTemplate = dcEventAnDcEmergencyPlans.getDcInfoBoardTemplate(); |
|
|
|
int eventType = Integer.parseInt(dcEvent.getEventType().toString()); |
|
|
|
if (eventType == EventTypeEnum.ABNORMAL_WEATHER.getCode() || |
|
|
|
eventType == EventTypeEnum.TRAFFIC_ACCIDENT.getCode() || |
|
|
|
eventType == EventTypeEnum.ILLEGAL_ROAD_USE.getCode() || |
|
|
|
eventType == EventTypeEnum.TRAFFIC_JAM.getCode() || |
|
|
|
eventType == EventTypeEnum.SERVICE_AREA_ABNORMALITY.getCode() || |
|
|
|
eventType == EventTypeEnum.ROADBLOCK_CLEARANCE.getCode()) { |
|
|
|
|
|
|
|
String content = Arrays.stream(EventSubclassEnum.values()) |
|
|
|
.filter(eventSubclassEnum -> eventSubclassEnum.getCode().equals(dcEvent.getEventSubclass())) |
|
|
|
.findFirst() |
|
|
|
.map(EventSubclassEnum::getText) |
|
|
|
.orElse("请注意前方危险"); |
|
|
|
dcInfoBoardTemplate.setContent(content); |
|
|
|
} else if (eventType == EventTypeEnum.VEHICLE_MALFUNCTION.getCode()) { |
|
|
|
// 车辆故障
|
|
|
|
DcEventVehicleAccident dcEventVehicleAccident = dcEvent.getDcEventVehicleAccident(); |
|
|
|
int locationType = Integer.parseInt(dcEventVehicleAccident.getLocationType().toString()); |
|
|
|
if (locationType == 1) { |
|
|
|
dcInfoBoardTemplate.setContent("高速主线发生车辆故障"); |
|
|
|
} else if (locationType == 2) { |
|
|
|
dcInfoBoardTemplate.setContent("服务区发生车辆故障"); |
|
|
|
} else if (locationType == 3) { |
|
|
|
dcInfoBoardTemplate.setContent("立交桥发生车辆故障"); |
|
|
|
} else if (locationType == 4) { |
|
|
|
dcInfoBoardTemplate.setContent("收费站发生车辆故障"); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (eventType == EventTypeEnum.TRAFFIC_CONTROL.getCode()) { |
|
|
|
// 交通管制
|
|
|
|
DcEventTrafficControl dcEventTrafficControl = dcEvent.getDcEventTrafficControl(); |
|
|
|
int classify = Integer.parseInt(dcEventTrafficControl.getClassify().toString()); |
|
|
|
String content = Arrays.stream(ClassifyEnum.values()) |
|
|
|
.filter(eventSubclassEnum -> eventSubclassEnum.getCode() == classify) |
|
|
|
.findFirst() |
|
|
|
.map(ClassifyEnum::getText) |
|
|
|
.orElse("前方存在限行或关闭"); |
|
|
|
dcInfoBoardTemplate.setContent(content); |
|
|
|
|
|
|
|
}else { |
|
|
|
// 施工建设
|
|
|
|
dcInfoBoardTemplate.setContent("前方施工请注意驾驶"); |
|
|
|
} |
|
|
|
return dcInfoBoardTemplate; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 感知事件确认 |
|
|
|
* @param dcEventAnDcEmergencyPlans 事件数据 和 事件预案数据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int executionWarningConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { |
|
|
|
// 获取事件数据
|
|
|
|
DcWarning dcWarning = dcEventAnDcEmergencyPlans.getDcWarning(); |
|
|
|
|
|
|
|
// 方向
|
|
|
|
String direction = dcWarning.getDirection(); |
|
|
|
// 事件编号
|
|
|
|
String id = dcWarning.getId(); |
|
|
|
return executionConfirmation(dcEventAnDcEmergencyPlans,dcWarning.getStakeMark(),direction,id); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 事件确认 |
|
|
|
* @param dcEventAnDcEmergencyPlans 事件数据 和 事件预案数据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public int executionConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans, |
|
|
|
String stakeMark, |
|
|
|
String direction, |
|
|
|
String id) { |
|
|
|
// 存储所有设备id
|
|
|
|
StringBuilder deviceIds = new StringBuilder(); |
|
|
|
// 存储所有设备的执行结果
|
|
|
|
JSONArray resultArray = new JSONArray(); |
|
|
|
|
|
|
|
// 获取事件数据
|
|
|
|
DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent(); |
|
|
|
// 获取事件预案数据
|
|
|
|
DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans(); |
|
|
|
// 事件桩号
|
|
|
|
String[] markArray = dcEvent.getStakeMark().split("\\+"); |
|
|
|
String[] markArray = stakeMark.split("\\+"); |
|
|
|
if (markArray[1].length() < 3) { |
|
|
|
// 不足三位 补零
|
|
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
|
} |
|
|
|
// 方向
|
|
|
|
String direction = dcEvent.getDirection(); |
|
|
|
|
|
|
|
// 获取事件预案数据
|
|
|
|
DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans(); |
|
|
|
|
|
|
|
|
|
|
|
//获取事件预案中的 执行操作配置
|
|
|
|
dcEmergencyPlans.getDcExecuteAction().stream() |
|
|
@ -363,7 +410,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
// 创建一个 预案事件关联对象
|
|
|
|
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc(); |
|
|
|
// 事件编号
|
|
|
|
eventPlanAssoc.setEventId(dcEvent.getId()); |
|
|
|
eventPlanAssoc.setEventId(id); |
|
|
|
|
|
|
|
// 区分是执行操作 还是 恢复操作
|
|
|
|
if (dcEventAnDcEmergencyPlans.getOperationType().equals(1)) { |
|
|
@ -380,7 +427,6 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString()); |
|
|
|
return eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -389,10 +435,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
public void invokedFunction(List<DcDevice> dcDevices, JSONObject otherConfig, JSONArray resultArray) throws HttpException, IOException { |
|
|
|
String iotDeviceId = ""; |
|
|
|
String functionId = ""; |
|
|
|
HashMap<String, Object> props = new HashMap<>(); |
|
|
|
|
|
|
|
for (DcDevice device : dcDevices) { |
|
|
|
iotDeviceId = device.getIotDeviceId(); |
|
|
|
HashMap<String, Object> props = new HashMap<>(); |
|
|
|
|
|
|
|
if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE)) { |
|
|
|
// 行车诱导
|
|
|
@ -415,10 +461,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
props.put("mode", "02"); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) { |
|
|
|
} |
|
|
|
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) { |
|
|
|
// 可变信息标志
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG; |
|
|
|
} else { |
|
|
|
// props.put("")
|
|
|
|
} |
|
|
|
else { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
@ -496,6 +545,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
.filter(dcExecuteAction -> dcExecuteAction.getId() == null) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (insertDcExecuteActionList.size() > 0) { |
|
|
|
insertDcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setCreateTime(DateUtils.getNowDate())); |
|
|
|
dcExecuteActionService.insertDcExecuteActionBatch(insertDcExecuteActionList); |
|
|
|
} |
|
|
|
|
|
|
|