Przeglądaj źródła

根据标识码条件查询

chenendian 1 miesiąc temu
rodzic
commit
7c6b846b17

+ 3 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/CadastreFileMapper.java

@@ -96,6 +96,9 @@ public interface CadastreFileMapper {
 
     int batchDeleteByBsm(@Param("tableName") String tableName, @Param("list") List<Map<String, Object>> list);
 
+    List<Map<String,Object>> selectTableDataByCondition(@Param("validFlag") String validFlag, @Param("tableName") String tableName,@Param("bsm") String bsm,@Param("ywh") String ywh);
+
+
 
 
 }

+ 15 - 27
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/CadastreManageServiceImpl.java

@@ -1265,40 +1265,28 @@ public class CadastreManageServiceImpl implements CadastreManageService {
     @Override
     public List<Map<String,Object>> selectTableRow(String tableName,String geomFlag,String bsm,String ywh) {
         String validFlag = "0";
-        List<Map<String,Object>> res = cadastreFileMapper.selectTableData(validFlag,tableName);
+        List<Map<String,Object>> res = cadastreFileMapper.selectTableDataByCondition(validFlag,tableName,bsm,ywh);
         if(CollectionUtils.isNotEmpty(res)){ //去掉geom字段和valid_flag字段
             //res.forEach(m -> m.keySet().removeIf(k -> "geom".equalsIgnoreCase(k)|| "valid_flag".equalsIgnoreCase(k)));
             res.forEach(m -> m.keySet().removeIf(k -> "valid_flag".equalsIgnoreCase(k)));
             if("0".equals(geomFlag)){
                 res.forEach(m -> m.keySet().removeIf(k -> "geom".equalsIgnoreCase(k)));
             }
-//            res.forEach(s->{
-//                WKBReader reader = new WKBReader();
-//                com.vividsolutions.jts.geom.Geometry geom = null;
-//                try {
-//                    geom = reader.read(WKBReader.hexToBytes(s.get("geom").toString()));
-//                } catch (ParseException e) {
-//                    throw new RuntimeException(e);
-//                }
-//                s.put("geom",geom.toText());
-//            });
-
-                res.forEach(s -> {
-                    if(s.get("geom") != null){
-                        WKBReader reader = new WKBReader();
-                        com.vividsolutions.jts.geom.Geometry geom = null;
-                        try {
-                            geom = reader.read(WKBReader.hexToBytes(s.get("geom").toString()));
-                        } catch (ParseException e) {
-                            throw new RuntimeException(e);
-                        }
-                        //geom.setSRID(4490);
-                        WKTWriter writer = new WKTWriter();
-                        String ewkt = "SRID=" + "4326" + ";" + writer.write(geom);
-                        s.put("geom", ewkt);
+           res.forEach(s -> {
+                if(s.get("geom") != null){
+                    WKBReader reader = new WKBReader();
+                    com.vividsolutions.jts.geom.Geometry geom = null;
+                    try {
+                        geom = reader.read(WKBReader.hexToBytes(s.get("geom").toString()));
+                    } catch (ParseException e) {
+                        throw new RuntimeException(e);
                     }
-                });
-
+                    //geom.setSRID(4490);
+                    WKTWriter writer = new WKTWriter();
+                    String ewkt = "SRID=" + "4326" + ";" + writer.write(geom);
+                    s.put("geom", ewkt);
+                }
+            });
         }
         return res;
     }

+ 14 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/cadastre/CadastreFileMapper.xml

@@ -261,6 +261,20 @@
         WHERE valid_flag = ${validFlag}
     </select>
 
+
+    <select id="selectTableDataByCondition"   resultType="Map">
+        SELECT *
+        FROM vector.${tableName}
+        WHERE valid_flag = ${validFlag}
+        <if test="bsm != null and bsm != ''">
+            and bsm= ${bsm}
+        </if>
+        <if test="ywh != null and ywh != ''">
+            and ywh= ${ywh}
+        </if>
+    </select>
+
+
     <select id="selectExistsSameData"   resultType="Map">
         SELECT * FROM vector.${tableName}
         WHERE valid_flag = ${validFlag}

+ 11 - 4
siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/controller/file/SpatialFilesDbController.java

@@ -149,15 +149,18 @@ public class SpatialFilesDbController extends BaseController {
     @GetMapping("/test/parse")
     public R<List<Map<String,Object>>> parse(@RequestParam("filePath") String filePath) {
         if(StringUtils.isBlank(filePath)){
-            filePath = "C:\\Users\\Administrator\\Desktop\\07\\shp_deom\\给一码管地\\地籍区.shp";
+            //filePath = "C:\\Users\\Administrator\\Desktop\\07\\shp_deom\\给一码管地\\地籍区.shp";
         }
-//        File shp = new File("C:\\Users\\Administrator\\Desktop\\07\\shp_deom\\给一码管地\\地表宗地.shp");
+        filePath = "C:\\Users\\Administrator\\Desktop\\07\\结合图-新—赣江新区图幅比例-0311\\500结合图.shp";
+
+
+//        File shp = new File("C:\\Users\\Administrator\\Desktop\\07\\结合图-新—赣江新区图幅比例\\500结合图.shp");
 //        String sql = null;
 //        try {
 //            sql = ShpPostgisTableBuilder.buildCreateTableSql(
 //                    shp,
 //                    "vector",
-//                    "test_table"
+//                    "tf_500_shp"
 //            );
 //        } catch (Exception e) {
 //            throw new RuntimeException(e);
@@ -169,7 +172,11 @@ public class SpatialFilesDbController extends BaseController {
 //        System.out.println(lll);
 //        System.exit(0);
 //        iSpatialFilesDbService.testInsertShp(res);
-        iSpatialFilesDbService.testInsertShpZD(res);
+//        iSpatialFilesDbService.testInsertShpZD(res);
+
+
+        iSpatialFilesDbService.testInsertShp(res);
+
 
         return R.ok(res);
     }

+ 9 - 0
siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/service/file/impl/SpatialFilesDbServiceImpl.java

@@ -446,8 +446,17 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
 
                 //tGeomDbDetailsMapper.batchInsertJzwShp(batch,4326);
                 //tGeomDbDetailsMapper.batchInsertZdShp(batch,4326);
+                //tGeomDbDetailsMapper.insertTableData(batch,4326);
+
+                for(Map<String,Object> map1 :batch){
+                    Map<String,Object> map2 = new HashMap<>();
+                    map2.put("geom", map1.get("the_geom"));
+                    map2.put("name", map1.get("图幅名"));
+                    tGeomDbDetailsMapper.insertTableData("tf_500_shp",map2,4527);
+                }
 
             }
+
         //tGeomDbDetailsMapper.batchInsertJzwShp(shpDataMapList,4326);
         return "";
     }