From 7ecf266e247ed25d7e7a1db183da6f879b6c7a8d Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 07 三月 2026 21:00:54 +0800
Subject: [PATCH] 修改小程序首页围栏查询

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java
index 8cbd7ef..2a5c40b 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java
@@ -29,7 +29,11 @@
 import com.xiaopeng.map.utils.holiday.HolidayUtil;
 import com.xiaopeng.map.vo.IsInOperationAreaVo;
 import com.xiaopeng.map.vo.WalkTimeVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.geo.Point;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -66,16 +70,17 @@
 
     @Resource
     private HolidayUtil holidayUtil;
+    @Autowired
+    private MongoTemplate mongoTemplate;
 
 
 
     @Override
     public List<XpElectronicFenceVo> citiesList(String cityCode) {
-        List<XpGeoFencingPolygon> xpGeoFencingPolygons = xpGeoFencingPolygonService.findAll();
+        List<XpGeoFencingPolygon> xpGeoFencingPolygons = mongoTemplate.find(new Query(Criteria.where("cityCode").is(cityCode)), XpGeoFencingPolygon.class);
         if(xpGeoFencingPolygons.isEmpty()){
             return new ArrayList<>();
         }
-        xpGeoFencingPolygons = xpGeoFencingPolygons.stream().filter(e->e.getCityCode().equals(cityCode)).collect(Collectors.toList());
         List<XpElectronicFenceVo> result = new ArrayList<>();
         List<String> fenceIds = xpGeoFencingPolygons.stream().map(XpGeoFencingPolygon::getFenceId).collect(Collectors.toList());
         if(fenceIds.isEmpty()){

--
Gitblit v1.7.1