refactor(接口测试): 补充清理接口报告逻辑

This commit is contained in:
wxg0103 2024-05-27 10:44:17 +08:00 committed by Craftsman
parent 3a31f12d41
commit 7760995b5d
3 changed files with 12 additions and 2 deletions

View File

@ -38,6 +38,8 @@ public class CleanupApiReportServiceImpl implements BaseCleanUpReport {
private ApiScenarioReportDetailMapper apiScenarioReportDetailMapper;
@Resource
private ApiScenarioReportLogMapper apiScenarioReportLogMapper;
@Resource
private ApiScenarioReportDetailBlobMapper apiScenarioReportDetailBlobMapper;
@Override
public void cleanReport(Map<String, String> map, String projectId) {
@ -87,6 +89,9 @@ public class CleanupApiReportServiceImpl implements BaseCleanUpReport {
ApiScenarioReportDetailExample detailExample = new ApiScenarioReportDetailExample();
detailExample.createCriteria().andReportIdIn(ids);
apiScenarioReportDetailMapper.deleteByExample(detailExample);
ApiScenarioReportDetailBlobExample blobExample = new ApiScenarioReportDetailBlobExample();
blobExample.createCriteria().andReportIdIn(ids);
apiScenarioReportDetailBlobMapper.deleteByExample(blobExample);
ApiScenarioReportLogExample logExample = new ApiScenarioReportLogExample();
logExample.createCriteria().andReportIdIn(ids);
apiScenarioReportLogMapper.deleteByExample(logExample);

View File

@ -99,6 +99,8 @@ public class CleanupApiResourceServiceImpl implements CleanupProjectResourceServ
private ApiScenarioCsvMapper apiScenarioCsvMapper;
@Resource
private ApiScenarioCsvStepMapper apiScenarioCsvStepMapper;
@Resource
private ApiScenarioReportDetailBlobMapper apiScenarioReportDetailBlobMapper;
@Async
@ -312,6 +314,9 @@ public class CleanupApiResourceServiceImpl implements CleanupProjectResourceServ
ApiScenarioReportLogExample logExample = new ApiScenarioReportLogExample();
logExample.createCriteria().andReportIdIn(ids);
apiScenarioReportLogMapper.deleteByExample(logExample);
ApiScenarioReportDetailBlobExample blobExample = new ApiScenarioReportDetailBlobExample();
blobExample.createCriteria().andReportIdIn(ids);
apiScenarioReportDetailBlobMapper.deleteByExample(blobExample);
}
private void deleteSchedule(String projectId) {

View File

@ -201,7 +201,7 @@ public class ApiScenarioReportService {
//将scenarioReportSteps按照parentId进行分组 值为list 然后根据sort进行排序
Map<String, List<ApiScenarioReportStepDTO>> scenarioReportStepMap = scenarioReportSteps.stream().collect(Collectors.groupingBy(ApiScenarioReportStepDTO::getParentId));
// TODO 查询修改
List<ApiScenarioReportStepDTO> steps = Optional.ofNullable(scenarioReportStepMap.get("NONE")).orElse(new ArrayList<>(0));
steps.sort(Comparator.comparingLong(ApiScenarioReportStepDTO::getSort));
@ -365,7 +365,7 @@ public class ApiScenarioReportService {
}
private List<ApiScenarioReportDetailBlobDTO> checkResourceStep(String stepId, String reportId) {
List<ApiScenarioReportDetailBlobDTO> apiReportDetails = extApiScenarioReportDetailBlobMapper.selectByExampleWithBLOBs(stepId,reportId);
List<ApiScenarioReportDetailBlobDTO> apiReportDetails = extApiScenarioReportDetailBlobMapper.selectByExampleWithBLOBs(stepId, reportId);
if (CollectionUtils.isEmpty(apiReportDetails)) {
return new ArrayList<>();
}