fix: 修改定时任务创建时的参数-测试计划等入口参数修改

修改定时任务创建时的参数-测试计划等入口参数修改
This commit is contained in:
song.tianyang 2021-03-12 14:55:59 +08:00
parent 7e9cf5b292
commit a0d7b33323
8 changed files with 18 additions and 10 deletions

View File

@ -20,6 +20,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao; import io.metersphere.dto.ScheduleDao;
import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.service.CheckPermissionService; import io.metersphere.service.CheckPermissionService;
@ -104,7 +105,7 @@ public class APITestController {
} }
@PostMapping(value = "/schedule/create") @PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) { public void createSchedule(@RequestBody ScheduleRequest request) {
apiTestService.createSchedule(request); apiTestService.createSchedule(request);
} }

View File

@ -16,6 +16,7 @@ import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.request.testplan.FileOperationRequest; import io.metersphere.track.request.testplan.FileOperationRequest;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
@ -149,7 +150,7 @@ public class ApiAutomationController {
} }
@PostMapping(value = "/schedule/create") @PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) { public void createSchedule(@RequestBody ScheduleRequest request) {
apiAutomationService.createSchedule(request); apiAutomationService.createSchedule(request);
} }

View File

@ -20,6 +20,7 @@ import io.metersphere.commons.utils.CronUtils;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.service.CheckPermissionService; import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.ScheduleService; import io.metersphere.service.ScheduleService;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
@ -156,7 +157,7 @@ public class ApiDefinitionController {
//定时任务创建 //定时任务创建
@PostMapping(value = "/schedule/create") @PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) { public void createSchedule(@RequestBody ScheduleRequest request) {
apiDefinitionService.createSchedule(request); apiDefinitionService.createSchedule(request);
} }
@PostMapping(value = "/schedule/update") @PostMapping(value = "/schedule/update")

View File

@ -21,6 +21,7 @@ import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao; import io.metersphere.dto.ScheduleDao;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiTestJob; import io.metersphere.job.sechedule.ApiTestJob;
@ -328,12 +329,12 @@ public class APITestService {
addOrUpdateApiTestCronJob(request); addOrUpdateApiTestCronJob(request);
} }
public void createSchedule(Schedule request) { public void createSchedule(ScheduleRequest request) {
scheduleService.addSchedule(buildApiTestSchedule(request)); scheduleService.addSchedule(buildApiTestSchedule(request));
addOrUpdateApiTestCronJob(request); addOrUpdateApiTestCronJob(request);
} }
private Schedule buildApiTestSchedule(Schedule request) { private Schedule buildApiTestSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request); Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(ApiTestJob.class.getName()); schedule.setJob(ApiTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_TEST.name()); schedule.setGroup(ScheduleGroup.API_TEST.name());

View File

@ -31,6 +31,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiScenarioTestJob; import io.metersphere.job.sechedule.ApiScenarioTestJob;
import io.metersphere.job.sechedule.TestPlanTestJob; import io.metersphere.job.sechedule.TestPlanTestJob;
@ -717,7 +718,7 @@ public class ApiAutomationService {
return apiScenarioMapper.selectByExampleWithBLOBs(example); return apiScenarioMapper.selectByExampleWithBLOBs(example);
} }
public void createSchedule(Schedule request) { public void createSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request); Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(ApiScenarioTestJob.class.getName()); schedule.setJob(ApiScenarioTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name()); schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());

View File

@ -28,6 +28,7 @@ import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.SwaggerUrlImportJob; import io.metersphere.job.sechedule.SwaggerUrlImportJob;
import io.metersphere.service.FileService; import io.metersphere.service.FileService;
@ -702,7 +703,7 @@ public class ApiDefinitionService {
} }
/*swagger定时导入*/ /*swagger定时导入*/
public void createSchedule(Schedule request) { public void createSchedule(ScheduleRequest request) {
/*保存swaggerUrl*/ /*保存swaggerUrl*/
SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject(); SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject();
swaggerUrlProject.setId(UUID.randomUUID().toString()); swaggerUrlProject.setId(UUID.randomUUID().toString());

View File

@ -10,6 +10,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.DashboardTestDTO; import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.dto.LoadTestDTO; import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.ScheduleDao; import io.metersphere.dto.ScheduleDao;
@ -175,7 +176,7 @@ public class PerformanceTestController {
} }
@PostMapping(value = "/schedule/create") @PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) { public void createSchedule(@RequestBody ScheduleRequest request) {
performanceTestService.createSchedule(request); performanceTestService.createSchedule(request);
} }

View File

@ -14,6 +14,7 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.config.KafkaProperties; import io.metersphere.config.KafkaProperties;
import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.DashboardTestDTO; import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.dto.LoadTestDTO; import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.ScheduleDao; import io.metersphere.dto.ScheduleDao;
@ -465,12 +466,12 @@ public class PerformanceTestService {
addOrUpdatePerformanceTestCronJob(request); addOrUpdatePerformanceTestCronJob(request);
} }
public void createSchedule(Schedule request) { public void createSchedule(ScheduleRequest request) {
scheduleService.addSchedule(buildPerformanceTestSchedule(request)); scheduleService.addSchedule(buildPerformanceTestSchedule(request));
addOrUpdatePerformanceTestCronJob(request); addOrUpdatePerformanceTestCronJob(request);
} }
private Schedule buildPerformanceTestSchedule(Schedule request) { private Schedule buildPerformanceTestSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request); Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(PerformanceTestJob.class.getName()); schedule.setJob(PerformanceTestJob.class.getName());
schedule.setGroup(ScheduleGroup.PERFORMANCE_TEST.name()); schedule.setGroup(ScheduleGroup.PERFORMANCE_TEST.name());