From d618593ffe425d4553539e83f0ba66aeb969d560 Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Tue, 29 Oct 2024 11:15:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=AF=BC=E5=85=A5=E5=9C=A8?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E9=A1=B9=E7=9B=AE=E5=88=9B=E5=BB=BA=E4=BA=86?= =?UTF-8?q?CASE=EF=BC=8C=E4=BD=86=E6=98=AF=E5=9C=BA=E6=99=AF=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=AD=A5=E9=AA=A4=E4=BE=9D=E7=84=B6=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E5=8E=9F=E5=9C=BA=E6=99=AF=E6=89=80=E5=9C=A8?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=AD=E7=9A=84CASE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1048274 --user=宋天阳 【场景导入】-导出有使用CASE的场景后,在目标项目创建了CASE,但是场景中的步骤依然引用的是原场景所在项目中的CASE https://www.tapd.cn/55049933/s/1599925 --- .../api/service/ApiScenarioDataTransferService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiScenarioDataTransferService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiScenarioDataTransferService.java index c99dfcdcec..60548b0b82 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiScenarioDataTransferService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiScenarioDataTransferService.java @@ -980,10 +980,11 @@ public class ApiScenarioDataTransferService { if (existenceApiCaseNumMap.containsKey(apiTestCaseDTO.getNum())) { returnResource.putApiTestCase(apiTestCaseDTO.getId(), existenceApiCaseNumMap.get(apiTestCaseDTO.getNum())); } else { + String oldId = apiTestCaseDTO.getId(); apiTestCaseDTO.setId(IDGenerator.nextStr()); apiTestCaseDTO.setProjectId(replaceApiDefinition.getProjectId()); apiTestCaseDTO.setApiDefinitionId(replaceApiDefinition.getId()); - returnResource.putApiTestCase(apiTestCaseDTO.getId(), apiTestCaseDTO); + returnResource.putApiTestCase(oldId, apiTestCaseDTO); analysisResult.setApiTestCase(apiTestCaseDTO); } } @@ -1003,10 +1004,11 @@ public class ApiScenarioDataTransferService { analysisResult.setApiDefinition(apiDefinitionDetail); for (ApiTestCaseDTO apiTestCaseDTO : testCaseList) { + String oldId = apiTestCaseDTO.getId(); apiTestCaseDTO.setId(IDGenerator.nextStr()); apiTestCaseDTO.setProjectId(apiDefinitionDetail.getProjectId()); apiTestCaseDTO.setApiDefinitionId(apiDefinitionDetail.getId()); - returnResource.putApiTestCase(apiTestCaseDTO.getId(), apiTestCaseDTO); + returnResource.putApiTestCase(oldId, apiTestCaseDTO); analysisResult.setApiTestCase(apiTestCaseDTO); } }