From 72851dc3cec76b289df670e48c0dd42963af6fd3 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 4 Feb 2021 16:11:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=B8=85=E7=90=86=E6=95=B0=E6=8D=AE=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=94=BE=E5=9C=A8data-streaming=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job/LoadTestReportDetailCleanJob.java | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 backend/src/main/java/io/metersphere/performance/job/LoadTestReportDetailCleanJob.java diff --git a/backend/src/main/java/io/metersphere/performance/job/LoadTestReportDetailCleanJob.java b/backend/src/main/java/io/metersphere/performance/job/LoadTestReportDetailCleanJob.java deleted file mode 100644 index 6b66cf8e1d..0000000000 --- a/backend/src/main/java/io/metersphere/performance/job/LoadTestReportDetailCleanJob.java +++ /dev/null @@ -1,42 +0,0 @@ -package io.metersphere.performance.job; - -import com.fit2cloud.quartz.anno.QuartzScheduled; -import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.LoadTestReport; -import io.metersphere.base.domain.LoadTestReportDetailExample; -import io.metersphere.base.domain.LoadTestReportExample; -import io.metersphere.base.mapper.LoadTestReportDetailMapper; -import io.metersphere.base.mapper.LoadTestReportMapper; -import io.metersphere.commons.constants.PerformanceTestStatus; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.List; - -@Component -public class LoadTestReportDetailCleanJob { - @Resource - private LoadTestReportDetailMapper loadTestReportDetailMapper; - @Resource - private LoadTestReportMapper loadTestReportMapper; - - /** - * 每天处理一次清理任务 - */ - @QuartzScheduled(cron = "0 0 1 * * ?") - public void cleanCompletedTestDetail() { - LoadTestReportExample example = new LoadTestReportExample(); - example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name()); - long count = loadTestReportMapper.countByExample(example); - for (int i = 0; i < count / 10; i++) { - PageHelper.startPage(i, 10); - List loadTestReports = loadTestReportMapper.selectByExample(example); - loadTestReports.forEach(report -> { - // 清理文件 - LoadTestReportDetailExample example2 = new LoadTestReportDetailExample(); - example2.createCriteria().andReportIdEqualTo(report.getId()); - loadTestReportDetailMapper.deleteByExample(example2); - }); - } - } -}