gushoubang 4 сар өмнө
parent
commit
69ffbe5213

+ 2 - 2
onemap-auth/src/main/resources/bootstrap.yml

@@ -15,11 +15,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 4 - 4
onemap-gateway/src/main/resources/bootstrap.yml

@@ -19,11 +19,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置
@@ -34,13 +34,13 @@ spring:
       eager: true
       transport:
         # 控制台地址
-        dashboard: 192.168.60.4:8718
+        dashboard: 127.0.0.1:8718
 
       # nacos配置持久化
       datasource:
         ds1:
           nacos:
-            server-addr: 192.168.60.4:8848
+            server-addr: 127.0.0.1:8848
             dataId: sentinel-onemap-gateway
             groupId: DEFAULT_GROUP
             data-type: json

+ 17 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/mapper/vector/CreateUtilsDBMapper.java

@@ -95,4 +95,21 @@ public interface CreateUtilsDBMapper {
                         @Param("tableNameB") String tableNameB,
                         @Param("newTableName") String newTableName,
                         @Param("value") Double value);
+
+    @Slave
+    void addDemValue(@Param("tableNameA") String tableNameA,
+                     @Param("tableIdsA") List<String> tableIdsA,
+                     @Param("tableNameB") String tableNameB,
+                     @Param("newTableName") String newTableName);
+
+    @Slave
+    void addColumnValue(@Param("tableNameA") String tableNameA,
+                        @Param("tableNameB") String tableNameB,
+                        @Param("column") String column,
+                        @Param("newTableName") String newTableName);
+
+    @Slave
+    void getHeightLimit(@Param("tableNameA") String tableNameA,
+                        @Param("tableNameB") String tableNameB,
+                        @Param("newTableName") String newTableName);
 }

+ 30 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/CreateUtilsDBService.java

@@ -85,10 +85,40 @@ public interface CreateUtilsDBService {
 
     /**
      * 生成新表,获取表tableNameA空间数据波段值大于value的数据
+     *
      * @param tableNameA
      * @param tableNameB
      * @param value
      * @return
      */
     String getGtBandValue(String tableNameA, String tableNameB, Double value);
+
+    /**
+     * 生成新表,添加表tableNameA中对应空间数据的高程值
+     *
+     * @param tableNameA
+     * @param tableIdsA
+     * @param tableNameB
+     * @return
+     */
+    String addDemValue(String tableNameA, List<String> tableIdsA, String tableNameB);
+
+    /**
+     * 生成新表,添加表tableNameA中对应tableNameB中的列值
+     *
+     * @param tableNameA
+     * @param tableNameB
+     * @param column
+     * @return
+     */
+    String addColumnValue(String tableNameA, String tableNameB, String column);
+
+    /**
+     * 获取符合限高要求的数据
+     *
+     * @param tableNameA
+     * @param tableNameB
+     * @return
+     */
+    String getHeightLimit(String tableNameA, String tableNameB);
 }

+ 21 - 0
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/CreateUtilsDBServiceImpl.java

@@ -91,4 +91,25 @@ public class CreateUtilsDBServiceImpl implements CreateUtilsDBService {
         createUtilsDBMapper.getGtBandValue(tableNameA, tableNameB, newTableName, value);
         return newTableName;
     }
+
+    @Override
+    public String addDemValue(String tableNameA, List<String> tableIdsA, String tableNameB) {
+        String newTableName = StringUtils.getTemporaryTableName();
+        createUtilsDBMapper.addDemValue(tableNameA, tableIdsA, tableNameB, newTableName);
+        return newTableName;
+    }
+
+    @Override
+    public String addColumnValue(String tableNameA, String tableNameB, String column) {
+        String newTableName = StringUtils.getTemporaryTableName();
+        createUtilsDBMapper.addColumnValue(tableNameA, tableNameB, column, newTableName);
+        return newTableName;
+    }
+
+    @Override
+    public String getHeightLimit(String tableNameA, String tableNameB) {
+        String newTableName = StringUtils.getTemporaryTableName();
+        createUtilsDBMapper.getHeightLimit(tableNameA, tableNameB,newTableName);
+        return newTableName;
+    }
 }

+ 10 - 12
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/FzssServiceImpl.java

