From a4545f11228540c354999784ee7d2a49e37b22be Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 28 Jan 2022 13:46:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A8=A1=E5=9D=97=E5=B8=A6=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=A4=B1=E8=B4=A5=20--bug=3D1009895=20--user?= =?UTF-8?q?=3D=E9=99=88=E5=BB=BA=E6=98=9F=20=E7=94=A8=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84excel=E5=AF=BC=E5=85=A5=E7=94=A8=E4=BE=8B=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BAnode=20id=E4=B8=BA=E7=A9=BA=EF=BC=8C=E7=9C=8B?= =?UTF-8?q?=E4=BA=86=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=9C=89node=20id=20https:?= =?UTF-8?q?//www.tapd.cn/55049933/s/1100397?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/service/NodeTreeService.java | 2 +- .../track/service/TestCaseNodeService.java | 2 +- .../io/metersphere/track/service/TestCaseService.java | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/NodeTreeService.java b/backend/src/main/java/io/metersphere/service/NodeTreeService.java index bd8d0c8989..7ea650d36c 100644 --- a/backend/src/main/java/io/metersphere/service/NodeTreeService.java +++ b/backend/src/main/java/io/metersphere/service/NodeTreeService.java @@ -170,7 +170,7 @@ public class NodeTreeService { path.append("/" + nodeName); - String pid = null; + String pid; //创建过不创建 if (pathMap.get(path.toString()) != null) { pid = pathMap.get(path.toString()); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java index fa9ec5df5f..f1bc6e0380 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java @@ -405,7 +405,7 @@ public class TestCaseNodeService extends NodeTreeService { List nodeNameList = new ArrayList<>(Arrays.asList(item.split("/"))); Iterator itemIterator = nodeNameList.iterator(); Boolean hasNode = false; - String rootNodeName = null; + String rootNodeName; if (nodeNameList.size() <= 1) { throw new ExcelException(Translator.get("test_case_create_module_fail") + ":" + item); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index f09a9fe959..58cb8bc683 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -937,6 +937,17 @@ public class TestCaseService { testCase.setCreateUser(SessionUtils.getUserId()); testCase.setCreateTime(System.currentTimeMillis()); testCase.setUpdateTime(System.currentTimeMillis()); + if (StringUtils.isNotBlank(testCase.getNodePath())) { + String[] modules = testCase.getNodePath().split("/"); + StringBuilder path = new StringBuilder(); + for (String module : modules) { + if (StringUtils.isNotBlank(module)) { + path.append("/"); + path.append(module.trim()); + } + } + testCase.setNodePath(path.toString()); + } testCase.setNodeId(nodePathMap.get(testCase.getNodePath())); testCase.setNum(num); if (project.getCustomNum() && StringUtils.isBlank(testCase.getCustomNum())) {