From 5a6d4e5d3582543305620faf6d275efb2f109c53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com>
Date: Thu, 30 May 2024 18:00:21 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E5=BA=A6=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/mapper/business/DcEventProcessMapper.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml
index e852e609..68376d4f 100644
--- a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml
+++ b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml
@@ -152,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
\ No newline at end of file
From 12caa19705334f5e84c09363dd7ce16875dceb7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com>
Date: Thu, 30 May 2024 18:12:30 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/impl/DcEventServiceImpl.java | 59 -------------------
1 file changed, 59 deletions(-)
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
index 53c23e79..cd94b9d1 100644
--- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
@@ -1166,65 +1166,6 @@ public class DcEventServiceImpl extends ServiceImpl impl
dcEventProcess.setContext("由" + sourceName + "上报了一起" + typeName + "事件");
dcEventProcessService.insertDcEventProcess(dcEventProcess);
- //插入调度默认数据
- ArrayList> hashMaps = new ArrayList<>();
- String stakeMark = dcEvent.getStakeMark();//传入桩号
- List> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
- for (HashMap map : mapList) {
- if (org.apache.commons.lang3.StringUtils.isBlank(map.get("stakeMark").toString())) {
- continue;
- }
- Long sectionId = (Long) map.get("id");//机构的id
- String stakeMarkNew = map.get("stakeMark").toString();//机构桩号
- com.zc.business.utils.StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
- Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数
- Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数
- Integer difference = Math.abs(afferentStakeMark - itselfStakeMark); //计算距离绝对值
- map.put("difference", difference / 1000.0);//米转公里加入到map
- map.put("id", sectionId);
- hashMaps.add(map);
- }
- List> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
- return (Double) map.get("difference");
- })).collect(Collectors.toList());
- HashMap hashMap = dcWarningMapper.selectDcDispatch(id);//查询事件是否已经有转的调度记录
- if (!sortedHashMaps.isEmpty() && hashMap == null) {
- HashMap map = sortedHashMaps.get(0);
- Long sortId = (Long) map.get("id");//取出最近的机构id
- if (sortId != null) {
- DcDispatch dcDispatch = new DcDispatch();
- DcDispatchResource dcDispatchResource = new DcDispatchResource();
- dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId());
- dcDispatch.setEventId(id);
- dcDispatch.setStartTime(DateUtils.getNowDate());
- dcDispatch.setDispatchStatus(2L);//进行中状态
- dcDispatch.setRemark(dcEvent.getRemark());
- dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
- Long dispatchId = dcDispatch.getId();//信息记录id
- List> employeesMap = dcWarningMapper.selectOrganizationEmployees(sortId);//人员map
- if (employeesMap != null && employeesMap.size() > 0) {
- // 生成一个随机索引,范围在0到列表长度减1之间
- int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size());
- HashMap randomEmployee = employeesMap.get(randomIndex);
- Long employeesId = (Long) randomEmployee.get("id");//随机人员id
- dcDispatchResource.setResourceId(employeesId);//资源id
- dcDispatchResource.setDispatchType(1);//资源类型
- dcDispatchResource.setDispatchId(dispatchId);//信息记录id
- dcWarningMapper.insertDispatchResource(dcDispatchResource);
- }
- List> vehiclesMap = dcWarningMapper.selectVehicles(sortId);//车辆map
- if (vehiclesMap != null && vehiclesMap.size() > 0) {
- // 生成一个随机索引,范围在0到列表长度减1之间
- int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size());
- HashMap randomEmployee = employeesMap.get(randomIndex);
- Long vehiclesId = (Long) randomEmployee.get("id");//随机车辆id
- dcDispatchResource.setResourceId(vehiclesId);//资源id
- dcDispatchResource.setDispatchType(2);//资源类型
- dcDispatchResource.setDispatchId(dispatchId);//信息记录id
- dcWarningMapper.insertDispatchResource(dcDispatchResource);//绑定车辆信息
- }
- }
- }
}
return i;
}
From ffba40c835f6d23a0f74869da1fc7399f463adcc Mon Sep 17 00:00:00 2001
From: wangsixiang <2970484253@qq.com>
Date: Thu, 30 May 2024 18:16:08 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=A4=84=E7=BD=AE=E8=B0=83=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/zc/business/service/impl/DcWarningServiceImpl.java | 4 +++-
.../src/main/resources/mapper/business/DcWarningMapper.xml | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
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 7216ea41..9cdd30aa 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
@@ -612,6 +612,7 @@ public class DcWarningServiceImpl implements IDcWarningService
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public AjaxResult commandAndDispatch(DcWarning dcWarning) {
Map mapAll = new HashMap<>();
HashMap dcDispatch = dcWarningMapper.selectDcDispatch(dcWarning.getId());//查询是否存在调度记录
@@ -671,6 +672,7 @@ public class DcWarningServiceImpl implements IDcWarningService
}
//指挥调度,当调度信息为空的时候调用智能分配资源
@Override
+ @Transactional(rollbackFor = Exception.class)
public AjaxResult intelligentSource(DcWarning dcWarning) {
String stakeMark = dcWarning.getStakeMark();
ArrayList> hashMaps = new ArrayList<>();
@@ -747,7 +749,7 @@ public class DcWarningServiceImpl implements IDcWarningService
employees = Long.parseLong(map.get("employeesId").toString());//人员
}
Long vehicles=null;
- if (map.get("vehiclesId").toString()!=null){
+ if (map.get("vehiclesId")!=null){
vehicles = Long.parseLong(map.get("vehiclesId").toString());//车辆
}
DcDispatch dcDispatch = new DcDispatch();
diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
index c3986369..c4155e2a 100644
--- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
+++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
@@ -319,7 +319,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where parent_id!=0