Sfoglia il codice sorgente

修复上下节点检查不正确的问题

欧阳劲驰 2 mesi fa
parent
commit
46d25dd350

+ 4 - 4
src/main/java/com/shkpr/service/alambizplugin/components/GisSurveyThirdImporter.java

@@ -477,11 +477,11 @@ public class GisSurveyThirdImporter {
             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());
+            return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getCode()
+                    , propertyTemplate.getKey(), layerApply.getUpNode());
         if (Objects.equals(GisSurveyImportDefine.TEMPLATE.DOWN_NODE, propertyTemplate.getKey()))
-            return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getDownNode()
-                    , propertyTemplate.getKey(), layerApply.getCode());
+            return new GisSurveyPropertyValueThirdCopy(params.getJobId(), layerApply.getCode()
+                    , propertyTemplate.getKey(), layerApply.getUpNode());
 
         //获取表头
         String templateName = propertyTemplate.getName();

+ 12 - 19
src/main/java/com/shkpr/service/alambizplugin/components/checker/InvalidLinesFinder.java

@@ -127,30 +127,23 @@ public class InvalidLinesFinder {
             GisMetadataPropertyTemplate downNoTemplate = ThirdImportTemplateUtils.getPropertyTemplate(line, lineLayerTemplates,
                     GisMetadataDefine.TYPE_KINE.LINE, GisSurveyImportDefine.TEMPLATE.DOWN_NO);
             //判断是否包含上下节点
-            boolean notContainsUp = false;
-            boolean notContainsDown = false;
-            String upNo = null;
-            String downNo = null;
-            if (upNoTemplate != null) {
-                upNo = ThirdImportTemplateUtils.getValue(line, upNoTemplate);
-                notContainsUp = StringUtils.isBlank(upNo) || !nos.contains(upNo);
-
-            }
-            if (downNoTemplate != null) {
-                downNo = ThirdImportTemplateUtils.getValue(line, downNoTemplate);
-                notContainsDown = StringUtils.isBlank(upNo) || !nos.contains(downNo);
-            }
+            String upNo = ThirdImportTemplateUtils.getValue(line, upNoTemplate);
+            boolean notContainsUp = StringUtils.isBlank(upNo) || !nos.contains(upNo);
+            String downNo = ThirdImportTemplateUtils.getValue(line, downNoTemplate);
+            boolean notContainsDown = StringUtils.isBlank(upNo) || !nos.contains(downNo);
             //不包含上节点或下节点,则收集
             if (notContainsUp || notContainsDown) {
                 //根据条件构造表头
-                String propertyName;
-                if (notContainsUp && notContainsDown)
-                    propertyName = upNoTemplate.getName() + "," + downNoTemplate.getName();
-                else if (notContainsUp) propertyName = upNoTemplate.getName();
-                else propertyName = downNoTemplate.getName();
+                List<String> propertyNames = new ArrayList<>();
+                if (upNoTemplate != null && notContainsUp) {
+                    propertyNames.add(upNoTemplate.getName());
+                }
+                if (downNoTemplate != null && notContainsDown) {
+                    propertyNames.add(downNoTemplate.getName());
+                }
                 //存入结果
                 results.add(new GisSurveyThirdImportElement(GisMetadataDefine.TYPE_KINE.LINE, upNo, downNo,
-                        line.get(GisSurveyImportDefine.FILE.LINE_LAYER), propertyName));
+                        line.get(GisSurveyImportDefine.FILE.LINE_LAYER), String.join(",", propertyNames)));
             }
         }
 

+ 6 - 0
src/main/java/com/shkpr/service/alambizplugin/components/checker/InvalidPropertiesFinder.java

@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * 无效属性查找器
@@ -177,6 +178,11 @@ public class InvalidPropertiesFinder {
             //排除非必填
             if (propertyTemplate.getRequired() != 1)
                 continue;
+            //排除编码
+            if (Objects.equals(GisSurveyImportDefine.TEMPLATE.CODE, propertyTemplate.getKey())
+                    || Objects.equals(GisSurveyImportDefine.TEMPLATE.UP_NODE, propertyTemplate.getKey())
+                    || Objects.equals(GisSurveyImportDefine.TEMPLATE.DOWN_NODE, propertyTemplate.getKey()))
+                continue;
             //模版名称
             String templateName = propertyTemplate.getName();
             //必填不存在则存入缺少必填