forked from github/dataease
Merge pull request #217 from dataease/pr@dev@excelType
feat: 根据预览的前100行推断excel类型
This commit is contained in:
commit
ae0efc3873
@ -951,16 +951,11 @@ public class DataSetTableService {
|
|||||||
tableFiled.setFieldName(columnName);
|
tableFiled.setFieldName(columnName);
|
||||||
tableFiled.setRemarks(columnName);
|
tableFiled.setRemarks(columnName);
|
||||||
fields.add(tableFiled);
|
fields.add(tableFiled);
|
||||||
} else if (i == 1) {
|
|
||||||
if (row == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
|
||||||
} else {
|
} else {
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r[j] = readCell(row.getCell(j), false, null);
|
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -1005,16 +1000,11 @@ public class DataSetTableService {
|
|||||||
tableFiled.setFieldName(columnName);
|
tableFiled.setFieldName(columnName);
|
||||||
tableFiled.setRemarks(columnName);
|
tableFiled.setRemarks(columnName);
|
||||||
fields.add(tableFiled);
|
fields.add(tableFiled);
|
||||||
} else if (i == 1) {
|
|
||||||
if (row == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
|
||||||
} else {
|
} else {
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r[j] = readCell(row.getCell(j), false, null);
|
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -1083,7 +1073,9 @@ public class DataSetTableService {
|
|||||||
double eps = 1e-10;
|
double eps = 1e-10;
|
||||||
if (value - Math.floor(value) < eps) {
|
if (value - Math.floor(value) < eps) {
|
||||||
if (cellType) {
|
if (cellType) {
|
||||||
tableFiled.setFieldType("LONG");
|
if (StringUtils.isEmpty(tableFiled.getFieldType()) || tableFiled.getFieldType().equalsIgnoreCase("TEXT")){
|
||||||
|
tableFiled.setFieldType("LONG");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return value.longValue() + "";
|
return value.longValue() + "";
|
||||||
} else {
|
} else {
|
||||||
@ -1132,7 +1124,9 @@ public class DataSetTableService {
|
|||||||
double eps = 1e-10;
|
double eps = 1e-10;
|
||||||
if (value - Math.floor(value) < eps) {
|
if (value - Math.floor(value) < eps) {
|
||||||
if (cellType) {
|
if (cellType) {
|
||||||
tableFiled.setFieldType("LONG");
|
if (StringUtils.isEmpty(tableFiled.getFieldType()) || tableFiled.getFieldType().equalsIgnoreCase("TEXT")){
|
||||||
|
tableFiled.setFieldType("LONG");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return value.longValue() + "";
|
return value.longValue() + "";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user