|
@@ -18,27 +18,29 @@ import com.shkpr.service.alambizplugin.constants.CommCRSDefine;
|
|
|
import com.shkpr.service.alambizplugin.constants.ExcelEnum;
|
|
|
import com.shkpr.service.alambizplugin.constants.GisMetadataDefine;
|
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine;
|
|
|
-import com.shkpr.service.alambizplugin.constants.GisSurveyImportStatusEnum;
|
|
|
+import com.shkpr.service.alambizplugin.constants.GisSurveyThirdImportKeys;
|
|
|
import com.shkpr.service.alambizplugin.constants.LogFlagBusiType;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.intef.GisMetadataLayerTemplateService;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyJobInfoService;
|
|
|
+import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyLayerApplyService;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyLayerApplyThirdCopyService;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyProjectInfoService;
|
|
|
+import com.shkpr.service.alambizplugin.dto.CommAsyncResult;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataLayerTemplate;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataPropertyTemplate;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyCondition;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyThirdCopy;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyPropertyValueThirdCopy;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyThirdImportElement;
|
|
|
-import com.shkpr.service.alambizplugin.dto.GisSurveyThirdImportResult;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyThirdImportResultDetail;
|
|
|
-import com.shkpr.service.alambizplugin.dto.GisSurveyThirdImportSubtask;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
import org.locationtech.jts.geom.Coordinate;
|
|
|
import org.locationtech.jts.geom.Geometry;
|
|
|
import org.locationtech.jts.geom.GeometryFactory;
|
|
|
+import org.locationtech.jts.geom.LineString;
|
|
|
+import org.locationtech.jts.geom.MultiLineString;
|
|
|
import org.locationtech.jts.geom.PrecisionModel;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.AsyncResult;
|
|
@@ -71,33 +73,43 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class GisSurveyThirdImporter {
|
|
|
/**
|
|
|
+ * 结果前缀
|
|
|
+ */
|
|
|
+ public final static String RESULT_PREFIX = "third-import-";
|
|
|
+ /**
|
|
|
* log
|
|
|
*/
|
|
|
private final String mStrClassName;
|
|
|
private final String mBizType;
|
|
|
+
|
|
|
private final GeometryFactory geometryFactory;
|
|
|
+ private final AsyncResultManager asyncResultManager;
|
|
|
private final GisSurveyProjectInfoService projectInfoService;
|
|
|
private final GisSurveyJobInfoService jobInfoService;
|
|
|
private final GisMetadataLayerTemplateService layerTemplateService;
|
|
|
private final GisSurveyLayerApplyThirdCopyService layerApplyThirdCopyService;
|
|
|
+ private final GisSurveyLayerApplyService layerApplyService;
|
|
|
private final DuplicatePointsFinder duplicatePointsFinder;
|
|
|
private final InvalidLinesFinder invalidLinesFinder;
|
|
|
private final InvalidPropertiesFinder invalidPropertiesFinder;
|
|
|
|
|
|
- public GisSurveyThirdImporter(GisSurveyProjectInfoService projectInfoService
|
|
|
+ public GisSurveyThirdImporter(AsyncResultManager asyncResultManager, GisSurveyProjectInfoService projectInfoService
|
|
|
, GisSurveyJobInfoService jobInfoService
|
|
|
, GisMetadataLayerTemplateService layerTemplateService
|
|
|
, GisSurveyLayerApplyThirdCopyService layerApplyThirdCopyService
|
|
|
+ , GisSurveyLayerApplyService layerApplyService
|
|
|
, DuplicatePointsFinder duplicatePointsFinder
|
|
|
, InvalidLinesFinder invalidLinesFinder
|
|
|
, InvalidPropertiesFinder invalidPropertiesFinder) {
|
|
|
mStrClassName = "GisSurveyThirdImporter";
|
|
|
mBizType = LogFlagBusiType.BUSI_GIS_SURVEY.toStrValue();
|
|
|
geometryFactory = new GeometryFactory(new PrecisionModel(), 4490);
|
|
|
+ this.asyncResultManager = asyncResultManager;
|
|
|
this.projectInfoService = projectInfoService;
|
|
|
this.jobInfoService = jobInfoService;
|
|
|
this.layerTemplateService = layerTemplateService;
|
|
|
this.layerApplyThirdCopyService = layerApplyThirdCopyService;
|
|
|
+ this.layerApplyService = layerApplyService;
|
|
|
this.duplicatePointsFinder = duplicatePointsFinder;
|
|
|
this.invalidLinesFinder = invalidLinesFinder;
|
|
|
this.invalidPropertiesFinder = invalidPropertiesFinder;
|
|
@@ -113,13 +125,15 @@ public class GisSurveyThirdImporter {
|
|
|
* @return 系统检查返回
|
|
|
*/
|
|
|
@Async
|
|
|
- public ListenableFuture<GisSurveyThirdImportResult> thirdImportTask(GisSurveyThirdImportParams params, List<InputStream> inputStreams
|
|
|
- , Consumer<GisSurveyThirdImportSubtask> onStartSubtask, Consumer<String> onDeprecatedSubtask) {
|
|
|
+ public ListenableFuture<CommAsyncResult<Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>>>> thirdImportTask(
|
|
|
+ GisSurveyThirdImportParams params, List<InputStream> inputStreams
|
|
|
+ , Consumer<Map<String, ListenableFuture<?>>> onStartSubtask, Consumer<String> onDeprecatedSubtask) {
|
|
|
//构建返回
|
|
|
- GisSurveyThirdImportResult result = GisSurveyThirdImportResult.fail(params);
|
|
|
+ CommAsyncResult<Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>>> result
|
|
|
+ = CommAsyncResult.fail(params.getJobId());
|
|
|
result.setOperator(params.getOperator());
|
|
|
//无效属性任务
|
|
|
- ListenableFuture<GisSurveyThirdImportResultDetail<Map<String, List<GisSurveyThirdImportElement>>>> invalidPropertiesFuture = null;
|
|
|
+ ListenableFuture<Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>>> invalidPropertiesFuture = null;
|
|
|
//重复点号任务
|
|
|
ListenableFuture<GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>> duplicatePointsFuture = null;
|
|
|
//无效线任务
|
|
@@ -148,35 +162,53 @@ public class GisSurveyThirdImporter {
|
|
|
List<GisMetadataLayerTemplate> pointLayerTemplates = layerTemplateService.findByNatureAndNameIn(params.getNature(), pointLayerNames);
|
|
|
List<GisMetadataLayerTemplate> lineLayerTemplates = layerTemplateService.findByNatureAndNameIn(params.getNature(), lineLayerNames);
|
|
|
|
|
|
+ //结果flag
|
|
|
+ final String FLAG = RESULT_PREFIX + params.getJobId();
|
|
|
+ //创建临时文件夹
|
|
|
+ if (!asyncResultManager.createTempDirectory(FLAG))
|
|
|
+ return new AsyncResult<>(result);
|
|
|
+
|
|
|
+ //子任务
|
|
|
+ Map<String, ListenableFuture<?>> subtask = new HashMap<>();
|
|
|
+
|
|
|
//无效属性检查
|
|
|
invalidPropertiesFuture = invalidPropertiesFinder.findInvalidProperties(points, lines
|
|
|
- , pointLayerTemplates, lineLayerTemplates, params.getCheckConstraint(), projectConstraints);
|
|
|
+ , pointLayerTemplates, lineLayerTemplates, params.getCheckConstraint(), projectConstraints, params.getJobId());
|
|
|
+ subtask.put(GisSurveyThirdImportKeys.INVALID_PROPERTIES, invalidPropertiesFuture);
|
|
|
//重复点检查
|
|
|
- duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points, pointLayerTemplates);
|
|
|
+ duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points, pointLayerTemplates, params.getJobId());
|
|
|
+ subtask.put(GisSurveyThirdImportKeys.DUPLICATE_POINTS, duplicatePointsFuture);
|
|
|
//无效线检查
|
|
|
- invalidLinesFuture = invalidLinesFinder.finderInvalidLines(points, lines, pointLayerTemplates, lineLayerTemplates);
|
|
|
+ invalidLinesFuture = invalidLinesFinder.finderInvalidLines(points, lines, pointLayerTemplates, lineLayerTemplates, params.getJobId());
|
|
|
+ subtask.put(GisSurveyThirdImportKeys.INVALID_LINES, invalidLinesFuture);
|
|
|
|
|
|
//返回子任务
|
|
|
- onStartSubtask.accept(
|
|
|
- new GisSurveyThirdImportSubtask(invalidPropertiesFuture, duplicatePointsFuture, invalidLinesFuture)
|
|
|
- );
|
|
|
-
|
|
|
- //等待结果
|
|
|
- GisSurveyThirdImportResultDetail<Map<String, List<GisSurveyThirdImportElement>>> invalidPropertiesResult = invalidPropertiesFuture.get();
|
|
|
- //存入无效属性结果
|
|
|
- result.setInvalidLayersResult(untarInvalidProperties(invalidPropertiesResult, GisSurveyExcelDefine.RESULT.INVALID_LAYERS));
|
|
|
- result.setMissingRequirementsResult(untarInvalidProperties(invalidPropertiesResult, GisSurveyExcelDefine.RESULT.MISSING_REQUIREMENTS));
|
|
|
- result.setInvalidTypesResult(untarInvalidProperties(invalidPropertiesResult, GisSurveyExcelDefine.RESULT.INVALID_TYPES));
|
|
|
- result.setOutRangesResult(untarInvalidProperties(invalidPropertiesResult, GisSurveyExcelDefine.RESULT.OUT_RANGES));
|
|
|
- result.setOutConstraintResult(untarInvalidProperties(invalidPropertiesResult, GisSurveyExcelDefine.RESULT.OUT_CONSTRAINT));
|
|
|
- //存入重复点结果
|
|
|
- result.setDuplicatePointsResult(duplicatePointsFuture.get());
|
|
|
- //存入无效线结果
|
|
|
- result.setInvalidLinesResult(invalidLinesFuture.get());
|
|
|
+ onStartSubtask.accept(subtask);
|
|
|
+
|
|
|
+ //数据
|
|
|
+ Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>> data = new HashMap<>();
|
|
|
+
|
|
|
+ //等待子任务
|
|
|
+ Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>> invalidPropertiesResult = invalidPropertiesFuture.get();
|
|
|
+ //存入无效属性数据
|
|
|
+ data.put(GisSurveyThirdImportKeys.INVALID_LAYERS, invalidPropertiesResult.get(GisSurveyThirdImportKeys.INVALID_LAYERS));
|
|
|
+ data.put(GisSurveyThirdImportKeys.MISSING_REQUIREMENTS, invalidPropertiesResult.get(GisSurveyThirdImportKeys.MISSING_REQUIREMENTS));
|
|
|
+ data.put(GisSurveyThirdImportKeys.INVALID_TYPES, invalidPropertiesResult.get(GisSurveyThirdImportKeys.INVALID_TYPES));
|
|
|
+ data.put(GisSurveyThirdImportKeys.OUT_RANGES, invalidPropertiesResult.get(GisSurveyThirdImportKeys.OUT_RANGES));
|
|
|
+ data.put(GisSurveyThirdImportKeys.OUT_CONSTRAINT, invalidPropertiesResult.get(GisSurveyThirdImportKeys.OUT_CONSTRAINT));
|
|
|
+ //存入重复点数据
|
|
|
+ data.put(GisSurveyThirdImportKeys.DUPLICATE_POINTS, duplicatePointsFuture.get());
|
|
|
+ //存入无效线数据
|
|
|
+ data.put(GisSurveyThirdImportKeys.INVALID_LINES, invalidLinesFuture.get());
|
|
|
+ //存入数据
|
|
|
+ result.setData(data);
|
|
|
+
|
|
|
+ //替换结果
|
|
|
+ asyncResultManager.replaceResult(FLAG);
|
|
|
|
|
|
//结果未通过
|
|
|
- if (!checkResult(result)) {
|
|
|
- result.setImportStatus(GisSurveyImportStatusEnum.DATA_ERROR.getCode());
|
|
|
+ if (!checkResult(data)) {
|
|
|
+ result.setStatus(CommAsyncStatusEnum.RESULT_ERROR.getCode());
|
|
|
result.setCompleteTime(LocalDateTime.now());
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
, String.format(
|
|
@@ -213,7 +245,7 @@ public class GisSurveyThirdImporter {
|
|
|
}
|
|
|
|
|
|
//完成任务
|
|
|
- result.setImportStatus(GisSurveyImportStatusEnum.SUCCESS.getCode());
|
|
|
+ result.setStatus(CommAsyncStatusEnum.SUCCESS.getCode());
|
|
|
result.setCompleteTime(LocalDateTime.now());
|
|
|
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
@@ -241,7 +273,7 @@ public class GisSurveyThirdImporter {
|
|
|
if (invalidLinesFuture != null) invalidLinesFuture.cancel(true);
|
|
|
|
|
|
//失败信息
|
|
|
- result.setImportStatus(CommAsyncStatusEnum.FAIL.getCode());
|
|
|
+ result.setStatus(CommAsyncStatusEnum.FAIL.getCode());
|
|
|
result.setCompleteTime(LocalDateTime.now());
|
|
|
|
|
|
//弃用子任务
|
|
@@ -251,6 +283,43 @@ public class GisSurveyThirdImporter {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 提交导入任务
|
|
|
+ *
|
|
|
+ * @param jobId 任务id
|
|
|
+ * @param operator 操作人
|
|
|
+ * @return 提交状态
|
|
|
+ */
|
|
|
+ @Async
|
|
|
+ public ListenableFuture<CommAsyncResult<Boolean>> commitImportTask(String jobId, String operator) {
|
|
|
+ //构建返回
|
|
|
+ CommAsyncResult<Boolean> result = CommAsyncResult.fail(jobId);
|
|
|
+ result.setOperator(operator);
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
+ , String.format(
|
|
|
+ "开始执合并导入;任务id: %s"
|
|
|
+ , jobId
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ //合并副表
|
|
|
+ Boolean merged = layerApplyService.mergeCopy(jobId, operator);
|
|
|
+
|
|
|
+ //完成任务
|
|
|
+ result.setStatus(CommAsyncStatusEnum.SUCCESS.getCode());
|
|
|
+ result.setCompleteTime(LocalDateTime.now());
|
|
|
+ result.setData(merged);
|
|
|
+
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
+ , String.format(
|
|
|
+ "结束执行合并导入;任务id: %s, 用时(毫秒):%d",
|
|
|
+ jobId,
|
|
|
+ Duration.between(result.getRequestTime(), result.getCompleteTime()).toMillis()
|
|
|
+ )
|
|
|
+ );
|
|
|
+ return new AsyncResult<>(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 解析excel
|
|
|
*
|
|
|
* @param inputStreams 输入流
|
|
@@ -304,35 +373,25 @@ public class GisSurveyThirdImporter {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 解包无效属性
|
|
|
+ * 检查数据
|
|
|
*
|
|
|
- * @param invalidPropertiesResult 无效属性结果
|
|
|
- * @param resultKey 结果key
|
|
|
- * @return 具体结果
|
|
|
- */
|
|
|
- private GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>> untarInvalidProperties(
|
|
|
- GisSurveyThirdImportResultDetail<Map<String, List<GisSurveyThirdImportElement>>> invalidPropertiesResult
|
|
|
- , String resultKey) {
|
|
|
- //获取结果
|
|
|
- List<GisSurveyThirdImportElement> importElements = invalidPropertiesResult.getResults().get(resultKey);
|
|
|
-
|
|
|
- return new GisSurveyThirdImportResultDetail<>(true, importElements);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 检查结果
|
|
|
- *
|
|
|
- * @param result 结果
|
|
|
+ * @param data 数据
|
|
|
* @return 结果通过状态
|
|
|
*/
|
|
|
- private Boolean checkResult(GisSurveyThirdImportResult result) {
|
|
|
- List<GisSurveyThirdImportElement> invalidLayers = result.getInvalidLayersResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> missingRequirements = result.getMissingRequirementsResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> invalidTypesResult = result.getInvalidTypesResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> outRanges = result.getOutRangesResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> outConstraint = result.getOutConstraintResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> duplicatePoints = result.getDuplicatePointsResult().getResults();
|
|
|
- List<GisSurveyThirdImportElement> invalidLines = result.getInvalidLinesResult().getResults();
|
|
|
+ private Boolean checkResult(Map<String, GisSurveyThirdImportResultDetail<List<GisSurveyThirdImportElement>>> data) {
|
|
|
+ //检查key
|
|
|
+ if (!data.containsKey(GisSurveyThirdImportKeys.INVALID_LAYERS) || !data.containsKey(GisSurveyThirdImportKeys.MISSING_REQUIREMENTS) ||
|
|
|
+ !data.containsKey(GisSurveyThirdImportKeys.INVALID_TYPES) || !data.containsKey(GisSurveyThirdImportKeys.OUT_RANGES) ||
|
|
|
+ !data.containsKey(GisSurveyThirdImportKeys.OUT_CONSTRAINT) || !data.containsKey(GisSurveyThirdImportKeys.DUPLICATE_POINTS) ||
|
|
|
+ !data.containsKey(GisSurveyThirdImportKeys.INVALID_LINES)) return false;
|
|
|
+ //获取结果
|
|
|
+ List<GisSurveyThirdImportElement> invalidLayers = data.get(GisSurveyThirdImportKeys.INVALID_LAYERS).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> missingRequirements = data.get(GisSurveyThirdImportKeys.MISSING_REQUIREMENTS).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> invalidTypesResult = data.get(GisSurveyThirdImportKeys.INVALID_TYPES).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> outRanges = data.get(GisSurveyThirdImportKeys.OUT_RANGES).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> outConstraint = data.get(GisSurveyThirdImportKeys.OUT_CONSTRAINT).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> duplicatePoints = data.get(GisSurveyThirdImportKeys.DUPLICATE_POINTS).getResults();
|
|
|
+ List<GisSurveyThirdImportElement> invalidLines = data.get(GisSurveyThirdImportKeys.INVALID_LINES).getResults();
|
|
|
//检查是否都为空
|
|
|
return CollectionUtils.isEmpty(invalidLayers) && CollectionUtils.isEmpty(missingRequirements) &&
|
|
|
CollectionUtils.isEmpty(invalidTypesResult) && CollectionUtils.isEmpty(outRanges) &&
|
|
@@ -370,8 +429,8 @@ public class GisSurveyThirdImporter {
|
|
|
|
|
|
//采集元素象集合
|
|
|
List<GisSurveyLayerApplyThirdCopy> result = new ArrayList<>();
|
|
|
- //点号映射,用于线写入上下游节点
|
|
|
- Map<String, String> pointNoMapping = new HashMap<>();
|
|
|
+ //点映射,用于线写入上下游节点
|
|
|
+ Map<String, GisSurveyLayerApplyThirdCopy> pointMapping = new HashMap<>();
|
|
|
//格式化点
|
|
|
for (Map<String, String> point : points) {
|
|
|
//获取模版
|
|
@@ -379,19 +438,25 @@ public class GisSurveyThirdImporter {
|
|
|
//解码点对象
|
|
|
GisSurveyLayerApplyThirdCopy layerApply = decodePointToLayerApply(point, layerTemplate, params);
|
|
|
//存入点号
|
|
|
- pointNoMapping.put(layerApply.getNo(), layerApply.getCode());
|
|
|
+ pointMapping.put(layerApply.getNo(), layerApply);
|
|
|
|
|
|
result.add(layerApply);
|
|
|
}
|
|
|
+ //清除点缓存
|
|
|
+ points.clear();
|
|
|
+
|
|
|
//格式化线
|
|
|
for (Map<String, String> line : lines) {
|
|
|
//获取模版
|
|
|
GisMetadataLayerTemplate layerTemplate = lineTemplateMap.get(line.get(GisSurveyExcelDefine.FILE.LINE_LAYER));
|
|
|
//解码对象
|
|
|
- GisSurveyLayerApplyThirdCopy layerApply = decodeLineToLayerApply(line, layerTemplate, params, pointNoMapping);
|
|
|
+ GisSurveyLayerApplyThirdCopy layerApply = decodeLineToLayerApply(line, layerTemplate, params, pointMapping);
|
|
|
|
|
|
result.add(layerApply);
|
|
|
}
|
|
|
+ //清除点映射和线缓存
|
|
|
+ pointMapping.clear();
|
|
|
+ lines.clear();
|
|
|
|
|
|
long end = System.currentTimeMillis();
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
@@ -491,13 +556,14 @@ public class GisSurveyThirdImporter {
|
|
|
/**
|
|
|
* 解码线数据到采集元素对象
|
|
|
*
|
|
|
- * @param line 线数据
|
|
|
- * @param layerTemplate 图层模版
|
|
|
- * @param params 导入参数
|
|
|
- * @param pointNoMapping 点号映射
|
|
|
+ * @param line 线数据
|
|
|
+ * @param layerTemplate 图层模版
|
|
|
+ * @param params 导入参数
|
|
|
+ * @param pointMapping 点号映射
|
|
|
* @return 采集元素拷贝对象
|
|
|
*/
|
|
|
- private GisSurveyLayerApplyThirdCopy decodeLineToLayerApply(Map<String, String> line, GisMetadataLayerTemplate layerTemplate, GisSurveyThirdImportParams params, Map<String, String> pointNoMapping) {
|
|
|
+ private GisSurveyLayerApplyThirdCopy decodeLineToLayerApply(Map<String, String> line, GisMetadataLayerTemplate layerTemplate
|
|
|
+ , GisSurveyThirdImportParams params, Map<String, GisSurveyLayerApplyThirdCopy> pointMapping) {
|
|
|
GisSurveyLayerApplyThirdCopy layerApply = new GisSurveyLayerApplyThirdCopy();
|
|
|
//必填项
|
|
|
layerApply.setJobId(params.getJobId());
|
|
@@ -507,14 +573,26 @@ public class GisSurveyThirdImporter {
|
|
|
//默认值
|
|
|
layerApply.setApply(GisSurveyExcelDefine.DEFAULT_VALUE.APPLY);
|
|
|
layerApply.setSource(GisSurveyExcelDefine.DEFAULT_VALUE.SOURCE);
|
|
|
- //上下游节点
|
|
|
+ //上游节点
|
|
|
String upNoStr = ThirdImportTemplateUtils.getValue(line, layerTemplate, GisSurveyExcelDefine.TEMPLATE.UP_NO);
|
|
|
- if (StringUtils.isNotBlank(upNoStr)) {
|
|
|
- layerApply.setUpNode(pointNoMapping.get(upNoStr));
|
|
|
- }
|
|
|
+ GisSurveyLayerApplyThirdCopy upNo = StringUtils.isNotBlank(upNoStr) ? pointMapping.get(upNoStr) : null;
|
|
|
+ if (upNo != null) layerApply.setUpNode(upNo.getCode());
|
|
|
+ //下游节点
|
|
|
String downNoStr = ThirdImportTemplateUtils.getValue(line, layerTemplate, GisSurveyExcelDefine.TEMPLATE.DOWN_NO);
|
|
|
- if (StringUtils.isNotBlank(downNoStr)) {
|
|
|
- layerApply.setDownNode(pointNoMapping.get(downNoStr));
|
|
|
+ GisSurveyLayerApplyThirdCopy downNo = StringUtils.isNotBlank(downNoStr) ? pointMapping.get(downNoStr) : null;
|
|
|
+ if (downNo != null) layerApply.setDownNode(downNo.getCode());
|
|
|
+ //gis
|
|
|
+ if (upNo != null && downNo != null && upNo.getGis() != null && downNo.getGis() != null) {
|
|
|
+ //上下游坐标
|
|
|
+ Coordinate upCoordinate = upNo.getGis().getCoordinate();
|
|
|
+ Coordinate downCoordinate = downNo.getGis().getCoordinate();
|
|
|
+ //创建线
|
|
|
+ LineString lineString = upCoordinate != null && downCoordinate != null ?
|
|
|
+ geometryFactory.createLineString(new Coordinate[]{upCoordinate, downCoordinate}) : null;
|
|
|
+ //创建多线
|
|
|
+ MultiLineString multiLineString = new MultiLineString(new LineString[]{lineString}, geometryFactory);
|
|
|
+ //设置gis
|
|
|
+ if (lineString != null) layerApply.setGis(multiLineString);
|
|
|
}
|
|
|
//遍历属性模版
|
|
|
List<GisSurveyPropertyValueThirdCopy> propertyValueList = new ArrayList<>();
|