Bläddra i källkod

Merge branch 'dev' of http://114.244.114.158:8802/siwei/sanya-data-management-back into dev

gushoubang 9 månader sedan
förälder
incheckning
bfeba12ec8

+ 15 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/fzss/HgxfxController.java

@@ -45,6 +45,21 @@ public class HgxfxController extends BaseController {
         return hgxfxService.AddHgxfx(hgxfxDTO);
     }
 
+    /**
+     * 新建合规性分析
+     *
+     * @param hgxfxDTO
+     * @return
+     */
+    @PostMapping("/AddHgxfxV1")
+    public RequestResult AddHgxfx2(@RequestBody HgxfxDTO hgxfxDTO) {
+        if (StringUtils.isNull(hgxfxDTO)) {
+            return RequestResult.error("参数为空");
+        }
+        hgxfxDTO.setCjyh(SecurityUtils.getUsername());
+        return hgxfxService.AddHgxfxV1(hgxfxDTO);
+    }
+
     /**
      * 获取任务日志
      *

+ 1 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/fzss/HgxfxMapper.java

@@ -17,4 +17,5 @@ public interface HgxfxMapper extends BaseMapper<HgxfxDTO> {
 
     Map getXzfw(@Param("id") String id);
 
+    int insertXzfw(Map map);
 }

+ 1 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/fzss/IHgxfxService.java

@@ -9,6 +9,7 @@ public interface IHgxfxService {
     RequestResult GetScxList(String param);
 
     RequestResult AddHgxfx(HgxfxDTO hgxfxDTO);
+    RequestResult AddHgxfxV1(HgxfxDTO hgxfxDTO);
 
     RequestResult GetLog(String bsm);
 

+ 38 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/fzss/HgxfxServiceImpl.java

@@ -112,6 +112,44 @@ public class HgxfxServiceImpl implements IHgxfxService {
         return RequestResult.success(bsm);
     }
 
+
+    @Override
+    public RequestResult AddHgxfxV1(HgxfxDTO hgxfxDTO) {
+
+        if (StringUtils.isEmpty(hgxfxDTO.getXmmc())) {
+            return RequestResult.error("项目参数为空");
+        }
+        if (StringUtils.isEmpty(hgxfxDTO.getXzfw())) {
+            return RequestResult.error("选址范围参数为空");
+        }
+        if (StringUtils.isEmpty(hgxfxDTO.getScxList())) {
+            return RequestResult.error("分析因子为空");
+        }
+        String xzfwId = StringUtils.getUUID();
+        Map<String, Object> xzfwMap = new HashMap<>();
+        xzfwMap.put("id", xzfwId);
+        xzfwMap.put("geom", "SRID=4326;" + hgxfxDTO.getXzfw());
+        xzfwMap.put("from_type", 1);
+        hgxfxMapper.insertXzfw(xzfwMap);
+
+        Map xzfw = hgxfxMapper.getXzfw(xzfwId);
+        if (StringUtils.isEmpty(xzfw)) {
+            return RequestResult.error("选址范围参数为空");
+        }
+        Double area = Double.valueOf(xzfw.get("area").toString());
+        String ewkt = (String) xzfw.get("geom");
+        if (StringUtils.isEmpty(ewkt)) {
+            return RequestResult.error("选址范围参数为空");
+        }
+        hgxfxDTO.setXzfw(xzfwId);
+        hgxfxDTO.setFxmj(area);
+        hgxfxDTO.setCjsj(new Date());
+        hgxfxDTO.setRwzt(0);
+        String bsm = insertHgxfx(hgxfxDTO);
+        hxfxHandleService.hgxfxHandle(bsm, ewkt);
+        return RequestResult.success(GetFxjg(bsm));
+    }
+
     @Transactional(rollbackFor = Exception.class)
     public String insertHgxfx(HgxfxDTO hgxfxDTO) {
         hgxfxDTO.setCjsj(new Date());

+ 86 - 5
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/table/TableDataSelectServiceImpl.java

@@ -38,15 +38,26 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
             QueryWrapper<TableResRuleDTO> queryResOneWrapper = new QueryWrapper<>();
             queryResOneWrapper.eq("id", bsm);
             TableResRuleDTO v_table_res_id = tableResRuleMapper.selectOne(queryResOneWrapper);
-            List<List<TableDataVo>> data = dataSelectById(pointEWkt, bsm);
+            List<List<TableDataVo>> data = null;
+            if ("hz".equals(v_table_res_id.getAnalyseType())) {
+                data = dataHzSelectById(pointEWkt, bsm);
+            } else {
+                data = dataSelectById(pointEWkt, bsm);
+            }
             if (data == null || data.size() <= 0) {
                 return retList;
             }
             retList.put("data", data);
-            retList.put("dataname", getTableName(v_table_res_id.getFromTableId()));
+            retList.put("dataname", v_table_res_id.getName());
+
+            //如果到汇总,程序终止
+            if ("hz".equals(v_table_res_id.getAnalyseType())) {
+                return retList;
+            }
 
             QueryWrapper<TableResRuleDTO> queryResWrapper = new QueryWrapper<>();
             queryResWrapper.eq("pid", bsm);
+            queryResWrapper.orderByDesc("create_time");
             List<TableResRuleDTO> v_table_Res = tableResRuleMapper.selectList(queryResWrapper);
             List<Map> childLit = new ArrayList<>();
             for (TableResRuleDTO tableResRuleDTO : v_table_Res) {
@@ -64,11 +75,14 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
                         Map v_childMap = dataSelectByPoint(geomEWKT, tableResRuleDTO.getId());
                         if (StringUtils.isNotEmpty(v_childMap)) {
                             v_data.addAll((List<Map>) v_childMap.get("data"));
-                            v_child.addAll((List<Map>) v_childMap.get("child"));
+                            Object child = v_childMap.get("child");
+                            if (StringUtils.isNotNull(child)) {
+                                v_child.addAll((List<Map>) v_childMap.get("child"));
+                            }
                         }
                     }
                 }
-                childMap.put("dataname", getTableName(tableResRuleDTO.getAnalyseTableId()));
+                childMap.put("dataname", tableResRuleDTO.getName());
                 childMap.put("data", v_data);
                 childMap.put("child", v_child);
                 childLit.add(childMap);
@@ -141,6 +155,72 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
         }
     }
 
+    private List<List<TableDataVo>> dataHzSelectById(String pointEWkt, String bsm) {
+        List<List<TableDataVo>> retList = new ArrayList<>();
+        QueryWrapper<TableResRuleDTO> queryResWrapper = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(bsm)) {
+            queryResWrapper.eq("pid", bsm);
+        } else {
+            return retList;
+        }
+
+        List<TableResRuleDTO> v_table_Res_list = tableResRuleMapper.selectList(queryResWrapper);
+        if (StringUtils.isNull(v_table_Res_list)) {
+            return retList;
+        }
+
+        for (TableResRuleDTO v_table_Res : v_table_Res_list) {
+
+            // 获取from_table_id
+            QueryWrapper<TableDTO> queryFromTableWrapper = new QueryWrapper<>();
+            queryFromTableWrapper.eq("id", v_table_Res.getFromTableId());
+            TableDTO v_from_table = tableMapper.selectOne(queryFromTableWrapper);
+            if (StringUtils.isNull(v_from_table)) {
+                return retList;
+            }
+
+            // 获取analyse_table_id
+            TableDTO v_analyse_table = null;
+            if (StringUtils.isNotEmpty(v_table_Res.getAnalyseTableId())) {
+                QueryWrapper<TableDTO> queryAnalyseTableWrapper = new QueryWrapper<>();
+                queryAnalyseTableWrapper.eq("id", v_table_Res.getAnalyseTableId());
+                v_analyse_table = tableMapper.selectOne(queryAnalyseTableWrapper);
+            }
+
+            List<List<TableDataVo>> table_list = null;
+            String v_analyse_type = v_table_Res.getAnalyseType();
+            if (v_analyse_table == null) {
+                //intersects 相交
+                //intersection 交集
+//            v_table_Res.getAnalyseType();
+                if ("intersection".equals(v_analyse_type)) {
+                    table_list = tableIntersectionHandle(pointEWkt, v_from_table.getTableName(), v_from_table.getId());
+                } else {
+                    table_list = tableIntersectsHandle(pointEWkt, v_from_table.getTableName(), v_from_table.getId());
+                }
+            } else {
+                if ("intersection".equals(v_analyse_type)) {
+                    table_list = tableIntersectionHandle(pointEWkt, v_analyse_table.getTableName(), v_analyse_table.getId());
+                } else {
+                    table_list = tableIntersectsHandle(pointEWkt, v_analyse_table.getTableName(), v_analyse_table.getId());
+                }
+                if (StringUtils.isNotNull(table_list)) {
+                    for (List<TableDataVo> v_table : table_list) {
+                        // 面积
+                        TableDataVo tableDataVo = new TableDataVo();
+                        tableDataVo.setData(v_analyse_table.getTableDescribe());
+                        tableDataVo.setFiledZH("权属类型");
+                        tableDataVo.setFiled("qslx");
+                        v_table.add(tableDataVo);
+                    }
+                }
+            }
+            retList.addAll(table_list);
+        }
+        return retList;
+
+    }
+
 
     //取相交的函数
     private List<List<TableDataVo>> tableIntersectsHandle(String eWkt, String tableName, String tableId) {
@@ -182,7 +262,6 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
         if (from_kj_ids == null || from_kj_ids.size() == 0) {
             return retList;
         }
-
         List<TableFiledDTO> list = getFieldListByTableId(tableId, 0);
         List<String> outputColumn = new ArrayList<>();
         for (TableFiledDTO v_data : list) {
@@ -198,6 +277,7 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
             return retList;
         }
 
+
         TargetTableVo targetTableVo = new TargetTableVo();
         targetTableVo.setTargetTableName(from_kj_data);
         targetTableVo.setColumns(outputColumn);
@@ -205,6 +285,7 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
         targetTableVo.setIsGeography(false);
         targetTableVo.setSrid(SRID);
         targetTableVo.setSiweiArea(true);
+
         List<Map> from_jg = httpAnalyseService.targetTable(targetTableVo);
         if (from_jg == null || from_jg.size() <= 0) {
             return retList;

+ 5 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/fzss/HgxfxMapper.xml

@@ -35,6 +35,11 @@
     </select>
 
 
+    <insert id="insertXzfw">
+        insert into t_fzss_zhxz_file (id, geom, from_type, create_time,area)
+        values (#{id}, public.st_geomfromewkt(#{geom}), #{from_type}, now(),public.st_area(public.st_geomfromewkt(#{geom})::public.geography))
+    </insert>
+
 
     <select id="getXzfw" parameterType="java.lang.String" resultType="map">
         SELECT id,

+ 2 - 2
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/table/TableFiledMapper.xml

@@ -7,8 +7,8 @@
         from t_table_filed_relation t
         left join t_table_filed t1 on t.filed_id = t1.id
         where t.table_id = #{tableId}
-        <if test="isDisplay != null and isDisplay != ''">
-            t.is_display = #{isDisplay}
+        <if test="isDisplay != null">
+           and t.is_display = #{isDisplay}
         </if>
         order by t.sort
     </select>

+ 8 - 15
sql/pgsql/0_init.sql

@@ -1,17 +1,10 @@
--- 7.17
--- 表同步
--- t_fzss_fzxz_factor
--- t_fzss_fzxz_dict
--- t_fzss_fzxz_factor_temp
+-- 7.24
 
--- 添加表
--- TB_GHDK_SITUATION
+-- Auto-generated SQL script #202407240932
+UPDATE base.t_jsc_sql
+SET jsc_sql='select #{id} as id, coalesce( t.xmsl,0) xmsl,round(coalesce( t.sdfw,0),2) sdfw,round(coalesce( t.tzje,0)/10000,2) tzje,round(coalesce( t.mj,0),2) mj from ( select sum(xmsl) xmsl,sum(mj) mj,sum(sdfw) sdfw,sum(tzje) tzje FROM vector."AFTER_TDZZHZ" x where xzqdm like #{id}||''%'' )t '
+WHERE id='7a8b3776-048a-4b7a-b231-506d9da308c0';
 
---修改试图
--- vector.v_jsc_tdgy_jt_xx
-
--- 添加表
---AFTER_BJXM_SZ
-
--- nacos 同步
--- onemap-analyse-dev.yml
+UPDATE base.t_jsc_sql
+SET jsc_sql='select t0.*, #{id} as id, #{begin_time} as create_time from ( select count(*) sj_number, round(coalesce(sum(x.ydmj),0)/1000000,2) sj_mj from vector."AFTER_BJXM_SZ" x where xzqdm like #{id} || ''%'' and x.bpsj >= #{begin_time} and x.bpsj< #{end_time})t0'
+WHERE id='b84ae1b9-1bc1-4154-a070-561a42a24fbd';