|
@@ -38,6 +38,7 @@ import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Path;
|
|
import java.time.Duration;
|
|
import java.time.Duration;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -45,6 +46,7 @@ import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
+import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,13 +116,24 @@ public class GisSurveyThirdExporter {
|
|
//处理坐标系
|
|
//处理坐标系
|
|
if (!Objects.equals(targetCRSCode, CommCRSDefine.CGCS2000)) transformGeom(targetCRSCode, points, lines);
|
|
if (!Objects.equals(targetCRSCode, CommCRSDefine.CGCS2000)) transformGeom(targetCRSCode, points, lines);
|
|
|
|
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
|
+ , String.format("开始构建模版查询条件;任务id: %s", jobId)
|
|
|
|
+ );
|
|
//获取图层key
|
|
//获取图层key
|
|
- List<String> pointLayer = getLayerKeys(points);
|
|
|
|
- List<String> lineLayer = getLayerKeys(lines);
|
|
|
|
|
|
+ Set<String> pointLayer = getLayerKeys(points);
|
|
|
|
+ Set<String> lineLayer = getLayerKeys(lines);
|
|
|
|
+
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
|
+ , String.format("开始查询模版;任务id: %s", jobId)
|
|
|
|
+ );
|
|
//查询点图层模版
|
|
//查询点图层模版
|
|
- List<GisMetadataLayerTemplate> pointLayerTemplates = layerTemplateService.findByKeyIn(pointLayer);
|
|
|
|
|
|
+ List<GisMetadataLayerTemplate> pointLayerTemplates = layerTemplateService.findByKeyIn(new ArrayList<>(pointLayer));
|
|
//查询线图层模版
|
|
//查询线图层模版
|
|
- List<GisMetadataLayerTemplate> lineLayerTemplates = layerTemplateService.findByKeyIn(lineLayer);
|
|
|
|
|
|
+ List<GisMetadataLayerTemplate> lineLayerTemplates = layerTemplateService.findByKeyIn(new ArrayList<>(lineLayer));
|
|
|
|
+
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
|
+ , String.format("查询模版完毕,开始导出;任务id: %s", jobId)
|
|
|
|
+ );
|
|
|
|
|
|
//结果flag
|
|
//结果flag
|
|
final String FLAG = RESULT_PREFIX + jobId;
|
|
final String FLAG = RESULT_PREFIX + jobId;
|
|
@@ -256,8 +269,18 @@ public class GisSurveyThirdExporter {
|
|
//构建excel数据
|
|
//构建excel数据
|
|
Map<String, List<Map<String, Object>>> excelData = buildExcelData(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
Map<String, List<Map<String, Object>>> excelData = buildExcelData(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
|
|
|
|
|
|
+ //清除查询的数据
|
|
|
|
+ points.clear();
|
|
|
|
+ lines.clear();
|
|
|
|
+
|
|
//导出excel
|
|
//导出excel
|
|
- return asyncResultManager.writeExcel(excelHeader, excelData, FLAG, "third-export.xlsx");
|
|
|
|
|
|
+ Path result = asyncResultManager.writeExcel(excelHeader, excelData, FLAG, "third-export.xlsx");
|
|
|
|
+
|
|
|
|
+ //清除shape数据
|
|
|
|
+ excelHeader.clear();
|
|
|
|
+ excelData.clear();
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -276,8 +299,17 @@ public class GisSurveyThirdExporter {
|
|
//构建shape数据
|
|
//构建shape数据
|
|
Map<SimpleFeatureType, List<Map<String, Object>>> shapeData = buildShapeData(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
Map<SimpleFeatureType, List<Map<String, Object>>> shapeData = buildShapeData(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
|
|
|
|
|
|
+ //清除查询的数据
|
|
|
|
+ points.clear();
|
|
|
|
+ lines.clear();
|
|
|
|
+
|
|
//导出shape
|
|
//导出shape
|
|
- return asyncResultManager.writeShape(shapeData, FLAG, "third-export.zip");
|
|
|
|
|
|
+ Path result = asyncResultManager.writeShape(shapeData, FLAG, "third-export.zip");
|
|
|
|
+
|
|
|
|
+ //清除shape数据
|
|
|
|
+ shapeData.clear();
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -287,13 +319,12 @@ public class GisSurveyThirdExporter {
|
|
* @param datas 数据
|
|
* @param datas 数据
|
|
* @return 图层key集合
|
|
* @return 图层key集合
|
|
*/
|
|
*/
|
|
- private List<String> getLayerKeys(List<GisSurveyLayerApply> datas) {
|
|
|
|
|
|
+ private Set<String> getLayerKeys(List<GisSurveyLayerApply> datas) {
|
|
//去重图层
|
|
//去重图层
|
|
return datas.parallelStream()
|
|
return datas.parallelStream()
|
|
.map(GisSurveyLayerApply::getLayer)
|
|
.map(GisSurveyLayerApply::getLayer)
|
|
.filter(StringUtils::isNotBlank)
|
|
.filter(StringUtils::isNotBlank)
|
|
- .distinct()
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|