fix(接口测试): 场景添加逻辑控制器保存报错

This commit is contained in:
AgAngle 2024-03-27 18:18:34 +08:00 committed by Craftsman
parent dee6bc7b32
commit b979c71ee4
4 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ import java.util.List;
* @CreateTime: 2024-01-10 11:24
*/
@Data
public class ApiScenarioStepCommonDTO {
public class ApiScenarioStepCommonDTO<T extends ApiScenarioStepCommonDTO> {
@Schema(description = "步骤id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_scenario_step.id.not_blank}")
@Size(max = 50, message = "{api_scenario_step.id.length_range}")
@ -75,5 +75,5 @@ public class ApiScenarioStepCommonDTO {
@Valid
@Schema(description = "子步骤")
private List<? extends ApiScenarioStepCommonDTO> children;
private List<T> children;
}

View File

@ -8,7 +8,7 @@ import lombok.Data;
* @CreateTime: 2024-01-10 11:24
*/
@Data
public class ApiScenarioStepDTO extends ApiScenarioStepCommonDTO {
public class ApiScenarioStepDTO extends ApiScenarioStepCommonDTO<ApiScenarioStepDTO> {
@Schema(description = "场景id")
private String scenarioId;

View File

@ -7,7 +7,7 @@ import lombok.Data;
* @CreateTime: 2024-01-10 11:24
*/
@Data
public class ApiScenarioStepRequest extends ApiScenarioStepCommonDTO {
public class ApiScenarioStepRequest extends ApiScenarioStepCommonDTO<ApiScenarioStepRequest> {
/**
* 记录是从哪个步骤复制来的
* 如果没有传步骤详情

View File

@ -809,14 +809,14 @@ public class ApiScenarioService extends MoveNodeService {
* 解析步骤树结构
* 获取待更新的 ApiScenarioStep 列表
*/
private List<ApiScenarioStep> getApiScenarioSteps(ApiScenarioStepCommonDTO parent,
List<? extends ApiScenarioStepCommonDTO> steps, List<ApiScenarioCsvStep> csvSteps) {
private List<ApiScenarioStep> getApiScenarioSteps(ApiScenarioStepRequest parent,
List<ApiScenarioStepRequest> steps, List<ApiScenarioCsvStep> csvSteps) {
if (CollectionUtils.isEmpty(steps)) {
return Collections.emptyList();
}
List<ApiScenarioStep> apiScenarioSteps = new ArrayList<>();
long sort = 1;
for (ApiScenarioStepCommonDTO step : steps) {
for (ApiScenarioStepRequest step : steps) {
ApiScenarioStep apiScenarioStep = new ApiScenarioStep();
BeanUtils.copyBean(apiScenarioStep, step);
apiScenarioStep.setSort(sort++);