fix: 修改缺陷平台后缺陷列表报错

--bug=1010179 --user=陈建星 【测试跟踪】-第三方平台改为jira后,在缺陷管理页提示tapd错误信息 https://www.tapd.cn/55049933/s/1102859
This commit is contained in:
chenjianxing 2022-02-10 17:59:25 +08:00 committed by jianxing
parent 22016e704e
commit bd4aca287a
1 changed files with 4 additions and 2 deletions

View File

@ -339,6 +339,8 @@ public class IssuesService {
Map<String, String> planMap = testPlans.stream() Map<String, String> planMap = testPlans.stream()
.collect(Collectors.toMap(TestPlan::getId, TestPlan::getName)); .collect(Collectors.toMap(TestPlan::getId, TestPlan::getName));
Project project = projectService.getProjectById(request.getProjectId());
issues.forEach(item -> { issues.forEach(item -> {
User createUser = userMap.get(item.getCreator()); User createUser = userMap.get(item.getCreator());
if (createUser != null) { if (createUser != null) {
@ -355,12 +357,12 @@ public class IssuesService {
.collect(Collectors.toList()); .collect(Collectors.toList());
item.setCaseIds(caseIds); item.setCaseIds(caseIds);
item.setCaseCount(testCaseIssues.size()); item.setCaseCount(testCaseIssues.size());
if (StringUtils.equals(item.getPlatform(), "Tapd")) { if (IssuesManagePlatform.Tapd.name().equals(project.getPlatform()) && StringUtils.equals(item.getPlatform(), IssuesManagePlatform.Tapd.name())) {
TapdPlatform platform = (TapdPlatform) IssueFactory.createPlatform(item.getPlatform(), request); TapdPlatform platform = (TapdPlatform) IssueFactory.createPlatform(item.getPlatform(), request);
List<String> tapdUsers = platform.getTapdUsers(item.getProjectId(), item.getPlatformId()); List<String> tapdUsers = platform.getTapdUsers(item.getProjectId(), item.getPlatformId());
item.setTapdUsers(tapdUsers); item.setTapdUsers(tapdUsers);
} }
if (StringUtils.equals(item.getPlatform(), "Zentao")) { if (IssuesManagePlatform.Zentao.name().equals(project.getPlatform()) && StringUtils.equals(item.getPlatform(), IssuesManagePlatform.Zentao.name())) {
ZentaoPlatform platform = (ZentaoPlatform) IssueFactory.createPlatform(item.getPlatform(), request); ZentaoPlatform platform = (ZentaoPlatform) IssueFactory.createPlatform(item.getPlatform(), request);
platform.getZentaoAssignedAndBuilds(item); platform.getZentaoAssignedAndBuilds(item);
} }