diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index a49da6aca0..36c740f874 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -16,19 +16,17 @@ import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; import io.metersphere.api.service.*; import io.metersphere.base.domain.*; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.commons.constants.ScheduleGroup; -import io.metersphere.commons.utils.*; +import io.metersphere.commons.utils.CronUtils; +import io.metersphere.commons.utils.PageUtils; +import io.metersphere.commons.utils.Pager; +import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.ScheduleRequest; import io.metersphere.dto.ScheduleDao; -import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.service.CheckPermissionService; import io.metersphere.service.ScheduleService; -import org.apache.commons.lang3.StringUtils; import org.apache.jorphan.collections.HashTree; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -59,12 +57,6 @@ public class APITestController { @Resource private ScheduleService scheduleService; @Resource - private APIReportService apiReportService; - @Resource - private PerformanceTestService performanceTestService; - @Resource - private CheckPermissionService checkPermissionService; - @Resource private HistoricalDataUpgradeService historicalDataUpgradeService; @Resource private ApiTestEnvironmentService environmentService; @@ -354,17 +346,9 @@ public class APITestController { return returnList; } - @GetMapping("/runningTask/{projectID}/{callFrom}") - public List runningTask(@PathVariable String projectID, @PathVariable String callFrom) { - List typeFilter = new ArrayList<>(); - if (StringUtils.equals(callFrom, "api_test")) { // 接口测试首页显示的运行中定时任务,只要这3种,不需要 性能测试、api_test(旧版) - typeFilter.add(ScheduleGroup.API_SCENARIO_TEST.name()); - typeFilter.add(ScheduleGroup.SWAGGER_IMPORT.name()); - typeFilter.add(ScheduleGroup.TEST_PLAN_TEST.name()); - } else if (StringUtils.equals(callFrom, "track_home")) { // 测试跟踪首页只显示测试计划的定时任务 - typeFilter.add(ScheduleGroup.TEST_PLAN_TEST.name()); - } - List resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, typeFilter); + @PostMapping("/runningTask/{projectID}") + public List runningTask(@PathVariable String projectID,@RequestBody BaseQueryRequest request) { + List resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, request); int dataIndex = 1; for (TaskInfoResult taskInfo : resultList) { diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.java index 36857bac0e..04d56c9ccd 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.java @@ -2,6 +2,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.api.dto.datacount.response.TaskInfoResult; import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO; +import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.dto.ScheduleDao; import org.apache.ibatis.annotations.Param; @@ -15,7 +16,7 @@ public interface ExtScheduleMapper { long countTaskByProjectIdAndCreateTimeRange(@Param("projectId")String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime); - List findRunningTaskInfoByProjectID(@Param("projectId") String workspaceID, @Param("types") List typeFilter); + List findRunningTaskInfoByProjectID(@Param("projectId") String workspaceID, @Param("request")BaseQueryRequest request); void insert(@Param("apiSwaggerUrlDTO") ApiSwaggerUrlDTO apiSwaggerUrlDTO); @@ -23,4 +24,4 @@ public interface ExtScheduleMapper { int updateNameByResourceID(@Param("resourceId") String resourceId, @Param("name") String name); -} \ No newline at end of file +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.xml index d234a83ebe..0322e6a5a0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtScheduleMapper.xml @@ -80,10 +80,21 @@ ) WHERE sch.`enable` = true AND sch.project_id = #{projectId,jdbcType=VARCHAR} - and sch.`group` in - - #{item} + + + + + + + and sch.group in + + #{value} + + + + +