From 430b0add871b45822db4851d6f082144383acb92 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 13 Jun 2024 15:42:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):?= =?UTF-8?q?=20=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=90=84=E4=B8=AA=E8=AF=84=E8=AE=BA=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/FunctionalCaseDetailDTO.java | 4 ++++ .../service/FunctionalCaseMinderService.java | 2 +- .../service/FunctionalCaseService.java | 20 ++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) 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 f716996c36..a427a4c5ed 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 @@ -1,5 +1,6 @@ package io.metersphere.functional.dto; +import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -116,6 +117,9 @@ public class FunctionalCaseDetailDTO implements Serializable { @Schema(description = "评论总数量") private Integer commentCount; + @Schema(description = "各种评论数量集合") + private List commentList; + @Schema(description = "变更历史数量") private Integer historyCount; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index cbea95d49a..7e1bc80152 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -450,7 +450,7 @@ public class FunctionalCaseMinderService { List updateList = resourceMap.get(OperationLogType.UPDATE.toString()); if (CollectionUtils.isNotEmpty(updateList)) { List nodes = new ArrayList<>(); - Map> parentModuleMap = getParentNodeMap(addList); + Map> parentModuleMap = getParentNodeMap(updateList); for (MindAdditionalNodeRequest mindAdditionalNodeRequest : updateList) { MindAdditionalNode updateModule = updateNode(userId, mindAdditionalNodeRequest, additionalNodeMapper); nodes.add(updateModule); 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 8d52838cc3..95248dcec7 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 @@ -428,16 +428,30 @@ public class FunctionalCaseService { } //获取评论总数量数量 - CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample(); - caseReviewHistoryExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId()); - long reviewComment = caseReviewHistoryMapper.countByExample(caseReviewHistoryExample); + ListcommentList = new ArrayList<>(); FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample(); functionalCaseCommentExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId()); long caseComment = functionalCaseCommentMapper.countByExample(functionalCaseCommentExample); + OptionDTO caseOption = new OptionDTO(); + caseOption.setId("caseComment"); + caseOption.setName(String.valueOf(caseComment)); + commentList.add(0,caseOption); + CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample(); + caseReviewHistoryExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId()); + long reviewComment = caseReviewHistoryMapper.countByExample(caseReviewHistoryExample); + OptionDTO reviewOption = new OptionDTO(); + reviewOption.setId("reviewComment"); + reviewOption.setName(String.valueOf(reviewComment)); + commentList.add(1,reviewOption); //获取关联测试计划的执行评论数量 TestPlanCaseExecuteHistoryExample testPlanCaseExecuteHistoryExample = new TestPlanCaseExecuteHistoryExample(); testPlanCaseExecuteHistoryExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId()); long testPlanExecuteComment = testPlanCaseExecuteHistoryMapper.countByExample(testPlanCaseExecuteHistoryExample); + OptionDTO executeOption = new OptionDTO(); + executeOption.setId("executiveComment"); + executeOption.setName(String.valueOf(reviewComment)); + commentList.add(2,executeOption); + functionalCaseDetailDTO.setCommentList(commentList); long commentCount = caseComment + reviewComment + testPlanExecuteComment; functionalCaseDetailDTO.setCommentCount((int) commentCount); //获取变更历史数量数量