From 237c3c37bc021def74e2a4159154a68e423b27eb Mon Sep 17 00:00:00 2001 From: taojinlong Date: Fri, 29 Dec 2023 12:16:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E3=80=90=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E3=80=91-=E6=9C=AC=E5=9C=B0Excel=E6=96=87=E4=BB=B6=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=9A=84=E6=95=B0=E6=8D=AE=E6=BA=90=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/provider/ExcelUtils.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java index 7f19164eb6..86a8482383 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/ExcelUtils.java @@ -297,25 +297,19 @@ public class ExcelUtils { } private String cellType(String value) { + if(value.length()> 19){ + return "TEXT"; + } try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - sdf.parse(value); - return "DATETIME"; - } catch (Exception e1) { - if(value.length()> 19){ - return "TEXT"; - } - try { - Double d = Double.valueOf(value); - double eps = 1e-10; - if (d - Math.floor(d) < eps) { - return "LONG"; - } else { - return "DOUBLE"; - } - } catch (Exception e2) { - return "TEXT"; + Double d = Double.valueOf(value); + double eps = 1e-10; + if (d - Math.floor(d) < eps) { + return "LONG"; + } else { + return "DOUBLE"; } + } catch (Exception e2) { + return "TEXT"; } }