refactor(测试跟踪): 优化导出测试计划报告

--bug=1013577 --user=赵勇 【测试跟踪】测试计划报告页面 导出报告  导出报告时间过长  差不多10秒,建议优化下 https://www.tapd.cn/55049933/s/1179328
This commit is contained in:
fit2-zhao 2022-06-10 21:03:36 +08:00 committed by fit2-zhao
parent caf477d8cc
commit 2aba1a00e2
1 changed files with 2 additions and 2 deletions

View File

@ -1415,9 +1415,9 @@ public class TestPlanService {
List<String> reportIds = cases.stream().map(TestPlanFailureApiDTO::getReportId).collect(Collectors.toList()); List<String> reportIds = cases.stream().map(TestPlanFailureApiDTO::getReportId).collect(Collectors.toList());
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample(); ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
example.createCriteria().andIdIn(reportIds); example.createCriteria().andIdIn(reportIds);
List<ApiDefinitionExecResult> results = apiDefinitionExecResultMapper.selectByExampleWithBLOBs(example); List<ApiDefinitionExecResultWithBLOBs> results = apiDefinitionExecResultMapper.selectByExampleWithBLOBs(example);
// 格式化数据结果 // 格式化数据结果
Map<String, ApiDefinitionExecResult> resultMap = results.stream().collect(Collectors.toMap(ApiDefinitionExecResult::getId, item -> item, (k, v) -> k)); Map<String, ApiDefinitionExecResultWithBLOBs> resultMap = results.stream().collect(Collectors.toMap(ApiDefinitionExecResult::getId, item -> item, (k, v) -> k));
cases.forEach(item -> { cases.forEach(item -> {
if (resultMap.get(item.getReportId()) != null && if (resultMap.get(item.getReportId()) != null &&
StringUtils.isNotBlank(resultMap.get(item.getReportId()).getContent())) { StringUtils.isNotBlank(resultMap.get(item.getReportId()).getContent())) {