fix(接口测试): 修复报告状态错误问题

--bug=1025715 --user=赵勇 【测试跟踪】测试计划-关联接口场景-执行-测试计划内场景一直为Running状态,实际已执行完成 https://www.tapd.cn/55049933/s/1365815

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-04-23 17:01:23 +08:00 committed by fit2-zhao
parent 100c2634bc
commit 9d0f5be85b
1 changed files with 20 additions and 20 deletions

View File

@ -256,27 +256,27 @@ public class ApiScenarioReportService {
return report;
}
public ApiScenarioReport editReport(String reportType, String reportId, String status, String runMode) {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
if (report != null) {
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())
|| StringUtils.equals(report.getStatus(), ApiReportStatus.STOPPED.name())) {
return report;
}
ApiScenarioReportWithBLOBs bloBs = new ApiScenarioReportWithBLOBs();
if (StringUtils.equals(runMode, CommonConstants.CASE)) {
bloBs.setTriggerMode(TriggerMode.MANUAL.name());
}
bloBs.setId(reportId);
bloBs.setStatus(status);
bloBs.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));
bloBs.setEndTime(System.currentTimeMillis());
bloBs.setUpdateTime(System.currentTimeMillis());
if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals(CommonConstants.CASE)) {
bloBs.setTriggerMode(TriggerMode.MANUAL.name());
}
apiScenarioReportMapper.updateByPrimaryKeySelective(bloBs);
public ApiScenarioReportWithBLOBs editReport(String reportType, String reportId, String status, String runMode) {
ApiScenarioReportWithBLOBs report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
if (report == null) {
report = new ApiScenarioReportWithBLOBs();
report.setId(reportId);
}
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())
|| StringUtils.equals(report.getStatus(), ApiReportStatus.STOPPED.name())) {
return report;
}
if (StringUtils.equals(runMode, CommonConstants.CASE)) {
report.setTriggerMode(TriggerMode.MANUAL.name());
}
report.setStatus(status);
report.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));
report.setEndTime(System.currentTimeMillis());
report.setUpdateTime(System.currentTimeMillis());
if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals(CommonConstants.CASE)) {
report.setTriggerMode(TriggerMode.MANUAL.name());
}
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
return report;
}