diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index 30232a9c2b..510408c5b8 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -620,7 +620,7 @@ public class TestPlanReportService { content.setApiBaseCount(null); } TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId()); - TestPlanReportDataStruct apiBaseCountStruct = this.generateTestPlanReportStruct(testPlan, testPlanReport, content); + TestPlanReportDataStruct apiBaseCountStruct = this.genReportStruct(testPlan, testPlanReport, content, isRerunningTestPlan); if (apiBaseCountStruct.getPassRate() == 1) { testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name()); } else if (apiBaseCountStruct.getPassRate() < 1) { @@ -675,11 +675,11 @@ public class TestPlanReportService { } //构建测试计划报告的数据结构 - private TestPlanReportDataStruct generateTestPlanReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) { + private TestPlanReportDataStruct genReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent, boolean rebuildReport) { TestPlanReportDataStruct returnDTO = null; if (testPlanReport != null && reportContent != null) { try { - returnDTO = testPlanService.buildTestPlanReportStruct(testPlan, testPlanReport, reportContent); + returnDTO = testPlanService.buildReportStruct(testPlan, testPlanReport, reportContent, rebuildReport); //查找运行环境 this.initRunInformation(returnDTO, testPlanReport); } catch (Exception e) { @@ -1066,7 +1066,7 @@ public class TestPlanReportService { } if (this.isDynamicallyGenerateReports(testPlanReportContent) || StringUtils.isNotEmpty(testPlanReportContent.getApiBaseCount())) { TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId()); - testPlanReportDTO = this.generateTestPlanReportStruct(testPlan, testPlanReport, testPlanReportContent); + testPlanReportDTO = this.genReportStruct(testPlan, testPlanReport, testPlanReportContent, false); } testPlanReportDTO.setId(reportId); testPlanReportDTO.setName(testPlanReport.getName()); diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java index d937d69f9e..9c7c065313 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -1383,7 +1383,7 @@ public class TestPlanService { * @param testPlanReportContentWithBLOBs 测试计划报告内容 * @return */ - public TestPlanReportDataStruct buildTestPlanReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) { + public TestPlanReportDataStruct buildReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs, boolean rebuildReport) { TestPlanReportDataStruct testPlanReportStruct = null; if (ObjectUtils.allNotNull(testPlanReport, testPlanReportContentWithBLOBs)) { Map config = null; @@ -1392,7 +1392,7 @@ public class TestPlanService { } testPlanReportStruct = this.getTestPlanReportStructByCreated(testPlanReportContentWithBLOBs); //检查是否有已经生成过的测试计划报告内容。如若没有则进行动态计算 - if (testPlanReportStruct == null) { + if (rebuildReport || testPlanReportStruct == null) { //查询测试计划内的用例信息,然后进行测试计划报告的结果统计 TestPlanCaseReportResultDTO testPlanExecuteReportDTO = testPlanReportService.selectCaseDetailByTestPlanReport(config, testPlan.getId(), testPlanReportContentWithBLOBs); testPlanReportStruct = initTestPlanReportStructData( @@ -2112,7 +2112,7 @@ public class TestPlanService { TestPlanWithBLOBs testPlanWithBLOBs = this.testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId()); TestPlanReportDataStruct testPlanReportDataStruct = new TestPlanReportDataStruct(); try { - testPlanReportDataStruct = this.buildTestPlanReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent); + testPlanReportDataStruct = this.buildReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent, false); } catch (Exception e) { LoggerUtil.error("统计测试计划数据出错!", e); }