|
@@ -5,6 +5,7 @@ import com.global.base.log.LogPrintMgr;
|
|
|
import com.shkpr.service.alambizplugin.apiparam.GisSurveyThirdImportParams;
|
|
|
import com.shkpr.service.alambizplugin.commtools.ExcelUtils;
|
|
|
import com.shkpr.service.alambizplugin.commtools.PointCodeUtil;
|
|
|
+import com.shkpr.service.alambizplugin.commtools.ThirdImportTemplateUtils;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.DuplicatePointsFinder;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.InvalidLinesFinder;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.InvalidPropertiesFinder;
|
|
@@ -118,8 +119,8 @@ public class GisSurveyThirdImporter {
|
|
|
parseExcel(inputStreams, points, lines);
|
|
|
|
|
|
//提取图层名
|
|
|
- List<String> pointLayerNames = getLayerNames(points, GisSurveyImportDefine.POINT.LAYER);
|
|
|
- List<String> lineLayerNames = getLayerNames(lines, GisSurveyImportDefine.LINE.LAYER);
|
|
|
+ List<String> pointLayerNames = getLayerNames(points, GisSurveyImportDefine.FILE.POINT_LAYER);
|
|
|
+ List<String> lineLayerNames = getLayerNames(lines, GisSurveyImportDefine.FILE.LINE_LAYER);
|
|
|
//图层模版
|
|
|
List<GisMetadataLayerTemplate> pointLayerTemplates = layerTemplateService.findByNatureAndNameIn(params.getNature(), pointLayerNames);
|
|
|
List<GisMetadataLayerTemplate> lineLayerTemplates = layerTemplateService.findByNatureAndNameIn(params.getNature(), lineLayerNames);
|
|
@@ -127,9 +128,9 @@ public class GisSurveyThirdImporter {
|
|
|
//无效属性检查
|
|
|
invalidPropertiesFuture = invalidPropertiesFinder.findInvalidProperties(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
|
//重复点检查
|
|
|
- duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points);
|
|
|
+ duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points, pointLayerTemplates);
|
|
|
//无效线检查
|
|
|
- invalidLinesFuture = invalidLinesFinder.finderInvalidLines(points, lines);
|
|
|
+ invalidLinesFuture = invalidLinesFinder.finderInvalidLines(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
|
|
|
|
//返回子任务
|
|
|
onStartSubtask.accept(
|
|
@@ -261,7 +262,7 @@ public class GisSurveyThirdImporter {
|
|
|
* 获取图层名称
|
|
|
*
|
|
|
* @param datas 数据
|
|
|
- * @param layerKey 图层的key
|
|
|
+ * @param layerKey 文件图层的key
|
|
|
* @return 图层名称集合
|
|
|
*/
|
|
|
private List<String> getLayerNames(List<Map<String, String>> datas, String layerKey) {
|
|
@@ -343,7 +344,7 @@ public class GisSurveyThirdImporter {
|
|
|
//格式化点
|
|
|
for (Map<String, String> point : points) {
|
|
|
//获取模版
|
|
|
- GisMetadataLayerTemplate layerTemplate = poineTemplateMap.get(point.get(GisSurveyImportDefine.POINT.LAYER));
|
|
|
+ GisMetadataLayerTemplate layerTemplate = poineTemplateMap.get(point.get(GisSurveyImportDefine.FILE.POINT_LAYER));
|
|
|
//解码点对象
|
|
|
GisSurveyLayerApplyThirdCopy layerApply = decodePointToLayerApply(point, layerTemplate, params);
|
|
|
//存入点号
|
|
@@ -354,7 +355,7 @@ public class GisSurveyThirdImporter {
|
|
|
//格式化线
|
|
|
for (Map<String, String> line : lines) {
|
|
|
//获取模版
|
|
|
- GisMetadataLayerTemplate layerTemplate = lineTemplateMap.get(line.get(GisSurveyImportDefine.LINE.LAYER));
|
|
|
+ GisMetadataLayerTemplate layerTemplate = lineTemplateMap.get(line.get(GisSurveyImportDefine.FILE.LINE_LAYER));
|
|
|
//解码对象
|
|
|
GisSurveyLayerApplyThirdCopy layerApply = decodeLineToLayerApply(line, layerTemplate, params, pointNoMapping);
|
|
|
|
|
@@ -387,29 +388,32 @@ public class GisSurveyThirdImporter {
|
|
|
layerApply.setLayer(layerTemplate.getKey());
|
|
|
layerApply.setKind(GisMetadataDefine.TYPE_KINE.POINT);
|
|
|
//解析坐标
|
|
|
- Point geometry = geometryFactory.createPoint(new Coordinate(
|
|
|
- Double.parseDouble(point.get(GisSurveyImportDefine.POINT.LNG))
|
|
|
- , Double.parseDouble(point.get(GisSurveyImportDefine.POINT.LAT))
|
|
|
- ));
|
|
|
- layerApply.setGis(geometry);
|
|
|
+ String lngStr = ThirdImportTemplateUtils.getValue(point, layerTemplate, GisSurveyImportDefine.TEMPLATE.LNG);
|
|
|
+ String latStr = ThirdImportTemplateUtils.getValue(point, layerTemplate, GisSurveyImportDefine.TEMPLATE.LAT);
|
|
|
+ if (NumberUtils.isParsable(lngStr) && NumberUtils.isParsable(latStr)) {
|
|
|
+ Point geometry = geometryFactory.createPoint(new Coordinate(Double.parseDouble(lngStr), Double.parseDouble(latStr)));
|
|
|
+ layerApply.setGis(geometry);
|
|
|
+ }
|
|
|
//默认值
|
|
|
layerApply.setApply(GisSurveyImportDefine.DEFAULT_VALUE.APPLY);
|
|
|
layerApply.setSource(GisSurveyImportDefine.DEFAULT_VALUE.SOURCE);
|
|
|
//高程和埋深
|
|
|
- String elevationStr = point.get(GisSurveyImportDefine.POINT.ELEVATION);
|
|
|
+ String elevationStr = ThirdImportTemplateUtils.getValue(point, layerTemplate, GisSurveyImportDefine.TEMPLATE.ELEVATION);
|
|
|
if (NumberUtils.isParsable(elevationStr))
|
|
|
layerApply.setElevation(Double.parseDouble(elevationStr));
|
|
|
- String depthStr = point.get(GisSurveyImportDefine.POINT.DEPTH);
|
|
|
+ String depthStr = ThirdImportTemplateUtils.getValue(point, layerTemplate, GisSurveyImportDefine.TEMPLATE.DEPTH);
|
|
|
if (NumberUtils.isParsable(depthStr))
|
|
|
layerApply.setDepth(Double.parseDouble(depthStr));
|
|
|
//点号(长度64截断)
|
|
|
- layerApply.setNo(StringUtils.substring(point.get(GisSurveyImportDefine.POINT.NO), 0, 64));
|
|
|
+ String noStr = ThirdImportTemplateUtils.getValue(point, layerTemplate, GisSurveyImportDefine.TEMPLATE.NO);
|
|
|
+ if (StringUtils.isNotBlank(noStr))
|
|
|
+ layerApply.setNo(StringUtils.substring(noStr, 0, 64));
|
|
|
//遍历属性模版
|
|
|
List<GisSurveyPropertyValueThirdCopy> propertyValueList = new ArrayList<>();
|
|
|
for (GisMetadataPropertyTemplate propertyTemplate : layerTemplate.getPropertyTemplates()) {
|
|
|
//解析属性
|
|
|
GisSurveyPropertyValueThirdCopy propertyValue = decodeDataToPropertyValue(point, layerApply
|
|
|
- , propertyTemplate, params, GisSurveyImportDefine.LayerType.POINT);
|
|
|
+ , propertyTemplate, params);
|
|
|
if (propertyValue != null) propertyValueList.add(propertyValue);
|
|
|
}
|
|
|
layerApply.setPropertyValues(propertyValueList);
|
|
@@ -437,13 +441,19 @@ public class GisSurveyThirdImporter {
|
|
|
layerApply.setApply(GisSurveyImportDefine.DEFAULT_VALUE.APPLY);
|
|
|
layerApply.setSource(GisSurveyImportDefine.DEFAULT_VALUE.SOURCE);
|
|
|
//上下游节点
|
|
|
- layerApply.setUpNode(pointNoMapping.get(line.get(GisSurveyImportDefine.LINE.UP_NO)));
|
|
|
- layerApply.setDownNode(pointNoMapping.get(line.get(GisSurveyImportDefine.LINE.DOWN_NO)));
|
|
|
+ String upNoStr = ThirdImportTemplateUtils.getValue(line, layerTemplate, GisSurveyImportDefine.TEMPLATE.UP_NO);
|
|
|
+ if (StringUtils.isNotBlank(upNoStr)) {
|
|
|
+ layerApply.setUpNode(pointNoMapping.get(upNoStr));
|
|
|
+ }
|
|
|
+ String downNoStr = ThirdImportTemplateUtils.getValue(line, layerTemplate, GisSurveyImportDefine.TEMPLATE.DOWN_NO);
|
|
|
+ if (StringUtils.isNotBlank(downNoStr)) {
|
|
|
+ layerApply.setDownNode(pointNoMapping.get(downNoStr));
|
|
|
+ }
|
|
|
//遍历属性模版
|
|
|
List<GisSurveyPropertyValueThirdCopy> propertyValueList = new ArrayList<>();
|
|
|
for (GisMetadataPropertyTemplate propertyTemplate : layerTemplate.getPropertyTemplates()) {
|
|
|
//解析属性
|
|
|
- GisSurveyPropertyValueThirdCopy propertyValue = decodeDataToPropertyValue(line, layerApply, propertyTemplate, params, GisSurveyImportDefine.LayerType.LINE);
|
|
|
+ GisSurveyPropertyValueThirdCopy propertyValue = decodeDataToPropertyValue(line, layerApply, propertyTemplate, params);
|
|
|
if (propertyValue != null) propertyValueList.add(propertyValue);
|
|
|
}
|
|
|
layerApply.setPropertyValues(propertyValueList);
|
|
@@ -458,35 +468,23 @@ public class GisSurveyThirdImporter {
|
|
|
* @param layerApply 采集元素
|
|
|
* @param propertyTemplate 属性模版
|
|
|
* @param params 导出参数
|
|
|
- * @param layerType 图层类型
|
|
|
* @return 属性值对象
|
|
|
*/
|
|
|
private GisSurveyPropertyValueThirdCopy decodeDataToPropertyValue(Map<String, String> data, GisSurveyLayerApplyThirdCopy layerApply
|
|
|
- , GisMetadataPropertyTemplate propertyTemplate, GisSurveyThirdImportParams params, GisSurveyImportDefine.LayerType layerType) {
|
|
|
+ , GisMetadataPropertyTemplate propertyTemplate, GisSurveyThirdImportParams params) {
|
|
|
//点号直接返回点号属性
|
|
|
if (Objects.equals(GisSurveyImportDefine.TEMPLATE.CODE, propertyTemplate.getKey()))
|
|
|
return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getCode()
|
|
|
, propertyTemplate.getKey(), layerApply.getCode());
|
|
|
- //根据图层类型和模版映射,获取表头
|
|
|
+ if (Objects.equals(GisSurveyImportDefine.TEMPLATE.UP_NODE, propertyTemplate.getKey()))
|
|
|
+ return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getUpNode()
|
|
|
+ , propertyTemplate.getKey(), layerApply.getCode());
|
|
|
+ if (Objects.equals(GisSurveyImportDefine.TEMPLATE.DOWN_NODE, propertyTemplate.getKey()))
|
|
|
+ return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getDownNode()
|
|
|
+ , propertyTemplate.getKey(), layerApply.getCode());
|
|
|
+
|
|
|
+ //获取表头
|
|
|
String templateName = propertyTemplate.getName();
|
|
|
- if (layerType == GisSurveyImportDefine.LayerType.POINT)
|
|
|
- switch (propertyTemplate.getKey()) {
|
|
|
- case GisSurveyImportDefine.TEMPLATE.LNG:
|
|
|
- templateName = GisSurveyImportDefine.POINT.LNG;
|
|
|
- break;
|
|
|
- case GisSurveyImportDefine.TEMPLATE.LAT:
|
|
|
- templateName = GisSurveyImportDefine.POINT.LAT;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (layerType == GisSurveyImportDefine.LayerType.LINE)
|
|
|
- switch (propertyTemplate.getKey()) {
|
|
|
- case GisSurveyImportDefine.TEMPLATE.UP_NODE:
|
|
|
- templateName = GisSurveyImportDefine.LINE.UP_NO;
|
|
|
- break;
|
|
|
- case GisSurveyImportDefine.TEMPLATE.DOWN_NODE:
|
|
|
- templateName = GisSurveyImportDefine.LINE.DOWN_NO;
|
|
|
- break;
|
|
|
- }
|
|
|
//获取值
|
|
|
String value = data.get(templateName);
|
|
|
//构建dto,并将值长度64截断
|