feat: 根据预览的前100行推断excel类型

This commit is contained in:
taojinlong 2021-07-12 18:39:34 +08:00
parent 9060a789f0
commit d611114f8d

View File

@ -951,16 +951,11 @@ public class DataSetTableService {
tableFiled.setFieldName(columnName);
tableFiled.setRemarks(columnName);
fields.add(tableFiled);
} else if (i == 1) {
if (row == null) {
break;
}
r[j] = readCell(row.getCell(j), true, fields.get(j));
} else {
if (row == null) {
break;
}
r[j] = readCell(row.getCell(j), false, null);
r[j] = readCell(row.getCell(j), true, fields.get(j));
}
}
if (i > 0) {
@ -1005,16 +1000,11 @@ public class DataSetTableService {
tableFiled.setFieldName(columnName);
tableFiled.setRemarks(columnName);
fields.add(tableFiled);
} else if (i == 1) {
if (row == null) {
break;
}
r[j] = readCell(row.getCell(j), true, fields.get(j));
} else {
if (row == null) {
break;
}
r[j] = readCell(row.getCell(j), false, null);
r[j] = readCell(row.getCell(j), true, fields.get(j));
}
}
if (i > 0) {
@ -1083,7 +1073,9 @@ public class DataSetTableService {
double eps = 1e-10;
if (value - Math.floor(value) < eps) {
if (cellType) {
tableFiled.setFieldType("LONG");
if (StringUtils.isEmpty(tableFiled.getFieldType()) || tableFiled.getFieldType().equalsIgnoreCase("TEXT")){
tableFiled.setFieldType("LONG");
}
}
return value.longValue() + "";
} else {
@ -1132,7 +1124,9 @@ public class DataSetTableService {
double eps = 1e-10;
if (value - Math.floor(value) < eps) {
if (cellType) {
tableFiled.setFieldType("LONG");
if (StringUtils.isEmpty(tableFiled.getFieldType()) || tableFiled.getFieldType().equalsIgnoreCase("TEXT")){
tableFiled.setFieldType("LONG");
}
}
return value.longValue() + "";
} else {