feat(任务中心): 组织任务中心后台任务列表查询
This commit is contained in:
parent
1a41bcae3f
commit
472d27f9ac
|
@ -2,7 +2,10 @@ package io.metersphere.system.controller;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
||||||
|
import io.metersphere.system.dto.taskhub.TaskHubScheduleDTO;
|
||||||
|
import io.metersphere.system.mapper.BaseProjectMapper;
|
||||||
import io.metersphere.system.service.BaseTaskHubService;
|
import io.metersphere.system.service.BaseTaskHubService;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
|
@ -25,6 +28,8 @@ public class OrganizationTaskHubController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BaseTaskHubService baseTaskHubService;
|
private BaseTaskHubService baseTaskHubService;
|
||||||
|
@Resource
|
||||||
|
BaseProjectMapper baseProjectMapper;
|
||||||
|
|
||||||
@PostMapping("/exec-task/page")
|
@PostMapping("/exec-task/page")
|
||||||
@Operation(summary = "组织-任务中心-执行任务列表")
|
@Operation(summary = "组织-任务中心-执行任务列表")
|
||||||
|
@ -32,4 +37,14 @@ public class OrganizationTaskHubController {
|
||||||
public Pager<List<TaskHubDTO>> projectList(@Validated @RequestBody BasePageRequest request) {
|
public Pager<List<TaskHubDTO>> projectList(@Validated @RequestBody BasePageRequest request) {
|
||||||
return baseTaskHubService.getTaskList(request, SessionUtils.getCurrentOrganizationId(), null);
|
return baseTaskHubService.getTaskList(request, SessionUtils.getCurrentOrganizationId(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/schedule/page")
|
||||||
|
@Operation(summary = "组织-任务中心-后台执行任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ)
|
||||||
|
public Pager<List<TaskHubScheduleDTO>> scheduleList(@Validated @RequestBody BasePageRequest request) {
|
||||||
|
List<OptionDTO> projectList = baseProjectMapper.getProjectOptionsByOrgId(SessionUtils.getCurrentOrganizationId());
|
||||||
|
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||||
|
return baseTaskHubService.getScheduleTaskList(request, projectIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
* 组织任务中心测试用例
|
* 组织任务中心测试用例
|
||||||
*/
|
*/
|
||||||
public static final String ORG_TASK_PAGE = "/organization/task-center/exec-task/page";
|
public static final String ORG_TASK_PAGE = "/organization/task-center/exec-task/page";
|
||||||
|
public static final String ORG_SCHEDULE_TASK_PAGE = "/organization/task-center/schedule/page";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(20)
|
@Order(20)
|
||||||
|
@ -79,4 +80,23 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
// 返回请求正常
|
// 返回请求正常
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织后台任务
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
public void getOrgSchedulePage() throws Exception {
|
||||||
|
BasePageRequest request = new BasePageRequest();
|
||||||
|
this.requestPost(ORG_SCHEDULE_TASK_PAGE, request);
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
MvcResult mvcResult = this.requestPostWithOkAndReturn(ORG_SCHEDULE_TASK_PAGE, request);
|
||||||
|
// 获取返回值
|
||||||
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
// 返回请求正常
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue