This commit is contained in:
fit2-zhao 2021-02-04 15:50:04 +08:00
commit 68256ca9fa
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,42 @@
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<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
loadTestReports.forEach(report -> {
// 清理文件
LoadTestReportDetailExample example2 = new LoadTestReportDetailExample();
example2.createCriteria().andReportIdEqualTo(report.getId());
loadTestReportDetailMapper.deleteByExample(example2);
});
}
}
}

View File

@ -54,7 +54,8 @@
import {CASE_ORDER} from "../../model/JsonData";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsBatchEdit from "../basis/BatchEdit";
import {CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
// import {CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
import {CASE_PRIORITY,API_METHOD_COLOUR, API_STATUS, REQ_METHOD, TCP_METHOD, SQL_METHOD, DUBBO_METHOD} from "../../model/JsonData";
export default {
name: 'ApiCaseList',
@ -313,6 +314,17 @@
this.$warning("请选择用例!");
return;
}
// //
if (this.currentApi.protocol == 'HTTP') {
this.valueArr.method = REQ_METHOD;
} else if (this.currentApi.protocol == 'TCP') {
this.valueArr.method = TCP_METHOD;
} else if (this.currentApi.protocol == 'SQL') {
this.valueArr.method = SQL_METHOD;
} else if (this.currentApi.protocol == 'DUBBO') {
this.valueArr.method = DUBBO_METHOD;
}
this.$refs.batchEdit.open();
},
batchEdit(form) {