fix(接口测试): 解决首页停止定时任务问题

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016708
This commit is contained in:
guoyuqi 2022-09-13 18:44:18 +08:00 committed by f2c-ci-robot[bot]
parent b973efa560
commit 571e6a0001
2 changed files with 10 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.schedule.ScheduleReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.JobKey;
import org.quartz.SchedulerException;
@ -91,9 +92,9 @@ public class ScheduleService {
return null;
}
public List<Schedule> getScheduleByResourceIds(List<String>resourceIds, String group) {
public List<Schedule> getScheduleByResourceIds(List<String> resourceIds, String group) {
ScheduleExample example = new ScheduleExample();
if(resourceIds.size()==0){
if (CollectionUtils.isEmpty(resourceIds)) {
return new ArrayList<>();
}
example.createCriteria().andResourceIdIn(resourceIds).andGroupEqualTo(group);
@ -194,7 +195,7 @@ public class ScheduleService {
LogUtil.error(e);
MSException.throwException("重置定时任务-删除旧定时任务时出现异常");
}
if(!request.getEnable()){
if (!request.getEnable()) {
return;
}
try {
@ -315,6 +316,12 @@ public class ScheduleService {
clazz = TestPlanTestJob.class;
request.setJob(TestPlanTestJob.class.getName());
needResetJob = true;
} else if (ScheduleGroup.SWAGGER_IMPORT.name().equals(request.getGroup())) {
jobKey = SwaggerUrlImportJob.getJobKey(request.getResourceId());
triggerKey = SwaggerUrlImportJob.getTriggerKey(request.getResourceId());
clazz = SwaggerUrlImportJob.class;
request.setJob(SwaggerUrlImportJob.class.getName());
needResetJob = true;
} else {
//默认为情景
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());

View File

@ -141,7 +141,6 @@ export default {
},
updateTask(taskRow) {
this.result = this.$post('/api/schedule/updateEnableByPrimyKey/disable', taskRow, response => {
this.search();
});