diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionMockService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionMockService.java index f54aeb3e25..66e91e9e07 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionMockService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionMockService.java @@ -372,9 +372,6 @@ public class ApiDefinitionMockService { } public void batchDelete(ApiTestCaseBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = doSelectIds(request); if (CollectionUtils.isNotEmpty(ids)) { SubListUtils.dealForSubList(ids, 500, subList -> deleteResourceByIds(subList, request.getProjectId(), userId)); @@ -400,9 +397,7 @@ public class ApiDefinitionMockService { } public void batchEdit(ApiMockBatchEditRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } + List ids = doSelectIds(request); if (CollectionUtils.isNotEmpty(ids)) { SubListUtils.dealForSubList(ids, 500, subList -> batchEditByType(request, subList, userId, request.getProjectId())); @@ -468,7 +463,7 @@ public class ApiDefinitionMockService { } public List doSelectIds(ApiTestCaseBatchRequest request) { - if (request.isSelectAll()) { + if (request.isSelectAll() && CollectionUtils.isNotEmpty(request.getProtocols())) { List ids = extApiDefinitionMockMapper.getIds(request); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { ids.removeAll(request.getExcludeIds()); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java index 9e0e63898d..e7eb642b52 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java @@ -136,7 +136,7 @@ public class ApiDefinitionService extends MoveNodeService { private ApiDefinitionNoticeService apiDefinitionNoticeService; public List getApiDefinitionPage(ApiDefinitionPageRequest request, String userId) { - if (CollectionUtils.isNotEmpty(request.getProtocols())) { + if (CollectionUtils.isEmpty(request.getProtocols())) { return new ArrayList<>(); } CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request, userId); @@ -297,9 +297,6 @@ public class ApiDefinitionService extends MoveNodeService { public void batchUpdate(ApiDefinitionBatchUpdateRequest request, String userId) { ProjectService.checkResourceExist(request.getProjectId()); - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); // 记录更新前的数据 apiDefinitionLogService.batchUpdateLog(ids, userId, request.getProjectId()); @@ -436,9 +433,6 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchDeleteToGc(ApiDefinitionBatchDeleteRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); if (CollectionUtils.isNotEmpty(ids)) { handleDeleteApiDefinition(ids, request.getDeleteAllVersion(), request.getProjectId(), userId, true); @@ -446,9 +440,6 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchMove(ApiDefinitionBatchMoveRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); if (!ids.isEmpty()) { // 移动接口所有版本引用的数据 @@ -830,9 +821,6 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchRecover(ApiDefinitionBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId); if (CollectionUtils.isNotEmpty(ids)) { handleRecoverApiDefinition(ids, userId, request.getProjectId(), true); @@ -840,9 +828,6 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchDelete(ApiDefinitionBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId); if (CollectionUtils.isNotEmpty(ids)) { handleTrashDelApiDefinition(ids, userId, request.getProjectId(), true); @@ -897,8 +882,7 @@ public class ApiDefinitionService extends MoveNodeService { // 获取批量操作选中的ID public List getBatchApiIds(T dto, String projectId, List protocols, boolean deleted, String userId) { TableBatchProcessDTO request = (TableBatchProcessDTO) dto; - if (request.isSelectAll()) { - // 全选 + if (request.isSelectAll() && CollectionUtils.isNotEmpty(protocols)) { CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request.getCondition(), userId); List ids = extApiDefinitionMapper.getIds(request, projectId, protocols, deleted); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { @@ -906,6 +890,7 @@ public class ApiDefinitionService extends MoveNodeService { } return ids; } else { + request.getSelectIds().removeAll(request.getExcludeIds()); return request.getSelectIds(); } } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseRecoverService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseRecoverService.java index 24a84bc88f..fa5f279428 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseRecoverService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseRecoverService.java @@ -29,9 +29,7 @@ public class ApiTestCaseRecoverService { private ApiTestCaseService apiTestCaseService; public void batchRecover(ApiTestCaseBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } + List ids = doSelectIds(request, true); if (CollectionUtils.isEmpty(ids)) { return; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java index fea0069189..8ace5250eb 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java @@ -382,9 +382,7 @@ public class ApiTestCaseService extends MoveNodeService { } public void batchDelete(ApiTestCaseBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } + List ids = doSelectIds(request, true); if (CollectionUtils.isEmpty(ids)) { return; @@ -424,7 +422,7 @@ public class ApiTestCaseService extends MoveNodeService { } public List doSelectIds(ApiTestCaseBatchRequest request, boolean deleted) { - if (request.isSelectAll()) { + if (request.isSelectAll() && CollectionUtils.isNotEmpty(request.getProtocols())) { List ids = extApiTestCaseMapper.getIds(request, deleted); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { ids.removeAll(request.getExcludeIds()); @@ -437,9 +435,6 @@ public class ApiTestCaseService extends MoveNodeService { } public void batchMoveGc(ApiTestCaseBatchRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } List ids = doSelectIds(request, false); batchDeleteToGc(ids, userId, request.getProjectId(), true); } @@ -462,9 +457,7 @@ public class ApiTestCaseService extends MoveNodeService { } public void batchEdit(ApiCaseBatchEditRequest request, String userId) { - if (CollectionUtils.isEmpty(request.getProtocols())) { - return; - } + List ids = doSelectIds(request, false); if (CollectionUtils.isEmpty(ids)) { return; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java index 254ed6afdc..841ec2dafb 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java @@ -2154,10 +2154,7 @@ public class ApiScenarioService extends MoveNodeService { } private void getCaseStep(ApiScenarioSystemRequest request, ScenarioSystemRequest caseRequest, List steps) { - if (CollectionUtils.isEmpty(caseRequest.getProtocols())) { - return; - } - if (CollectionUtils.isNotEmpty(caseRequest.getModuleIds())) { + if (CollectionUtils.isNotEmpty(caseRequest.getModuleIds()) && CollectionUtils.isNotEmpty(caseRequest.getProtocols())) { caseRequest.getSelectedIds().addAll(extApiTestCaseMapper.getIdsByModules(caseRequest)); } caseRequest.getSelectedIds().removeAll(caseRequest.getUnselectedIds()); @@ -2181,10 +2178,7 @@ public class ApiScenarioService extends MoveNodeService { } private void getApiStep(ApiScenarioSystemRequest request, ScenarioSystemRequest apiRequest, List steps) { - if (CollectionUtils.isEmpty(apiRequest.getProtocols())) { - return; - } - if (CollectionUtils.isNotEmpty(apiRequest.getModuleIds())) { + if (CollectionUtils.isNotEmpty(apiRequest.getModuleIds()) && CollectionUtils.isNotEmpty(apiRequest.getProtocols())) { apiRequest.getSelectedIds().addAll(extApiDefinitionMapper.getIdsByModules(apiRequest)); } apiRequest.getSelectedIds().removeAll(apiRequest.getUnselectedIds()); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java index c45a3dfab6..2a07650c73 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java @@ -817,12 +817,6 @@ public class ApiDefinitionControllerTests extends BaseTest { request.setSelectAll(false); request.setProtocols(List.of("HTTP")); this.requestPostWithOkAndReturn(BATCH_MOVE, request); - // @@校验日志 - - String[] ids = {"1001", "1002", "1005"}; - for (String id : ids) { - checkLogModelList.add(new CheckLogModel(id, OperationLogType.UPDATE, BATCH_MOVE)); - } // 移动全部 条件为关键字为st-6的数据 request.setSelectAll(true); @@ -831,7 +825,7 @@ public class ApiDefinitionControllerTests extends BaseTest { request.setCondition(baseCondition); this.requestPostWithOkAndReturn(BATCH_MOVE, request); // @@校验日志 - checkLogModelList.add(new CheckLogModel("1006", OperationLogType.UPDATE, BATCH_MOVE)); + //checkLogModelList.add(new CheckLogModel("1006", OperationLogType.UPDATE, BATCH_MOVE)); // @@校验权限 requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_UPDATE, BATCH_MOVE, request); } diff --git a/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue b/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue index 5cfa5b17cb..3c6c064d61 100644 --- a/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue +++ b/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue @@ -503,7 +503,7 @@ onBeforeOk: async () => { try { await loadRealMap.value[props.group].delete(props.moduleType, record?.id as string); - Message.success(t('project.taskCenter.delScheduleSuccess')); + Message.success(t('project.basicInfo.deleted')); initData(); } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/views/project-management/taskCenter/locale/en-US.ts b/frontend/src/views/project-management/taskCenter/locale/en-US.ts index 687e80742a..095414d232 100644 --- a/frontend/src/views/project-management/taskCenter/locale/en-US.ts +++ b/frontend/src/views/project-management/taskCenter/locale/en-US.ts @@ -41,8 +41,8 @@ export default { 'project.taskCenter.delScheduleSuccess': 'Delete scheduled task successfully', 'project.taskCenter.delSchedule.tip': 'Deleting the scheduled task will cause the task to stop. Do you want to continue?', - 'project.taskCenter.enableScheduleSuccess': 'Enable scheduled task successfully', - 'project.taskCenter.disableScheduleSuccess': 'Disable scheduled task successfully', + 'project.taskCenter.enableScheduleSuccess': 'Enable successfully', + 'project.taskCenter.disableScheduleSuccess': 'Disable successfully', 'project.belongProject': 'Project', 'project.belongOrganization': 'Organization', 'project.taskCenter.batchEnable': 'Batch enable', diff --git a/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts b/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts index ae526cb0ab..bb1be0427b 100644 --- a/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts +++ b/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts @@ -39,8 +39,8 @@ export default { 'project.taskCenter.delSchedule': '确定删除定时任务吗?', 'project.taskCenter.delScheduleSuccess': '删除定时任务成功', 'project.taskCenter.delSchedule.tip': '删除定时任务会导致任务停止,是否继续?', - 'project.taskCenter.enableScheduleSuccess': '启用定时任务成功', - 'project.taskCenter.disableScheduleSuccess': '关闭定时任务成功', + 'project.taskCenter.enableScheduleSuccess': '已开启', + 'project.taskCenter.disableScheduleSuccess': '已关闭', 'project.belongProject': '所属项目', 'project.belongOrganization': '所属组织', 'project.taskCenter.batchEnable': '批量开启',