GisSurveyCheckParams.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package com.shkpr.service.alambizplugin.apiparam;
  2. import com.shkpr.service.alambizplugin.constants.GisSurveyCheckTypeEnum;
  3. import com.shkpr.service.alambizplugin.controllervalid.CommonParamValidSK;
  4. import lombok.Getter;
  5. import lombok.Setter;
  6. import org.apache.commons.lang3.StringUtils;
  7. import javax.validation.constraints.NotNull;
  8. import javax.validation.constraints.Size;
  9. import java.time.LocalDateTime;
  10. import java.util.Arrays;
  11. import java.util.Objects;
  12. /**
  13. * 系统检查入参
  14. *
  15. * @author 欧阳劲驰
  16. * @since 1.0.0
  17. */
  18. @Getter
  19. @Setter
  20. public class GisSurveyCheckParams {
  21. /**
  22. * 检查类型:0:项目,1:任务
  23. */
  24. @NotNull(groups = {CommonParamValidSK.class})
  25. private Integer checkType;
  26. /**
  27. * 项目id
  28. */
  29. @Size(max = 64, groups = {CommonParamValidSK.class})
  30. private String projId;
  31. /**
  32. * 任务id
  33. */
  34. @Size(max = 64, groups = {CommonParamValidSK.class})
  35. private String jobId;
  36. /**
  37. * 当前操作人id
  38. */
  39. @NotNull(groups = {CommonParamValidSK.class})
  40. @Size(max = 64, groups = {CommonParamValidSK.class})
  41. private String operator;
  42. /**
  43. * 忽略失败
  44. */
  45. private Boolean ignoreFail = false;
  46. /**
  47. * 返回上次结果
  48. */
  49. private Boolean returnLastResult = false;
  50. /**
  51. * 是否启动检查(满足检查条件的情况下)
  52. */
  53. private Boolean checkStart = true;
  54. /**
  55. * 孤立点启动
  56. */
  57. private Boolean isolatedPointsStart = true;
  58. /**
  59. * 孤立线启动
  60. */
  61. private Boolean isolatedLinesStart = true;
  62. /**
  63. * 重复点启动
  64. */
  65. private Boolean duplicatePointsStart = true;
  66. /**
  67. * 重叠线启动
  68. */
  69. private Boolean overlapLinesStart = true;
  70. /**
  71. * 元素/属性的变化时间
  72. * <p>系统内部用</p>
  73. */
  74. private LocalDateTime refreshTime;
  75. /**
  76. * 入参校验
  77. *
  78. * @return 校验状态
  79. */
  80. public boolean checkValid() {
  81. //检查项目类型
  82. if (checkType == null || Arrays.stream(GisSurveyCheckTypeEnum.values())
  83. .noneMatch(e -> Objects.equals(e.getCode(), checkType))) {
  84. return false;
  85. }
  86. //检查项目ID和任务ID
  87. if (Objects.equals(checkType, GisSurveyCheckTypeEnum.PROJECT.getCode())) {
  88. return StringUtils.isNotBlank(projId);
  89. } else if (Objects.equals(checkType, GisSurveyCheckTypeEnum.JOB.getCode())) {
  90. return StringUtils.isNotBlank(jobId);
  91. }
  92. return false;
  93. }
  94. }