Merge pull request #7469 from dataease/pr@dev-v2@fixDatasource

fix:【数据源】-本地Excel文件创建的数据源数据预览为空
This commit is contained in:
taojinlong 2023-12-29 12:20:55 +08:00 committed by GitHub
commit 5e83d113b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,25 +297,19 @@ public class ExcelUtils {
} }
private String cellType(String value) { private String cellType(String value) {
if(value.length()> 19){
return "TEXT";
}
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Double d = Double.valueOf(value);
sdf.parse(value); double eps = 1e-10;
return "DATETIME"; if (d - Math.floor(d) < eps) {
} catch (Exception e1) { return "LONG";
if(value.length()> 19){ } else {
return "TEXT"; return "DOUBLE";
}
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";
} }
} catch (Exception e2) {
return "TEXT";
} }
} }