fix(项目设置): 定时清理测试报告未清理CASE报告

This commit is contained in:
shiziyuan9527 2022-02-24 15:11:11 +08:00 committed by shiziyuan9527
parent 7cb8e8285e
commit 7d8b065754
1 changed files with 7 additions and 0 deletions

View File

@ -798,6 +798,13 @@ public class ApiScenarioReportService {
example.createCriteria().andCreateTimeLessThan(time).andProjectIdEqualTo(projectId);
List<ApiScenarioReport> apiScenarioReports = apiScenarioReportMapper.selectByExample(example);
List<String> ids = apiScenarioReports.stream().map(ApiScenarioReport::getId).collect(Collectors.toList());
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
definitionExecResultExample.createCriteria().andCreateTimeLessThan(time).andProjectIdEqualTo(projectId);
List<ApiDefinitionExecResult> apiDefinitionExecResults = definitionExecResultMapper.selectByExample(definitionExecResultExample);
List<String> definitionExecIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
ids.addAll(definitionExecIds);
if (CollectionUtils.isNotEmpty(ids)) {
APIReportBatchRequest request = new APIReportBatchRequest();
request.setIds(ids);