From 5f2ee03958a1a16dc27195c76ea7cffb422c95d1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 19 十二月 2025 22:40:34 +0800
Subject: [PATCH] feat: 任务修改接口,删除一些不要的字段同步
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java | 251 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 174 insertions(+), 77 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
index 8ea35df..0159840 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
@@ -8,9 +8,11 @@
import java.net.URL;
import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.*;
import com.ruoyi.system.domain.vo.*;
-import com.ruoyi.system.event.TaskDispatchSyncEvent;
+import com.ruoyi.system.event.*;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.*;
import com.ruoyi.system.utils.TaskCodeGenerator;
@@ -19,10 +21,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.GpsDistanceUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.system.domain.SysTask;
@@ -34,9 +32,6 @@
import com.ruoyi.system.domain.SysTaskAssignee;
import com.ruoyi.system.domain.enums.TaskStatus;
import com.ruoyi.system.domain.VehicleInfo;
-import com.ruoyi.system.event.TaskCreatedEvent;
-import com.ruoyi.system.event.TaskAssignedEvent;
-import com.ruoyi.system.event.TaskStatusChangedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -83,8 +78,13 @@
@Autowired
private ISysTaskAttachmentService sysTaskAttachmentService;
+
+
@Autowired
- private SysUserMapper sysUserMapper;
+ private ISysDeptService deptService;
+
+ @Autowired
+ private ISysUserService userService;
@Autowired(required = false)
private IMapService mapService;
@@ -104,13 +104,16 @@
@Override
public Boolean dispatchSyncEvent(Long taskId) {
SysTask task= sysTaskMapper.selectSysTaskByTaskId(taskId);
- SysUser user= sysUserMapper.selectUserById(task.getCreatorId());
+ SysUser user= userService.selectUserById(task.getCreatorId());
Integer oaUser=user.getOaUserId();
SysTaskEmergency emergency = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(taskId);
eventPublisher.publishEvent(new TaskDispatchSyncEvent(this, taskId, task.getTaskCode(),emergency.getLegacyServiceOrdId(), emergency.getLegacyDispatchOrdId(),oaUser));
return true;
}
+ private Long getBranchCompanyId(Long userId) {
+ return userService.getBranchCompanyIdByUserId(userId);
+ }
/**
* 鏌ヨ浠诲姟绠$悊
*
@@ -121,6 +124,7 @@
public SysTask selectSysTaskByTaskId(Long taskId) {
SysTask task = sysTaskMapper.selectSysTaskByTaskId(taskId);
if (task != null) {
+
// 鍔犺浇鎬ユ晳杞繍鎵╁睍淇℃伅
if ("EMERGENCY_TRANSFER".equals(task.getTaskType())) {
SysTaskEmergency emergencyInfo = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(taskId);
@@ -145,12 +149,32 @@
public List<SysTask> selectSysTaskList(TaskQueryVO queryVO) {
List<SysTask> tasks= sysTaskMapper.selectSysTaskList(queryVO);
tasks.forEach(task -> {
+
if ("EMERGENCY_TRANSFER".equals(task.getTaskType())) {
SysTaskEmergency emergencyInfo = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(task.getTaskId());
task.setEmergencyInfo(emergencyInfo);
}
});
return tasks;
+ }
+
+ /**
+ * 璁剧疆浠诲姟鏄�婚儴鎺ㄩ�佺殑鏍囪
+ * @param taskCreatorId 浠诲姟鍒涘缓浜虹殑鐢ㄦ埛ID
+ * @param taskDeptId 浠诲姟涓殑褰掑睘鏈烘瀯ID
+ */
+ @Override
+ public Boolean isTaskHeaderPush(Long taskCreatorId,Long taskDeptId){
+ if(LongUtil.isEmpty(taskCreatorId))return false;
+ if(LongUtil.isEmpty(taskDeptId))return false ;
+ Long createrDeptId = getBranchCompanyId(taskCreatorId);
+
+ if(createrDeptId !=null && !taskDeptId.equals(createrDeptId) && createrDeptId.equals(DeptUtil.GUANGZHOU_DEPT_ID)){
+ //骞垮窞鎬婚儴鎺ㄩ�佺殑浠诲姟
+ return true;
+ }else{
+ return false;
+ }
}
/**
@@ -186,6 +210,7 @@
// Get all tasks matching the other criteria
List<SysTask> allTasks = sysTaskMapper.selectSysTaskList(newQuery);
allTasks.stream().forEach(task -> {
+
if ("EMERGENCY_TRANSFER".equals(task.getTaskType())) {
SysTaskEmergency emergencyInfo = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(task.getTaskId());
task.setEmergencyInfo(emergencyInfo);
@@ -195,6 +220,7 @@
if (task.getTaskCode() != null && task.getTaskCode().contains(taskCode)) {
return true;
}
+
if ("EMERGENCY_TRANSFER".equals(task.getTaskType()) && task.getEmergencyInfo() != null) {
String dispatchCode = task.getEmergencyInfo().getDispatchCode();
String serviceCode = task.getEmergencyInfo().getServiceCode();
@@ -239,6 +265,8 @@
task.setUpdateTime(DateUtils.getNowDate());
task.setRemark(createVO.getRemark());
task.setDelFlag("0");
+
+ task.setIsHeadPush(isTaskHeaderPush(userId,task.getDeptId())?"1":"0");
// 璁剧疆鍦板潃鍜屽潗鏍囦俊鎭�
setAddressAndCoordinatesFromVO(task, createVO);
@@ -317,7 +345,7 @@
*/
@Override
@Transactional
- public int insertTask(TaskCreateVO createVO,String serviceOrderId,String dispatchOrderId, String serviceOrdNo, Long userId,String userName, Long deptId, Date createTime, Date updateTime) {
+ public int insertTask(TaskCreateVO createVO,Long serviceOrderId,Long dispatchOrderId, String serviceOrdNo, Long userId,String userName, Long deptId, Date createTime, Date updateTime) {
SysTask task = new SysTask();
if(createVO.getTaskCode()!=null){
task.setTaskCode(createVO.getTaskCode());
@@ -343,6 +371,13 @@
task.setRemark(createVO.getRemark());
task.setDelFlag("0");
+ Boolean isHeadPush=this.isTaskHeaderPush(userId, deptId);
+ if(isHeadPush){
+ task.setIsHeadPush("1");
+ }else{
+ task.setIsHeadPush("0");
+ }
+
// 璁剧疆鍦板潃鍜屽潗鏍囦俊鎭�
@@ -351,8 +386,8 @@
if (createVO.getTransferTime() != null) {
task.setPlannedStartTime(createVO.getTransferTime());
}
- if (createVO.getTransferDistance() != null) {
- task.setEstimatedDistance(createVO.getTransferDistance());
+ if (createVO.getDistance() != null) {
+ task.setEstimatedDistance(createVO.getDistance());
}
if (createVO.getPlannedStartTime() != null) {
task.setPlannedStartTime(createVO.getPlannedStartTime());
@@ -411,8 +446,9 @@
}
-
-
+ if(result>0) {
+ this.sendEmeryTaskProcess(task, dispatchOrderId);
+ }
return result;
}
@@ -445,14 +481,13 @@
@Override
@Transactional
public int updateSysTask(TaskUpdateVO updateVO, Boolean updateFromLegacy) {
- SysTask oldTask = sysTaskMapper.selectSysTaskByTaskId(updateVO.getTaskId());
- if (oldTask == null) {
+ SysTask task = sysTaskMapper.selectSysTaskByTaskId(updateVO.getTaskId());
+ if (task == null) {
throw new RuntimeException("浠诲姟涓嶅瓨鍦�");
}
Long userId = SecurityUtils.getUserId();
String userName = SecurityUtils.getUsername();
-
- SysTask task = new SysTask();
+
task.setTaskId(updateVO.getTaskId());
task.setTaskDescription(updateVO.getTaskDescription());
task.setPlannedStartTime(updateVO.getPlannedStartTime());
@@ -461,23 +496,16 @@
task.setUpdateBy(userName);
task.setUpdateTime(updateVO.getUpdateTime() != null ? updateVO.getUpdateTime() : DateUtils.getNowDate());
task.setRemark(updateVO.getRemark());
+
+
- // 璁剧疆閫氱敤鍦板潃鍜屽潗鏍囦俊鎭�
- task.setDepartureAddress(updateVO.getDepartureAddress());
- task.setDestinationAddress(updateVO.getDestinationAddress());
- task.setDepartureLongitude(updateVO.getDepartureLongitude());
- task.setDepartureLatitude(updateVO.getDepartureLatitude());
- task.setDestinationLongitude(updateVO.getDestinationLongitude());
- task.setDestinationLatitude(updateVO.getDestinationLatitude());
+
// 璁剧疆棰勮璺濈
if (updateVO.getEstimatedDistance() != null) {
task.setEstimatedDistance(updateVO.getEstimatedDistance());
- } else if (updateVO.getTransferDistance() != null) {
- // 鍏煎鎬ユ晳杞繍瀛楁
- task.setEstimatedDistance(updateVO.getTransferDistance());
} else if (updateVO.getDistance() != null) {
- // 鍏煎绂忕杞﹀瓧娈�
+ // 鍏煎鎬ユ晳杞繍瀛楁
task.setEstimatedDistance(updateVO.getDistance());
}
@@ -485,17 +513,18 @@
if (updateVO.getDeptId() != null) {
task.setDeptId(updateVO.getDeptId());
}
-
// 濡傛灉鏇存柊浜嗕换鍔$紪鍙�
if (updateVO.getTaskCode() != null) {
task.setTaskCode(updateVO.getTaskCode());
}
-
+ Boolean hasSetDepartureFlag=false;
+ //璁剧疆鎬婚儴鎺ㄩ��
+ task.setIsHeadPush(this.isTaskHeaderPush(task.getCreatorId(), task.getDeptId())?"1":"0");
// 鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣锛堝鏋滄洿鏂颁簡鍦板潃浣嗙己澶卞潗鏍囷級
if (updateVO.getDepartureAddress() != null &&
(updateVO.getDepartureLongitude() == null || updateVO.getDepartureLatitude() == null) &&
mapService != null) {
- if (!updateVO.getDepartureAddress().equals(oldTask.getDepartureAddress())) {
+ if (!updateVO.getDepartureAddress().equals(task.getDepartureAddress())) {
try {
Map<String, Double> coords = mapService.geocoding(
updateVO.getDepartureAddress(),
@@ -504,6 +533,7 @@
if (coords != null) {
task.setDepartureLongitude(BigDecimal.valueOf(coords.get("lng")));
task.setDepartureLatitude(BigDecimal.valueOf(coords.get("lat")));
+ hasSetDepartureFlag = true;
// log.info("鍑哄彂鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
}
} catch (Exception e) {
@@ -511,12 +541,20 @@
}
}
}
-
+ // 璁剧疆閫氱敤鍦板潃鍜屽潗鏍囦俊鎭�
+ task.setDepartureAddress(updateVO.getDepartureAddress());
+ if(!hasSetDepartureFlag) {
+
+ task.setDepartureLongitude(updateVO.getDepartureLongitude());
+ task.setDepartureLatitude(updateVO.getDepartureLatitude());
+ }
+
+ Boolean hasSetDestinationFlag=false;
// 鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣锛堝鏋滄洿鏂颁簡鍦板潃浣嗙己澶卞潗鏍囷級
if (updateVO.getDestinationAddress() != null &&
(updateVO.getDestinationLongitude() == null || updateVO.getDestinationLatitude() == null) &&
mapService != null) {
- if (!updateVO.getDestinationAddress().equals(oldTask.getDestinationAddress())) {
+ if (!updateVO.getDestinationAddress().equals(task.getDestinationAddress())) {
try {
Map<String, Double> coords = mapService.geocoding(
updateVO.getDestinationAddress(),
@@ -525,6 +563,7 @@
if (coords != null) {
task.setDestinationLongitude(BigDecimal.valueOf(coords.get("lng")));
task.setDestinationLatitude(BigDecimal.valueOf(coords.get("lat")));
+ hasSetDestinationFlag = true;
// log.info("鐩殑鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
}
} catch (Exception e) {
@@ -532,13 +571,19 @@
}
}
}
+ task.setDestinationAddress(updateVO.getDestinationAddress());
+ if(!hasSetDestinationFlag) {
+ task.setDestinationLongitude(updateVO.getDestinationLongitude());
+ task.setDestinationLatitude(updateVO.getDestinationLatitude());
+ }
+
if(updateVO.getAssignees()!=null && !updateVO.getAssignees().isEmpty()){
TaskCreateVO.AssigneeInfo assigneeInfo= updateVO.getAssignees().get(0);
task.setAssigneeId(assigneeInfo.getUserId());
task.setAssigneeName(assigneeInfo.getUserName());
}
// 鐢ㄤ簬璺熻釜鏄惁闇�瑕侀噸鏂板悓姝ワ紙杞﹁締銆佷汉鍛樸�佸湴鍧�銆佹垚浜や环鍙樻洿锛�
- boolean needResync = false;
+ boolean needResync = true;
int result = sysTaskMapper.updateSysTask(task);
@@ -552,7 +597,8 @@
needResync = true;
}
}
-
+
+
// 鏇存柊鎵ц浜哄憳锛堟娴嬩汉鍛樺彉鏇达級
if (result > 0 && updateVO.getAssignees() != null) {
boolean assigneesChanged = sysTaskAssigneeService.updateTaskAssignees(
@@ -564,40 +610,52 @@
}
Long dispatchOrderId=0L;
// 鏇存柊鎬ユ晳杞繍鎵╁睍淇℃伅锛堟娴嬪湴鍧�鍜屾垚浜や环鍙樻洿锛�
- if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType())) {
+ if (result > 0 && "EMERGENCY_TRANSFER".equals(task.getTaskType())) {
SysTaskEmergency oldEmergency = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(updateVO.getTaskId());
sysEmergencyTaskService.updateEmergencyInfoFromUpdateVO(oldEmergency, updateVO, userName);
dispatchOrderId= oldEmergency.getLegacyDispatchOrdId();
- sysEmergencyTaskService.markNeedResyncIfNecessary(updateVO.getTaskId(), oldTask, updateVO, updateFromLegacy);
+
+ markNeedSync(task,updateVO);
}
// 鏇存柊绂忕杞︽墿灞曚俊鎭�
- if (result > 0 && "WELFARE".equals(oldTask.getTaskType())) {
+ if (result > 0 && "WELFARE".equals(task.getTaskType())) {
if (updateVO.getPassenger() != null || updateVO.getStartAddress() != null || updateVO.getEndAddress() != null) {
sysWelfareTaskService.updateWelfareInfo(updateVO.getTaskId(), updateVO, userName);
}
}
- // 濡傛灉鏄�ユ晳杞繍浠诲姟涓旀湁鍙樻洿锛屾爣璁伴渶瑕侀噸鏂板悓姝�
- if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType()) && needResync && !updateFromLegacy) {
- sysEmergencyTaskService.markNeedResyncIfNecessary(updateVO.getTaskId(), oldTask, updateVO, updateFromLegacy);
- }
+
// 璁板綍鎿嶄綔鏃ュ織
if (result > 0) {
recordTaskLog(updateVO.getTaskId(), "UPDATE", "鏇存柊浠诲姟",
- buildTaskDescription(oldTask), buildTaskDescription(task),
+ buildTaskDescription(task), buildTaskDescription(task),
userId, userName);
}
- if(result > 0 && oldTask.getTaskStatus().equals(TaskStatus.PENDING.getCode()) && updateVO.getAssignees() != null && !updateVO.getAssignees().isEmpty() && dispatchOrderId>0L){
+ if(result > 0 && task.getTaskStatus().equals(TaskStatus.PENDING.getCode())
+ && updateVO.getAssignees() != null
+ && !updateVO.getAssignees().isEmpty()
+ && LongUtil.isNotEmpty(dispatchOrderId)){
- this.sendTaskAssigneeEvent(updateVO,oldTask,userId,userName);
+ this.sendTaskAssigneeEvent(updateVO,task,userId,userName);
}
return result;
}
+
+ private void markNeedSync(SysTask sysTask,TaskUpdateVO updateVO){
+ // 濡傛灉鏄�ユ晳杞繍浠诲姟涓旀湁鍙樻洿锛屾爣璁伴渶瑕侀噸鏂板悓姝�
+ if ( "EMERGENCY_TRANSFER".equals(sysTask.getTaskType()) ) {
+
+ sysEmergencyTaskService.markNeedResyncIfNecessary(updateVO.getTaskId(), sysTask, updateVO, true);
+
+ eventPublisher.publishEvent(new TaskUpdateEvent(this,sysTask.getTaskId(),
+ sysTask.getTaskCode(),sysTask.getTaskType()));
+ }
+ }
/**
* 鏇存柊浠诲姟锛堢敤浜庢棫绯荤粺鍚屾锛�
*
@@ -613,15 +671,17 @@
* @return 缁撴灉
*/
@Override
- public int updateTask(TaskUpdateVO updateVO, String serviceOrderId, String dispatchOrderId, String serviceOrdNo,
+ public int updateTask(TaskUpdateVO updateVO, Long serviceOrderId, Long dispatchOrderId, String serviceOrdNo,
Long userId, String userName, Long deptId, Date createTime, Date updateTime) {
// log.info("寮�濮嬫洿鏂颁换鍔� ServiceOrdID: {} , dispatchOrdId:{}", serviceOrderId,dispatchOrderId);
// 閫氳繃鏃х郴缁熸湇鍔″崟ID鏌ユ壘浠诲姟
- SysTaskEmergency taskEmergency = sysTaskEmergencyMapper.selectByLegacyServiceOrdId(Long.parseLong(serviceOrderId));
+ // 鑾峰彇鏃т换鍔′俊鎭紝鐢ㄤ簬鍒ゆ柇鍦板潃鏄惁鍙樻洿
+
+
+ SysTaskEmergency taskEmergency = sysTaskEmergencyMapper.selectByLegacyServiceOrdId(serviceOrderId);
Long taskId = taskEmergency.getTaskId();
+ SysTask task = sysTaskMapper.selectSysTaskByTaskId(taskId);
updateVO.setTaskId(taskId);
- SysTask task = new SysTask();
- task.setTaskId(taskId);
if(updateVO.getTaskStatus()!=null){
task.setTaskStatus(updateVO.getTaskStatus());
}
@@ -634,6 +694,11 @@
if(updateVO.getActualEndTime() != null) {
task.setActualEndTime(updateVO.getActualEndTime());
}
+ if(deptId!=null){
+ task.setDeptId(deptId);
+ }
+
+
// task.setAssigneeId(updateVO.getAssigneeId());
task.setUpdateBy(userName);
task.setUpdateTime(DateUtils.getNowDate());
@@ -641,12 +706,7 @@
// 璁剧疆鍦板潃鍜屽潗鏍囦俊鎭�
- task.setDepartureAddress(updateVO.getDepartureAddress());
- task.setDestinationAddress(updateVO.getDestinationAddress());
- task.setDepartureLongitude(updateVO.getDepartureLongitude());
- task.setDepartureLatitude(updateVO.getDepartureLatitude());
- task.setDestinationLongitude(updateVO.getDestinationLongitude());
- task.setDestinationLatitude(updateVO.getDestinationLatitude());
+
if(updateVO.getAssignees()!=null && !updateVO.getAssignees().isEmpty()){
TaskCreateVO.AssigneeInfo assigneeInfo= updateVO.getAssignees().get(0);
task.setAssigneeId(assigneeInfo.getUserId());
@@ -661,13 +721,18 @@
if (updateVO.getTaskCode() != null) {
task.setTaskCode(updateVO.getTaskCode());
}
-
- // 鑾峰彇鏃т换鍔′俊鎭紝鐢ㄤ簬鍒ゆ柇鍦板潃鏄惁鍙樻洿
- SysTask oldTask = sysTaskMapper.selectSysTaskByTaskId(taskId);
-
+
+
+
+
+// task.setDepartureLongitude(updateVO.getDepartureLongitude());
+// task.setDepartureLatitude(updateVO.getDepartureLatitude());
+// task.setDestinationLongitude(updateVO.getDestinationLongitude());
+// task.setDestinationLatitude(updateVO.getDestinationLatitude());
+ Boolean modifyOutLongLat = false;
// 鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣锛堝鏋滃湴鍧�鍙樻洿涓旂己澶卞潗鏍囷級
- if (oldTask != null && updateVO.getDepartureAddress() != null
- && !updateVO.getDepartureAddress().equals(oldTask.getDepartureAddress())
+ if (task != null && updateVO.getDepartureAddress() != null
+ && !updateVO.getDepartureAddress().equals(task.getDepartureAddress())
&& (updateVO.getDepartureLongitude() == null || updateVO.getDepartureLatitude() == null)
&& mapService != null) {
try {
@@ -678,16 +743,23 @@
if (coords != null) {
task.setDepartureLongitude(BigDecimal.valueOf(coords.get("lng")));
task.setDepartureLatitude(BigDecimal.valueOf(coords.get("lat")));
+ modifyOutLongLat = true;
// log.info("鍑哄彂鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
}
} catch (Exception e) {
log.error("鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣澶辫触", e);
}
}
-
+ task.setDepartureAddress(updateVO.getDepartureAddress());
+ if(!modifyOutLongLat){
+ task.setDepartureLongitude(updateVO.getDepartureLongitude());
+ task.setDepartureLatitude(updateVO.getDepartureLatitude());
+ }
+
+ Boolean modifyInLongLat = false;
// 鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣锛堝鏋滃湴鍧�鍙樻洿涓旂己澶卞潗鏍囷級
- if (oldTask != null && updateVO.getDestinationAddress() != null
- && !updateVO.getDestinationAddress().equals(oldTask.getDestinationAddress())
+ if (task != null && updateVO.getDestinationAddress() != null
+ && !updateVO.getDestinationAddress().equals(task.getDestinationAddress())
&& (updateVO.getDestinationLongitude() == null || updateVO.getDestinationLatitude() == null)
&& mapService != null) {
try {
@@ -698,11 +770,17 @@
if (coords != null) {
task.setDestinationLongitude(BigDecimal.valueOf(coords.get("lng")));
task.setDestinationLatitude(BigDecimal.valueOf(coords.get("lat")));
+ modifyInLongLat = true;
// log.info("鐩殑鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
}
} catch (Exception e) {
log.error("鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣澶辫触", e);
}
+ }
+ task.setDestinationAddress(updateVO.getDestinationAddress());
+ if(!modifyInLongLat){
+ task.setDestinationLongitude(updateVO.getDestinationLongitude());
+ task.setDestinationLatitude(updateVO.getDestinationLatitude());
}
int result = sysTaskMapper.updateSysTask(task);
@@ -722,14 +800,14 @@
// log.info("鏇存柊鎵ц浜哄憳 ServiceOrdID:{},dispatchOrderId:{}",serviceOrderId,dispatchOrderId);
sysTaskAssigneeService.updateTaskAssignees(taskId, updateVO.getAssignees(), userName);
}
- Long dispatchOrderIdLong = 0L;
+
// 鏇存柊鎬ユ晳杞繍鎵╁睍淇℃伅
if (result > 0) {
// 鏇存柊鏃х郴缁烮D
- taskEmergency.setLegacyServiceOrdId(Long.parseLong(serviceOrderId));
- if (dispatchOrderId != null) {
- dispatchOrderIdLong = Long.parseLong(dispatchOrderId);
- taskEmergency.setLegacyDispatchOrdId(dispatchOrderIdLong);
+ taskEmergency.setLegacyServiceOrdId(serviceOrderId);
+ if (LongUtil.isNotEmpty(dispatchOrderId)) {
+
+ taskEmergency.setLegacyDispatchOrdId(dispatchOrderId);
taskEmergency.setDispatchSyncStatus(2);
taskEmergency.setDispatchSyncTime(new Date());
taskEmergency.setDispatchSyncErrorMsg("鏃х郴缁熷悓姝ヨ繃鏉�");
@@ -739,7 +817,8 @@
}
taskEmergency.setUpdateTime(DateUtils.getNowDate());
- Boolean hasEmergencyInfo = updateVO.getHospitalOut() != null || updateVO.getHospitalIn() != null || updateVO.getPatient() != null;
+ Boolean hasEmergencyInfo = updateVO.getHospitalOut() != null || updateVO.getHospitalIn() != null || updateVO.getPatient() != null
+ || updateVO.getPrice() != null || updateVO.getDistance() != null;
// 浣跨敤TaskCreateVO鐨勫瓧娈垫潵鏇存柊鎬ユ晳杞繍淇℃伅
@@ -747,16 +826,33 @@
sysEmergencyTaskService.updateEmergencyInfoFromCreateVO(taskEmergency, updateVO, userName);
}
SysTaskEmergency emergency= sysEmergencyTaskService.selectSysTaskEmergencyByTaskId(taskId);
- dispatchOrderIdLong = emergency.getLegacyDispatchOrdId();
+ dispatchOrderId = emergency.getLegacyDispatchOrdId();
}
- if(updateVO.getTaskStatus()!=null && updateVO.getTaskStatus().equals(TaskStatus.PENDING.getCode()) && updateVO.getAssignees()!=null && !updateVO.getAssignees().isEmpty() && dispatchOrderIdLong>0L){
+ if(updateVO.getTaskStatus()!=null
+ && updateVO.getTaskStatus().equals(TaskStatus.PENDING.getCode())
+ && updateVO.getAssignees()!=null && !updateVO.getAssignees().isEmpty()
+ && LongUtil.isNotEmpty(dispatchOrderId)){
this.sendTaskAssigneeEvent(updateVO,task,userId,userName);
}
-
+
return result;
}
+ private void sendEmeryTaskProcess(SysTask task,Long dispatchOrderId){
+ Long taskId = task.getTaskId();
+ String taskCode = task.getShowTaskCode();
+ if(task.getTaskStatus()!=null && task.getTaskStatus().equals(TaskStatus.PENDING.getCode())){
+ //濡傛灉娌℃湁鍒嗛厤浜哄憳锛屼笖娌℃湁璋冨害鍗曪紝涓嶆槸骞垮窞鎬诲叕鍙哥殑灏遍渶瑕佸彂閫侀�氱煡璺熻繘
+ if(LongUtil.isEmpty(dispatchOrderId)){
+ if(!task.getDeptId().equals(DeptUtil.GUANGZHOU_DEPT_ID) && (task.getAssignees()==null || task.getAssignees().isEmpty())){
+ //鍙戦�侀�氱煡
+ eventPublisher.publishEvent(new TaskOnlyServerOrderSyncEvent(this, taskId, taskCode));
+
+ }
+ }
+ }
+ }
/**
* 鎵归噺鍒犻櫎浠诲姟绠$悊
*
@@ -1103,6 +1199,7 @@
public List<SysTask> selectMyTasks(Long userId) {
List<SysTask> list = sysTaskMapper.selectMyTasks(userId);
list.stream().forEach(task -> {
+
if(task.getTaskType().equals("EMERGENCY_TRANSFER")){
task.setEmergencyInfo(sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(task.getTaskId()));
}
@@ -1344,8 +1441,8 @@
if (createVO.getTransferTime() != null) {
task.setPlannedStartTime(createVO.getTransferTime());
}
- if (createVO.getTransferDistance() != null) {
- task.setEstimatedDistance(createVO.getTransferDistance());
+ if (createVO.getDistance() != null) {
+ task.setEstimatedDistance(createVO.getDistance());
}
// 璁剧疆绂忕杞︾壒瀹氫俊鎭�
--
Gitblit v1.9.1