From 83fb392680f43f98d425030415d76e94040c497e Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Fri, 18 Oct 2024 11:03:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):?= =?UTF-8?q?=20=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83=E5=88=A0=E9=99=A4&?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E4=BB=BB=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectTaskHubController.java | 17 ++ .../ProjectTaskHubControllerTests.java | 26 +++ .../OrganizationTaskHubController.java | 20 +++ .../controller/SystemTaskHubController.java | 11 +- .../system/mapper/ExtExecTaskItemMapper.java | 2 + .../system/mapper/ExtExecTaskItemMapper.xml | 7 + .../system/mapper/ExtExecTaskMapper.java | 2 +- .../system/mapper/ExtExecTaskMapper.xml | 7 +- .../system/service/BaseTaskHubLogService.java | 149 +++++++++++++++++- .../system/service/BaseTaskHubService.java | 33 +++- .../BaseTaskHubControllerTests.java | 38 +++++ 11 files changed, 303 insertions(+), 9 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java index 79db30f523..b05c7a7a7b 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java @@ -2,6 +2,7 @@ package io.metersphere.project.controller; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.dto.sdk.BasePageRequest; +import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.metersphere.system.dto.taskhub.ResourcePoolOptionsDTO; import io.metersphere.system.dto.taskhub.TaskHubDTO; import io.metersphere.system.dto.taskhub.TaskHubItemDTO; @@ -82,12 +83,28 @@ public class ProjectTaskHubController { } + @PostMapping("/exec-task/batch-stop") + @Operation(summary = "项目-任务中心-用例执行任务-批量停止任务") + @Log(type = OperationLogType.UPDATE, expression = "#msClass.projectBatchStopLog(#id)", msClass = BaseTaskHubLogService.class) + @RequiresPermissions(PermissionConstants.PROJECT_CASE_TASK_CENTER_EXEC_STOP) + public void batchStopTask(@Validated @RequestBody TableBatchProcessDTO request) { + baseTaskHubService.batchStopTask(request, SessionUtils.getUserId(), null, SessionUtils.getCurrentProjectId()); + } + + @GetMapping("/exec-task/delete/{id}") @Operation(summary = "项目-任务中心-用例执行任务-删除任务") @Log(type = OperationLogType.DELETE, expression = "#msClass.projectDeleteLog(#id)", msClass = BaseTaskHubLogService.class) @RequiresPermissions(PermissionConstants.PROJECT_CASE_TASK_CENTER_DELETE) public void deleteTask(@PathVariable String id) { + baseTaskHubService.deleteTask(id, null, SessionUtils.getCurrentProjectId()); + } + @PostMapping("/exec-task/batch-delete") + @Operation(summary = "项目-任务中心-用例执行任务-批量删除任务") + @Log(type = OperationLogType.DELETE, expression = "#msClass.projectBatchDeleteLog(#id)", msClass = BaseTaskHubLogService.class) + @RequiresPermissions(PermissionConstants.PROJECT_CASE_TASK_CENTER_DELETE) + public void batchDeleteTask(@PathVariable String id) { baseTaskHubService.deleteTask(id, null, SessionUtils.getCurrentProjectId()); } } diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTaskHubControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTaskHubControllerTests.java index 44c16c4676..622a3520ab 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTaskHubControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTaskHubControllerTests.java @@ -4,6 +4,7 @@ import io.metersphere.sdk.util.JSON; import io.metersphere.system.base.BaseTest; import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.dto.sdk.BasePageRequest; +import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Order; @@ -26,6 +27,8 @@ public class ProjectTaskHubControllerTests extends BaseTest { public static final String PROJECT_RESOURCE_POOL_OPTIONS = "/project/task-center/resource-pool/options"; public static final String PROJECT_TASK_STOP = "/project/task-center/exec-task/stop/"; public static final String PROJECT_TASK_DELETE = "/project/task-center/exec-task/delete/"; + public static final String PROJECT_TASK_BATCH_STOP = "/project/task-center/exec-task/batch-stop/"; + public static final String PROJECT_TASK_BATCH_DELETE = "/organization/task-center/exec-task/batch-delete/"; @Test @Order(1) @@ -124,6 +127,20 @@ public class ProjectTaskHubControllerTests extends BaseTest { Assertions.assertNotNull(resultHolder); } + /** + * 系统执行任务停止 + */ + @Test + @Order(23) + public void projectTaskBatchStop() throws Exception { + TableBatchProcessDTO request = new TableBatchProcessDTO(); + request.setSelectAll(true); + this.requestPost(PROJECT_TASK_BATCH_STOP, request); + request.setSelectAll(false); + request.setSelectIds(List.of("pro_1", "pro_2")); + this.requestPost(PROJECT_TASK_BATCH_STOP, request); + } + /** * 项目执行任务删除 @@ -138,4 +155,13 @@ public class ProjectTaskHubControllerTests extends BaseTest { // 返回请求正常 Assertions.assertNotNull(resultHolder); } + + @Test + @Order(6) + public void projectBatchTaskDelete() throws Exception { + TableBatchProcessDTO request = new TableBatchProcessDTO(); + request.setSelectAll(false); + request.setSelectIds(List.of("1")); + this.requestPost(PROJECT_TASK_BATCH_DELETE, request); + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java index c6e3934c2e..afeb3efaad 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java @@ -3,6 +3,7 @@ package io.metersphere.system.controller; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.dto.sdk.BasePageRequest; import io.metersphere.system.dto.sdk.OptionDTO; +import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.metersphere.system.dto.taskhub.ResourcePoolOptionsDTO; import io.metersphere.system.dto.taskhub.TaskHubDTO; import io.metersphere.system.dto.taskhub.TaskHubItemDTO; @@ -89,6 +90,16 @@ public class OrganizationTaskHubController { } + @PostMapping("/exec-task/batch-stop") + @Operation(summary = "组织-任务中心-用例执行任务-批量停止任务") + @Log(type = OperationLogType.UPDATE, expression = "#msClass.orgBatchStopLog(#id)", msClass = BaseTaskHubLogService.class) + @RequiresPermissions(PermissionConstants.ORGANIZATION_CASE_TASK_CENTER_EXEC_STOP) + public void batchStopTask(@Validated @RequestBody TableBatchProcessDTO request) { + baseTaskHubService.batchStopTask(request, SessionUtils.getUserId(), SessionUtils.getCurrentOrganizationId(), null); + } + + + @GetMapping("/exec-task/delete/{id}") @Operation(summary = "组织-任务中心-用例执行任务-删除任务") @Log(type = OperationLogType.DELETE, expression = "#msClass.orgDeleteLog(#id)", msClass = BaseTaskHubLogService.class) @@ -96,4 +107,13 @@ public class OrganizationTaskHubController { public void deleteTask(@PathVariable String id) { baseTaskHubService.deleteTask(id, SessionUtils.getCurrentOrganizationId(), null); } + + + @PostMapping("/exec-task/batch-delete") + @Operation(summary = "组织-任务中心-用例执行任务-批量删除任务") + @Log(type = OperationLogType.DELETE, expression = "#msClass.orgBatchDeleteLog(#request)", msClass = BaseTaskHubLogService.class) + @RequiresPermissions(PermissionConstants.ORGANIZATION_CASE_TASK_CENTER_DELETE) + public void batchDeleteTask(@Validated @RequestBody TableBatchProcessDTO request) { + baseTaskHubService.batchDeleteTask(request, SessionUtils.getCurrentOrganizationId(), null); + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java index be94dd9e73..52e72f26d1 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java @@ -106,7 +106,16 @@ public class SystemTaskHubController { baseTaskHubService.deleteTask(id, null, null); } - //TODO 系统&组织&项目 任务按钮操作:删除 停止 失败重跑 查看报告 批量删除 批量停止 批量失败重跑 + + @PostMapping("/exec-task/batch-delete") + @Operation(summary = "系统-任务中心-用例执行任务-批量删除任务") + @Log(type = OperationLogType.DELETE, expression = "#msClass.systemBatchDeleteLog(#request)", msClass = BaseTaskHubLogService.class) + @RequiresPermissions(PermissionConstants.SYSTEM_CASE_TASK_CENTER_DELETE) + public void batchDeleteTask(@Validated @RequestBody TableBatchProcessDTO request) { + baseTaskHubService.batchDeleteTask(request, SessionUtils.getCurrentOrganizationId(), null); + } + + //TODO 系统&组织&项目 任务按钮操作:失败重跑 查看报告 批量失败重跑 //TODO 系统&组织&项目 任务详情按钮操作:查看 停止 批量停止 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java index ef0f0c0f28..455d53313e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java @@ -36,4 +36,6 @@ public interface ExtExecTaskItemMapper { Boolean hasErrorItem(@Param("taskId") String taskId); Boolean hasFakeErrorItem(@Param("taskId") String taskId); + + List getItemIdByTaskIds(@Param("taskIds") List taskIds); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml index a68aebc223..12dcee52ed 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml @@ -153,4 +153,11 @@ WHERE task_id = #{taskId} AND `result` = 'FAKE_ERROR' limit 1 + + \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.java index 71a73f2f4e..bf720048ee 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.java @@ -13,7 +13,7 @@ import java.util.List; public interface ExtExecTaskMapper { List selectList(@Param("request") BasePageRequest request, @Param("orgId") String orgId, @Param("projectId") String projectId); - void deleteTaskById(@Param("id") String id, @Param("orgId") String orgId, @Param("projectId") String projectId); + void deleteTaskByIds(@Param("ids") List ids, @Param("orgId") String orgId, @Param("projectId") String projectId); List getIds(@Param("request") TableBatchProcessDTO request); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml index 46f9ea63fb..ed5f60d19e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml @@ -27,10 +27,13 @@ - + DELETE FROM exec_task - WHERE id = #{id} + WHERE id in + + #{id} + and project_id = #{projectId} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubLogService.java index ed3c8f03e7..311e1b4825 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubLogService.java @@ -1,11 +1,8 @@ package io.metersphere.system.service; import io.metersphere.sdk.constants.OperationLogConstants; -import io.metersphere.sdk.util.JSON; import io.metersphere.system.domain.ExecTask; import io.metersphere.system.domain.ExecTaskExample; -import io.metersphere.system.domain.UserRole; -import io.metersphere.system.dto.sdk.request.UserRoleUpdateRequest; import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogType; @@ -32,6 +29,7 @@ public class BaseTaskHubLogService { /** * 系统停止任务日志 + * * @param id * @return */ @@ -82,6 +80,7 @@ public class BaseTaskHubLogService { /** * 组织停止任务日志 + * * @param id * @return */ @@ -102,9 +101,38 @@ public class BaseTaskHubLogService { } + /** + * 组织批量停止任务日志 + * + * @param request + * @return + */ + public List orgBatchStopLog(TableBatchProcessDTO request) { + List ids = baseTaskHubService.getTaskIds(request); + ExecTaskExample example = new ExecTaskExample(); + example.createCriteria().andIdIn(ids); + List execTasks = execTaskMapper.selectByExample(example); + List logDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(execTasks)) { + execTasks.forEach(item -> { + LogDTO dto = new LogDTO( + OperationLogConstants.ORGANIZATION, + null, + item.getId(), + null, + OperationLogType.STOP.name(), + OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, + item.getTaskName()); + logDTOList.add(dto); + }); + } + return logDTOList; + } + /** * 项目停止任务日志 + * * @param id * @return */ @@ -125,8 +153,38 @@ public class BaseTaskHubLogService { } + /** + * 项目批量停止任务日志 + * + * @param request + * @return + */ + public List projectBatchStopLog(TableBatchProcessDTO request) { + List ids = baseTaskHubService.getTaskIds(request); + ExecTaskExample example = new ExecTaskExample(); + example.createCriteria().andIdIn(ids); + List execTasks = execTaskMapper.selectByExample(example); + List logDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(execTasks)) { + execTasks.forEach(item -> { + LogDTO dto = new LogDTO( + null, + null, + item.getId(), + null, + OperationLogType.STOP.name(), + OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER, + item.getTaskName()); + logDTOList.add(dto); + }); + } + return logDTOList; + } + + /** * 系统删除任务日志 + * * @param id * @return */ @@ -146,8 +204,37 @@ public class BaseTaskHubLogService { return dto; } + /** + * 系统批量删除任务日志 + * + * @param request + * @return + */ + public List systemBatchDeleteLog(TableBatchProcessDTO request) { + List ids = baseTaskHubService.getTaskIds(request); + ExecTaskExample example = new ExecTaskExample(); + example.createCriteria().andIdIn(ids); + List execTasks = execTaskMapper.selectByExample(example); + List logDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(execTasks)) { + execTasks.forEach(item -> { + LogDTO dto = new LogDTO( + OperationLogConstants.SYSTEM, + OperationLogConstants.SYSTEM, + item.getId(), + null, + OperationLogType.DELETE.name(), + OperationLogModule.SETTING_SYSTEM_TASK_CENTER, + item.getTaskName()); + logDTOList.add(dto); + }); + } + return logDTOList; + } + /** * 组织删除任务日志 + * * @param id * @return */ @@ -167,9 +254,37 @@ public class BaseTaskHubLogService { return dto; } + /** + * 组织批量删除任务日志 + * + * @param request + * @return + */ + public List orgBatchDeleteLog(TableBatchProcessDTO request) { + List ids = baseTaskHubService.getTaskIds(request); + ExecTaskExample example = new ExecTaskExample(); + example.createCriteria().andIdIn(ids); + List execTasks = execTaskMapper.selectByExample(example); + List logDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(execTasks)) { + execTasks.forEach(item -> { + LogDTO dto = new LogDTO( + OperationLogConstants.ORGANIZATION, + null, + item.getId(), + null, + OperationLogType.DELETE.name(), + OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, + item.getTaskName()); + logDTOList.add(dto); + }); + } + return logDTOList; + } /** * 项目删除任务日志 + * * @param id * @return */ @@ -189,4 +304,32 @@ public class BaseTaskHubLogService { return dto; } + + /** + * 项目批量删除任务日志 + * + * @param request + * @return + */ + public List projectBatchDeleteLog(TableBatchProcessDTO request) { + List ids = baseTaskHubService.getTaskIds(request); + ExecTaskExample example = new ExecTaskExample(); + example.createCriteria().andIdIn(ids); + List execTasks = execTaskMapper.selectByExample(example); + List logDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(execTasks)) { + execTasks.forEach(item -> { + LogDTO dto = new LogDTO( + null, + null, + item.getId(), + null, + OperationLogType.DELETE.name(), + OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER, + item.getTaskName()); + logDTOList.add(dto); + }); + } + return logDTOList; + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java index 22dba7bc5f..6973bd82b8 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java @@ -2,6 +2,8 @@ package io.metersphere.system.service; import com.github.pagehelper.Page; import com.github.pagehelper.page.PageMethod; +import io.metersphere.api.domain.ApiReportRelateTaskExample; +import io.metersphere.api.mapper.ApiReportRelateTaskMapper; import io.metersphere.engine.EngineFactory; import io.metersphere.engine.MsHttpClient; import io.metersphere.project.domain.Project; @@ -91,6 +93,8 @@ public class BaseTaskHubService { private UserMapper userMapper; @Resource private TestResourcePoolService testResourcePoolService; + @Resource + private ApiReportRelateTaskMapper apiReportRelateTaskMapper; /** * 系统-获取执行任务列表 @@ -530,12 +534,22 @@ public class BaseTaskHubService { public void deleteTask(String id, String orgId, String projectId) { //1.删除任务 - extExecTaskMapper.deleteTaskById(id, orgId, projectId); + extExecTaskMapper.deleteTaskByIds(List.of(id), orgId, projectId); //2.删除任务明细 ExecTaskItemExample itemExample = new ExecTaskItemExample(); itemExample.createCriteria().andTaskIdEqualTo(id); execTaskItemMapper.deleteByExample(itemExample); - //TODO jmeter执行队列中移除 + //3.删除任务与报告关联关系 + deleteReportRelateTask(List.of(id)); + handleStopTask(List.of(id)); + } + + private void deleteReportRelateTask(List ids) { + List itemIds = extExecTaskItemMapper.getItemIdByTaskIds(ids); + itemIds.addAll(ids); + ApiReportRelateTaskExample reportExample = new ApiReportRelateTaskExample(); + reportExample.createCriteria().andTaskResourceIdIn(itemIds); + apiReportRelateTaskMapper.deleteByExample(reportExample); } public void batchStopTask(TableBatchProcessDTO request, String userId, String orgId, String projectId) { @@ -561,4 +575,19 @@ public class BaseTaskHubService { return request.getSelectIds(); } } + + public void batchDeleteTask(TableBatchProcessDTO request, String orgId, String projectId) { + List ids = getTaskIds(request); + if (CollectionUtils.isNotEmpty(ids)) { + //1.删除任务 + extExecTaskMapper.deleteTaskByIds(ids, orgId, projectId); + //2.删除任务明细 + ExecTaskItemExample itemExample = new ExecTaskItemExample(); + itemExample.createCriteria().andTaskIdIn(ids); + execTaskItemMapper.deleteByExample(itemExample); + //3.删除任务与报告关联关系 + deleteReportRelateTask(ids); + handleStopTask(ids); + } + } } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/BaseTaskHubControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/BaseTaskHubControllerTests.java index a62359e014..ed3c236e9f 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/BaseTaskHubControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/BaseTaskHubControllerTests.java @@ -44,6 +44,7 @@ public class BaseTaskHubControllerTests extends BaseTest { public static final String SYSTEM_TASK_STOP = "/system/task-center/exec-task/stop/"; public static final String SYSTEM_TASK_DELETE = "/system/task-center/exec-task/delete/"; public static final String SYSTEM_TASK_BATCH_STOP = "/system/task-center/exec-task/batch-stop/"; + public static final String SYSTEM_TASK_BATCH_DELETE = "/system/task-center/exec-task/batch-delete/"; @Test @Order(1) @@ -175,6 +176,15 @@ public class BaseTaskHubControllerTests extends BaseTest { Assertions.assertNotNull(resultHolder); } + @Test + @Order(7) + public void systemBatchTaskDelete() throws Exception { + TableBatchProcessDTO request = new TableBatchProcessDTO(); + request.setSelectAll(false); + request.setSelectIds(List.of("1")); + this.requestPost(SYSTEM_TASK_BATCH_DELETE, request); + } + /** * 系统执行任务停止 @@ -201,6 +211,8 @@ public class BaseTaskHubControllerTests extends BaseTest { public static final String ORG_RESOURCE_POOL_OPTIONS = "/organization/task-center/resource-pool/options"; public static final String ORG_TASK_STOP = "/organization/task-center/exec-task/stop/"; public static final String ORG_TASK_DELETE = "/organization/task-center/exec-task/delete/"; + public static final String ORG_TASK_BATCH_STOP = "/organization/task-center/exec-task/batch-stop/"; + public static final String ORG_TASK_BATCH_DELETE = "/organization/task-center/exec-task/batch-delete/"; @Test @Order(20) @@ -300,6 +312,32 @@ public class BaseTaskHubControllerTests extends BaseTest { testResourcePoolMapper.deleteByPrimaryKey("2"); } + + /** + * 系统执行任务停止 + */ + @Test + @Order(23) + public void orgTaskBatchStop() throws Exception { + TableBatchProcessDTO request = new TableBatchProcessDTO(); + request.setSelectAll(true); + this.requestPost(ORG_TASK_BATCH_STOP, request); + request.setSelectAll(false); + request.setSelectIds(List.of("1", "2")); + this.requestPost(ORG_TASK_BATCH_STOP, request); + } + + + @Test + @Order(23) + public void orgBatchTaskDelete() throws Exception { + TableBatchProcessDTO request = new TableBatchProcessDTO(); + request.setSelectAll(false); + request.setSelectIds(List.of("1")); + this.requestPost(ORG_TASK_BATCH_DELETE, request); + } + + /** * 组织执行任务删除 */