From 67ba7d7ed35008438ca0d97fbc9794169265c91a Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 27 二月 2026 17:34:51 +0800
Subject: [PATCH] 订单轨迹实时查询

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
index 93bc0e9..6bedaac 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
@@ -4,6 +4,8 @@
 import com.xiaopeng.api.dto.map.OrderRouteAndFareDto;
 import com.xiaopeng.api.dto.map.RouteAndFareDto;
 import com.xiaopeng.api.dto.operation.LonLatDto;
+import com.xiaopeng.api.feignClient.order.XpOrderClient;
+import com.xiaopeng.api.model.order.XpOrder;
 import com.xiaopeng.api.vo.map.PointByIpVo;
 import com.xiaopeng.api.vo.map.XpDistanceAndDurationVo;
 import com.xiaopeng.api.vo.operation.RouteVo;
@@ -38,11 +40,13 @@
     private final GDMapGeocodingUtil gdMapGeocodingUtil;
     private final XpGeoFencingPolygonService xpGeoFencingPolygonService;
     private final RedisService redisService;
+    private final XpOrderClient xpOrderClient;
 
-    public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService) {
+    public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService, XpOrderClient xpOrderClient) {
         this.gdMapGeocodingUtil = gdMapGeocodingUtil;
         this.xpGeoFencingPolygonService = xpGeoFencingPolygonService;
         this.redisService = redisService;
+        this.xpOrderClient = xpOrderClient;
     }
 
 
@@ -112,9 +116,17 @@
 
         // 存储redis
         redisService.setCacheObject(CacheConstants.ORDER_ROUTE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo);
-
+        // 查询订单信息
+        XpOrder xpOrder = xpOrderClient.queryOrderById(dto.getOrderId()).getData();
+        // 封装消息内容
+        Integer routeType = dto.getRouteType();
+        if(routeType == 2){
+            routeType = 3;
+        }else {
+            routeType = xpOrder.getStatus() == 4 ? 1 : 2;
+        }
         // 存储路线偏离缓存,后续进行轨迹截取
-        redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo);
+        redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType, routeVo);
 
         return R.ok(routeVo);
     }

--
Gitblit v1.7.1