From a6f0b69caf5c1913b6fec8b94d2454b33d15d649 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 07 三月 2026 21:00:56 +0800
Subject: [PATCH] 修改mongodb查询

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 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 07485dd..1365c3b 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
@@ -21,6 +21,7 @@
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.bson.Document;
+import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -41,12 +42,14 @@
     private final XpGeoFencingPolygonService xpGeoFencingPolygonService;
     private final RedisService redisService;
     private final XpOrderClient xpOrderClient;
+    private final MongoTemplate mongoTemplate;
 
-    public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService, XpOrderClient xpOrderClient) {
+    public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService, XpOrderClient xpOrderClient, MongoTemplate mongoTemplate) {
         this.gdMapGeocodingUtil = gdMapGeocodingUtil;
         this.xpGeoFencingPolygonService = xpGeoFencingPolygonService;
         this.redisService = redisService;
         this.xpOrderClient = xpOrderClient;
+        this.mongoTemplate = mongoTemplate;
     }
 
 
@@ -100,14 +103,11 @@
         GeoPoint startPoint = new GeoPoint(dto.getOrigin().getLongitude(),dto.getOrigin().getLatitude());
         List<String> operatingArea = xpGeoFencingPolygonService.findFencesContainingPoint(startPoint, "operating_area", "points");
         // 避让区域
-        ArrayList<String> pointStrParam = null;
+        ArrayList<String> pointStrParam = new ArrayList<>();
         String fenceId = null;
         if(!operatingArea.isEmpty()){
             fenceId = operatingArea.get(0);
             List<Document> pointsInFence = xpGeoFencingPolygonService.findPointsByParentId(fenceId, "parentId", "prohibited_area");
-            if(!pointsInFence.isEmpty()){
-                pointStrParam = new ArrayList<>();
-            }
             for (Document document : pointsInFence) {
                 List<GeoPoint> points = document.getList("points", GeoPoint.class);
                 // 一个区域的点位

--
Gitblit v1.7.1