Browse Source

修改事件确认代码

增加根据事件id-查询预案事件关联表
develop
Mr.Wang 8 months ago
parent
commit
b07864492d
  1. 9
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  2. 8
      zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java
  3. 37
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

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

@ -126,6 +126,15 @@ public class DcEmergencyPlansController extends BaseController {
return AjaxResult.success(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans));
}
/**
* 根据事件id-查询预案事件关联表
*/
@ApiOperation("根据事件id-查询预案事件关联表")
@GetMapping("/event/assoc/{id}")
public AjaxResult eventConfirm(@PathVariable("id") String id) {
return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocByEventId(id));
}
/**
* 感知事件确定
*/

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

@ -65,6 +65,14 @@ public interface DcEmergencyPlansService {
*/
JSONArray executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
/**
* 根据事件id-查询预案事件关联表
*
* @param eventId 事件id
* @return 结果
*/
EventPlanAssoc selectEventPlanAssocByEventId(String eventId);
/**
* 感知事件确定
*

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

@ -424,6 +424,18 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
return executionConfirmation(dcEventAnDcEmergencyPlans, dcEvent.getStakeMark(), direction, id);
}
/**
* 根据事件id-查询预案事件关联表
* @param eventId 事件id
* @return
*/
@Override
public EventPlanAssoc selectEventPlanAssocByEventId(String eventId) {
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc();
eventPlanAssoc.setEventId(eventId);
return eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
}
/**
* 感知事件-情报板自动生成
*
@ -584,17 +596,24 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc();
// 事件编号
eventPlanAssoc.setEventId(id);
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
// 区分是执行操作 还是 恢复操作
if (dcEventAnDcEmergencyPlans.getOperationType().equals(1)) {
// 事件预案编号
if (dcEventAnDcEmergencyPlans.getOperationType().equals(1) && StringUtils.isEmpty(selectEventPlanAssoc.getId())) {
// 首次执行操作
eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId());
eventPlanAssoc.setExecutingControlDevice(deviceIds.toString().replaceFirst(";", ""));
eventPlanAssoc.setExecutingControlResult(resultArray.toJSONString());
eventPlanAssoc.setCreateTime(DateUtils.getNowDate());
eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc);
} else {
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
}
else if (StringUtils.isNotEmpty(selectEventPlanAssoc.getId()) && dcEventAnDcEmergencyPlans.getOperationType().equals(1)) {
// 多次执行操作
selectEventPlanAssoc.setExecutingControlResult(resultArray.toJSONString());
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate());
eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc);
}
else {
// 恢复操作 未执行的事件不能进行恢复操作
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate());
selectEventPlanAssoc.setRecoveredControlDevice(deviceIds.toString().replaceFirst(";", ""));
selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString());
@ -620,7 +639,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
iotDeviceId = device.getIotDeviceId();
HashMap<String, Object> props = new HashMap<>();
try {
if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE)) {
if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE.toString())) {
// 行车诱导
functionId = DeviceFunctionIdConstants.DRIVING_GUIDANCE;
// 控制模式 1-手动 2-自动 3-万年历
@ -645,7 +664,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) {
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) {
if (operationType == 1) {
// 执行操作
@ -721,7 +740,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
}
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) {
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())) {
// 路段广播
JSONObject params = new JSONObject();
params.put("name", "task-event");
@ -742,7 +761,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
else if (device.getDeviceType().equals(DeviceTypeConstants.LASER_FATIGUE_AWAKENING)) {
else if (device.getDeviceType().equals(DeviceTypeConstants.LASER_FATIGUE_AWAKENING.toString())) {
// 激光疲劳唤醒
functionId = otherConfig.get("state").toString();

Loading…
Cancel
Save