|
|
@@ -2,6 +2,7 @@ package com.siwei.apply.service.cadastre.impl;
|
|
|
|
|
|
import com.siwei.apply.domain.CadastreFile;
|
|
|
import com.siwei.apply.domain.FzssFxrwrz;
|
|
|
+import com.siwei.apply.domain.LayerAndDbData;
|
|
|
import com.siwei.apply.domain.vo.*;
|
|
|
import com.siwei.apply.mapper.CadastreFileMapper;
|
|
|
import com.siwei.apply.mapper.FzssFxrwrzMapper;
|
|
|
@@ -353,7 +354,7 @@ public class CadastreManageServiceImpl implements CadastreManageService {
|
|
|
//todo 这里根据表名获取相关校验字段信息
|
|
|
List<String> checkFieldList = new ArrayList<>();
|
|
|
//checkFieldList.add("111");
|
|
|
- checkFieldList.add("bz");
|
|
|
+ //checkFieldList.add("bz");
|
|
|
//仅获取图层属性
|
|
|
List<Map<String, Object>> theValueList = getValueList(layer,new LinkedHashMap<>(), false);
|
|
|
for (Map<String, Object> theMap : theValueList) {
|
|
|
@@ -719,6 +720,69 @@ public class CadastreManageServiceImpl implements CadastreManageService {
|
|
|
|
|
|
|
|
|
|
|
|
+ //1.获取图层中所有数据
|
|
|
+ //2.获取库中所有数据
|
|
|
+ //3.进行对比返回
|
|
|
+ @Override
|
|
|
+ public List<LayerAndDbData> getLayerData(String uploadId) {
|
|
|
+ List<LayerAndDbData> resList = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ CadastreFile cadastreFile = cadastreFileMapper.get(uploadId);
|
|
|
+ //这里判断是否校验通过
|
|
|
+ if (!cadastreFile.getStatus().equalsIgnoreCase("3")) {
|
|
|
+ log.info("校验未通过,不能入库");
|
|
|
+ throw new ServiceException("校验未通过,不能入库");
|
|
|
+ }
|
|
|
+ String gdbPath = cadastreFile.getUnzipPath();
|
|
|
+ DataSource ds = ogr.Open(gdbPath + "/" + cadastreFile.getName(), 0); // 0 = 只读
|
|
|
+ if (ds == null) {
|
|
|
+ log.warn("无法打开 gdb");
|
|
|
+ throw new ServiceException("无法打开 gdb");
|
|
|
+ }
|
|
|
+ //这里进行遍历每个图层
|
|
|
+ for (int i = 0; i < ds.GetLayerCount(); i++) {
|
|
|
+ Layer layer = ds.GetLayer(i);
|
|
|
+ String layerName = layer.GetName();
|
|
|
+ //todo 相关代码
|
|
|
+ if (!layerName.equalsIgnoreCase("T_CGZJ_CWTC_M")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ LayerAndDbData layerAndDbData = new LayerAndDbData();
|
|
|
+ layerAndDbData.setCurrentTableName(layerName);
|
|
|
+
|
|
|
+ boolean haveGeom = false;//这里不需要geom信息
|
|
|
+ List<Map<String,String>> dbFieldNameAndTypeList = cadastreFileMapper.selectTableCollumAndType(layerName.toLowerCase(Locale.ROOT));
|
|
|
+ Map<String,String> dbFieldNameAndTypeMap = dbFieldNameAndTypeList.stream().collect(Collectors.toMap(
|
|
|
+ s -> s.get("column_name"),
|
|
|
+ s -> s.get("data_type"),
|
|
|
+ (existing, replacement) -> existing // 如果有重复键,保留第一个值
|
|
|
+ ));
|
|
|
+ List<Map<String, Object>> theValueList = getValueList(layer,dbFieldNameAndTypeMap, haveGeom);
|
|
|
+ List<Map<String, Object>> dbDataList = cadastreFileMapper.selectTableData("0",layerName);
|
|
|
+
|
|
|
+ layerAndDbData.setAddTotalNum(theValueList.size());
|
|
|
+ layerAndDbData.setInsertNum(theValueList.size());
|
|
|
+ layerAndDbData.setMarkHistoryNum(dbDataList.size());
|
|
|
+ layerAndDbData.setInsertDataList(theValueList);
|
|
|
+ layerAndDbData.setMarkHistoryDataList(dbDataList);
|
|
|
+ resList.add(layerAndDbData);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("矢量数据入库异常,uploadId: {}", uploadId, e);
|
|
|
+ throw new ServiceException("矢量数据入库异常," + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return resList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|