From fb836c56d462e676b20328a9d6369f05c49c36c5 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期日, 15 三月 2026 17:56:05 +0800
Subject: [PATCH] bugfix
---
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java | 66 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
index 14d7ccb..6017864 100644
--- a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
+++ b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -778,7 +778,10 @@
xpTaskHandleDetailRoutine.setOperationsUserId(id);
xpTaskHandleDetailRoutineMapper.insert(xpTaskHandleDetailRoutine);
//更新任务状态为已完成
- lambdaUpdate().set(XpTask::getStatus, 2).eq(XpTask::getId, dto.getId()).update();
+ lambdaUpdate().set(XpTask::getStatus, 2).set(XpTask::getHandleUserId, id)
+ .set(XpTask::getHandleTime, LocalDateTime.now())
+ .eq(XpTask::getId, dto.getId())
+ .update();
return R.ok();
}
@@ -812,6 +815,7 @@
res.setTaskCategory(task.getTaskCategory());
res.setTaskTypeId(task.getTaskTypeId());
res.setStatus(task.getStatus());
+ res.setHandleTime(task.getHandleTime());
XpVehicleClean vehicleDetection = vehicleCleanMapper.selectOne(new LambdaQueryWrapper<XpVehicleClean>()
.eq(XpVehicleClean::getTaskId, id).last("limit 1"));
if (vehicleDetection != null) {
@@ -821,6 +825,7 @@
XpOperationsUser operationsUser = xpOperationUserClient.queryById(vehicleDetection.getOperationsUserId()).getData();
if (operationsUser != null) {
res.setOperationsUserName(operationsUser.getNickName());
+ res.setHandleUserName(operationsUser.getNickName());
}
}
}
@@ -851,12 +856,59 @@
return R.fail("任务已被处理");
}
+ Long vehicleId = task.getVehicleId();
+ String plateNumber = "";
+ try {
+ if (vehicleId != null) {
+ R<XpVehicle> vehicleResult = xpVehicleClient.queryById(vehicleId);
+ XpVehicle vehicle = vehicleResult == null ? null : vehicleResult.getData();
+ if (vehicle != null && org.apache.commons.lang3.StringUtils.isNotBlank(vehicle.getPlateNumber())) {
+ plateNumber = vehicle.getPlateNumber();
+ }
+ }
+ } catch (Exception e) {
+ log.error("confirmArrive查询车辆信息失败,taskId={}, vehicleId={}", id, vehicleId, e);
+ }
+ String taskCode = org.apache.commons.lang3.StringUtils.isNotBlank(task.getTaskCode())
+ ? task.getTaskCode()
+ : String.valueOf(task.getId());
+
// 更新任务
task.setStatus(1);
task.setVehicleId(null);
task.setHandleUserId(userId.toString());
this.updateById(task);
+
+ // 保存通知记录 + 推送阿里云 NOTICE 消息(不影响主流程)
+ try {
+ String content = String.format("你处理的%s关联车辆:%s状态由待到达变更为待处理", taskCode, plateNumber);
+ String bodyJson = buildTaskStatusChangedPushBodyJson(content, id);
+
+ XpOperationsUserNotification notification = new XpOperationsUserNotification();
+ notification.setNotificationType(NotificationTypeEnum.ACCIDENT_STATUS_CHANGED.getCode());
+ notification.setNotificationContent(content);
+ notification.setOperationsUserId(userId);
+ notification.setDataId(id);
+ notification.setReadStatus(0);
+ notification.setNotificationExt(bodyJson);
+ xpOperationUserNotificationClient.addNotificationBatch(Collections.singletonList(notification));
+
+ XpOperationsUser operationsUser = xpOperationUserClient.queryById(userId).getData();
+ if (operationsUser != null
+ && operationsUser.getDeviceType() != null
+ && StringUtils.isNotBlank(operationsUser.getPhoneNumber())) {
+ xpAliPushMessageClient.pushMessage(AliPushMessageDTO.builder()
+ .deviceType(operationsUser.getDeviceType())
+ .account(operationsUser.getPhoneNumber())
+ .title("任务状态变更")
+ .body(bodyJson)
+ .pushType(AliPushTypeConstant.NOTICE)
+ .build());
+ }
+ } catch (Exception e) {
+ log.error("confirmArrive消息通知失败,taskId={}, userId={}", id, userId, e);
+ }
return R.ok();
} catch (InterruptedException e) {
@@ -870,6 +922,18 @@
}
}
+ /**
+ * 构建任务状态变更推送 body JSON
+ */
+ private String buildTaskStatusChangedPushBodyJson(String content, Long taskId) {
+ Map<String, Object> param = new HashMap<>();
+ param.put("content", content);
+ param.put("strategy", NotificationTypeEnum.ACCIDENT_STATUS_CHANGED.getCode());
+ param.put("type", TaskTypeNotificationEnum.ACCIDENT_TASK.getCode());
+ param.put("id", taskId == null ? "0" : taskId.toString());
+ return JSONObject.toJSONString(param);
+ }
+
@Override
public PageInfo<XpTaskRecordVO> queryTaskByVehicleId(XpTaskRecordPageQuery query) {
// 1. 构建查询条件
--
Gitblit v1.7.1