fix(接口测试): 修复停止调试后,调试记录状态未更新问题

--bug=1023177 --user=赵勇 【接口测试】github#21873,接口自动化调试过程中点击停止,调试历史列表中状态不会更新 https://www.tapd.cn/55049933/s/1336738
This commit is contained in:
fit2-zhao 2023-02-16 18:03:22 +08:00 committed by fit2-zhao
parent 981e9006b0
commit aad6e26e8e
2 changed files with 5 additions and 3 deletions

View File

@ -328,11 +328,11 @@ public class ApiScenarioController {
List<TaskRequestDTO> reportIds = new ArrayList<>(); List<TaskRequestDTO> reportIds = new ArrayList<>();
TaskRequestDTO taskRequest = new TaskRequestDTO(); TaskRequestDTO taskRequest = new TaskRequestDTO();
taskRequest.setReportId(reportId); taskRequest.setReportId(reportId);
taskRequest.setType(ElementConstants.SCENARIO); taskRequest.setType(ElementConstants.SCENARIO_UPPER);
reportIds.add(taskRequest); reportIds.add(taskRequest);
WebSocketUtil.onClose(reportId); WebSocketUtil.onClose(reportId);
apiTaskService.stop(reportIds); apiTaskService.apiStop(reportIds);
} }
} }

View File

@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -262,7 +263,8 @@ public class ApiScenarioReportService {
report = new ApiScenarioReportWithBLOBs(); report = new ApiScenarioReportWithBLOBs();
report.setId(reportId); report.setId(reportId);
} }
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) { if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())
|| StringUtils.equals(report.getStatus(), ApiReportStatus.STOPPED.name())) {
return report; return report;
} }
if (StringUtils.equals(runMode, CommonConstants.CASE)) { if (StringUtils.equals(runMode, CommonConstants.CASE)) {