|
@@ -33,8 +33,8 @@ import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.Charset;
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
@@ -387,7 +387,6 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public TGeomDb uploadAddShpDrawV1(String geom, String fromRoute, Integer fromtype) {
|
|
public TGeomDb uploadAddShpDrawV1(String geom, String fromRoute, Integer fromtype) {
|
|
@@ -424,7 +423,6 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<Map<String,Object>> testReadShape(String shpFile) {
|
|
public List<Map<String,Object>> testReadShape(String shpFile) {
|
|
|
List<Map<String, Object>> shpFeaturesList = readShapeFile(new File(shpFile));
|
|
List<Map<String, Object>> shpFeaturesList = readShapeFile(new File(shpFile));
|
|
@@ -437,19 +435,147 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
|
//List<Map<String, Object>> shpFeaturesList = readShapeFile(new File(shpFile));
|
|
//List<Map<String, Object>> shpFeaturesList = readShapeFile(new File(shpFile));
|
|
|
//shpDataMapList = shpDataMapList.stream().filter(map -> map.get("djqdm").equals("360122015")).collect(Collectors.toList());
|
|
//shpDataMapList = shpDataMapList.stream().filter(map -> map.get("djqdm").equals("360122015")).collect(Collectors.toList());
|
|
|
//tGeomDbDetailsMapper.batchInsertDjq(shpDataMapList,4326);
|
|
//tGeomDbDetailsMapper.batchInsertDjq(shpDataMapList,4326);
|
|
|
- tGeomDbDetailsMapper.batchInsertDjzq(shpDataMapList,4326);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ int batchSize = 100;
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < shpDataMapList.size(); i += batchSize) {
|
|
|
|
|
+
|
|
|
|
|
+ int end = Math.min(i + batchSize, shpDataMapList.size());
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String,Object>> batch = shpDataMapList.subList(i, end);
|
|
|
|
|
+
|
|
|
|
|
+ //tGeomDbDetailsMapper.batchInsertJzwShp(batch,4326);
|
|
|
|
|
+ //tGeomDbDetailsMapper.batchInsertZdShp(batch,4326);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ //tGeomDbDetailsMapper.batchInsertJzwShp(shpDataMapList,4326);
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 针对地籍库中的宗地基本信息表,找出shp中个别对应的字段进行入库。
|
|
|
|
|
+ * @param shpDataMapList
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
- public List<Map<String,Object>> testGetShpData(String tabeName) {
|
|
|
|
|
- List<Map<String,Object>> geoms = tGeomDbDetailsMapper.selectTableDataAndGeom(tabeName);
|
|
|
|
|
- return geoms;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public String testInsertShpZD(List<Map<String,Object>> shpDataMapList) {
|
|
|
|
|
+ String[] arr = {"bdcdyh", "bsm", "bz", "dah", "dj", "djh", "djzt", "jg", "jzmd", "jzxg", "mjdw", "qllx", "qlsdfs", "qlxz", "rjl", "tfh", "ybzddm", "ydyhfl", "ysdm", "yt", "zddm", "zdmj", "zdszb", "zdszd", "zdszn", "zdszx", "zdt", "zdtzm", "zl", "zt",""};
|
|
|
|
|
+ int i=0;
|
|
|
|
|
+ for (Map<String,Object> map : shpDataMapList){
|
|
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
|
|
+ for (String key : arr) {
|
|
|
|
|
+ if (map.containsKey(key)) {
|
|
|
|
|
+ map1.put(key, map.get(key));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(key.equals("zdt")){
|
|
|
|
|
+ map1.put("zdt", String.valueOf(map.get(key)).getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(key.equals("yt")){
|
|
|
|
|
+ String yt = String.valueOf(map.get("yt"));
|
|
|
|
|
+ if(yt.contains("/")){
|
|
|
|
|
+ yt = yt.replace("/","");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(yt.length()>6){
|
|
|
|
|
+ yt = yt.substring(0,6);
|
|
|
|
|
+ }
|
|
|
|
|
+ map1.put("yt", yt);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(key.equals("jzxg")){
|
|
|
|
|
+ Double jzxg = (Double)map1.get("jzxg");
|
|
|
|
|
+ map1.put("jzxg", jzxg+1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("jzxg")){
|
|
|
|
|
+ Double jzxg = (Double)map1.get("jzxg");
|
|
|
|
|
+ if(jzxg<= 0 ){
|
|
|
|
|
+ log.info("------------aaa{}",jzxg);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if(map1.containsKey("rjl")){
|
|
|
|
|
+ Double rjl = (Double)map.get("rjl");
|
|
|
|
|
+ if(rjl<= 0 ){
|
|
|
|
|
+ log.info("------------bbb{}",rjl);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("qllx")) {
|
|
|
|
|
+ String qllx = String.valueOf(map.get("qllx"));
|
|
|
|
|
+ if (StringUtils.isBlank(qllx)) {
|
|
|
|
|
+ log.info("------------ccc{}",qllx);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ int qllxTmp = Integer.parseInt(qllx);
|
|
|
|
|
+ if (qllxTmp < 1 || qllxTmp > 43) {
|
|
|
|
|
+ log.info("------------ccc111{}",qllx);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("zdmj")) {
|
|
|
|
|
+ Double zdmj = (Double)map.get("zdmj");
|
|
|
|
|
+ if(zdmj<= 0 ){
|
|
|
|
|
+ log.info("------------dddd{}",zdmj);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("dj")) {
|
|
|
|
|
+ String dj = String.valueOf(map.get("dj"));
|
|
|
|
|
+ if (StringUtils.isBlank(dj)) {
|
|
|
|
|
+ log.info("------------eee{}",dj);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ int djTmp = Integer.parseInt(dj);
|
|
|
|
|
+ if (djTmp < 1 || djTmp > 15) {
|
|
|
|
|
+ log.info("------------fff{}",dj);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("qlxz")) {
|
|
|
|
|
+ int[] intArray = {101, 102, 103, 104, 105, 106, 107, 108, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212};
|
|
|
|
|
+ String qlxz = String.valueOf(map.get("qlxz"));
|
|
|
|
|
+ int qlxzTmp = Integer.parseInt(qlxz);
|
|
|
|
|
+ //判断是否包含于当前数组中
|
|
|
|
|
+ boolean contains = Arrays.stream(intArray).anyMatch(x -> x == qlxzTmp);
|
|
|
|
|
+ if (!contains) {
|
|
|
|
|
+ log.info("------------eee{}",qlxz);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(map1.containsKey("jzmd")) {
|
|
|
|
|
+ Double jzmd = (Double)map.get("jzmd");
|
|
|
|
|
+ if(jzmd< 0 || jzmd> 1 ){
|
|
|
|
|
+ log.info("------------ffff{}",jzmd);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (map.containsKey("the_geom")) {
|
|
|
|
|
+ map1.put("geom", map.get("the_geom"));
|
|
|
|
|
+ }
|
|
|
|
|
+ map1.put("bdcdyb", "0".getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
+ //map1.put("zdmj", 2);
|
|
|
|
|
+ //map1.put("dj", 1);
|
|
|
|
|
+ //map1.put("qlxz", 207);
|
|
|
|
|
+ //map1.put("jzmd", 0.122);
|
|
|
|
|
|
|
|
|
|
+ map1.put("bsm", ++i);
|
|
|
|
|
+ tGeomDbDetailsMapper.insertTableData("zdjbxx",map1,4326);
|
|
|
|
|
+ }
|
|
|
|
|
+ return "success";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -459,6 +585,11 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Map<String,Object>> testGetShpData(String tabeName) {
|
|
|
|
|
+ List<Map<String,Object>> geoms = tGeomDbDetailsMapper.selectTableDataAndGeom(tabeName);
|
|
|
|
|
+ return geoms;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|