fix(系统设置): 优化批量全选关闭定时任务报错的缺陷

--bug=1039407 --user=王孝刚 【项目任务中心】定时任务-接口场景/API导入列表-全选所有页-批量开启/关闭-报Name
cannot be null. https://www.tapd.cn/55049933/s/1497619
This commit is contained in:
wxg0103 2024-04-15 19:37:23 +08:00 committed by wxg0103
parent b4ce05288e
commit 627a63c511
6 changed files with 20 additions and 33 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -149,17 +149,9 @@
select task.* from (
<if test="request.scheduleTagType == 'API_IMPORT'">
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 @@
</if>
<if test="request.scheduleTagType == 'API_SCENARIO'">
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

View File

@ -534,5 +534,6 @@ public interface NoticeConstants {
String platformBugId = "platformBugId";
String handleUsers = "handleUsers";
String groupId = "groupId";
String job = "job";
}
}