From 320e7cd68a368a666986019e29c4af0fc9ddaa48 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期日, 12 四月 2026 20:13:21 +0800
Subject: [PATCH] 处理冲突

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 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 1755dc7..bfb5b6f 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
@@ -92,14 +92,12 @@
 
             List<HistoryPointDto> history = new ArrayList<>();
             if(null != dto.getVehicleId()){
-                List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId());
-                if(cacheList!=null && !cacheList.isEmpty()){
-                    for (Object cache : cacheList) {
-                        HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class);
-                        history.add(historyPointDto);
-                    }
-                }
+                history = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId());
             }
+            if(history.size() > 10){
+                history = history.subList(history.size() - 10, history.size());
+            }
+            redisService.setCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId(), history);
             RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), pointStrParam, fenceId,dto.getRoutePlanRule(), history);
             if(routeVo==null){
                 return R.fail("没有找到路线");
@@ -141,14 +139,12 @@
         }
         List<HistoryPointDto> history = new ArrayList<>();
         if(null != dto.getVehicleId()){
-            List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId());
-            if(cacheList!=null && !cacheList.isEmpty()){
-                for (Object cache : cacheList) {
-                    HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class);
-                    history.add(historyPointDto);
-                }
-            }
+            history = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId());
         }
+        if(history.size() > 10){
+            history = history.subList(history.size() - 10, history.size());
+        }
+        redisService.setCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVehicleId(), history);
         RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), pointStrParam, fenceId,dto.getRoutePlanRule(), history);
         if(routeVo==null){
             return R.fail("没有找到路线");

--
Gitblit v1.7.1