package com.shkpr.service.alambizplugin.dto; import com.shkpr.service.alambizplugin.commtools.ThirdImportTemplateUtils; import com.shkpr.service.alambizplugin.constants.GisMetadataDefine; import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine; import lombok.Data; import java.util.Map; import java.util.Objects; /** * 第三方导入元素dto * * @author 欧阳劲驰 * @since 1.0.0 */ @Data public class GisSurveyThirdImportElement { /** * 点号 */ private String no; /** * 上游点号 */ private String upNO; /** * 下游点号 */ private String downNO; /** * 元素分类:point--点;line--线;face--面 */ private String kind; /** * 图层名称 */ private String layerName; /** * 属性名称 */ private String propertyName; /** * 约束条件 */ private GisSurveyCondition condition; /** * 值 */ private String value; /** * 原因 */ private String message; public GisSurveyThirdImportElement(String kind, String no, String layerName, String propertyName, String message) { this.kind = kind; this.no = no; this.layerName = layerName; this.propertyName = propertyName; this.message = message; } public GisSurveyThirdImportElement(String kind, String upNO, String downNO, String layerName, String propertyName, String message) { this.kind = kind; this.upNO = upNO; this.downNO = downNO; this.layerName = layerName; this.propertyName = propertyName; this.message = message; } public static GisSurveyThirdImportElement create(Map data, GisMetadataLayerTemplate layerTemplate , String propertyName, String message) { if (Objects.equals(GisMetadataDefine.TYPE_KINE.POINT, layerTemplate.getKind())) { return new GisSurveyThirdImportElement(GisMetadataDefine.TYPE_KINE.POINT, ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.NO), layerTemplate.getName(), propertyName, message ); } if (Objects.equals(GisMetadataDefine.TYPE_KINE.LINE, layerTemplate.getKind())) { return new GisSurveyThirdImportElement(GisMetadataDefine.TYPE_KINE.LINE, ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.UP_NO), ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.DOWN_NO), layerTemplate.getName(), propertyName, message ); } return null; } public static GisSurveyThirdImportElement create(Map data, GisMetadataLayerTemplate layerTemplate , String propertyName, String value, GisSurveyCondition condition, String message) { GisSurveyThirdImportElement element = create(data, layerTemplate, propertyName, message); if (element == null) return null; element.setValue(value); element.setCondition(condition); return element; } }