puzhibing
2026-03-03 97950ee9f9c7b1bce76fff0a9faa8743ada2b533
修改小程序首页围栏查询
4个文件已修改
24 ■■■■■ 已修改文件
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/map/XpGeoFencingPolygon.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/map/XpGeoFencingProhibitedPolygon.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/vo/XpGeoPointPolygon.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/map/XpGeoFencingPolygon.java
@@ -1,7 +1,10 @@
package com.xiaopeng.api.model.map;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.geo.GeoJsonPolygon;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
@@ -15,9 +18,15 @@
 */
@Data
@Document(collection = "operating_area")
@CompoundIndexes({
        @CompoundIndex(name = "fenceId_id_areaId_id", def = "{'fenceId': 1, 'areaId': 1}"),
        @CompoundIndex(name = "location_index", def = "{'points': '2dsphere'}")
}
)
public class XpGeoFencingPolygon implements Serializable {
    private static final long serialVersionUID = 4508868382007529971L;
    @Id
    private String id;
    /**
@@ -51,7 +60,6 @@
    /**
     * 多边形经纬度
     */
    @GeoSpatialIndexed(type = GeoSpatialIndexType.GEO_2DSPHERE)
    private GeoJsonPolygon points;
}
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/map/XpGeoFencingProhibitedPolygon.java
@@ -1,6 +1,7 @@
package com.xiaopeng.api.model.map;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.geo.GeoJsonPolygon;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexed;
@@ -18,6 +19,7 @@
public class XpGeoFencingProhibitedPolygon implements Serializable {
    private static final long serialVersionUID = 4508868382007529971L;
    @Id
    private String id;
    /**
     * 围栏id
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceServiceImpl.java
@@ -254,7 +254,7 @@
            }
        }
        if (xpElectronicFence.getStatus() == 2) {
        if (xpElectronicFence.getStatus() == 1 || xpElectronicFence.getStatus() == 2) {
            for (XpElectronicFenceArea newElectronicFenceArea : newElectronicFenceAreas) {
                if (newElectronicFenceArea.getAreaType() == 1
                        && newElectronicFenceArea.getAreaStatus() == 1) {
@@ -391,6 +391,8 @@
            // 删除旧的区域数据,然后保存新的区域数据
            xpElectronicFenceAreaMapper.delete(new LambdaQueryWrapper<XpElectronicFenceArea>()
                    .eq(XpElectronicFenceArea::getElectronicId, dto.getId()));
            mongoTemplate.remove(new Query(Criteria.where("fenceId").is(String.valueOf(dto.getId()))), XpGeoFencingPolygon.class);
            if (xpElectronicFence.getStatus() == 2) {
                // 设置电子围栏ID并保存区域数据
                for (XpElectronicFenceArea area : updatedElectronicFenceAreas) {
@@ -410,7 +412,7 @@
                    xpElectronicFenceAreaMapper.insert(area);
                }
            }
            if (dto.getStatus() == 2) {
            if (dto.getStatus() == 1 || dto.getStatus() == 2) {
                for (XpElectronicFenceArea newElectronicFenceArea : updatedElectronicFenceAreas) {
                    if (newElectronicFenceArea.getAreaType() == 1
                            && newElectronicFenceArea.getAreaStatus() == 1) {
@@ -423,16 +425,18 @@
                            XpGeoFencingPolygon xpGeoFencingPolygon = new XpGeoFencingPolygon();
                            xpGeoFencingPolygon.setFenceId(String.valueOf(xpElectronicFence.getId()));
                            xpGeoFencingPolygon.setName(xpElectronicFence.getElectronicName());
                            xpGeoFencingPolygon.setCityCode(cityCode);
                            xpGeoFencingPolygon.setAreaId(String.valueOf(newElectronicFenceArea.getId()));
                            xpGeoFencingPolygon.setOperationStrategy(xpElectronicFence.getOperationStrategy());
                            // 将围栏点转换为GeoJSON多边形
                            GeoJsonPolygon geoJsonPolygon = convertToGeoJsonPolygon(newElectronicFenceArea.getFencePoints());
                            xpGeoFencingPolygon.setPoints(geoJsonPolygon);
                            mongoTemplate.insert(xpGeoFencingPolygon);
                            mongoTemplate.save(xpGeoFencingPolygon);
                        } else {
                            // 如果存在,则更新已有文档
                            old.setFenceId(String.valueOf(xpElectronicFence.getId()));
                            old.setName(xpElectronicFence.getElectronicName());
                            old.setCityCode(cityCode);
                            old.setAreaId(String.valueOf(newElectronicFenceArea.getId()));
                            old.setOperationStrategy(xpElectronicFence.getOperationStrategy());
                            // 将围栏点转换为GeoJSON多边形
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/vo/XpGeoPointPolygon.java
@@ -1,6 +1,7 @@
package com.xiaopeng.map.vo;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable;
@@ -15,6 +16,7 @@
public class XpGeoPointPolygon implements Serializable {
    private static final long serialVersionUID = 4508868382007529971L;
    @Id
    private String id;
    /**
     * 围栏id