fix(测试计划): 停止执行中的计划任务时报告统计用例明细有误

--bug=1042661 --user=宋昌昌 【任务中心】停止计划任务-查看独立报告详情-执行分析和场景分析无数据 https://www.tapd.cn/55049933/s/1532899
This commit is contained in:
song-cc-rock 2024-06-20 16:06:43 +08:00 committed by Craftsman
parent 4d3f6878d3
commit f1fc2f302f
2 changed files with 9 additions and 1 deletions

View File

@ -61,6 +61,9 @@ public class TestPlanExecuteSupportService {
public void summaryTestPlanReport(String reportId, boolean isGroupReport, boolean isStop) {
LogUtils.info("开始合并报告: --- 报告ID[{}],是否是报告组[{}]", reportId, isGroupReport);
try {
// 如果是停止的计划任务, 报告用例状态改成STOPPED
updateReportDetailStopped(reportId);
if (isGroupReport) {
testPlanReportService.summaryGroupReport(reportId);
} else {
@ -160,6 +163,11 @@ public class TestPlanExecuteSupportService {
testPlanReport.setExecStatus(ExecStatus.STOPPED.name());
testPlanReportMapper.updateByPrimaryKeySelective(testPlanReport);
// 用例明细未执行的更新为Stopped
updateReportDetailStopped(testPlanReportId);
}
public void updateReportDetailStopped(String testPlanReportId) {
TestPlanReportApiCaseExample apiCaseExample = new TestPlanReportApiCaseExample();
apiCaseExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReportId).andApiCaseExecuteResultIsNull();
TestPlanReportApiCase testPlanReportApiCase = new TestPlanReportApiCase();

View File

@ -922,7 +922,7 @@ public class TestPlanReportService {
Map<String, Long> resultMap = resultMapList.stream().collect(Collectors.toMap(CaseStatusCountMap::getStatus, CaseStatusCountMap::getCount));
caseCount.setSuccess(resultMap.getOrDefault(ExecStatus.SUCCESS.name(), 0L).intValue());
caseCount.setError(resultMap.getOrDefault(ExecStatus.ERROR.name(), 0L).intValue());
caseCount.setPending(resultMap.getOrDefault(ExecStatus.PENDING.name(), 0L).intValue());
caseCount.setPending(resultMap.getOrDefault(ExecStatus.PENDING.name(), 0L).intValue() + resultMap.getOrDefault(ExecStatus.STOPPED.name(), 0L).intValue());
caseCount.setBlock(resultMap.getOrDefault(ExecStatus.BLOCKED.name(), 0L).intValue());
caseCount.setFakeError(resultMap.getOrDefault(ExecStatus.FAKE_ERROR.name(), 0L).intValue());
return caseCount;