|
|
@ -445,12 +445,14 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
{ |
|
|
|
return dcWarningMapper.deleteDcWarningById(id); |
|
|
|
} |
|
|
|
//感知事件转交通事件(感知事件状态改为处置中,把感知事件的数据整理新增到交通事件)
|
|
|
|
//感知事件转交通事件(感知事件状态改为处置中,把感知事件的数据整理新增到交通事件)
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public AjaxResult updateWarningConvert(DcWarning dcWarning) { |
|
|
|
if (dcWarning==null||dcWarning.getId()==null|| StringUtils.isBlank(dcWarning.getStakeMark())|| |
|
|
|
StringUtils.isBlank(dcWarning.getDirection())){ |
|
|
|
if (dcWarning==null||dcWarning.getId()==null|| dcWarning.getStakeMark()==null|| |
|
|
|
StringUtils.isBlank(dcWarning.getStakeMark())||dcWarning.getDirection()==null|| |
|
|
|
StringUtils.isBlank(dcWarning.getDirection()) || |
|
|
|
dcWarning.getWarningType()==null|| dcWarning.getWarningSource()==null){ |
|
|
|
return AjaxResult.error("参数错误"); |
|
|
|
} |
|
|
|
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>(); |
|
|
@ -475,23 +477,28 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
if (dcWarning.getWarningType()!=null) { |
|
|
|
dcEvent.setEventType((long) ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类
|
|
|
|
} |
|
|
|
if (StringUtils.isBlank(dcWarning.getWarningSubclass())&&dcWarning.getWarningType()!=7&& |
|
|
|
if (dcWarning.getWarningSubclass()!=null&&StringUtils.isBlank(dcWarning.getWarningSubclass())&&dcWarning.getWarningType()!=7&& |
|
|
|
dcWarning.getWarningType()!=10) { |
|
|
|
dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类(7与10不转)
|
|
|
|
} |
|
|
|
if (StringUtils.isBlank(dcWarning.getWarningSubclass())&&(dcWarning.getWarningType()==7|| |
|
|
|
if (dcWarning.getWarningSubclass()!=null&&StringUtils.isBlank(dcWarning.getWarningSubclass())&&(dcWarning.getWarningType()==7|| |
|
|
|
dcWarning.getWarningType()==10)){ |
|
|
|
dcEvent.setEventSubclass(dcWarning.getWarningSubclass());//事件子类(7与10主类对应的子类直接set)
|
|
|
|
} |
|
|
|
dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//发生时间
|
|
|
|
dcEvent.setStartTime(DateUtils.getNowDate());//开始时间
|
|
|
|
dcEvent.setEstimatedEndTime(DateUtils.getObtainDateAfter(180));//预计结束时间,开始时间+3小时
|
|
|
|
dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题
|
|
|
|
dcEvent.setLang(dcWarning.getLane());//车道
|
|
|
|
dcEvent.setRemark(dcEvent.getRemark());//备注
|
|
|
|
dcEvent.setRemark(dcWarning.getRemark());//备注
|
|
|
|
dcEvent.setIsPerceived(1);//是否感知事件
|
|
|
|
dcEvent.setEventState(Long.valueOf(1));//状态为处理中
|
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
|
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
|
|
|
|
int insertDcEvent = dcEventService.insertDcEventWarning(dcEvent); |
|
|
|
|
|
|
|
if (insertDcEvent==0){ |
|
|
|
return AjaxResult.error("操作失败"); |
|
|
|
} |
|
|
|
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
|
|
|
|
for (HashMap<String,Object> map:mapList){ |
|
|
|
if (StringUtils.isBlank(map.get("stakeMark").toString())){ |
|
|
@ -518,10 +525,13 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
DcDispatchResource dcDispatchResource = new DcDispatchResource(); |
|
|
|
dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId()); |
|
|
|
dcDispatch.setEventId(dcWarning.getId()); |
|
|
|
dcDispatch.setStartTime(DateUtils.getNowDate()); |
|
|
|
dcDispatch.setDispatchStatus(2L);//进行中状态
|
|
|
|
dcDispatch.setRemark(dcWarning.getRemark()); |
|
|
|
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
|
|
|
|
Long dispatchId = dcDispatch.getId();//信息记录id
|
|
|
|
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(dispatchId);//人员map
|
|
|
|
if (employeesMap != null) { |
|
|
|
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(id);//人员map
|
|
|
|
if (employeesMap != null&&employeesMap.size()>0) { |
|
|
|
// 生成一个随机索引,范围在0到列表长度减1之间
|
|
|
|
int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size()); |
|
|
|
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex); |
|
|
@ -531,8 +541,8 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
dcDispatchResource.setDispatchId(dispatchId);//信息记录id
|
|
|
|
dcWarningMapper.insertDispatchResource(dcDispatchResource); |
|
|
|
} |
|
|
|
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehicles(dispatchId);//车辆map
|
|
|
|
if (vehiclesMap != null) { |
|
|
|
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehicles(id);//车辆map
|
|
|
|
if (vehiclesMap != null&&vehiclesMap.size()>0) { |
|
|
|
// 生成一个随机索引,范围在0到列表长度减1之间
|
|
|
|
int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size()); |
|
|
|
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex); |
|
|
@ -544,10 +554,6 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (insertDcEvent==0){ |
|
|
|
return AjaxResult.error("操作失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//事件处置流程记录
|
|
|
|
DcEventProcess dcEventProcess = new DcEventProcess(); |
|
|
|
dcEventProcess.setEventId(dcEvent.getId()); |
|
|
|