|
@@ -4,6 +4,7 @@ import com.shkpr.service.alambizplugin.constants.GisMetadataDefine;
|
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataLayerTemplate;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisMetadataPropertyTemplate;
|
|
|
+import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApply;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -17,9 +18,54 @@ import java.util.Objects;
|
|
|
* @since 1.0.0
|
|
|
*/
|
|
|
public class ThirdImportTemplateUtils {
|
|
|
+ /**
|
|
|
+ * 获取图层模版
|
|
|
+ *
|
|
|
+ * @param data 数据
|
|
|
+ * @param layerTemplates 图层模版
|
|
|
+ * @param kind 数据类型
|
|
|
+ * @return 图层模版
|
|
|
+ */
|
|
|
+ public static GisMetadataLayerTemplate getLayerTemplate(Map<String, String> data
|
|
|
+ , List<GisMetadataLayerTemplate> layerTemplates, String kind) {
|
|
|
+ //图层文件key
|
|
|
+ String layKey = null;
|
|
|
+ if (Objects.equals(kind, GisMetadataDefine.TYPE_KINE.POINT))
|
|
|
+ layKey = GisSurveyExcelDefine.FILE.POINT_LAYER;
|
|
|
+ if (Objects.equals(kind, GisMetadataDefine.TYPE_KINE.LINE))
|
|
|
+ layKey = GisSurveyExcelDefine.FILE.LINE_LAYER;
|
|
|
+ if (layKey == null) return null;
|
|
|
+
|
|
|
+ //过滤对应模版
|
|
|
+ String finalLayKey = layKey;
|
|
|
+ return layerTemplates.stream()
|
|
|
+ .filter(template -> StringUtils.isNotBlank(template.getName())
|
|
|
+ && Objects.equals(template.getName(), data.get(finalLayKey))
|
|
|
+ && Objects.equals(template.getKind(), kind)
|
|
|
+ )
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取图层模版
|
|
|
+ *
|
|
|
+ * @param data 数据
|
|
|
+ * @param layerTemplates 图层模版
|
|
|
+ * @return 图层模版
|
|
|
+ */
|
|
|
+ public static GisMetadataLayerTemplate getLayerTemplate(GisSurveyLayerApply data, List<GisMetadataLayerTemplate> layerTemplates) {
|
|
|
+ if (StringUtils.isBlank(data.getLayer()) || StringUtils.isBlank(data.getKind())) return null;
|
|
|
+ //过滤对应模版
|
|
|
+ return layerTemplates.stream()
|
|
|
+ .filter(template -> StringUtils.isNotBlank(template.getName())
|
|
|
+ && Objects.equals(template.getKey(), data.getLayer())
|
|
|
+ && Objects.equals(template.getKind(), data.getKind())
|
|
|
+ )
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 获取模版
|
|
|
+ * 获取属性模版
|
|
|
*
|
|
|
* @param data 数据
|
|
|
* @param layerTemplates 图层模版集合
|
|
@@ -37,7 +83,20 @@ public class ThirdImportTemplateUtils {
|
|
|
return layerTemplate.getPropertyTemplates().stream()
|
|
|
.filter(template -> Objects.equals(propertyKey, template.getKey()))
|
|
|
.findFirst().orElse(null);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取属性模版
|
|
|
+ *
|
|
|
+ * @param layerTemplate 图层模版
|
|
|
+ * @param propertyKey 属性模版key
|
|
|
+ * @return 点号
|
|
|
+ */
|
|
|
+ public static GisMetadataPropertyTemplate getPropertyTemplate(GisMetadataLayerTemplate layerTemplate, String propertyKey) {
|
|
|
+ //提取点号模版
|
|
|
+ return layerTemplate.getPropertyTemplates().stream()
|
|
|
+ .filter(template -> Objects.equals(propertyKey, template.getKey()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -90,32 +149,4 @@ public class ThirdImportTemplateUtils {
|
|
|
GisMetadataLayerTemplate layerTemplate = getLayerTemplate(data, layerTemplates, kind);
|
|
|
return getValue(data, layerTemplate, propertyKey);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取图层模版
|
|
|
- *
|
|
|
- * @param data 数据
|
|
|
- * @param layerTemplates 图层模版
|
|
|
- * @param kind 数据类型
|
|
|
- * @return 图层模版
|
|
|
- */
|
|
|
- public static GisMetadataLayerTemplate getLayerTemplate(Map<String, String> data
|
|
|
- , List<GisMetadataLayerTemplate> layerTemplates, String kind) {
|
|
|
- //图层文件key
|
|
|
- String layKey = null;
|
|
|
- if (Objects.equals(kind, GisMetadataDefine.TYPE_KINE.POINT))
|
|
|
- layKey = GisSurveyExcelDefine.FILE.POINT_LAYER;
|
|
|
- if (Objects.equals(kind, GisMetadataDefine.TYPE_KINE.LINE))
|
|
|
- layKey = GisSurveyExcelDefine.FILE.LINE_LAYER;
|
|
|
- if (layKey == null) return null;
|
|
|
-
|
|
|
- //过滤对应模版
|
|
|
- String finalLayKey = layKey;
|
|
|
- return layerTemplates.stream()
|
|
|
- .filter(template -> StringUtils.isNotBlank(template.getName())
|
|
|
- && Objects.equals(template.getName(), data.get(finalLayKey))
|
|
|
- && Objects.equals(template.getKind(), kind)
|
|
|
- )
|
|
|
- .findFirst().orElse(null);
|
|
|
- }
|
|
|
}
|