From 44026e11faff32db2babd303d885b2cd0315a00b Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 17 Feb 2022 17:51:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=8F=8F=E8=BF=B0=E4=BB=A5=E5=A4=A7=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E5=BC=80=E5=A4=B4=E5=AF=BC=E5=85=A5=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=20--bug=3D1010265=20--user=3D=E9=99=88=E5=BB=BA=E6=98=9F=20?= =?UTF-8?q?=E6=A0=87=E5=87=86=E6=A8=A1=E6=9D=BF=E7=94=A8=E4=BE=8B=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=A4=B1=E8=B4=A5=EF=BC=8C=E6=8F=90=E7=A4=BA=20Packet?= =?UTF-8?q?=20for=20query=20is=20too=20large=20(128,530,704=20>=2067,108,8?= =?UTF-8?q?64)=20https://www.tapd.cn/55049933/s/1105293?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/TestCaseNoModelDataListener.java | 48 ++++++++----------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java index f79e5e6a23..2e21e64502 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java @@ -517,27 +517,17 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener stepDescList = new ArrayList<>(); List stepResList = new ArrayList<>(); - ListUtils listUtils = new ListUtils(); + ListUtils listUtils = new ListUtils<>(); + + Set rowNums = new HashSet<>(); if (data.getStepDesc() != null) { - String desc = data.getStepDesc().replaceAll("\\n([0-9]+\\.)", "\r\n$1"); - String[] stepDesc = desc.split("\r\n"); - StringBuffer stepBuffer = new StringBuffer(); - int lastStepIndex = 1; + String[] stepDesc = data.getStepDesc().split("\r\n"); + + int rowIndex = 1; for (String row : stepDesc) { - RowInfo rowInfo = this.parseIndexInRow(row); - int rowIndex = rowInfo.index; - String rowMessage = rowInfo.rowInfo; - if (rowIndex > -1) { - listUtils.set(stepDescList, lastStepIndex - 1, stepBuffer.toString(), ""); - stepBuffer = new StringBuffer(); - lastStepIndex = rowIndex; - stepBuffer.append(rowMessage); - } else { - stepBuffer.append(row); - } - } - if (StringUtils.isNotEmpty(stepBuffer.toString())) { - listUtils.set(stepDescList, lastStepIndex - 1, stepBuffer.toString(), ""); + TestCaseNoModelDataListener.RowInfo rowInfo = this.parseIndexInRow(row); + stepDescList.add(rowInfo.rowInfo); + rowNums.add(rowIndex++); } } else { stepDescList.add(""); @@ -546,24 +536,20 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener -1) { - listUtils.set(stepResList, lastStepIndex - 1, stepBuffer.toString(), ""); - stepBuffer = new StringBuffer(); + + if (rowIndex > -1 && rowNums.contains(rowIndex)) { + listUtils.set(stepResList, lastStepIndex - 1, rowMessage, ""); lastStepIndex = rowIndex; - stepBuffer.append(rowMessage); } else { - stepBuffer.append(row); + listUtils.set(stepResList, lastStepIndex - 1, rowMessage, ""); + lastStepIndex++; } } - if (StringUtils.isNotEmpty(stepBuffer.toString())) { - listUtils.set(stepResList, lastStepIndex - 1, stepBuffer.toString(), ""); - } } else { stepResList.add(""); } @@ -577,10 +563,14 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener