From 4b8eda69e0870e24e5678de3682751f1c3a1015c Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Wed, 1 Sep 2021 11:01:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-58579=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=91rank=E7=9A=84=E5=B8=A6=E5=8F=82?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=AE=A1=E7=AE=97=E5=80=BC=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=201.=E6=95=B0=E5=AD=97=E7=B1=BB=E5=9E=8B=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 3d7fe889c..ca5f030dd 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -5,6 +5,7 @@ import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ParameterMapNameSpace; import com.fr.base.TableDataNameSpace; +import com.fr.base.Utils; import com.fr.base.io.IOFile; import com.fr.data.TableDataSource; import com.fr.design.actions.UpdateAction; @@ -39,6 +40,7 @@ import com.fr.parser.BlockIntervalLiteral; import com.fr.parser.ColumnRowRangeInPage; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; +import com.fr.parser.NumberLiteral; import com.fr.parser.SheetIntervalLiteral; import com.fr.report.core.namespace.SimpleCellValueNameSpace; import com.fr.script.Calculator; @@ -98,6 +100,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -817,8 +820,24 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { if (entry.getValue().toString().startsWith("[") && entry.getValue().toString().endsWith("]")) { Expression parse = calculator.parse(entry.getValue()); ArrayExpression arrayExpression = (ArrayExpression) parse.getConditionalExpression(); - FArray fArray = new FArray<>(arrayExpression.getArrays()); + Node[] arrays = arrayExpression.getArrays(); + List arrayList = new ArrayList<>(); + for (Node array : arrays) { + if (array instanceof NumberLiteral) { + arrayList.add(NumberFormat.getInstance().parse(array.toString())); + } else { + arrayList.add(array); + } + } + FArray fArray = new FArray<>(arrayList); parameterMap.put(entry.getKey(), fArray); + } else if (Utils.isNumeric(entry.getValue().toString())) { + try { + Number number = NumberFormat.getInstance().parse(entry.getValue().toString()); + parameterMap.put(entry.getKey(), number); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn("", e); + } } } } catch (Exception e) {