@@ -81,6 +81,8 @@ public class FzssServiceImpl implements IFzssService {
     private MultipleMapper multipleMapper;
     //**需要拿出来的逻辑**//
 
+    private static final String SJY = "TB_GHDK";
+
     /**
      * 保存选址参数
      *
@@ -98,7 +100,7 @@ public class FzssServiceImpl implements IFzssService {
         fzxzDTO.setYdxz_bsm(fzxzDTO.getYdxz_bsm().replaceAll("\\[", "").replaceAll("\\]", ""));
         // TODO 数据源
         if (fzxzDTO.getSjy() == null) {
-            fzxzDTO.setSjy("TB_GHDK");
+            fzxzDTO.setSjy(SJY);
         }
 
         // 选址因子
@@ -398,9 +400,7 @@ public class FzssServiceImpl implements IFzssService {
                     }
                 }
             } else if (factorSpatialVo.getSpatialType().equals("distance")) {
-                String calculateEwkt = getFactorEwkt(factorUseDTO.getFactorBsm(), ewkt,
-                        Float.parseFloat(factorSpatialVo.getDefaultValue()),
-                        Float.parseFloat(factorSpatialVo.getDefaultValue()));
+                String calculateEwkt = getFactorEwkt(factorUseDTO.getFactorBsm(), ewkt, Float.parseFloat(factorSpatialVo.getDefaultValue()), Float.parseFloat(factorSpatialVo.getDefaultValue()));
 
                 if (factorSpatialVo.isClip()) {
                     // 距离判断
@@ -453,14 +453,12 @@ public class FzssServiceImpl implements IFzssService {
                 }
             } else if (factorSpatialVo.getSpatialType().equals("height")) {
                 if (factorSpatialVo.getDefaultType().equals("use")) {
-                    //1. 找出相交的 TODO
-                    rawTable = createUtilsDBService.intersectionTableWkt(rawTable, null, ewkt);
-                    //1.1找出相交的地块的高程值
-                    //1.2找出不符合高程值得地块
-                    //切割计算,将符合要求空间范围保留,不符合的删除
-
-                    //2. 判断相交的是否全部符合限高
-                    //3. 不符合的地块进行切割
+                    //1. 添加高程值
+                    rawTable = createUtilsDBService.addDemValue(rawTable, null, "RASTER_DEM_BP");
+                    //2. 添加规划限高
+                    rawTable = createUtilsDBService.addColumnValue(rawTable, SJY, "jzxgd");
+                    //3.保留符合高程值的地块
+                    rawTable = createUtilsDBService.getHeightLimit(rawTable,"TB_JKXG");
                 }
             }
             Integer tableCount = tableDateService.getTableCount(rawTable);

+ 2 - 2
onemap-modules/onemap-analyse/src/main/resources/bootstrap.yml

@@ -20,11 +20,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 116 - 17
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/CreateUtilsDBMapper.xml

@@ -55,19 +55,19 @@
         DROP TABLE IF EXISTS "${temporaryTable}";
     </insert>
 
-<!--    <insert id="differenceTableWkt">-->
-<!--        CREATE TABLE "${newTableName}" AS-->
-<!--        SELECT id, public.ST_Difference(inTbale.geom, public.st_geomfromewkt(#{ewkt})) AS geom-->
-<!--        FROM "${tableName}" inTbale-->
-<!--        WHERE NOT public.ST_IsEmpty(public.ST_Difference(inTbale.geom, public.st_geomfromewkt(#{ewkt})))-->
-<!--        <if test="tableIds != null and tableIds.size() > 0">-->
-<!--            AND inTbale.id::VARCHAR IN-->
-<!--            <foreach collection="tableIds" item="tableId" open="(" close=")" separator=",">-->
-<!--                #{tableId}-->
-<!--            </foreach>-->
-<!--        </if>-->
-<!--        ;-->
-<!--    </insert>-->
+    <!--    <insert id="differenceTableWkt">-->
+    <!--        CREATE TABLE "${newTableName}" AS-->
+    <!--        SELECT id, public.ST_Difference(inTbale.geom, public.st_geomfromewkt(#{ewkt})) AS geom-->
+    <!--        FROM "${tableName}" inTbale-->
+    <!--        WHERE NOT public.ST_IsEmpty(public.ST_Difference(inTbale.geom, public.st_geomfromewkt(#{ewkt})))-->
+    <!--        <if test="tableIds != null and tableIds.size() > 0">-->
+    <!--            AND inTbale.id::VARCHAR IN-->
+    <!--            <foreach collection="tableIds" item="tableId" open="(" close=")" separator=",">-->
+    <!--                #{tableId}-->
+    <!--            </foreach>-->
+    <!--        </if>-->
+    <!--        ;-->
+    <!--    </insert>-->
 
     <insert id="differenceTableWkt" timeout="60">
         CREATE TABLE vector."${newTableName}" AS
@@ -114,20 +114,119 @@
 
     <insert id="getLtBandValue">
         CREATE TABLE "${newTableName}" AS
-        SELECT DISTINCT ta.id,ta.geom
+        SELECT DISTINCT ta.id, ta.geom
         FROM "${tableNameA}" ta,
              "${tableNameB}" tb
         WHERE public.ST_Intersects(tb.rast, ta.geom)
           AND (SELECT (stats).mean
-            FROM (SELECT PUBLIC.ST_SummaryStats(PUBLIC.ST_Clip(tb.rast,ta.geom)) AS stats) AS summary) &lt; #{value};
+            FROM
+        (
+            SELECT
+            PUBLIC
+            .
+            ST_SummaryStats(
+            PUBLIC
+            .
+            ST_Clip
+        (
+            tb
+            .
+            rast,
+            ta
+            .
+            geom
+        )) AS stats) AS summary) &lt; #{value};
     </insert>
     <insert id="getGtBandValue">
         CREATE TABLE "${newTableName}" AS
-        SELECT DISTINCT ta.id,ta.geom
+        SELECT DISTINCT ta.id, ta.geom
         FROM "${tableNameA}" ta,
              "${tableNameB}" tb
         WHERE public.ST_Intersects(tb.rast, ta.geom)
           AND (SELECT (stats).mean
-            FROM (SELECT PUBLIC.ST_SummaryStats(PUBLIC.ST_Clip(tb.rast,ta.geom)) AS stats) AS summary) &gt; #{value};
+            FROM
+        (
+            SELECT
+            PUBLIC
+            .
+            ST_SummaryStats(
+            PUBLIC
+            .
+            ST_Clip
+        (
+            tb
+            .
+            rast,
+            ta
+            .
+            geom
+        )) AS stats) AS summary) &gt; #{value};
+    </insert>
+    <insert id="addDemValue">
+        CREATE TABLE "${newTableName}" AS
+        WITH geom_transformed AS (SELECT id,
+                                         geom,
+                                         public.ST_Transform(geom, 3857) AS geom_3857
+                                  FROM "${tableNameA}"),
+             clipped_raster AS (SELECT a.id,
+                                       a.geom,
+                                       public.ST_Clip(r.rast, 1, a.geom_3857, TRUE) AS clipped
+                                FROM geom_transformed a
+                                         LEFT JOIN "${tableNameB}" r
+                                                   ON public.ST_Intersects(r.rast, a.geom_3857)),
+             summary_stats AS (SELECT id,
+                                      geom,
+                                      CASE
+                                          WHEN COUNT(clipped) = 0 THEN 0
+                                          ELSE SUM((public.ST_SummaryStats(clipped, 1)).sum) /
+                                               SUM((public.ST_SummaryStats(clipped, 1)).count)
+                                          END AS average_elevation
+                               FROM clipped_raster
+                               GROUP BY id, geom)
+        SELECT id,
+               geom,
+               COALESCE(average_elevation, 0) AS average_elevation
+        FROM summary_stats;
+    </insert>
+
+    <insert id="addColumnValue">
+        CREATE TABLE "${newTableName}" AS
+        SELECT ta.id,
+               ta.geom,
+               ta.average_elevation,
+               COALESCE(tb."${column}", 0)                        AS "${column}",
+               ta.average_elevation + COALESCE(tb."${column}", 0) AS height
+        FROM "${tableNameA}" as ta,
+             "${tableNameB}" as tb
+        WHERE ta.id = tb.id;
+    </insert>
+    <insert id="getHeightLimit">
+        CREATE TABLE "${newTableName}" AS
+        WITH intersected AS (SELECT ta.id                            AS a_id,
+                                    ta.geom                          AS a_geom,
+                                    ta.height                        AS a_height,
+                                    tb.id                            AS b_id,
+                                    tb.geom                          AS b_geom,
+                                    tb.hight                         AS b_hight,
+                                    public.ST_Intersection(ta.geom, tb.geom) AS intersect_geom
+                             FROM "${tableNameA}" as ta
+                                      JOIN
+                                  "${tableNameB}" as tb
+                                  ON
+                                      public.ST_Intersects(ta.geom, tb.geom))
+        SELECT a_id as id,
+               intersect_geom AS geom,
+               a_height        AS height
+        FROM intersected
+        WHERE a_height &lt;= b_hight
+        UNION ALL
+        SELECT ta.id    AS id,
+               ta.geom  AS geom,
+               ta.height AS height
+        FROM "${tableNameA}" as ta
+        WHERE NOT EXISTS (SELECT 1
+                          FROM "${tableNameB}" as tb
+                          WHERE public.ST_Intersects(ta.geom, tb.geom));
+
     </insert>
 </mapper>

+ 2 - 2
onemap-modules/onemap-apply/src/main/resources/bootstrap.yml

@@ -30,11 +30,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 2 - 2
onemap-modules/onemap-file/src/main/resources/bootstrap.yml

@@ -34,11 +34,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 2 - 2
onemap-modules/onemap-model/src/main/resources/bootstrap.yml

@@ -31,11 +31,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 2 - 2
onemap-modules/onemap-spatial/src/main/resources/bootstrap.yml

@@ -20,11 +20,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置

+ 2 - 2
onemap-modules/onemap-system/src/main/resources/bootstrap.yml

@@ -15,11 +15,11 @@ spring:
       discovery:
         namespace: model
         # 服务注册地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
       config:
         namespace: model
         # 配置中心地址
-        server-addr: 192.168.60.4:8848
+        server-addr: 127.0.0.1:8848
         # 配置文件格式
         file-extension: yml
         # 共享配置