fix(测试跟踪): 首页遗留缺陷跳转问题

--bug=1026929 --user=宋昌昌 【测试跟踪】首页-测试计划遗留缺陷统计-遗留缺陷数跳转链接是全部缺陷数 https://www.tapd.cn/55049933/s/1383063
This commit is contained in:
song-cc-rock 2023-06-19 11:15:22 +08:00 committed by 刘瑞斌
parent b6fb1fcb84
commit 6a075e56f1
2 changed files with 27 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public class IssuesRequest extends BaseQueryRequest {
private List<String> exportIds;
/**
* 本周测试计划遗留缺陷
* 本周测试计划关联缺陷
*/
private Boolean thisWeekUnClosedTestPlanIssue = false;
/**

View File

@ -1960,7 +1960,32 @@ public class IssuesService {
} else {
issueIds = Collections.EMPTY_LIST;
}
request.setFilterIds(issueIds);
Map<String, String> statusMap = customFieldIssuesService.getIssueStatusMap(issueIds, request.getProjectId());
if (MapUtils.isEmpty(statusMap) && CollectionUtils.isNotEmpty(issueIds)) {
// 未找到自定义字段状态, 则获取平台状态
IssuesRequest issuesRequest = new IssuesRequest();
issuesRequest.setProjectId(SessionUtils.getCurrentProjectId());
issuesRequest.setFilterIds(issueIds);
List<IssuesDao> issues = extIssuesMapper.getIssues(issuesRequest);
statusMap = issues.stream().collect(Collectors.toMap(IssuesDao::getId, i -> Optional.ofNullable(i.getPlatformStatus()).orElse("new")));
}
if (MapUtils.isEmpty(statusMap)) {
request.setFilterIds(issueIds);
} else {
if (request.getUnClosedTestPlanIssue()) {
CustomField customField = baseCustomFieldService.getCustomFieldByName(SessionUtils.getCurrentProjectId(), SystemCustomField.ISSUE_STATUS);
JSONArray statusArray = JSONArray.parseArray(customField.getOptions());
Map<String, String> tmpStatusMap = statusMap;
List<String> unClosedIds = issueIds.stream()
.filter(id -> !StringUtils.equals(tmpStatusMap.getOrDefault(id, StringUtils.EMPTY).replaceAll("\"", StringUtils.EMPTY), "closed"))
.collect(Collectors.toList());
request.setFilterIds(unClosedIds);
} else {
request.setFilterIds(issueIds);
}
}
}
public boolean thirdPartTemplateEnable(String projectId) {