diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java index 029931fa..ffb01f0c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java @@ -184,6 +184,27 @@ public class DcWarningController extends BaseController } return (dcWarningService.insertDispatch(map)); } + //4.指挥调度资源新增(用户修改弹窗的提交) + @PostMapping("/updateSource") + public AjaxResult insertDispatchSource(@RequestBody HashMap map){ + return toAjax(dcWarningService.insertDispatchSource(map)); + } + //5.修改调度资源记录 1.查询记录id +// @PostMapping("/selectDispatchId") +// public AjaxResult selectDispatchId(@RequestBody HashMap map){ +// if (map == null || !map.containsKey("eventId")||StringUtils.isBlank(map.get("eventId").toString())){ +// return AjaxResult.error("参数错误"); +// } +// return AjaxResult.success(dcWarningService.selectDispatchId(map.get("eventId").toString())); +// } + //5.修改调度资源记录 2.提交调度资源 + @PostMapping("/updateDispatchSource") + public AjaxResult updateDispatch(@RequestBody HashMap map){ + if (map == null || !map.containsKey("dispatchId")||StringUtils.isBlank(map.get("dispatchId").toString())){ + return AjaxResult.error("参数错误"); + } + return toAjax(dcWarningService.updateDispatchSource(map)); + } //指挥调度记录修改 @PostMapping("/updateDispatch") public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){ @@ -192,11 +213,6 @@ public class DcWarningController extends BaseController } return toAjax(dcWarningService.insertDispatch(dcDispatch)); } - //4.指挥调度资源新增(用户修改弹窗的提交) - @PostMapping("/updateSource") - public AjaxResult insertDispatchSource(@RequestBody HashMap map){ - return toAjax(dcWarningService.insertDispatchSource(map)); - } //感知事件误报 @PostMapping("/falseAlarm") public AjaxResult falseAlarmResolution(@RequestBody DcWarning dcWarning){ diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index 95df0a5b..fa39632b 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -148,4 +148,6 @@ public interface DcWarningMapper public String vehiclesType(Long id); //依据机构id查询机构名称 public String organizationName(Long id); + //事件id查询调度记录id + public HashMap selectDispatchId(@Param("eventId")String eventId); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java index 095c3f74..73f3312c 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java @@ -97,10 +97,13 @@ public interface IDcWarningService AjaxResult intelligentSource(DcWarning dcWarning); //3.指挥调度新增资源 AjaxResult insertDispatch(HashMap map); + //4.新增指挥调度资源记录 + public Integer insertDispatchSource(HashMap map); + //5.修改调度资源记录 + public HashMap selectDispatchId(String eventId); + public Integer updateDispatchSource(HashMap map); //修改指挥调度资源记录 public Integer insertDispatch(DcDispatch dcDispatch); - //新增指挥调度资源记录 - public Integer insertDispatchSource(HashMap map); //误报解除 public Integer falseAlarmResolution(DcWarning dcWarning); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 9cdd30aa..2af5e6f7 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -650,6 +650,7 @@ public class DcWarningServiceImpl implements IDcWarningService mapAll.put("existence",0); return AjaxResult.success(mapAll); } + mapAll.put("dispatchId",dcDispatch.get("id")); mapAll.put("existence",1); HashMap map = dcWarningMapper.selectDcDispatch(dcWarning.getId());//获取机构id与资源id if (map!=null){ @@ -855,6 +856,64 @@ public class DcWarningServiceImpl implements IDcWarningService dcEventProcessService.insertDcEventProcess(dcEventProcess); return 1; } + + @Override + public HashMap selectDispatchId(String eventId) { + return dcWarningMapper.selectDispatchId(eventId); + } + + @Override + public Integer updateDispatchSource(HashMap map) { + DcDispatchResource dcDispatchResource = new DcDispatchResource(); + Long dispatchId = Long.parseLong(map.get("dispatchId").toString()); + dcWarningMapper.deleteDispatchResource(dispatchId);//删除全部属于该调度记录下的全部资源 + ArrayList> employeesArray = (ArrayList>) map.get("employees");//取出人员 + String context = ""; + if (employeesArray!=null&&employeesArray.size()>0) { + context += "路管人员"; + for (Map array : employeesArray) { + dcDispatchResource.setDispatchType(1);//类型 + dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString()));//资源id + dcDispatchResource.setDispatchId(dispatchId);//关联调度记录 + Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource); + context = context + array.get("name").toString() + "、"; + if (integer == 0) { + throw new RuntimeException("插入资源失败"); + } + } + context = context.substring(0,context.length() -1); + context += "参与事件救援"; + } + ArrayList> vehicleArray = (ArrayList>) map.get("vehicle");////取出车辆 + if (vehicleArray!=null&&vehicleArray.size()>0) { + if (context.length() > 0){ + context += ","; + } + context += "救援车辆"; + for (Map array : vehicleArray) { + dcDispatchResource.setDispatchType(2); + dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString())); + dcDispatchResource.setDispatchId(dispatchId); + Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource); + + context = context + array.get("vehiclePlate").toString() + "、"; + if (integer == 0) { + throw new RuntimeException("插入资源失败"); + } + } + context = context.substring(0,context.length() -1); + context += "参与事件救援"; + } + + DcDispatch dcDispatchEventId = dcWarningMapper.selectDcDispatchById(dispatchId); + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(dcDispatchEventId.getEventId()); + dcEventProcess.setSource(1); + dcEventProcess.setContext(context); + dcEventProcessService.insertDcEventProcess(dcEventProcess); + return 1; + } + //误报解除 @Override public Integer falseAlarmResolution(DcWarning dcWarning) { diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index c4155e2a..4bfb8a26 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -430,5 +430,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +