吉安感知网项目-后端
linwei
2026-04-07 9ef34071be717671266098812fdfc08fa2cfb2a2
opt: 设备入库初始化面数据
2 files modified
8 ■■■■■ changed files
drone-service/drone-gd/src/main/java/org/sxkj/gd/utils/GeomUtils.java 7 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java 1 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/utils/GeomUtils.java
@@ -59,19 +59,20 @@
        return (Polygon) area;
    }
    /**
        /**
     * 获取某点周围指定距离(米)的缓冲区,返回WKT字符串格式
     *
     * @param lon      中心点经度
     * @param lat      中心点纬度
     * @param distance 距离(米)
     * @return WKT格式的多边形字符串,格式:POLYGON((lon1 lat1, lon2 lat2, ...))
     * @return EWKT格式的多边形字符串,格式:SRID=4326;POLYGON((lon1 lat1, lon2 lat2, ...))
     */
    public static String getBufferAroundPointAsString(double lon, double lat, double distance) throws Exception {
        Polygon polygon = getBufferAroundPoint(lon, lat, distance);
        return polygon.toText();
        return "SRID=4326;" + polygon.toText();
    }
    /**
     * 将Polygon对象转换为WKT字符串格式
     *
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdManageDeviceServiceImpl.java
@@ -93,6 +93,7 @@
        // 获取设备位置 生成缓冲区
        if (gdManageDeviceEntity.getLongitude() != null && gdManageDeviceEntity.getLatitude() != null) {
            String bufferAroundPointAsString = GeomUtils.getBufferAroundPointAsString(gdManageDeviceEntity.getLongitude(), gdManageDeviceEntity.getLatitude(), 5 * 1000);
            log.info("saveOrUpdateDevice {}", bufferAroundPointAsString);
            gdManageDeviceEntity.setGeom(bufferAroundPointAsString);
            String location = GdGeoAddressUtil.getFormattedAddress(gdManageDeviceEntity.getLongitude(), gdManageDeviceEntity.getLatitude());
            gdManageDeviceEntity.setLocation(location);