|
@ -37,6 +37,7 @@ import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.CountDownLatch; |
|
|
import java.util.concurrent.CountDownLatch; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@Slf4j |
|
|
@Slf4j |
|
@ -169,31 +170,89 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
list.forEach(dcEmergencyPlans -> { |
|
|
list.forEach(dcEmergencyPlans -> { |
|
|
List<DcExecuteAction> dcExecuteActions = dcEmergencyPlans.getDcExecuteAction(); |
|
|
List<DcExecuteAction> dcExecuteActions = dcEmergencyPlans.getDcExecuteAction(); |
|
|
dcExecuteActions.forEach(dcExecuteAction -> { |
|
|
dcExecuteActions.forEach(dcExecuteAction -> { |
|
|
|
|
|
List<DcDevice> deviceList = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection()); |
|
|
|
|
|
String devices = deviceList.stream() |
|
|
|
|
|
.map(DcDevice::getIotDeviceId) |
|
|
|
|
|
.map(String::valueOf) |
|
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
|
dcExecuteAction.setDeviceList(devices); |
|
|
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode() |
|
|
if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode() |
|
|
&& executeConfig.getString("operationType").equals("2")) { |
|
|
&& executeConfig.getString("operationType").equals("2")) { |
|
|
// 执行操作中智能发布语音广播
|
|
|
// 执行操作中智能发布语音广播
|
|
|
String content = intelligentPublishingOfInformation(dcEvent); |
|
|
String content = intelligentPublishingOfInformation(dcEvent); |
|
|
updateIntelligentPublishingContent(dcExecuteAction,markArray,dcEvent,content,dcEvent.getDirection()); |
|
|
updateIntelligentPublishingContent(dcExecuteAction,markArray,deviceList,content,dcEvent.getDirection()); |
|
|
} else if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.VARIABLE_INFORMATION_FLAG.getCode() |
|
|
} else if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.VARIABLE_INFORMATION_FLAG.getCode() |
|
|
&& executeConfig.getString("operationType").equals("2")) { |
|
|
&& executeConfig.getString("operationType").equals("2")) { |
|
|
// 执行操作中智能发布情报板
|
|
|
// 执行操作中智能发布情报板
|
|
|
String content = intelligentPublishingOfInformation(dcEvent); |
|
|
String content = intelligentPublishingOfInformation(dcEvent); |
|
|
updateIntelligentPublishingContent(dcExecuteAction,markArray,dcEvent,content,dcEvent.getDirection()); |
|
|
updateIntelligentPublishingContent(dcExecuteAction,markArray,deviceList,content,dcEvent.getDirection()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 交通事件-根据事件、单个执行操作筛选设备 |
|
|
|
|
|
* @param dcEventAnDcEmergencyPlans |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<DcDevice> selectDeviceListByEventDcExecuteAction(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { |
|
|
|
|
|
// 事件桩号
|
|
|
|
|
|
DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent(); |
|
|
|
|
|
dcEvent.setStakeMark(dcEvent.getStakeMark().replace("K", "")); |
|
|
|
|
|
String[] markArray = dcEvent.getStakeMark().split("\\+"); |
|
|
|
|
|
if (markArray[1].length() < 3) { |
|
|
|
|
|
// 不足三位 补零
|
|
|
|
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
|
|
|
} |
|
|
|
|
|
return ruleFiltering(dcEventAnDcEmergencyPlans.getDcExecuteAction(), markArray, dcEvent.getDirection()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 设备管控-确认按钮生成内容 |
|
|
|
|
|
* @param dcEventAnDcEmergencyPlans |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public DcExecuteAction confirmButtonToGenerateContent(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans, DcEvent dcEvent) { |
|
|
|
|
|
// 查询设备
|
|
|
|
|
|
dcEvent.setStakeMark(dcEvent.getStakeMark().replace("K", "")); |
|
|
|
|
|
String[] markArray = dcEvent.getStakeMark().split("\\+"); |
|
|
|
|
|
if (markArray[1].length() < 3) { |
|
|
|
|
|
// 不足三位 补零
|
|
|
|
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
|
|
|
} |
|
|
|
|
|
DcExecuteAction dcExecuteAction = dcEventAnDcEmergencyPlans.getDcExecuteAction(); |
|
|
|
|
|
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection()); |
|
|
|
|
|
String devices = dcDevices.stream() |
|
|
|
|
|
.map(DcDevice::getIotDeviceId) |
|
|
|
|
|
.map(String::valueOf) |
|
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
|
dcExecuteAction.setDeviceList(devices); |
|
|
|
|
|
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
|
|
|
if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode() || |
|
|
|
|
|
dcExecuteAction.getDeviceType() == DeviceTypeEnum.VARIABLE_INFORMATION_FLAG.getCode()) { |
|
|
|
|
|
// 修改执行操作数据内容
|
|
|
|
|
|
if (executeConfig.getString("operationType").equals("2")) { |
|
|
|
|
|
// 说明是智能发布
|
|
|
|
|
|
String content = intelligentPublishingOfInformation(dcEvent); |
|
|
|
|
|
updateIntelligentPublishingContent(dcExecuteAction,markArray,dcDevices,content,dcEvent.getDirection()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return dcExecuteAction; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 更改智能发布中的发布内容-计算公里数 |
|
|
* 更改智能发布中的发布内容-计算公里数 |
|
|
*/ |
|
|
*/ |
|
|
public void updateIntelligentPublishingContent(DcExecuteAction dcExecuteAction, |
|
|
public void updateIntelligentPublishingContent(DcExecuteAction dcExecuteAction, |
|
|
String[] markArray, |
|
|
String[] markArray, |
|
|
DcEvent dcEvent, |
|
|
List<DcDevice> deviceList, |
|
|
String content, |
|
|
String content, |
|
|
String direction) { |
|
|
String direction) { |
|
|
List<DcDevice> deviceList = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection()); |
|
|
// List<DcDevice> deviceList = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection());
|
|
|
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
List<Map<String,Object>> contentList = new ArrayList<>(); |
|
|
List<Map<String,Object>> contentList = new ArrayList<>(); |
|
|
deviceList.forEach(dcDevice -> { |
|
|
deviceList.forEach(dcDevice -> { |
|
@ -620,29 +679,6 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
.forEach(dcExecuteAction -> { |
|
|
.forEach(dcExecuteAction -> { |
|
|
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction); |
|
|
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction); |
|
|
|
|
|
|
|
|
// // 此代码 是为了防止事件没有匹配到预案,但是还执行了设备控制,并且执行操作中带有智能发布
|
|
|
|
|
|
// boolean isIdEmpty = ObjectUtils.isEmpty(dcEmergencyPlans.getId());
|
|
|
|
|
|
// Set<Integer> targetDeviceTypes = new HashSet<>(Arrays.asList(
|
|
|
|
|
|
// DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode(),
|
|
|
|
|
|
// DeviceTypeEnum.VARIABLE_INFORMATION_FLAG.getCode()
|
|
|
|
|
|
// ));
|
|
|
|
|
|
// boolean isTargetDeviceType = targetDeviceTypes.contains(dcExecuteAction.getDeviceType());
|
|
|
|
|
|
// if (isIdEmpty && isTargetDeviceType) {
|
|
|
|
|
|
// String configJson = operationType.equals(1) ? dcExecuteAction.getExecuteConfig() : dcExecuteAction.getRecoverConfig();
|
|
|
|
|
|
// JSONObject config = JSON.parseObject(configJson);
|
|
|
|
|
|
// if (config.getString("operationType").equals("2")) {
|
|
|
|
|
|
// DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent();
|
|
|
|
|
|
// String content = intelligentPublishingOfInformation(dcEvent);
|
|
|
|
|
|
// updateIntelligentPublishingContent(
|
|
|
|
|
|
// dcExecuteAction,
|
|
|
|
|
|
// markArray,
|
|
|
|
|
|
// dcEvent,
|
|
|
|
|
|
// content,
|
|
|
|
|
|
// dcEvent.getDirection()
|
|
|
|
|
|
// );
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject otherConfig = operationType.equals(1)? |
|
|
JSONObject otherConfig = operationType.equals(1)? |
|
|
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig()); |
|
|
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig()); |
|
|
try { |
|
|
try { |
|
|