Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-dc into develop

develop
xiepufeng 8 months ago
parent
commit
757535af96
  1. 8
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  2. 2
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  3. 6
      zc-business/src/main/java/com/zc/business/domain/DcEmergencyPlans.java
  4. 3
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  5. 18
      zc-business/src/main/java/com/zc/business/domain/DcExecuteAction.java
  6. 210
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java
  7. 2
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  8. 24
      zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml
  9. 28
      zc-business/src/main/resources/mapper/business/DcExecuteActionMapper.xml

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

@ -34,7 +34,7 @@ public class DcEmergencyPlansController extends BaseController {
* 查询事件预案列表 * 查询事件预案列表
*/ */
@ApiOperation("查询事件预案列表") @ApiOperation("查询事件预案列表")
@PreAuthorize("@ss.hasPermi('business:plans:list')") // @PreAuthorize("@ss.hasPermi('business:plans:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(DcEmergencyPlans dcEmergencyPlans) { public TableDataInfo list(DcEmergencyPlans dcEmergencyPlans) {
startPage(); startPage();
@ -46,7 +46,7 @@ public class DcEmergencyPlansController extends BaseController {
* 根据事件预案id查询事件预案列表 * 根据事件预案id查询事件预案列表
*/ */
@ApiOperation("根据事件预案id查询事件预案列表") @ApiOperation("根据事件预案id查询事件预案列表")
@PreAuthorize("@ss.hasPermi('business:plans:list')") // @PreAuthorize("@ss.hasPermi('business:plans:list')")
@GetMapping("/list/{id}") @GetMapping("/list/{id}")
public AjaxResult list(@PathVariable @ApiParam(name = "id", value = "事件预案id", required = true) Integer id) { public AjaxResult list(@PathVariable @ApiParam(name = "id", value = "事件预案id", required = true) Integer id) {
@ -149,7 +149,7 @@ public class DcEmergencyPlansController extends BaseController {
* 新增事件预案 * 新增事件预案
*/ */
@ApiOperation("新增预案") @ApiOperation("新增预案")
@PreAuthorize("@ss.hasPermi('business:plans:add')") // @PreAuthorize("@ss.hasPermi('business:plans:add')")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody DcEmergencyPlans dcEmergencyPlans) { public AjaxResult add(@RequestBody DcEmergencyPlans dcEmergencyPlans) {
return toAjax(dcEmergencyPlansService.insertDcEmergencyPlans(dcEmergencyPlans)); return toAjax(dcEmergencyPlansService.insertDcEmergencyPlans(dcEmergencyPlans));
@ -159,7 +159,7 @@ public class DcEmergencyPlansController extends BaseController {
* 修改事件预案 * 修改事件预案
*/ */
@ApiOperation("修改预案") @ApiOperation("修改预案")
@PreAuthorize("@ss.hasPermi('business:plans:edit')") // @PreAuthorize("@ss.hasPermi('business:plans:edit')")
@PutMapping @PutMapping
public AjaxResult update(@RequestBody DcEmergencyPlans dcEmergencyPlans) { public AjaxResult update(@RequestBody DcEmergencyPlans dcEmergencyPlans) {
return toAjax(dcEmergencyPlansService.updateDcEmergencyPlans(dcEmergencyPlans)); return toAjax(dcEmergencyPlansService.updateDcEmergencyPlans(dcEmergencyPlans));

2
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -46,10 +46,8 @@ public class DcEventController extends BaseController
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(DcEvent dcEvent) public TableDataInfo list(DcEvent dcEvent)
{ {
startPage(); startPage();
List<DcEvent> list = dcEventService.selectDcEventList(dcEvent); List<DcEvent> list = dcEventService.selectDcEventList(dcEvent);
return getDataTable(list); return getDataTable(list);
} }

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

@ -81,12 +81,6 @@ public class DcEmergencyPlans {
@ApiModelProperty("控制指令") @ApiModelProperty("控制指令")
private String controlCommand; private String controlCommand;
/**
* 事件分类
*/
@ApiModelProperty("事件分类")
private int eventCategory;
/** /**
* 执行操作列表 * 执行操作列表
*/ */

3
zc-business/src/main/java/com/zc/business/domain/DcEvent.java

@ -279,6 +279,9 @@ public class DcEvent {
@ApiModelProperty("事件类型名称") @ApiModelProperty("事件类型名称")
@TableField(exist = false) @TableField(exist = false)
private String eventName; private String eventName;
@ApiModelProperty("流程节点")
@TableField(exist = false)
private String processNode;

18
zc-business/src/main/java/com/zc/business/domain/DcExecuteAction.java

@ -39,12 +39,6 @@ public class DcExecuteAction{
@ApiModelProperty("设备类型") @ApiModelProperty("设备类型")
private int deviceType; private int deviceType;
/**
* 操作类型
*/
@ApiModelProperty("操作类型")
private int actionType;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
@ApiModelProperty("修改时间") @ApiModelProperty("修改时间")
@ -69,10 +63,16 @@ public class DcExecuteAction{
private String deviceList; private String deviceList;
/** /**
* 其他配置 * 执行操作配置
*/
@ApiModelProperty("执行操作配置")
private String executeConfig;
/**
* 恢复操作配置
*/ */
@ApiModelProperty("其他配置") @ApiModelProperty("恢复操作配置")
private String otherConfig; private String recoverConfig;

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

@ -196,7 +196,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); markArray[1] = String.format("%0" + 3 + "d", markArray[1]);
} }
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction();
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction); Integer operationType = dcEventAnDcEmergencyPlans.getOperationType();
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction, operationType);
return getBoardTemplate(dcDevices); return getBoardTemplate(dcDevices);
} }
@ -217,7 +218,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); markArray[1] = String.format("%0" + 3 + "d", markArray[1]);
} }
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction();
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction); Integer operationType = dcEventAnDcEmergencyPlans.getOperationType();
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction, operationType);
return getBoardTemplate(dcDevices); return getBoardTemplate(dcDevices);
} }
@ -287,9 +289,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* @param direction * @param direction
* @return * @return
*/ */
public List<DcDevice> ruleFiltering(DcExecuteAction dcExecuteAction, String[] markArray, String direction) { public List<DcDevice> ruleFiltering(DcExecuteAction dcExecuteAction, String[] markArray, String direction, Integer operationType) {
Integer searchRule = dcExecuteAction.getSearchRule(); Integer searchRule = dcExecuteAction.getSearchRule();
// 区分执行操作还是恢复操作
JSONObject otherConfig = operationType.equals(1)?
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig());
List<String> start = new ArrayList<>(); List<String> start = new ArrayList<>();
List<String> end = new ArrayList<>(); List<String> end = new ArrayList<>();
// 设备列表 // 设备列表
@ -301,7 +306,6 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 指定设备资源 // 指定设备资源
// 根据设备id,获取设备集合 // 根据设备id,获取设备集合
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>();
JSONObject otherConfig = JSON.parseObject(dcExecuteAction.getOtherConfig());
List<String> deviceList = (List<String>) otherConfig.get("deviceList"); List<String> deviceList = (List<String>) otherConfig.get("deviceList");
queryWrapper.in(DcDevice::getIotDeviceId, deviceList); queryWrapper.in(DcDevice::getIotDeviceId, deviceList);
dcDevices = dcDeviceService.list(queryWrapper); dcDevices = dcDeviceService.list(queryWrapper);
@ -564,19 +568,21 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 获取事件预案数据 // 获取事件预案数据
DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans(); DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans();
Integer operationType = dcEventAnDcEmergencyPlans.getOperationType();
//获取事件预案中的 执行操作配置 //获取事件预案中的操作配置
dcEmergencyPlans.getDcExecuteAction() dcEmergencyPlans.getDcExecuteAction()
.forEach(dcExecuteAction -> { .forEach(dcExecuteAction -> {
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction); List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction, operationType);
JSONObject otherConfig = operationType.equals(1)?
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig());
try { try {
// 根据不通设备类型,执行不通的功能操作 // 根据不通设备类型,执行不通的功能操作
invokedFunction( invokedFunction(
dcEventAnDcEmergencyPlans.getOperationType(), dcEventAnDcEmergencyPlans.getOperationType(),
dcDevices, dcDevices,
JSON.parseObject(dcExecuteAction.getOtherConfig()), otherConfig,
resultArray); resultArray);
// 记录操作过的设备id // 记录操作过的设备id
@ -666,81 +672,31 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) { else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) {
if (operationType == 1) { if (operationType == 1) {
// 情报板发布全流程
// 执行操作 boardReleaseProcess(props, iotDeviceId, otherConfig, device, resultArray);
// 可变信息标志 分三步
// 1:执行11功能码
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11;
props.put("fileName", "play011.lst");
props.put("size", "65535");
AjaxResult ajaxResult11;
ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
if (ajaxResult11.get("code").equals(200)) {
// 2:执行13功能码
HashMap<String, Object> props11 = new HashMap<>();
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13;
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> parameters = new HashMap<>();
DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject(
JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")),
DcInfoBoardTemplate.class);
// stopTime
parameters.put("STAY", dcInfoBoardTemplate.getStopTime());
// inScreenMode
parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode());
// fontSpacing
parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing());
// fontColor
parameters.put("COLOR", dcInfoBoardTemplate.getFontColor());
// fontType
parameters.put("FONT", dcInfoBoardTemplate.getFontType());
// fontSize
parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize());
// content
parameters.put("CONTENT", dcInfoBoardTemplate.getContent());
// screenSize 768*64 宽度和高度
parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]);
parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]);
// formatStyle
parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle());
list.add(parameters);
props11.put("parameters", list);
AjaxResult ajaxResult13 = null;
ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11);
JSONObject result = new JSONObject();
if (ajaxResult13.get("code").equals(200)) {
HashMap<String, Object> props1B = new HashMap<>();
// 3: 执行1B功能码
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
props1B.put("fileId", "11");
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B);
result.put("device", device.getId());
result.put("result", ajaxResult1B);
resultArray.add(result);
} else {
result.put("device", device.getId());
result.put("result", ajaxResult13);
resultArray.add(result);
}
}
} else { } else {
// 恢复操作 // 恢复操作
props.put("fileId", "10"); if (otherConfig.get("operationType").equals("2")) {
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; // 还原上次
AjaxResult ajaxResult1B; props.put("fileId", "10");
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
AjaxResult ajaxResult1B;
ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("device", device.getId()); result.put("device", device.getId());
result.put("result", ajaxResult1B); result.put("result", ajaxResult1B);
resultArray.add(result); resultArray.add(result);
}else {
// 播放自定义
boardReleaseProcess(props, iotDeviceId, otherConfig, device, resultArray);
}
} }
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())) { else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())
&& operationType.equals(1)) {
// 路段广播 // 路段广播
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("name", "task-event"); params.put("name", "task-event");
@ -793,6 +749,75 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
/**
* 情报板发布全流程
*/
public void boardReleaseProcess(HashMap<String, Object> props,
String iotDeviceId,
JSONObject otherConfig,
DcDevice device,
JSONArray resultArray
) throws HttpException, IOException {
String functionId = "";
// 执行操作
// 可变信息标志 分三步
// 1:执行11功能码
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11;
props.put("fileName", "play011.lst");
props.put("size", "65535");
AjaxResult ajaxResult11;
ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
if (ajaxResult11.get("code").equals(200)) {
// 2:执行13功能码
HashMap<String, Object> props11 = new HashMap<>();
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13;
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> parameters = new HashMap<>();
DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject(
JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")),
DcInfoBoardTemplate.class);
// stopTime
parameters.put("STAY", dcInfoBoardTemplate.getStopTime());
// inScreenMode
parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode());
// fontSpacing
parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing());
// fontColor
parameters.put("COLOR", dcInfoBoardTemplate.getFontColor());
// fontType
parameters.put("FONT", dcInfoBoardTemplate.getFontType());
// fontSize
parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize());
// content
parameters.put("CONTENT", dcInfoBoardTemplate.getContent());
// screenSize 768*64 宽度和高度
parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]);
parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]);
// formatStyle
parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle());
list.add(parameters);
props11.put("parameters", list);
AjaxResult ajaxResult13 = null;
ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11);
JSONObject result = new JSONObject();
if (ajaxResult13.get("code").equals(200)) {
HashMap<String, Object> props1B = new HashMap<>();
// 3: 执行1B功能码
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
props1B.put("fileId", "11");
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B);
result.put("device", device.getId());
result.put("result", ajaxResult1B);
resultArray.add(result);
} else {
result.put("device", device.getId());
result.put("result", ajaxResult13);
resultArray.add(result);
}
}
}
/** /**
* 新增事件预案 * 新增事件预案
@ -828,7 +853,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans); dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans);
// 修改执行操作表数据 // 修改执行操作表数据
dcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); dcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate()));
// 过滤出删除掉的执行操作和恢复操作 // 过滤出删除掉的操作
String dcExecuteActionId = dcExecuteActionList.stream() String dcExecuteActionId = dcExecuteActionList.stream()
.filter(dcExecuteAction -> dcExecuteAction.getId() != null) .filter(dcExecuteAction -> dcExecuteAction.getId() != null)
.map(DcExecuteAction::getEmergencyPlansId) .map(DcExecuteAction::getEmergencyPlansId)
@ -839,17 +864,16 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.filter(dcExecuteAction -> dcExecuteAction.getId() != null) .filter(dcExecuteAction -> dcExecuteAction.getId() != null)
.map(DcExecuteAction::getId) .map(DcExecuteAction::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 查询出事件预案关联的执行操作和恢复操作 // 查询出事件预案关联的操作
List<String> dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcExecuteActionId); List<String> dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcExecuteActionId);
List<String> commonIds = new ArrayList<>(ids); List<String> commonIds = new ArrayList<>(ids);
commonIds.retainAll(dcExecuteActionIdList); commonIds.retainAll(dcExecuteActionIdList);
// 删除后的执行操作id和恢复操作id // 删除后的操作id
List<String> idsNotInDcExecuteActionIdList = new ArrayList<>(dcExecuteActionIdList); List<String> idsNotInDcExecuteActionIdList = new ArrayList<>(dcExecuteActionIdList);
idsNotInDcExecuteActionIdList.removeAll(commonIds); idsNotInDcExecuteActionIdList.removeAll(commonIds);
// 根据执行操作id和恢复操作id,进行删除操作 // 根据操作id,进行删除操作
if (idsNotInDcExecuteActionIdList.size() > 0) { if (idsNotInDcExecuteActionIdList.size() > 0) {
System.out.println("存在需要删除的数据");
dcExecuteActionService.deleteDcExecuteAction(idsNotInDcExecuteActionIdList); dcExecuteActionService.deleteDcExecuteAction(idsNotInDcExecuteActionIdList);
} }
@ -907,14 +931,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* 数据处理 * 数据处理
*/ */
public static List<DcExecuteAction> dataProcessing(DcEmergencyPlans dcEmergencyPlans) { public static List<DcExecuteAction> dataProcessing(DcEmergencyPlans dcEmergencyPlans) {
// 过滤出执行操作数据
List<DcExecuteAction> dcExecuteActionOperationList = dcEmergencyPlans.getDcExecuteAction()
.stream()
.filter(dcExecuteAction -> dcExecuteAction.getActionType() == 1)
.collect(Collectors.toList());
List<DcExecuteAction> dcExecuteActionList = dcEmergencyPlans.getDcExecuteAction(); List<DcExecuteAction> dcExecuteActionList = dcEmergencyPlans.getDcExecuteAction();
// 设备类型 数据处理 // 设备类型 数据处理
String deviceType = dcExecuteActionOperationList.stream() String deviceType = dcExecuteActionList.stream()
.map(DcExecuteAction::getDeviceType) .map(DcExecuteAction::getDeviceType)
.distinct() .distinct()
.map(type -> Arrays.stream(DeviceTypeEnum.values()) .map(type -> Arrays.stream(DeviceTypeEnum.values())
@ -926,7 +946,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));
dcEmergencyPlans.setDeviceType(deviceType); dcEmergencyPlans.setDeviceType(deviceType);
// 可控设备 数据处理 // 可控设备 数据处理
List<DcExecuteAction> dcExecuteActionNewList = dcExecuteActionOperationList.stream() List<DcExecuteAction> dcExecuteActionNewList = dcExecuteActionList.stream()
.filter(dcExecuteAction -> dcExecuteAction.getSearchRule() == 1) .filter(dcExecuteAction -> dcExecuteAction.getSearchRule() == 1)
.collect(Collectors.toList()); .collect(Collectors.toList());
String controllableDevice = dcExecuteActionNewList.stream() String controllableDevice = dcExecuteActionNewList.stream()
@ -934,11 +954,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.collect(Collectors.joining("、")); .collect(Collectors.joining("、"));
dcEmergencyPlans.setControllableDevice(controllableDevice); dcEmergencyPlans.setControllableDevice(controllableDevice);
// 控制指令 数据处理 // 控制指令 数据处理
List<String> otherConfigList = dcExecuteActionOperationList.stream() List<String> otherConfigList = dcExecuteActionList.stream()
.map(dcExecuteAction -> { .map(dcExecuteAction -> {
JSONObject config = new JSONObject(); JSONObject config = new JSONObject();
String otherConfig = dcExecuteAction.getOtherConfig(); // 执行操作配置
JSONObject jsonObject = JSON.parseObject(otherConfig); String executeConfig = dcExecuteAction.getExecuteConfig();
JSONObject jsonObject = JSON.parseObject(executeConfig);
if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.DRIVING_GUIDANCE) { if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.DRIVING_GUIDANCE) {
// 行车诱导 // 行车诱导
config.put("controlModelName",jsonObject.get("controlModelName")); config.put("controlModelName",jsonObject.get("controlModelName"));
@ -950,7 +971,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG || }else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG ||
dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) { dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) {
// 情报板/语音广播 // 情报板/语音广播
config.put("content",jsonObject.get("content")); if (jsonObject.get("operationType").equals("1")) {
config.put("content",jsonObject.get("content"));
}else {
config.put("operationType","智能发布");
}
} }
else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.LASER_FATIGUE_AWAKENING) { else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.LASER_FATIGUE_AWAKENING) {
// 激光疲劳唤醒 // 激光疲劳唤醒

2
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -603,6 +603,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
public DcEvent selectEventSubclassById(int eventType, String id) { public DcEvent selectEventSubclassById(int eventType, String id) {
//todo //todo
DcEvent dcEvent = dcEventMapper.selectDcEventById(id); DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
dcEvent.setProcessConfigList(processConfigList);
switch (eventType) { switch (eventType) {
//交通事故 //交通事故
case 1: case 1:

24
zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml

@ -15,18 +15,17 @@
<result property="triggeringCondition" column="triggering_condition"/> <result property="triggeringCondition" column="triggering_condition"/>
<result property="controllableDevice" column="controllable_device"/> <result property="controllableDevice" column="controllable_device"/>
<result property="controlCommand" column="control_command"/> <result property="controlCommand" column="control_command"/>
<result property="eventCategory" column="event_category"/>
<collection property="dcExecuteAction" ofType="DcExecuteAction"> <collection property="dcExecuteAction" ofType="DcExecuteAction">
<result property="id" column="action_id"/> <result property="id" column="action_id"/>
<result property="emergencyPlansId" column="action_emergency_plans_id"/> <result property="emergencyPlansId" column="action_emergency_plans_id"/>
<result property="deviceType" column="action_device_type"/> <result property="deviceType" column="action_device_type"/>
<result property="actionType" column="action_action_type"/>
<result property="createTime" column="action_create_time"/> <result property="createTime" column="action_create_time"/>
<result property="updateTime" column="action_update_time"/> <result property="updateTime" column="action_update_time"/>
<result property="searchRule" column="action_search_rule"/> <result property="searchRule" column="action_search_rule"/>
<result property="number" column="action_number"/> <result property="number" column="action_number"/>
<result property="deviceList" column="action_device_list"/> <result property="deviceList" column="action_device_list"/>
<result property="otherConfig" column="action_other_config"/> <result property="executeConfig" column="action_execute_config"/>
<result property="recoverConfig" column="action_recover_config"/>
</collection> </collection>
</resultMap> </resultMap>
@ -43,7 +42,6 @@
<if test="triggeringCondition != null and triggeringCondition != ''">triggering_condition,</if> <if test="triggeringCondition != null and triggeringCondition != ''">triggering_condition,</if>
<if test="controllableDevice != null and controllableDevice != ''">controllable_device,</if> <if test="controllableDevice != null and controllableDevice != ''">controllable_device,</if>
<if test="controlCommand != null and controlCommand != ''">control_command,</if> <if test="controlCommand != null and controlCommand != ''">control_command,</if>
<if test="eventCategory != null">event_category,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null and planName != ''">#{planName},</if> <if test="planName != null and planName != ''">#{planName},</if>
@ -55,7 +53,6 @@
<if test="triggeringCondition != null and triggeringCondition != ''">#{triggeringCondition},</if> <if test="triggeringCondition != null and triggeringCondition != ''">#{triggeringCondition},</if>
<if test="controllableDevice != null and controllableDevice != ''">#{controllableDevice},</if> <if test="controllableDevice != null and controllableDevice != ''">#{controllableDevice},</if>
<if test="controlCommand != null and controlCommand != ''">#{controlCommand},</if> <if test="controlCommand != null and controlCommand != ''">#{controlCommand},</if>
<if test="eventCategory != null">#{eventCategory},</if>
</trim> </trim>
</insert> </insert>
@ -68,8 +65,7 @@
device_type = #{deviceType}, device_type = #{deviceType},
triggering_condition = #{triggeringCondition}, triggering_condition = #{triggeringCondition},
controllable_device = #{controllableDevice}, controllable_device = #{controllableDevice},
control_command = #{controlCommand}, control_command = #{controlCommand}
event_category = #{eventCategory}
where id = #{id} where id = #{id}
</update> </update>
@ -90,16 +86,16 @@
t1.triggering_condition, t1.triggering_condition,
t1.controllable_device, t1.controllable_device,
t1.control_command, t1.control_command,
t1.event_category,
t2.id as action_id, t2.id as action_id,
t2.emergency_plans_id as action_emergency_plans_id, t2.emergency_plans_id as action_emergency_plans_id,
t2.device_type as action_device_type, t2.device_type as action_device_type,
t2.action_type as action_action_type,
t2.create_time as action_create_time, t2.create_time as action_create_time,
t2.update_time as action_update_time,
t2.search_rule as action_search_rule, t2.search_rule as action_search_rule,
t2.`number` as action_number, t2.`number` as action_number,
t2.device_list as action_device_list, t2.device_list as action_device_list,
t2.other_config as action_other_config t2.execute_config as action_execute_config,
t2.recover_config as action_recover_config
from dc_emergency_plans t1 from dc_emergency_plans t1
left join dc_execute_action t2 left join dc_execute_action t2
on t1.id = t2.emergency_plans_id on t1.id = t2.emergency_plans_id
@ -115,13 +111,11 @@
t1.device_type, t1.device_type,
t1.triggering_condition, t1.triggering_condition,
t1.controllable_device, t1.controllable_device,
t1.control_command, t1.control_command
t1.event_category
from dc_emergency_plans t1 from dc_emergency_plans t1
<where> <where>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if> <if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="eventType != 0 "> and event_type = #{eventType}</if> <if test="eventType != 0 "> and event_type = #{eventType}</if>
<if test="eventCategory != 0"> and event_category = #{eventCategory}</if>
</where> </where>
order by t1.id desc order by t1.id desc
</select> </select>
@ -133,12 +127,12 @@
<select id="selectDcEmergencyPlansByEventType" parameterType="dcEvent" resultMap="DcEmergencyPlansResult"> <select id="selectDcEmergencyPlansByEventType" parameterType="dcEvent" resultMap="DcEmergencyPlansResult">
<include refid="selectDcEmergencyPlansListAll"/> <include refid="selectDcEmergencyPlansListAll"/>
where t1.event_type = #{eventType} and t1.event_category = 1 where t1.event_type = #{eventType}
</select> </select>
<select id="selectDcEmergencyPlansByWarningType" parameterType="int" resultMap="DcEmergencyPlansResult"> <select id="selectDcEmergencyPlansByWarningType" parameterType="int" resultMap="DcEmergencyPlansResult">
<include refid="selectDcEmergencyPlansListAll"/> <include refid="selectDcEmergencyPlansListAll"/>
where t1.event_type = #{eventType} and t1.event_category = 2 where t1.event_type = #{eventType}
</select> </select>

28
zc-business/src/main/resources/mapper/business/DcExecuteActionMapper.xml

@ -10,24 +10,26 @@
(emergency_plans_id, (emergency_plans_id,
device_type, device_type,
action_type,
create_time, create_time,
search_rule, search_rule,
`number`, `number`,
device_list, device_list,
other_config execute_config,
recover_config
) )
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.emergencyPlansId}, (
#{item.emergencyPlansId},
#{item.deviceType}, #{item.deviceType},
#{item.actionType},
#{item.createTime}, #{item.createTime},
#{item.searchRule}, #{item.searchRule},
#{item.number}, #{item.number},
#{item.deviceList}, #{item.deviceList},
#{item.otherConfig}) #{item.executeConfig},
#{item.recoverConfig}
)
</foreach> </foreach>
</insert> </insert>
@ -47,12 +49,6 @@
then #{item.deviceType} then #{item.deviceType}
</foreach> </foreach>
</trim> </trim>
<trim prefix="action_type =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id}
then #{item.actionType}
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,"> <trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="item" index="index"> <foreach collection="list" item="item" index="index">
when id=#{item.id} when id=#{item.id}
@ -77,10 +73,16 @@
then #{item.deviceList} then #{item.deviceList}
</foreach> </foreach>
</trim> </trim>
<trim prefix="other_config =case" suffix="end,"> <trim prefix="execute_config =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id}
then #{item.executeConfig}
</foreach>
</trim>
<trim prefix="recover_config =case" suffix="end,">
<foreach collection="list" item="item" index="index"> <foreach collection="list" item="item" index="index">
when id=#{item.id} when id=#{item.id}
then #{item.otherConfig} then #{item.recoverConfig}
</foreach> </foreach>
</trim> </trim>
</trim> </trim>

Loading…
Cancel
Save