fix(测试跟踪): 关联功能用例所属项目显示错误

--bug=1013939 --user=陈建星 【测试跟踪】测试计划关联功能测试用例,选中版本后再切换其他项目,用例没有显示 https://www.tapd.cn/55049933/s/1181303
This commit is contained in:
chenjianxing 2022-06-14 15:42:32 +08:00 committed by jianxing
parent 8e1153e4d3
commit e82917ab8c
1 changed files with 7 additions and 4 deletions

View File

@ -92,9 +92,14 @@ public class TestPlanTestCaseService {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request);
if (CollectionUtils.isNotEmpty(list)) {
Map<String, String> projectMap = ServiceUtils.getProjectNameMap(list.stream().map(TestPlanCaseDTO::getProjectId)
.distinct()
.collect(Collectors.toList()));
list.forEach(item -> {
// 设置项目名称
item.setProjectName(request.getProjectName());
item.setProjectName(projectMap.get(item.getProjectId()));
if (!request.getIsCustomNum()) {
// 如果配置是不启用自定义字段则设置为 num
item.setCustomNum(item.getNum().toString());
@ -116,10 +121,8 @@ public class TestPlanTestCaseService {
}
public QueryTestPlanCaseRequest wrapQueryTestPlanCaseRequest(QueryTestPlanCaseRequest request) {
Project project = projectService.getProjectById(request.getProjectId());
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(project.getId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(request.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
request.setIsCustomNum(StringUtils.equals(projectApplication.getTypeValue(), "false") ? false : true);
request.setProjectName(project.getName());
return request;
}