|
@@ -6,6 +6,9 @@ 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.commtools.norule.JPSurveyApplyColumn;
|
|
|
+import com.shkpr.service.alambizplugin.commtools.norule.RuleFormatSetting;
|
|
|
+import com.shkpr.service.alambizplugin.commtools.norule.SurveyCommonAssistant;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.DuplicatePointsFinder;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.InvalidLinesFinder;
|
|
|
import com.shkpr.service.alambizplugin.components.checker.InvalidPropertiesFinder;
|
|
@@ -16,6 +19,7 @@ import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine;
|
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveyImportStatusEnum;
|
|
|
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.GisSurveyLayerApplyThirdCopyService;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataLayerTemplate;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataPropertyTemplate;
|
|
@@ -72,9 +76,10 @@ public class GisSurveyThirdImporter {
|
|
|
private final DuplicatePointsFinder duplicatePointsFinder;
|
|
|
private final InvalidLinesFinder invalidLinesFinder;
|
|
|
private final InvalidPropertiesFinder invalidPropertiesFinder;
|
|
|
+ private final GisSurveyJobInfoService gisSurveyJobInfoService;
|
|
|
|
|
|
public GisSurveyThirdImporter(GisMetadataLayerTemplateService layerTemplateService, GisSurveyLayerApplyThirdCopyService gisSurveyLayerApplyThirdCopyService
|
|
|
- , DuplicatePointsFinder duplicatePointsFinder, InvalidLinesFinder invalidLinesFinder, InvalidPropertiesFinder invalidPropertiesFinder) {
|
|
|
+ , DuplicatePointsFinder duplicatePointsFinder, InvalidLinesFinder invalidLinesFinder, InvalidPropertiesFinder invalidPropertiesFinder, GisSurveyJobInfoService gisSurveyJobInfoService) {
|
|
|
mStrClassName = "GisSurveyThirdImporter";
|
|
|
mBizType = LogFlagBusiType.BUSI_GIS_SURVEY.toStrValue();
|
|
|
geometryFactory = new GeometryFactory(new PrecisionModel(), 4490);
|
|
@@ -83,6 +88,7 @@ public class GisSurveyThirdImporter {
|
|
|
this.duplicatePointsFinder = duplicatePointsFinder;
|
|
|
this.invalidLinesFinder = invalidLinesFinder;
|
|
|
this.invalidPropertiesFinder = invalidPropertiesFinder;
|
|
|
+ this.gisSurveyJobInfoService = gisSurveyJobInfoService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -99,6 +105,7 @@ public class GisSurveyThirdImporter {
|
|
|
, Consumer<GisSurveyThirdImportSubtask> onStartSubtask, Consumer<String> onDeprecatedSubtask) {
|
|
|
//构建返回
|
|
|
GisSurveyThirdImportResult result = GisSurveyThirdImportResult.fail(params);
|
|
|
+ result.setOperator(params.getOperator());
|
|
|
//无效属性任务
|
|
|
ListenableFuture<GisSurveyThirdImportResultDetail<Map<String, List<GisSurveyThirdImportElement>>>> invalidPropertiesFuture = null;
|
|
|
//重复点号任务
|
|
@@ -169,6 +176,10 @@ public class GisSurveyThirdImporter {
|
|
|
|
|
|
//解码点线数据
|
|
|
List<GisSurveyLayerApplyThirdCopy> layerApplyList = decodeDataToLayerApply(points, lines, pointLayerTemplates, lineLayerTemplates, params);
|
|
|
+
|
|
|
+ //重置点号
|
|
|
+ if (params.getResetNo()) resetNo(params.getJobId(), layerApplyList);
|
|
|
+
|
|
|
//批量写入
|
|
|
Boolean saved = gisSurveyLayerApplyThirdCopyService.saveAll(params.getJobId(), layerApplyList);
|
|
|
if (!saved) {
|
|
@@ -524,4 +535,45 @@ public class GisSurveyThirdImporter {
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置点号
|
|
|
+ *
|
|
|
+ * @param jobId 任务id
|
|
|
+ * @param layerApplyList 采集元素集合
|
|
|
+ */
|
|
|
+ private void resetNo(String jobId, List<GisSurveyLayerApplyThirdCopy> layerApplyList) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, "开始重置点号 ======>");
|
|
|
+ long begin = System.currentTimeMillis();
|
|
|
+
|
|
|
+ //点号规则
|
|
|
+ final List<RuleFormatSetting> ruleFormat = gisSurveyJobInfoService.findRuleFormat(jobId);
|
|
|
+ //并行遍历元素
|
|
|
+ layerApplyList.parallelStream()
|
|
|
+ .filter(la -> Objects.equals(la.getKind(), GisMetadataDefine.TYPE_KINE.POINT))
|
|
|
+ .forEach(la -> {
|
|
|
+ //生成点号
|
|
|
+ String no = SurveyCommonAssistant.genNo(
|
|
|
+ la.getCode(),
|
|
|
+ la.getPropertyValues().stream()
|
|
|
+ .map(pv -> new JPSurveyApplyColumn(pv.getProperty(), pv.getProperty()))
|
|
|
+ .collect(Collectors.toList()),
|
|
|
+ ruleFormat
|
|
|
+ );
|
|
|
+ //设置元素点号
|
|
|
+ la.setNo(no);
|
|
|
+ //设置属性点号
|
|
|
+ la.getPropertyValues().stream()
|
|
|
+ .filter(it -> Objects.equals(it.getProperty(), GisSurveyExcelDefine.TEMPLATE.NO))
|
|
|
+ .forEach(it -> it.setValue(no));
|
|
|
+ });
|
|
|
+
|
|
|
+ long end = System.currentTimeMillis();
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
+ , String.format(
|
|
|
+ "结束执行执行重置点号,用时(毫秒):%d"
|
|
|
+ , (end - begin)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|