fix(测试跟踪): 用例评审列表跨项目用例,责任人显示可能为空
--bug=1024451 --user=陈建星 【测试跟踪】用例评审-关联跨项目用例-责任人未显示 https://www.tapd.cn/55049933/s/1351037
This commit is contained in:
parent
1348fad4df
commit
f840218c8f
|
@ -81,10 +81,20 @@ public class TestReviewTestCaseService {
|
||||||
ServiceUtils.buildProjectInfo(list);
|
ServiceUtils.buildProjectInfo(list);
|
||||||
ServiceUtils.buildCustomNumInfo(list);
|
ServiceUtils.buildCustomNumInfo(list);
|
||||||
|
|
||||||
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
|
// 责任人
|
||||||
queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentProjectId());
|
List<String> userIds = list.stream()
|
||||||
Map<String, String> userMap = baseUserService.getMemberList(queryMemberRequest)
|
.map(TestReviewCaseDTO::getMaintainer)
|
||||||
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<String> caseIds = list.stream()
|
||||||
|
.map(TestReviewCaseDTO::getCaseId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 查询评审人
|
||||||
|
userIds.addAll(getReviewUserIds(request.getReviewId(), caseIds));
|
||||||
|
|
||||||
|
Map<String, String> userNameMap = ServiceUtils.getUserNameMap(userIds);
|
||||||
|
|
||||||
List<String> versionIds = list.stream().map(TestReviewCaseDTO::getVersionId).collect(Collectors.toList());
|
List<String> versionIds = list.stream().map(TestReviewCaseDTO::getVersionId).collect(Collectors.toList());
|
||||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
||||||
if (projectVersionService != null) {
|
if (projectVersionService != null) {
|
||||||
|
@ -96,11 +106,9 @@ public class TestReviewTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
String reviewId = item.getReviewId();
|
// 设置责任人和评审人名称
|
||||||
String caseId = item.getCaseId();
|
item.setReviewerName(getReviewName(userIds, userNameMap));
|
||||||
List<String> userIds = getReviewUserIds(reviewId, caseId);
|
item.setMaintainerName(userNameMap.get(item.getMaintainer()));
|
||||||
item.setReviewerName(getReviewName(userIds, userMap));
|
|
||||||
item.setMaintainerName(userMap.get(item.getMaintainer()));
|
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -678,6 +686,16 @@ public class TestReviewTestCaseService {
|
||||||
return testCaseReviewUsers.stream().map(TestCaseReviewTestCaseUsers::getUserId).collect(Collectors.toList());
|
return testCaseReviewUsers.stream().map(TestCaseReviewTestCaseUsers::getUserId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> getReviewUserIds(String reviewId, List<String> caseIds) {
|
||||||
|
if (CollectionUtils.isEmpty(caseIds)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
TestCaseReviewTestCaseUsersExample testCaseReviewTestCaseUsersExample = new TestCaseReviewTestCaseUsersExample();
|
||||||
|
testCaseReviewTestCaseUsersExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdIn(caseIds);
|
||||||
|
List<TestCaseReviewTestCaseUsers> testCaseReviewUsers = testCaseReviewTestCaseUsersMapper.selectByExample(testCaseReviewTestCaseUsersExample);
|
||||||
|
return testCaseReviewUsers.stream().map(TestCaseReviewTestCaseUsers::getUserId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
public List<TestCaseReviewTestCase> getCaseStatusByReviewIds(List<String> reviewIds) {
|
public List<TestCaseReviewTestCase> getCaseStatusByReviewIds(List<String> reviewIds) {
|
||||||
if (CollectionUtils.isEmpty(reviewIds)) {
|
if (CollectionUtils.isEmpty(reviewIds)) {
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
|
|
Loading…
Reference in New Issue