Browse Source

增加交通事件-切换智能发布生成内容接口

develop
Mr.Wang 9 months ago
parent
commit
fa4a052c5b
  1. 15
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  2. 44
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

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

@ -14,6 +14,8 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -67,6 +69,19 @@ public class DcEmergencyPlansController extends BaseController {
return AjaxResult.success(dcEmergencyPlansList);
}
/**
* 交通事件-切换智能发布生成内容
*/
@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);
}
/**
* 感知事件-根据事件数据查询事件预案列表
*/

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

@ -720,28 +720,28 @@ 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()
);
}
}
// // 此代码 是为了防止事件没有匹配到预案,但是还执行了设备控制,并且执行操作中带有智能发布
// 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());

Loading…
Cancel
Save