refactor(功能用例): 功能用例增加各个评论数量

This commit is contained in:
guoyuqi 2024-06-13 15:42:34 +08:00 committed by 刘瑞斌
parent 86cbd0efbb
commit 430b0add87
3 changed files with 22 additions and 4 deletions

View File

@ -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<OptionDTO> commentList;
@Schema(description = "变更历史数量")
private Integer historyCount;

View File

@ -450,7 +450,7 @@ public class FunctionalCaseMinderService {
List<MindAdditionalNodeRequest> updateList = resourceMap.get(OperationLogType.UPDATE.toString());
if (CollectionUtils.isNotEmpty(updateList)) {
List<MindAdditionalNode> nodes = new ArrayList<>();
Map<String, List<MindAdditionalNode>> parentModuleMap = getParentNodeMap(addList);
Map<String, List<MindAdditionalNode>> parentModuleMap = getParentNodeMap(updateList);
for (MindAdditionalNodeRequest mindAdditionalNodeRequest : updateList) {
MindAdditionalNode updateModule = updateNode(userId, mindAdditionalNodeRequest, additionalNodeMapper);
nodes.add(updateModule);

View File

@ -428,16 +428,30 @@ public class FunctionalCaseService {
}
//获取评论总数量数量
CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample();
caseReviewHistoryExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
long reviewComment = caseReviewHistoryMapper.countByExample(caseReviewHistoryExample);
List<OptionDTO>commentList = 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);
//获取变更历史数量数量