mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(用例管理): 修复评审批量取消关联用例有一个用例关联多个评审导致用例最后结果计算错误问题
--bug=1036899 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036899
This commit is contained in:
parent
638af8a922
commit
14bd29d33c
@ -128,32 +128,35 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
FunctionalCaseMapper mapper = sqlSession.getMapper(FunctionalCaseMapper.class);
|
||||
if (CollectionUtils.isEmpty(otherReviewFunctionalCases)) {
|
||||
for (String id : caseIdList) {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(id);
|
||||
functionalCase.setReviewStatus(FunctionalCaseReviewStatus.UN_REVIEWED.toString());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
}
|
||||
setUnReviewCase(caseIdList, mapper);
|
||||
} else {
|
||||
//如果不为空,那就把不为空的设置为上一次的结果,再取caseIdList的id,与map的key的差集,则为要置为未评审的
|
||||
Map<String, List<CaseReviewFunctionalCase>> collect = otherReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getCaseId));
|
||||
List<String>hasMoreReviewCaseIds = new ArrayList<>(collect.keySet());
|
||||
caseIdList.removeAll(hasMoreReviewCaseIds);
|
||||
if (CollectionUtils.isNotEmpty(caseIdList)) {
|
||||
setUnReviewCase(caseIdList, mapper);
|
||||
}
|
||||
collect.forEach((caseId, caseList) -> {
|
||||
if (!caseIdList.contains(caseId)) {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(caseId);
|
||||
functionalCase.setReviewStatus(FunctionalCaseReviewStatus.UN_REVIEWED.toString());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
} else {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(caseId);
|
||||
functionalCase.setReviewStatus(caseList.get(0).getStatus());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
}
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(caseId);
|
||||
functionalCase.setReviewStatus(caseList.get(0).getStatus());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
});
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
}
|
||||
|
||||
private static void setUnReviewCase(List<String> caseIdList, FunctionalCaseMapper mapper) {
|
||||
for (String id : caseIdList) {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(id);
|
||||
functionalCase.setReviewStatus(FunctionalCaseReviewStatus.UN_REVIEWED.toString());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.功能用例的删除/批量删除重新计算用例评审的通过率和用例数
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user