From a1eac0996f31296ce8355ad7cfeeeeb894169e05 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 12 Jan 2021 14:51:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiModuleService.java | 31 +++-- .../complete/EditCompleteDubboApi.vue | 112 +++++++++--------- .../complete/EditCompleteSQLApi.vue | 4 + .../request/tcp/TcpBasisParameters.vue | 2 +- 4 files changed, 77 insertions(+), 72 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java index 7ef25fb2de..89cbbeee16 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java @@ -24,7 +24,7 @@ import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; +import org.apache.commons.collections.CollectionUtils; import javax.annotation.Resource; import java.util.*; @@ -214,22 +214,21 @@ public class ApiModuleService extends NodeTreeService { request.setUpdateTime(System.currentTimeMillis()); checkApiModuleExist(request); List apiDefinitionResults = queryByModuleIds(request.getNodeIds()); - - apiDefinitionResults.forEach(apiDefinition -> { - if (StringUtils.isNotBlank(apiDefinition.getModulePath())) { - StringBuilder path = new StringBuilder(apiDefinition.getModulePath()); - List pathLists = Arrays.asList(path.toString().split("/")); - pathLists.set(request.getLevel(), request.getName()); - path.delete(0, path.length()); - for (int i = 1; i < pathLists.size(); i++) { - path = path.append("/").append(pathLists.get(i)); + if (CollectionUtils.isNotEmpty(apiDefinitionResults)) { + apiDefinitionResults.forEach(apiDefinition -> { + if (apiDefinition != null && StringUtils.isNotBlank(apiDefinition.getModulePath())) { + StringBuilder path = new StringBuilder(apiDefinition.getModulePath()); + List pathLists = Arrays.asList(path.toString().split("/")); + pathLists.set(request.getLevel(), request.getName()); + path.delete(0, path.length()); + for (int i = 1; i < pathLists.size(); i++) { + path = path.append("/").append(pathLists.get(i)); + } + apiDefinition.setModulePath(path.toString()); } - apiDefinition.setModulePath(path.toString()); - } - }); - - batchUpdateApiDefinition(apiDefinitionResults); - + }); + batchUpdateApiDefinition(apiDefinitionResults); + } return apiModuleMapper.updateByPrimaryKeySelective(request); } diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue index 88d9af53d7..d73e1ad2ba 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue @@ -29,68 +29,70 @@ diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue index 94e434e7b4..2053db88bd 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue @@ -71,6 +71,10 @@ export default { this.validateApi(); if (this.validated) { this.basisData.request = this.request; + this.basisData.method = this.basisData.protocol; + if (this.basisData.tags instanceof Array) { + this.basisData.tags = JSON.stringify(this.basisData.tags); + } this.$emit('runTest', this.basisData); } }, diff --git a/frontend/src/business/components/api/definition/components/request/tcp/TcpBasisParameters.vue b/frontend/src/business/components/api/definition/components/request/tcp/TcpBasisParameters.vue index 4a762f5173..5de8018d3e 100644 --- a/frontend/src/business/components/api/definition/components/request/tcp/TcpBasisParameters.vue +++ b/frontend/src/business/components/api/definition/components/request/tcp/TcpBasisParameters.vue @@ -3,7 +3,7 @@
- +