diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CommentEnum.java b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/CommentEnum.java similarity index 57% rename from backend/services/case-management/src/main/java/io/metersphere/functional/dto/CommentEnum.java rename to backend/services/case-management/src/main/java/io/metersphere/functional/constants/CommentEnum.java index fb4ca3cb0f..1fc5dd5d0b 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CommentEnum.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/CommentEnum.java @@ -1,4 +1,4 @@ -package io.metersphere.functional.dto; +package io.metersphere.functional.constants; public enum CommentEnum { CASE, TEST_PLAN, CASE_REVIEW diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java index 4493ad1ee0..f7f759de1a 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java @@ -15,6 +15,7 @@ import io.metersphere.project.dto.CustomFieldOptions; import io.metersphere.project.service.ProjectTemplateService; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.sdk.constants.TemplateScene; +import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.dto.sdk.TemplateDTO; import io.metersphere.system.log.annotation.Log; import io.metersphere.system.log.constants.OperationLogType; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/AssociationDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/AssociationDTO.java index df8d07e6ff..a1c399ebd0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/AssociationDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/AssociationDTO.java @@ -2,8 +2,8 @@ package io.metersphere.functional.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; import java.util.List; @@ -11,9 +11,8 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class AssociationDTO implements Serializable { - + @Serial private static final long serialVersionUID = 1L; @Schema(description = "类型",allowableValues = {"EMPTY","NOT_EMPTY"}) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/BaseFunctionalCaseBatchDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/BaseFunctionalCaseBatchDTO.java index aea1654a26..c76f57b48d 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/BaseFunctionalCaseBatchDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/BaseFunctionalCaseBatchDTO.java @@ -3,7 +3,6 @@ package io.metersphere.functional.dto; import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.List; @@ -12,11 +11,8 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class BaseFunctionalCaseBatchDTO extends TableBatchProcessDTO implements Serializable { - private static final long serialVersionUID = 1L; - @Schema(description = "模块id") private List moduleIds; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CaseCustomFieldDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CaseCustomFieldDTO.java index 8d8670585d..88a7c9c9d1 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CaseCustomFieldDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CaseCustomFieldDTO.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; +import java.io.Serial; import java.io.Serializable; import java.util.Objects; @@ -13,6 +14,7 @@ import java.util.Objects; @Data public class CaseCustomFieldDTO implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "字段id") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CombineDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CombineDTO.java index 1564f369a2..86dc8cd061 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CombineDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/CombineDTO.java @@ -1,7 +1,6 @@ package io.metersphere.functional.dto; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.List; @@ -10,7 +9,6 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class CombineDTO implements Serializable { private String id; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java index e1235af56c..88e04fd7fc 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java @@ -3,7 +3,6 @@ package io.metersphere.functional.dto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serializable; @@ -11,7 +10,6 @@ import java.io.Serializable; * @author guoyuqi */ @Data -@EqualsAndHashCode(callSuper = false) public class DemandDTO implements Serializable { @Schema(description = "需求ID") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FileUploadDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FileUploadDTO.java index b2dbeb0987..4dd8ab364d 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FileUploadDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FileUploadDTO.java @@ -1,14 +1,14 @@ package io.metersphere.functional.dto; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; @Data -@EqualsAndHashCode(callSuper = false) public class FileUploadDTO implements Serializable { + @Serial private static final long serialVersionUID = 1L; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseAttachmentDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseAttachmentDTO.java index 086680e2cf..d911720cff 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseAttachmentDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseAttachmentDTO.java @@ -2,17 +2,17 @@ package io.metersphere.functional.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseAttachmentDTO implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "ID") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java index ba686528a6..267bdac3f7 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java @@ -3,8 +3,8 @@ package io.metersphere.functional.dto; import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; import java.util.List; @@ -12,9 +12,9 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseDetailDTO implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "ID") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCasePageDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCasePageDTO.java index d02327031b..532228c99b 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCasePageDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCasePageDTO.java @@ -4,7 +4,6 @@ import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.domain.FunctionalCaseCustomField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; import java.util.List; @@ -12,7 +11,6 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCasePageDTO extends FunctionalCase { diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseVersionDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseVersionDTO.java index d65ec5fc55..e85ecdb949 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseVersionDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseVersionDTO.java @@ -2,17 +2,17 @@ package io.metersphere.functional.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseVersionDTO implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "用例id") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewFollowerRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewFollowerRequest.java index 45bf2a8130..b511d3ab0a 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewFollowerRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewFollowerRequest.java @@ -3,17 +3,17 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author guoyuqi */ @Data -@EqualsAndHashCode(callSuper = false) public class CaseReviewFollowerRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewRequest.java index d899397273..1e207558a2 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/CaseReviewRequest.java @@ -5,14 +5,12 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serial; import java.io.Serializable; import java.util.List; @Data -@EqualsAndHashCode(callSuper = false) public class CaseReviewRequest implements Serializable { @Serial diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseAddRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseAddRequest.java index d2aa580ad4..0f67a8aad7 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseAddRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseAddRequest.java @@ -3,8 +3,8 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; import java.util.List; import java.util.Map; @@ -13,9 +13,9 @@ import java.util.Map; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseAddRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchEditRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchEditRequest.java index 8a9d60bfd4..c459c32156 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchEditRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchEditRequest.java @@ -4,7 +4,6 @@ import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO; import io.metersphere.functional.dto.CaseCustomFieldDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; import java.util.List; @@ -12,7 +11,6 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseBatchEditRequest extends BaseFunctionalCaseBatchDTO { diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchMoveRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchMoveRequest.java index 7dafdb0077..556a7bc524 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchMoveRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchMoveRequest.java @@ -2,13 +2,11 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseBatchMoveRequest extends FunctionalCaseBatchRequest { @Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchRequest.java index 92ab22087f..add323a3d5 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseBatchRequest.java @@ -3,13 +3,11 @@ package io.metersphere.functional.request; import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseBatchRequest extends BaseFunctionalCaseBatchDTO { diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseCommentRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseCommentRequest.java index 734f9d9a94..fce2d7a7e0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseCommentRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseCommentRequest.java @@ -5,10 +5,8 @@ import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseCommentRequest { @Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDeleteRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDeleteRequest.java index 9e23ed2806..48a11f44d1 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDeleteRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDeleteRequest.java @@ -3,16 +3,16 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseDeleteRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDemandRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDemandRequest.java index 76b1822998..f47d834321 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDemandRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseDemandRequest.java @@ -5,7 +5,6 @@ import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; import java.util.List; @@ -13,7 +12,6 @@ import java.util.List; * @author guoyuqi */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseDemandRequest { @Schema(description = "功能用例需求关系ID") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseEditRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseEditRequest.java index 8ff3c696e8..4bb3d4fa45 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseEditRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseEditRequest.java @@ -3,7 +3,6 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; import java.util.List; @@ -11,7 +10,6 @@ import java.util.List; * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseEditRequest extends FunctionalCaseAddRequest { @Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFileRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFileRequest.java index a001b5f2c8..b40a6192f6 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFileRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFileRequest.java @@ -2,17 +2,17 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseFileRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "项目id",requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFollowerRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFollowerRequest.java index af32f078d5..e8d9cc0537 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFollowerRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseFollowerRequest.java @@ -3,17 +3,17 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class FunctionalCaseFollowerRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java index 3d1a9b4e5f..3d678eef41 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java @@ -5,17 +5,18 @@ import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; +import java.io.Serializable; import java.util.List; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) -public class FunctionalCasePageRequest extends BasePageRequest { +public class FunctionalCasePageRequest extends BasePageRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/TemplateFieldsRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/TemplateFieldsRequest.java index 9cf866df1e..d28c6fff1d 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/TemplateFieldsRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/TemplateFieldsRequest.java @@ -3,17 +3,17 @@ package io.metersphere.functional.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import lombok.EqualsAndHashCode; +import java.io.Serial; import java.io.Serializable; /** * @author wx */ @Data -@EqualsAndHashCode(callSuper = false) public class TemplateFieldsRequest implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "模板id") diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java index 5b7f20a9f3..bb8bc93bc1 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java @@ -4,7 +4,7 @@ package io.metersphere.functional.service; import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.domain.FunctionalCaseComment; import io.metersphere.functional.domain.FunctionalCaseCommentExample; -import io.metersphere.functional.dto.CommentEnum; +import io.metersphere.functional.constants.CommentEnum; import io.metersphere.functional.dto.FunctionalCaseCommentDTO; import io.metersphere.functional.dto.FunctionalCaseDTO; import io.metersphere.functional.mapper.FunctionalCaseCommentMapper; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 44110f19a9..0cb67ca21c 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -10,7 +10,6 @@ import io.metersphere.functional.mapper.FunctionalCaseFollowerMapper; import io.metersphere.functional.mapper.FunctionalCaseMapper; import io.metersphere.functional.request.*; import io.metersphere.functional.result.CaseManagementResultCode; -import io.metersphere.functional.util.ServiceUtils; import io.metersphere.project.domain.FileAssociation; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.mapper.ExtBaseProjectVersionMapper; @@ -24,8 +23,10 @@ import io.metersphere.sdk.util.CommonBeanFactory; import io.metersphere.sdk.util.JSON; import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO; import io.metersphere.system.dto.sdk.TemplateDTO; +import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.NumGenerator; +import io.metersphere.system.utils.ServiceUtils; import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -633,7 +634,7 @@ public class FunctionalCaseService { } public void editPos(PosRequest request) { - ServiceUtils.updateOrderField(request, + ServiceUtils.updatePosField(request, FunctionalCase.class, functionalCaseMapper::selectByPrimaryKey, extFunctionalCaseMapper::getPrePos, diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java b/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java deleted file mode 100644 index cfcb12da93..0000000000 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.metersphere.functional.util; - -import io.metersphere.functional.constants.MoveTypeEnum; -import io.metersphere.functional.request.PosRequest; -import io.metersphere.sdk.exception.MSException; - -import java.lang.reflect.Method; -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; - -public class ServiceUtils { - - public static final int POS_STEP = 5000; - - public static void updateOrderField(PosRequest request, Class clazz, - Function selectByPrimaryKeyFunc, - BiFunction getPreOrderFunc, - BiFunction getLastOrderFunc, - Consumer updateByPrimaryKeySelectiveFuc) { - Long pos; - Long lastOrPrePos; - try { - Method getPos = clazz.getMethod("getPos"); - Method setId = clazz.getMethod("setId", String.class); - Method setPos = clazz.getMethod("setPos", Long.class); - - // 获取移动的参考对象 - T target = selectByPrimaryKeyFunc.apply(request.getTargetId()); - - if (target == null) { - // 如果参考对象被删除,则不处理 - return; - } - - Long targetOrder = (Long) getPos.invoke(target); - - if (request.getMoveMode().equals(MoveTypeEnum.AFTER.name())) { - // 追加到参考对象的之后 - pos = targetOrder - ServiceUtils.POS_STEP; - // ,因为是降序排,则查找比目标 order 小的一个order - lastOrPrePos = getPreOrderFunc.apply(request.getProjectId(), targetOrder); - } else { - // 追加到前面 - pos = targetOrder + ServiceUtils.POS_STEP; - // 因为是降序排,则查找比目标 order 更大的一个order - lastOrPrePos = getLastOrderFunc.apply(request.getProjectId(), targetOrder); - } - if (lastOrPrePos != null) { - // 如果不是第一个或最后一个则取中间值 - pos = (targetOrder + lastOrPrePos) / 2; - } - - // 更新order值 - T updateObj = (T) clazz.getDeclaredConstructor().newInstance(); - setId.invoke(updateObj, request.getMoveId()); - setPos.invoke(updateObj, pos); - updateByPrimaryKeySelectiveFuc.accept(updateObj); - } catch (Exception e) { - throw new MSException("更新 order 字段失败"); - } - } -} diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java index 012b673502..ca48b48b51 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java @@ -16,6 +16,7 @@ import io.metersphere.sdk.util.JSON; import io.metersphere.system.base.BaseTest; import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.domain.CustomField; +import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.mapper.CustomFieldMapper; import io.metersphere.system.notice.constants.NoticeConstants; import io.metersphere.system.utils.Pager; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/enums/MoveTypeEnum.java similarity index 65% rename from backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java rename to backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/enums/MoveTypeEnum.java index eb220bc1fb..404c9ffbb2 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/enums/MoveTypeEnum.java @@ -1,4 +1,4 @@ -package io.metersphere.functional.constants; +package io.metersphere.system.dto.sdk.enums; /** * @author wx diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/request/PosRequest.java similarity index 96% rename from backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java rename to backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/request/PosRequest.java index 7ae8095fe9..d544cc6ac7 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/request/PosRequest.java @@ -1,4 +1,4 @@ -package io.metersphere.functional.request; +package io.metersphere.system.dto.sdk.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java b/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java index 54554685d9..572118a40f 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java @@ -1,11 +1,20 @@ package io.metersphere.system.utils; import io.metersphere.sdk.exception.MSException; +import io.metersphere.system.dto.sdk.enums.MoveTypeEnum; +import io.metersphere.system.dto.sdk.request.PosRequest; + +import java.lang.reflect.Method; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; import static io.metersphere.system.controller.handler.result.MsHttpResultCode.NOT_FOUND; public class ServiceUtils { + public static final int POS_STEP = 5000; + /** * 保存资源名称,在处理 NOT_FOUND 异常时,拼接资源名称 */ @@ -33,4 +42,52 @@ public class ServiceUtils { public static void clearResourceName() { resourceName.remove(); } + + public static void updatePosField(PosRequest request, Class clazz, + Function selectByPrimaryKeyFunc, + BiFunction getPrePosFunc, + BiFunction getLastPosFunc, + Consumer updateByPrimaryKeySelectiveFuc) { + Long pos; + Long lastOrPrePos; + try { + Method getPos = clazz.getMethod("getPos"); + Method setId = clazz.getMethod("setId", String.class); + Method setPos = clazz.getMethod("setPos", Long.class); + + // 获取移动的参考对象 + T target = selectByPrimaryKeyFunc.apply(request.getTargetId()); + + if (target == null) { + // 如果参考对象被删除,则不处理 + return; + } + + Long targetPos = (Long) getPos.invoke(target); + + if (request.getMoveMode().equals(MoveTypeEnum.AFTER.name())) { + // 追加到参考对象的之后 + pos = targetPos - POS_STEP; + // ,因为是降序排,则查找比目标 order 小的一个order + lastOrPrePos = getPrePosFunc.apply(request.getProjectId(), targetPos); + } else { + // 追加到前面 + pos = targetPos + POS_STEP; + // 因为是降序排,则查找比目标 order 更大的一个order + lastOrPrePos = getLastPosFunc.apply(request.getProjectId(), targetPos); + } + if (lastOrPrePos != null) { + // 如果不是第一个或最后一个则取中间值 + pos = (targetPos + lastOrPrePos) / 2; + } + + // 更新order值 + T updateObj = (T) clazz.getDeclaredConstructor().newInstance(); + setId.invoke(updateObj, request.getMoveId()); + setPos.invoke(updateObj, pos); + updateByPrimaryKeySelectiveFuc.accept(updateObj); + } catch (Exception e) { + throw new MSException("更新 pos 字段失败"); + } + } }