fix: Excel支持公式;错误提示增加文档链接

This commit is contained in:
junjie 2021-07-01 11:20:51 +08:00
parent fbba1e66bc
commit 162ac4d69a
4 changed files with 35 additions and 3 deletions

View File

@ -975,6 +975,38 @@ public class DataSetTableService {
return "";
}
CellType cellTypeEnum = cell.getCellTypeEnum();
if (cellTypeEnum.equals(CellType.FORMULA)) {
try {
double d = cell.getNumericCellValue();
try {
Double value = new Double(d);
double eps = 1e-10;
if (value - Math.floor(value) < eps) {
if (cellType) {
tableFiled.setFieldType("LONG");
}
return value.longValue() + "";
} else {
if (cellType) {
tableFiled.setFieldType("DOUBLE");
}
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
return nf.format(value);
}
} catch (Exception e) {
BigDecimal b = new BigDecimal(d);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
}
} catch (IllegalStateException e) {
String s = String.valueOf(cell.getRichStringCellValue());
if (cellType) {
tableFiled.setFieldType("TEXT");
tableFiled.setFieldSize(65533);
}
return s;
}
}
if (cellTypeEnum.equals(CellType.STRING)) {
if (cellType) {
tableFiled.setFieldType("TEXT");

View File

@ -848,7 +848,7 @@ export default {
edit_field: 'Edit Field',
preview_100_data: 'Show 100 lines data',
invalid_table_check: 'Please sync data first.',
parse_error: 'Parse Error,please check',
parse_error: 'Parse Error,please check.Referencehttps://dataease.io/docs/faq/dataset_faq/',
origin_field_type: 'Origin Type',
edit_excel_table: 'Edit Excel Dataset',
edit_excel: 'Edit Excel',

View File

@ -890,7 +890,7 @@ export default {
edit_field: '編輯自斷',
preview_100_data: '顯示前100行數據',
invalid_table_check: '非直連數據集請先完成數據同步',
parse_error: 'Excel解析錯誤請檢查格式、字段等信息',
parse_error: 'Excel解析錯誤請檢查格式、字段等信息。具體參考https://dataease.io/docs/faq/dataset_faq/',
origin_field_type: '原始類型',
edit_excel_table: '編輯Excel數據集',
edit_excel: '編輯Excel',

View File

@ -848,7 +848,7 @@ export default {
edit_field: '编辑字段',
preview_100_data: '显示前100行数据',
invalid_table_check: '非直连数据集请先完成数据同步',
parse_error: 'Excel解析错误请检查格式、字段等信息',
parse_error: 'Excel解析错误请检查格式、字段等信息。具体参考https://dataease.io/docs/faq/dataset_faq/',
origin_field_type: '原始类型',
edit_excel_table: '编辑Excel数据集',
edit_excel: '编辑Excel',