GisSurveyThirdImportElement.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package com.shkpr.service.alambizplugin.dto;
  2. import com.shkpr.service.alambizplugin.commtools.ThirdImportTemplateUtils;
  3. import com.shkpr.service.alambizplugin.constants.GisMetadataDefine;
  4. import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine;
  5. import lombok.Data;
  6. import java.util.Map;
  7. import java.util.Objects;
  8. /**
  9. * 第三方导入元素dto
  10. *
  11. * @author 欧阳劲驰
  12. * @since 1.0.0
  13. */
  14. @Data
  15. public class GisSurveyThirdImportElement {
  16. /**
  17. * 点号
  18. */
  19. private String no;
  20. /**
  21. * 上游点号
  22. */
  23. private String upNO;
  24. /**
  25. * 下游点号
  26. */
  27. private String downNO;
  28. /**
  29. * 元素分类:point--点;line--线;face--面
  30. */
  31. private String kind;
  32. /**
  33. * 图层名称
  34. */
  35. private String layerName;
  36. /**
  37. * 属性名称
  38. */
  39. private String propertyName;
  40. /**
  41. * 约束条件
  42. */
  43. private GisSurveyCondition condition;
  44. /**
  45. * 值
  46. */
  47. private String value;
  48. /**
  49. * 原因
  50. */
  51. private String message;
  52. public GisSurveyThirdImportElement(String kind, String no, String layerName, String propertyName, String message) {
  53. this.kind = kind;
  54. this.no = no;
  55. this.layerName = layerName;
  56. this.propertyName = propertyName;
  57. this.message = message;
  58. }
  59. public GisSurveyThirdImportElement(String kind, String upNO, String downNO, String layerName, String propertyName, String message) {
  60. this.kind = kind;
  61. this.upNO = upNO;
  62. this.downNO = downNO;
  63. this.layerName = layerName;
  64. this.propertyName = propertyName;
  65. this.message = message;
  66. }
  67. public static GisSurveyThirdImportElement create(Map<String, String> data, GisMetadataLayerTemplate layerTemplate
  68. , String propertyName, String message) {
  69. if (Objects.equals(GisMetadataDefine.TYPE_KINE.POINT, layerTemplate.getKind())) {
  70. return new GisSurveyThirdImportElement(GisMetadataDefine.TYPE_KINE.POINT,
  71. ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.NO),
  72. layerTemplate.getName(),
  73. propertyName,
  74. message
  75. );
  76. }
  77. if (Objects.equals(GisMetadataDefine.TYPE_KINE.LINE, layerTemplate.getKind())) {
  78. return new GisSurveyThirdImportElement(GisMetadataDefine.TYPE_KINE.LINE,
  79. ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.UP_NO),
  80. ThirdImportTemplateUtils.getValue(data, layerTemplate, GisSurveyExcelDefine.TEMPLATE.DOWN_NO),
  81. layerTemplate.getName(),
  82. propertyName,
  83. message
  84. );
  85. }
  86. return null;
  87. }
  88. public static GisSurveyThirdImportElement create(Map<String, String> data, GisMetadataLayerTemplate layerTemplate
  89. , String propertyName, String value, GisSurveyCondition condition, String message) {
  90. GisSurveyThirdImportElement element = create(data, layerTemplate, propertyName, message);
  91. if (element == null) return null;
  92. element.setValue(value);
  93. element.setCondition(condition);
  94. return element;
  95. }
  96. }