fix: 手动保存测试计划报告打开报错

This commit is contained in:
chenjianxing 2022-01-14 17:19:56 +08:00 committed by jianxing
parent c3aba0cdd6
commit 5ea73af079
2 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,7 @@ public class TestPlanReportController {
String reportId = UUID.randomUUID().toString(); String reportId = UUID.randomUUID().toString();
TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(reportId, planId, userId, triggerMode); TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(reportId, planId, userId, triggerMode);
TestPlanScheduleReportInfoDTO report = testPlanReportService.genTestPlanReport(saveRequest); TestPlanScheduleReportInfoDTO report = testPlanReportService.genTestPlanReport(saveRequest);
testPlanReportService.genTestPlanReportContent(report);
testPlanReportService.countReportByTestPlanReportId(report.getTestPlanReport().getId(), null, triggerMode); testPlanReportService.countReportByTestPlanReportId(report.getTestPlanReport().getId(), null, triggerMode);
return "success"; return "success";
} }

View File

@ -222,6 +222,19 @@ public class TestPlanReportService {
return returnDTO; return returnDTO;
} }
public void genTestPlanReportContent(TestPlanScheduleReportInfoDTO returnDTO) {
TestPlanReportContentWithBLOBs testPlanReportContent = new TestPlanReportContentWithBLOBs();
testPlanReportContent.setId(UUID.randomUUID().toString());
testPlanReportContent.setTestPlanReportId(returnDTO.getTestPlanReport().getId());
if (testPlanReportContent.getStartTime() == null) {
testPlanReportContent.setStartTime(System.currentTimeMillis());
}
if (testPlanReportContent.getEndTime() == null) {
testPlanReportContent.setEndTime(System.currentTimeMillis());
}
testPlanReportContentMapper.insert(testPlanReportContent);
}
public TestPlanReportDTO getMetric(String reportId) { public TestPlanReportDTO getMetric(String reportId) {
TestPlanReportDTO returnDTO = new TestPlanReportDTO(); TestPlanReportDTO returnDTO = new TestPlanReportDTO();
TestPlanReport report = testPlanReportMapper.selectByPrimaryKey(reportId); TestPlanReport report = testPlanReportMapper.selectByPrimaryKey(reportId);