parent
77a56b4f9c
commit
7ee21f06ff
|
@ -1028,31 +1028,36 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除 UI 报告产生的截图
|
// 删除 UI 报告产生的截图
|
||||||
public void cleanUpUiReportImg(){
|
public void cleanUpUiReportImg() {
|
||||||
// 属于定时任务删除调试报告情况
|
try {
|
||||||
// 获取昨天的当前时间
|
// 属于定时任务删除调试报告情况
|
||||||
Date backupTime = org.apache.commons.lang3.time.DateUtils.addDays(new Date(), -1);
|
// 获取昨天的当前时间
|
||||||
// 清理类型为 UI 报告类型,且时间为昨天之前的 UI 调试类型报告截图
|
Date backupTime = org.apache.commons.lang3.time.DateUtils.addDays(new Date(), -1);
|
||||||
ApiScenarioReportExample example = new ApiScenarioReportExample();
|
// 清理类型为 UI 报告类型,且时间为昨天之前的 UI 调试类型报告截图
|
||||||
example.createCriteria().andCreateTimeLessThan(backupTime.getTime()).andReportTypeEqualTo(ReportTypeConstants.UI_INDEPENDENT.name())
|
ApiScenarioReportExample example = new ApiScenarioReportExample();
|
||||||
.andExecuteTypeEqualTo(ExecuteType.Debug.name());
|
example.createCriteria().andCreateTimeLessThan(backupTime.getTime()).andReportTypeEqualTo(ReportTypeConstants.UI_INDEPENDENT.name())
|
||||||
List<ApiScenarioReport> apiScenarioReports = apiScenarioReportMapper.selectByExample(example);
|
.andExecuteTypeEqualTo(ExecuteType.Debug.name());
|
||||||
// 删除调试报告的截图
|
List<ApiScenarioReport> apiScenarioReports = apiScenarioReportMapper.selectByExample(example);
|
||||||
for(ApiScenarioReport apiScenarioReport : apiScenarioReports){
|
// 删除调试报告的截图
|
||||||
if(FileUtil.deleteDir(new File(FileUtils.UI_IMAGE_DIR + "/" + apiScenarioReport.getId()))){
|
for (ApiScenarioReport apiScenarioReport : apiScenarioReports) {
|
||||||
LogUtil.info("删除 UI 调试报告截图成功,报告 ID 为 :" + apiScenarioReport.getId());
|
if (FileUtil.deleteDir(new File(FileUtils.UI_IMAGE_DIR + "/" + apiScenarioReport.getId()))) {
|
||||||
|
LogUtil.info("删除 UI 调试报告截图成功,报告 ID 为 :" + apiScenarioReport.getId());
|
||||||
|
|
||||||
// 删除调试报告
|
// 删除调试报告
|
||||||
ApiScenarioReportResultExample resultExample = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample resultExample = new ApiScenarioReportResultExample();
|
||||||
resultExample.createCriteria().andReportIdEqualTo(apiScenarioReport.getId());
|
resultExample.createCriteria().andReportIdEqualTo(apiScenarioReport.getId());
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
structureExample.createCriteria().andReportIdEqualTo(apiScenarioReport.getId());
|
structureExample.createCriteria().andReportIdEqualTo(apiScenarioReport.getId());
|
||||||
|
|
||||||
apiScenarioReportDetailMapper.deleteByPrimaryKey(apiScenarioReport.getId());
|
apiScenarioReportDetailMapper.deleteByPrimaryKey(apiScenarioReport.getId());
|
||||||
apiScenarioReportResultMapper.deleteByExample(resultExample);
|
apiScenarioReportResultMapper.deleteByExample(resultExample);
|
||||||
apiScenarioReportStructureMapper.deleteByExample(structureExample);
|
apiScenarioReportStructureMapper.deleteByExample(structureExample);
|
||||||
apiScenarioReportMapper.deleteByPrimaryKey(apiScenarioReport.getId());
|
apiScenarioReportMapper.deleteByPrimaryKey(apiScenarioReport.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e.getMessage(), e);
|
||||||
|
MSException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue