From d8ceb22bb68fe83aa8f68146b00636373c9c4a48 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Mon, 21 Oct 2024 16:33:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=A4=8D=E5=88=B6=E5=9C=BA=E6=99=AF=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=B1=95=E5=BC=80=E5=AD=90=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047506 --user=陈建星 【接口测试】批量复制场景后,场景中的场景类型步骤无法展开 https://www.tapd.cn/55049933/s/1594910 --- .../api/service/scenario/ApiScenarioService.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 a60e371567..d453d84fe8 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 @@ -2025,12 +2025,18 @@ public class ApiScenarioService extends MoveNodeService { } List stepList = apiScenarioStepMap.get(apiScenario.getId()); + Map originStepIdMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(stepList)) { stepList.forEach(step -> { + String originStepId = step.getId(); ApiScenarioStep copyStep = new ApiScenarioStep(); BeanUtils.copyBean(copyStep, step); copyStep.setId(IDGenerator.nextStr()); copyStep.setScenarioId(copyScenario.getId()); + originStepIdMap.put(originStepId, copyStep.getId()); + if (StringUtils.isNotBlank(step.getParentId()) && originStepIdMap.containsKey(step.getParentId())) { + copyStep.setParentId(originStepIdMap.get(step.getParentId())); + } insertApiScenarioStepList.add(copyStep); //这块的批量复制不处理csv文件和场景的配置信息