refactor(测试跟踪): 修复只有功能用例的测试计划报告展开报错的问题

--bug=1011486 --user=宋天阳 【测试计划】只存在功能用例 报告统计 页面报错
https://www.tapd.cn/55049933/s/1122433
This commit is contained in:
song-tianyang 2022-03-21 18:33:12 +08:00 committed by CountryBuilder
parent 89f89ae81e
commit 9ddcb35344
2 changed files with 18 additions and 13 deletions

View File

@ -412,17 +412,22 @@ public class TestPlanTestCaseService {
} }
public List<TestPlanCaseDTO> buildCaseInfo(List<TestPlanCaseDTO> cases) { public List<TestPlanCaseDTO> buildCaseInfo(List<TestPlanCaseDTO> cases) {
Map<String, Project> projectMap = ServiceUtils.getProjectMap( if(CollectionUtils.isNotEmpty(cases)){
cases.stream().map(TestPlanCaseDTO::getProjectId).collect(Collectors.toList())); Map<String, Project> projectMap = ServiceUtils.getProjectMap(
Map<String, String> userNameMap = ServiceUtils.getUserNameMap( cases.stream().map(TestPlanCaseDTO::getProjectId).collect(Collectors.toList()));
cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList())); Map<String, String> userNameMap = ServiceUtils.getUserNameMap(
cases.forEach(item -> { cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList()));
item.setProjectName(projectMap.get(item.getProjectId()).getName()); cases.forEach(item -> {
ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name()); if(projectMap.containsKey(item.getProjectId())){
boolean customNum = config.getCaseCustomNum(); item.setProjectName(projectMap.get(item.getProjectId()).getName());
item.setIsCustomNum(customNum); }
item.setExecutorName(userNameMap.get(item.getExecutor())); ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
}); boolean customNum = config.getCaseCustomNum();
item.setIsCustomNum(customNum);
item.setExecutorName(userNameMap.get(item.getExecutor()));
});
}
return cases; return cases;
} }

View File

@ -24,14 +24,14 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="errorReport" v-if="content.errorCode > 0"> <el-tab-pane name="errorReport" v-if="content.errorCode > 0">
<template slot="label"> <template slot="label">
<span class="fail">{{ $t('error_report_library.option.name') }}</span> <span class="fail" style="color: #F6972A">{{ $t('error_report_library.option.name') }}</span>
</template> </template>
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console" <ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
:treeData="fullTreeNodes" ref="errorReportTree"/> :treeData="fullTreeNodes" ref="errorReportTree"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="unExecute" v-if="content.unExecute > 0"> <el-tab-pane name="unExecute" v-if="content.unExecute > 0">
<template slot="label"> <template slot="label">
<span class="fail">{{ $t('api_test.home_page.detail_card.unexecute') }}</span> <span class="fail" style="color: #9C9B9A">{{ $t('api_test.home_page.detail_card.unexecute') }}</span>
</template> </template>
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console" <ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
:treeData="fullTreeNodes" ref="unExecuteTree"/> :treeData="fullTreeNodes" ref="unExecuteTree"/>