From cf9615a317aab7b4ba16f147a167bc1691b11af2 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 13 Dec 2022 18:19:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=80=9A=E7=94=A8=E5=8A=9F=E8=83=BD):=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=BD=AE=E6=96=B0=E7=94=A8=E4=BE=8B=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=EF=BC=8C=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E8=87=AA=E5=8A=A8=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --- .../ApiDefinitionImportUtilService.java | 51 ++++++++++++------- .../definition/ApiDefinitionService.java | 2 +- .../service/scenario/ApiScenarioService.java | 2 +- .../service/PerformanceTestService.java | 2 +- .../metersphere/service/TestCaseService.java | 2 +- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java index 01e8a01850..3ce26fc339 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java @@ -529,31 +529,42 @@ public class ApiDefinitionImportUtilService { if (i == v.size()) { //如果系统内的所有版本都不是当前选择的数据更新版本,需要与lasted = 1 比较请求参数,参数一致,仅变更接口模块为当前导入接口的模块,不一致,新增并变更接口模块为当前导入接口的模块 if (latestApi != null) { - Boolean hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs); + Boolean hasChange; + if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) { + hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs); + } else { + hasChange = true; + } if (!hasChange) { - for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { - definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); - definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); - definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); - updateApiList.add(definitionWithBLOBs); + if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) { + for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { + definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); + definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); + definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); + updateApiList.add(definitionWithBLOBs); + } } apiDefinitionWithBLOBs.setVersionId("trash"); } else { addNewVersionApi(apiDefinitionWithBLOBs, latestApi, "update"); - for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { - definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); - definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); - definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); - updateApiList.add(definitionWithBLOBs); + if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) { + for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { + definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); + definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); + definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); + updateApiList.add(definitionWithBLOBs); + } } } } } else { - for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { - definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); - definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); - definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); - updateApiList.add(definitionWithBLOBs); + if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) { + for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) { + definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId()); + definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath()); + definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); + updateApiList.add(definitionWithBLOBs); + } } optionData.remove(apiDefinitionWithBLOBs); } @@ -862,7 +873,6 @@ public class ApiDefinitionImportUtilService { if (MapUtils.isNotEmpty(caseNameMap)) { buildCaseList(oldCaseMap, caseNameMap, definitionWithBLOBs, optionDataCases); } - ApiDefinitionWithBLOBs api = new ApiDefinitionWithBLOBs(); BeanUtils.copyBean(api, apiDefinitionWithBLOBs); api.setId(definitionWithBLOBs.getId()); @@ -874,7 +884,12 @@ public class ApiDefinitionImportUtilService { } if (i == v.size()) { if (latestApi!=null) { - Boolean hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs); + boolean hasChange; + if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) { + hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs); + } else { + hasChange = true; + } if (!hasChange) { optionData.remove(apiDefinitionWithBLOBs); } else { diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index fb9c647eeb..0a7c3bd8b5 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -783,7 +783,7 @@ public class ApiDefinitionService { apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate()); } ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId()); - checkAndSetLatestVersion(result.getRefId()); + //checkAndSetLatestVersion(result.getRefId()); // 存储附件关系 extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.API.name()); diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 5de483f2e4..6ae6a11d26 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -409,7 +409,7 @@ public class ApiScenarioService { if (relationshipEdgeService != null) { relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario); } - checkAndSetLatestVersion(beforeScenario.getRefId()); + //checkAndSetLatestVersion(beforeScenario.getRefId()); // 存储附件关系 extFileAssociationService.saveScenario(scenario.getId(), request.getScenarioDefinition()); return scenario; diff --git a/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java b/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java index 93f92d9ed8..235bfd33d1 100644 --- a/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java +++ b/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java @@ -325,7 +325,7 @@ public class PerformanceTestService { copyLoadTestFiles(testId, loadTest.getId()); loadTestMapper.insertSelective(loadTest); } - checkAndSetLatestVersion(loadTest.getRefId()); + //checkAndSetLatestVersion(loadTest.getRefId()); return loadTest; } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 1aa0554c66..243f246b71 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -463,7 +463,7 @@ public class TestCaseService { dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId()); testCaseMapper.insertSelective(testCase); } - checkAndSetLatestVersion(testCase.getRefId()); + //checkAndSetLatestVersion(testCase.getRefId()); } /**