feat(功能用例): 用例详情tab数量统计
This commit is contained in:
parent
2e51b7c9d1
commit
22fdae5612
|
@ -21,7 +21,7 @@ public class FunctionalCaseDetailDTO implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(description = "业务ID")
|
@Schema(description = "业务ID")
|
||||||
private Integer num;
|
private Long num;
|
||||||
|
|
||||||
@Schema(description = "模块ID")
|
@Schema(description = "模块ID")
|
||||||
private String moduleId;
|
private String moduleId;
|
||||||
|
@ -91,4 +91,22 @@ public class FunctionalCaseDetailDTO implements Serializable {
|
||||||
|
|
||||||
@Schema(description = "用例等级")
|
@Schema(description = "用例等级")
|
||||||
private String functionalPriority;
|
private String functionalPriority;
|
||||||
|
|
||||||
|
@Schema(description = "需求数量")
|
||||||
|
private Integer demandCount;
|
||||||
|
|
||||||
|
@Schema(description = "用例数量")
|
||||||
|
private Integer caseCount;
|
||||||
|
|
||||||
|
@Schema(description = "缺陷数量")
|
||||||
|
private Integer bugCount;
|
||||||
|
|
||||||
|
@Schema(description = "依赖关系数量")
|
||||||
|
private Integer relateEdgeCount;
|
||||||
|
|
||||||
|
@Schema(description = "用例评审数量")
|
||||||
|
private Integer caseReviewCount;
|
||||||
|
|
||||||
|
@Schema(description = "测试计划数量")
|
||||||
|
private Integer testPlanCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
</choose>
|
</choose>
|
||||||
order by
|
order by
|
||||||
<if test="sort != null and sort != ''">
|
<if test="sort != null and sort != ''">
|
||||||
crfc.${sort}
|
functional_case.${sort}
|
||||||
</if>
|
</if>
|
||||||
<if test="sort == null or sort == ''">
|
<if test="sort == null or sort == ''">
|
||||||
crfc.pos desc
|
crfc.pos desc
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package io.metersphere.functional.service;
|
package io.metersphere.functional.service;
|
||||||
|
|
||||||
|
import io.metersphere.bug.domain.BugRelationCaseExample;
|
||||||
|
import io.metersphere.bug.mapper.BugRelationCaseMapper;
|
||||||
import io.metersphere.functional.constants.CaseEvent;
|
import io.metersphere.functional.constants.CaseEvent;
|
||||||
import io.metersphere.functional.constants.CaseFileSourceType;
|
import io.metersphere.functional.constants.CaseFileSourceType;
|
||||||
import io.metersphere.functional.constants.FunctionalCaseReviewStatus;
|
import io.metersphere.functional.constants.FunctionalCaseReviewStatus;
|
||||||
import io.metersphere.functional.domain.*;
|
import io.metersphere.functional.domain.*;
|
||||||
import io.metersphere.functional.dto.*;
|
import io.metersphere.functional.dto.*;
|
||||||
import io.metersphere.functional.mapper.ExtFunctionalCaseMapper;
|
import io.metersphere.functional.mapper.*;
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseBlobMapper;
|
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseFollowerMapper;
|
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
|
||||||
import io.metersphere.functional.request.*;
|
import io.metersphere.functional.request.*;
|
||||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||||
import io.metersphere.project.domain.FileAssociation;
|
import io.metersphere.project.domain.FileAssociation;
|
||||||
|
@ -104,6 +103,18 @@ public class FunctionalCaseService {
|
||||||
private static final String UPDATE_FUNCTIONAL_CASE_FILE_LOG_URL = "/functional/case/update";
|
private static final String UPDATE_FUNCTIONAL_CASE_FILE_LOG_URL = "/functional/case/update";
|
||||||
private static final String FUNCTIONAL_CASE_BATCH_COPY_FILE_LOG_URL = "/functional/case/batch/copy";
|
private static final String FUNCTIONAL_CASE_BATCH_COPY_FILE_LOG_URL = "/functional/case/batch/copy";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FunctionalCaseDemandMapper functionalCaseDemandMapper;
|
||||||
|
@Resource
|
||||||
|
private FunctionalCaseTestMapper functionalCaseTestMapper;
|
||||||
|
@Resource
|
||||||
|
private BugRelationCaseMapper bugRelationCaseMapper;
|
||||||
|
@Resource
|
||||||
|
private FunctionalCaseRelationshipEdgeMapper functionalCaseRelationshipEdgeMapper;
|
||||||
|
@Resource
|
||||||
|
private CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper;
|
||||||
|
|
||||||
|
|
||||||
public FunctionalCase addFunctionalCase(FunctionalCaseAddRequest request, List<MultipartFile> files, String userId) {
|
public FunctionalCase addFunctionalCase(FunctionalCaseAddRequest request, List<MultipartFile> files, String userId) {
|
||||||
String caseId = IDGenerator.nextStr();
|
String caseId = IDGenerator.nextStr();
|
||||||
//添加功能用例
|
//添加功能用例
|
||||||
|
@ -112,7 +123,7 @@ public class FunctionalCaseService {
|
||||||
//上传文件
|
//上传文件
|
||||||
functionalCaseAttachmentService.uploadFile(request.getProjectId(), caseId, files, true, userId);
|
functionalCaseAttachmentService.uploadFile(request.getProjectId(), caseId, files, true, userId);
|
||||||
|
|
||||||
functionalCaseAttachmentService.uploadMinioFile(caseId,request.getProjectId(),request.getCaseDetailFileIds(),userId, CaseFileSourceType.CASE_DETAIL.toString());
|
functionalCaseAttachmentService.uploadMinioFile(caseId, request.getProjectId(), request.getCaseDetailFileIds(), userId, CaseFileSourceType.CASE_DETAIL.toString());
|
||||||
|
|
||||||
//关联附件
|
//关联附件
|
||||||
if (CollectionUtils.isNotEmpty(request.getRelateFileMetaIds())) {
|
if (CollectionUtils.isNotEmpty(request.getRelateFileMetaIds())) {
|
||||||
|
@ -230,10 +241,42 @@ public class FunctionalCaseService {
|
||||||
functionalCaseDetailDTO.setVersionName(versions.get(0).getName());
|
functionalCaseDetailDTO.setVersionName(versions.get(0).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理已关联需求数量/缺陷数量/用例数量
|
||||||
|
handleCount(functionalCaseDetailDTO);
|
||||||
|
|
||||||
return functionalCaseDetailDTO;
|
return functionalCaseDetailDTO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleCount(FunctionalCaseDetailDTO functionalCaseDetailDTO) {
|
||||||
|
//获取已关联需求数量
|
||||||
|
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||||
|
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
|
||||||
|
functionalCaseDetailDTO.setDemandCount((int) functionalCaseDemandMapper.countByExample(functionalCaseDemandExample));
|
||||||
|
//获取已关联用例数量
|
||||||
|
FunctionalCaseTestExample caseTestExample = new FunctionalCaseTestExample();
|
||||||
|
caseTestExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
|
||||||
|
functionalCaseDetailDTO.setCaseCount((int) functionalCaseTestMapper.countByExample(caseTestExample));
|
||||||
|
//获取已关联缺陷数量
|
||||||
|
BugRelationCaseExample bugRelationCaseExample = new BugRelationCaseExample();
|
||||||
|
bugRelationCaseExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
|
||||||
|
functionalCaseDetailDTO.setBugCount((int) bugRelationCaseMapper.countByExample(bugRelationCaseExample));
|
||||||
|
//获取已关联依赖关系数量
|
||||||
|
FunctionalCaseRelationshipEdgeExample relationshipEdgeExample = new FunctionalCaseRelationshipEdgeExample();
|
||||||
|
relationshipEdgeExample.createCriteria()
|
||||||
|
.andSourceIdEqualTo(functionalCaseDetailDTO.getId());
|
||||||
|
relationshipEdgeExample.or(
|
||||||
|
relationshipEdgeExample.createCriteria()
|
||||||
|
.andTargetIdEqualTo(functionalCaseDetailDTO.getId())
|
||||||
|
);
|
||||||
|
functionalCaseDetailDTO.setRelateEdgeCount((int) functionalCaseRelationshipEdgeMapper.countByExample(relationshipEdgeExample));
|
||||||
|
//获取已关联用例评审数量
|
||||||
|
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||||
|
caseReviewFunctionalCaseExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
|
||||||
|
functionalCaseDetailDTO.setCaseReviewCount((int) caseReviewFunctionalCaseMapper.countByExample(caseReviewFunctionalCaseExample));
|
||||||
|
//TODO 获取已关联测试计划数量
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Boolean checkIsFollowCase(String caseId, String userId) {
|
private Boolean checkIsFollowCase(String caseId, String userId) {
|
||||||
FunctionalCaseFollowerExample example = new FunctionalCaseFollowerExample();
|
FunctionalCaseFollowerExample example = new FunctionalCaseFollowerExample();
|
||||||
|
@ -320,7 +363,7 @@ public class FunctionalCaseService {
|
||||||
functionalCaseAttachmentService.uploadFile(request.getProjectId(), request.getId(), files, true, userId);
|
functionalCaseAttachmentService.uploadFile(request.getProjectId(), request.getId(), files, true, userId);
|
||||||
|
|
||||||
//上传副文本文件
|
//上传副文本文件
|
||||||
functionalCaseAttachmentService.uploadMinioFile(request.getId(),request.getProjectId(),request.getCaseDetailFileIds(),userId,CaseFileSourceType.CASE_DETAIL.toString());
|
functionalCaseAttachmentService.uploadMinioFile(request.getId(), request.getProjectId(), request.getCaseDetailFileIds(), userId, CaseFileSourceType.CASE_DETAIL.toString());
|
||||||
|
|
||||||
//关联新附件
|
//关联新附件
|
||||||
if (CollectionUtils.isNotEmpty(request.getRelateFileMetaIds())) {
|
if (CollectionUtils.isNotEmpty(request.getRelateFileMetaIds())) {
|
||||||
|
|
Loading…
Reference in New Issue