puzhibing
2026-03-04 a6f0b69caf5c1913b6fec8b94d2454b33d15d649
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);
                // 一个区域的点位