refactor(功能用例): 功能用例联调问题处理

This commit is contained in:
WangXu10 2024-01-09 10:32:59 +08:00 committed by 刘瑞斌
parent fbb478d19c
commit 4ca362a6a6
3 changed files with 11 additions and 6 deletions

View File

@ -16,12 +16,15 @@ public class ReviewFunctionalCaseDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Schema(description = "用例id")
@Schema(description = "id")
private String id;
@Schema(description = "用例名称")
private String name;
@Schema(description = "用例id")
private String caseId;
@Schema(description = "版本id")
private String versionId;

View File

@ -99,23 +99,24 @@ public class CaseReviewFunctionalCaseService {
private List<ReviewFunctionalCaseDTO> doHandleDTO(List<ReviewFunctionalCaseDTO> list, String reviewId) {
if (CollectionUtils.isNotEmpty(list)) {
List<String> ids = list.stream().map(ReviewFunctionalCaseDTO::getId).toList();
List<BaseTreeNode> modules = extFunctionalCaseModuleMapper.selectBaseByIds(ids);
List<String> moduleIds = list.stream().map(ReviewFunctionalCaseDTO::getModuleId).toList();
List<BaseTreeNode> modules = extFunctionalCaseModuleMapper.selectBaseByIds(moduleIds);
Map<String, String> moduleMap = modules.stream().collect(Collectors.toMap(BaseTreeNode::getId, BaseTreeNode::getName));
List<String> versionIds = list.stream().map(ReviewFunctionalCaseDTO::getVersionId).toList();
List<ProjectVersion> versions = extBaseProjectVersionMapper.getVersionByIds(versionIds);
Map<String, String> versionMap = versions.stream().collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
List<ReviewsDTO> reviewers = extCaseReviewFunctionalCaseUserMapper.selectReviewers(ids, reviewId);
List<String> caseIds = list.stream().map(ReviewFunctionalCaseDTO::getCaseId).toList();
List<ReviewsDTO> reviewers = extCaseReviewFunctionalCaseUserMapper.selectReviewers(caseIds, reviewId);
Map<String, String> userIdMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserIds));
Map<String, String> userNameMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserNames));
list.forEach(item -> {
item.setModuleName(moduleMap.get(item.getModuleId()));
item.setVersionName(versionMap.get(item.getVersionId()));
item.setReviewers(Collections.singletonList(userIdMap.get(item.getId())));
item.setReviewNames(Collections.singletonList(userNameMap.get(item.getId())));
item.setReviewers(Collections.singletonList(userIdMap.get(item.getCaseId())));
item.setReviewNames(Collections.singletonList(userNameMap.get(item.getCaseId())));
});
}
return list;

View File

@ -181,6 +181,7 @@ public class FunctionalCaseRelationshipEdgeService {
public void delete(String id) {
RelationshipEdgeUtils.updateGraphId(id, extFunctionalCaseRelationshipEdgeMapper::getGraphId, extFunctionalCaseRelationshipEdgeMapper::getEdgeByGraphId, extFunctionalCaseRelationshipEdgeMapper::update);
functionalCaseRelationshipEdgeMapper.deleteByPrimaryKey(id);
}