Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 6 months ago
parent
commit
e193acb643
  1. 23
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  2. 6
      zc-business/src/main/java/com/zc/business/domain/DcEventAnDcEmergencyPlans.java
  3. 10
      zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java
  4. 90
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

23
zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java

@ -3,10 +3,7 @@ package com.zc.business.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.zc.business.domain.DcEmergencyPlans;
import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcEventAnDcEmergencyPlans;
import com.zc.business.domain.DcWarning;
import com.zc.business.domain.*;
import com.zc.business.service.DcEmergencyPlansService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -70,16 +67,22 @@ public class DcEmergencyPlansController extends BaseController {
}
/**
* 交通事件-切换智能发布生成内容
* 设备管控-确认按钮生成内容
*/
@ApiOperation("交通事件-切换智能发布生成内容")
@ApiOperation("设备管控-确认按钮生成内容")
// @PreAuthorize("@ss.hasPermi('business:plans:list')")
@PostMapping("/list/event/emergencyPlans")
public AjaxResult switchIntelligentPublishingToContent(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
List<DcEmergencyPlans> dcEmergencyPlansList = new ArrayList<>();
dcEmergencyPlansList.add(dcEventAnDcEmergencyPlans.getDcEmergencyPlans());
dcEmergencyPlansService.dispositionDeviceContent(dcEmergencyPlansList,dcEventAnDcEmergencyPlans.getDcEvent());
return AjaxResult.success(dcEmergencyPlansList.get(0));
return AjaxResult.success(dcEmergencyPlansService.confirmButtonToGenerateContent(dcEventAnDcEmergencyPlans,dcEventAnDcEmergencyPlans.getDcEvent()));
}
/**
* 交通事件-根据事件单个执行操作筛选设备
*/
@ApiOperation("交通事件-根据事件、单个执行操作筛选设备")
@PostMapping("/list/event/deviceList")
public AjaxResult selectDeviceListByEventDcExecuteAction(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
return AjaxResult.success(dcEmergencyPlansService.selectDeviceListByEventDcExecuteAction(dcEventAnDcEmergencyPlans));
}
/**

6
zc-business/src/main/java/com/zc/business/domain/DcEventAnDcEmergencyPlans.java

@ -37,6 +37,12 @@ public class DcEventAnDcEmergencyPlans {
@ApiModelProperty("事件预案数据")
private DcEmergencyPlans dcEmergencyPlans;
/**
* 单个执行操作数据
*/
@ApiModelProperty("单个执行操作数据")
private DcExecuteAction dcExecuteAction;
/**
* 情报板模板数据
*/

10
zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java

@ -44,6 +44,16 @@ public interface DcEmergencyPlansService {
*/
void dispositionDeviceContent(List<DcEmergencyPlans> list, DcEvent dcEvent);
/**
* 交通事件-根据事件单个执行操作筛选设备
*/
List<DcDevice> selectDeviceListByEventDcExecuteAction(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
/**
* 设备管控-确认按钮生成内容
*/
DcExecuteAction confirmButtonToGenerateContent(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans, DcEvent dcEvent);
/**
* 交通事件-情报板确认回显原始模板
*/

90
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -37,6 +37,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@Slf4j
@ -169,31 +170,89 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
list.forEach(dcEmergencyPlans -> {
List<DcExecuteAction> dcExecuteActions = dcEmergencyPlans.getDcExecuteAction();
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());
if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode()
&& executeConfig.getString("operationType").equals("2")) {
// 执行操作中智能发布语音广播
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()
&& executeConfig.getString("operationType").equals("2")) {
// 执行操作中智能发布情报板
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,
String[] markArray,
DcEvent dcEvent,
List<DcDevice> deviceList,
String content,
String direction) {
List<DcDevice> deviceList = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection());
// List<DcDevice> deviceList = ruleFiltering(dcExecuteAction, markArray, dcEvent.getDirection());
JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig());
List<Map<String,Object>> contentList = new ArrayList<>();
deviceList.forEach(dcDevice -> {
@ -620,29 +679,6 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.forEach(dcExecuteAction -> {
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)?
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig());
try {

Loading…
Cancel
Save