From 2b306afe79cd8096dd9394b0d8d04ff467b7e09c Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期五, 10 四月 2026 22:38:18 +0800
Subject: [PATCH] fix:车辆无XPUID返回内容修改、围栏自动停用补偿定时任务

---
 xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
index d2d3593..42a31b6 100644
--- a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
+++ b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -137,6 +137,9 @@
 @RequiredArgsConstructor(onConstructor_ = @Lazy)
 public class XpOrderServiceImpl extends ServiceImpl<XpOrderMapper, XpOrder> implements IXpOrderService {
 
+    private static final String REASSIGN_CANCEL_CONTEXT_PREFIX = "REASSIGN_CANCEL_CONTEXT:";
+    private static final long REASSIGN_CANCEL_CONTEXT_TTL_MINUTES = 5L;
+
     private final UserResourcesClient userResourcesClient;
     private final XpPointClient xpPointClient;
     private final XpVehicleClient xpVehicleClient;
@@ -969,6 +972,8 @@
                     cancelDto.setOperation_type(OrderOperationType.CLOUD_CANCEL_ORDER);
                     cancelDto.setCancelScene(CancelOrderSceneEnum.REASSIGN_OLD_VEHICLE.getCode());
                     orderMissionClient.cancelOrder(cancelDto);
+                    cacheReassignCancelContext(orderId, oldVehicleId, newVehicleId,
+                            oldVehicle.getVehicleVin(), currentStatus);
                     log.info("已取消原车辆订单指令,订单ID: {}, VIN: {}, taskId: {}, cancelScene: {}",
                             orderId, oldVehicle.getVehicleVin(), cancelDto.getTaskId(), cancelDto.getCancelScene());
 
@@ -1113,6 +1118,22 @@
 
     }
 
+    private void cacheReassignCancelContext(Long orderId, Long oldVehicleId, Long newVehicleId,
+                                            String oldVehicleVin, Integer preReassignStatus) {
+        JSONObject context = new JSONObject();
+        context.put("orderId", orderId);
+        context.put("oldVehicleId", oldVehicleId);
+        context.put("newVehicleId", newVehicleId);
+        context.put("oldVehicleVin", oldVehicleVin);
+        context.put("cancelScene", CancelOrderSceneEnum.REASSIGN_OLD_VEHICLE.getCode());
+        context.put("operationTime", System.currentTimeMillis());
+        context.put("preReassignStatus", preReassignStatus);
+        redisService.setCacheObject(REASSIGN_CANCEL_CONTEXT_PREFIX + orderId, context.toJSONString(),
+                REASSIGN_CANCEL_CONTEXT_TTL_MINUTES, TimeUnit.MINUTES);
+        log.info("记录改派取消上下文成功,orderId: {}, oldVehicleId: {}, newVehicleId: {}, preReassignStatus: {}",
+                orderId, oldVehicleId, newVehicleId, preReassignStatus);
+    }
+
     /**
      * 为原车辆创建返程巡游订单
      * <p>

--
Gitblit v1.7.1