From 627a63c5117c93c766bf064885f1c6a516722a59 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 15 Apr 2024 19:37:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=B9=E9=87=8F=E5=85=A8=E9=80=89=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1039407 --user=王孝刚 【项目任务中心】定时任务-接口场景/API导入列表-全选所有页-批量开启/关闭-报Name cannot be null. https://www.tapd.cn/55049933/s/1497619 --- .../scenario/ApiScenarioReportStepDTO.java | 3 ++- .../ApiDefinitionNoticeService.java | 2 ++ .../definition/ApiTestCaseNoticeService.java | 8 ++----- .../scenario/ApiScenarioNoticeService.java | 15 +++++++----- .../system/mapper/ExtScheduleMapper.xml | 24 ++++--------------- .../notice/constants/NoticeConstants.java | 1 + 6 files changed, 20 insertions(+), 33 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioReportStepDTO.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioReportStepDTO.java index 724390a5f4..45ff1255e6 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioReportStepDTO.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ApiScenarioReportStepDTO.java @@ -1,5 +1,6 @@ package io.metersphere.api.dto.scenario; +import io.metersphere.sdk.constants.ApiReportStatus; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -27,7 +28,7 @@ public class ApiScenarioReportStepDTO { private String parentId; @Schema(description = "结果状态") - private String status; + private String status = ApiReportStatus.PENDING.name(); @Schema(description = "误报编号/误报状态独有") private String fakeCode; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionNoticeService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionNoticeService.java index c847f505c1..4377c9bbfd 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionNoticeService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionNoticeService.java @@ -36,6 +36,8 @@ public class ApiDefinitionNoticeService { public ApiDefinitionCaseDTO getUpdateApiDTO(ApiDefinitionUpdateRequest request) { ApiDefinitionCaseDTO caseDTO = new ApiDefinitionCaseDTO(); + ApiDefinition apiDefinition = apiDefinitionMapper.selectByPrimaryKey(request.getId()); + BeanUtils.copyBean(caseDTO, apiDefinition); BeanUtils.copyBean(caseDTO, request); return caseDTO; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseNoticeService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseNoticeService.java index ebd3fe327d..23d6708c4e 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseNoticeService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseNoticeService.java @@ -36,13 +36,9 @@ public class ApiTestCaseNoticeService { public ApiDefinitionCaseDTO getCaseDTO(ApiTestCaseUpdateRequest request) { ApiDefinitionCaseDTO caseDTO = new ApiDefinitionCaseDTO(); + ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(request.getId()); + BeanUtils.copyBean(caseDTO, testCase); BeanUtils.copyBean(caseDTO, request); - caseDTO.setName(null); - caseDTO.setStatus(null); - caseDTO.setCaseCreateUser(null); - caseDTO.setCaseUpdateUser(null); - caseDTO.setCaseName(request.getName()); - caseDTO.setCaseStatus(request.getStatus()); return caseDTO; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioNoticeService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioNoticeService.java index be13e550bb..a429c87456 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioNoticeService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioNoticeService.java @@ -9,6 +9,7 @@ import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.SubListUtils; import io.metersphere.system.domain.Schedule; import io.metersphere.system.domain.ScheduleExample; +import io.metersphere.system.dto.sdk.ApiScenarioMessageDTO; import io.metersphere.system.mapper.ScheduleMapper; import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; @@ -52,21 +53,23 @@ public class ApiScenarioNoticeService { return dtoList; } - public ApiScenarioDTO getScenarioDTO(ApiScenarioAddRequest request) { - ApiScenarioDTO scenarioDTO = new ApiScenarioDTO(); + public ApiScenarioMessageDTO getScenarioDTO(ApiScenarioAddRequest request) { + ApiScenarioMessageDTO scenarioDTO = new ApiScenarioMessageDTO(); BeanUtils.copyBean(scenarioDTO, request); return scenarioDTO; } - public ApiScenarioDTO getScenarioDTO(ApiScenarioUpdateRequest request) { - ApiScenarioDTO scenarioDTO = new ApiScenarioDTO(); + public ApiScenarioMessageDTO getScenarioDTO(ApiScenarioUpdateRequest request) { + ApiScenarioMessageDTO scenarioDTO = new ApiScenarioMessageDTO(); + ApiScenario apiScenario = apiScenarioMapper.selectByPrimaryKey(request.getId()); + BeanUtils.copyBean(scenarioDTO, apiScenario); BeanUtils.copyBean(scenarioDTO, request); return scenarioDTO; } - public ApiScenarioDTO getScenarioDTO(String id) { + public ApiScenarioMessageDTO getScenarioDTO(String id) { ApiScenario apiScenario = apiScenarioMapper.selectByPrimaryKey(id); - ApiScenarioDTO scenarioDTO = new ApiScenarioDTO(); + ApiScenarioMessageDTO scenarioDTO = new ApiScenarioMessageDTO(); BeanUtils.copyBean(scenarioDTO, apiScenario); return scenarioDTO; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml index ce4566fea9..086aee8789 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml @@ -149,17 +149,9 @@ select task.* from ( SELECT - schedule.id, - schedule.name as taskname, - schedule.project_id, - resource_type, + schedule.*, ads.num as resource_num, - ads.name as resource_name, - ads.id as resource_id, - schedule.value, - schedule.enable, - schedule.create_user AS createUserName, - schedule.create_time + ads.name as resource_name FROM schedule inner join api_definition_swagger ads on schedule.resource_id = ads.id @@ -167,17 +159,9 @@ SELECT - schedule.id, - schedule.name as taskname, - schedule.project_id, - resource_type, + schedule.*, api_scenario.num as resource_num, - api_scenario.name as resource_name, - api_scenario.id as resource_id, - schedule.value, - schedule.enable, - schedule.create_user AS createUserName, - schedule.create_time + api_scenario.name as resource_name FROM schedule inner join api_scenario on schedule.resource_id = api_scenario.id diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/constants/NoticeConstants.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/constants/NoticeConstants.java index 7a1b64e5c3..765bebdbb5 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/constants/NoticeConstants.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/constants/NoticeConstants.java @@ -534,5 +534,6 @@ public interface NoticeConstants { String platformBugId = "platformBugId"; String handleUsers = "handleUsers"; String groupId = "groupId"; + String job = "job"; } }