From 09726552cf71b8b68a87c2a35d0c833868dfd12d Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 10 Jun 2021 17:58:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=80=9D=E7=BB=B4=E5=AF=BC=E5=9B=BE=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E5=85=B3=E9=94=AE=E5=AD=97=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/xmind/XmindCaseParser.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index c3af4de07e..1c2ead4dd1 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -68,7 +68,7 @@ public class XmindCaseParser { private String importType; - public XmindCaseParser(TestCaseService testCaseService, String userId, String projectId, Set testCaseNames,boolean isUseCustomId,String importType) { + public XmindCaseParser(TestCaseService testCaseService, String userId, String projectId, Set testCaseNames, boolean isUseCustomId, String importType) { this.testCaseService = testCaseService; this.maintainer = userId; this.projectId = projectId; @@ -84,11 +84,11 @@ public class XmindCaseParser { this.importType = importType; } - private static final String TC_REGEX = "(?:tc:|tc:|tc)"; - private static final String PC_REGEX = "(?:pc:|pc:|pc)"; - private static final String RC_REGEX = "(?:rc:|rc:|rc)"; - private static final String ID_REGEX = "(?:id:|id:|id)"; - private static final String TAG_REGEX = "(?:tag:|tag:|tag)"; + private static final String TC_REGEX = "(?:tc:|tc:)"; + private static final String PC_REGEX = "(?:pc:|pc:)"; + private static final String RC_REGEX = "(?:rc:|rc:)"; + private static final String ID_REGEX = "(?:id:|id:)"; + private static final String TAG_REGEX = "(?:tag:|tag:)"; public void clear() { compartDatas.clear(); @@ -99,18 +99,18 @@ public class XmindCaseParser { } public List getTestCase() { - if(StringUtils.equals(this.importType,FunctionCaseImportEnum.Create.name())){ + if (StringUtils.equals(this.importType, FunctionCaseImportEnum.Create.name())) { return this.testCases; - }else { - return new ArrayList<>(); + } else { + return new ArrayList<>(); } } public List getUpdateTestCase() { - if(StringUtils.equals(this.importType,FunctionCaseImportEnum.Update.name())){ + if (StringUtils.equals(this.importType, FunctionCaseImportEnum.Update.name())) { return this.updateTestCases; - }else { - return new ArrayList<>(); + } else { + return new ArrayList<>(); } } @@ -233,13 +233,13 @@ public class XmindCaseParser { //自定义ID判断 - if(StringUtils.isEmpty(data.getCustomNum())){ - if(StringUtils.equals(this.importType, FunctionCaseImportEnum.Update.name())){ + if (StringUtils.isEmpty(data.getCustomNum())) { + if (StringUtils.equals(this.importType, FunctionCaseImportEnum.Update.name())) { validatePass = false; process.add(Translator.get("id_required"), nodePath + "/" + compartData.getName()); return false; - }else{ - if(isUseCustomId){ + } else { + if (isUseCustomId) { validatePass = false; process.add(Translator.get("custom_num_is_not_exist"), nodePath + "/" + compartData.getName()); return false; @@ -248,7 +248,7 @@ public class XmindCaseParser { } //判断更新 - if(StringUtils.equals(this.importType,FunctionCaseImportEnum.Update.name())) { + if (StringUtils.equals(this.importType, FunctionCaseImportEnum.Update.name())) { String checkResult = null; if (isUseCustomId) { checkResult = testCaseService.checkCustomIdExist(data.getCustomNum().toString(), projectId); @@ -257,13 +257,13 @@ public class XmindCaseParser { } if (null != checkResult) { //该ID在当前项目中存在 //如果前面所经过的校验都没报错 - if(!isUseCustomId){ + if (!isUseCustomId) { data.setNum(Integer.parseInt(data.getCustomNum())); data.setCustomNum(null); } data.setId(checkResult); updateTestCases.add(data); - }else { + } else { process.add(Translator.get("custom_num_is_not_exist"), nodePath + "/" + compartData.getName()); validatePass = false; } @@ -406,7 +406,7 @@ public class XmindCaseParser { }); } testCase.setRemark(rc.toString()); - if(isUseCustomId || StringUtils.equals(importType,FunctionCaseImportEnum.Update.name())){ + if (isUseCustomId || StringUtils.equals(importType, FunctionCaseImportEnum.Update.name())) { testCase.setCustomNum(customId.toString()); }