diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java index 60c5ad3096..ee046ddaab 100644 --- a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java +++ b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java @@ -68,6 +68,6 @@ public class ExcelReaderUtil { } public static void main(String[] args) throws Exception { - ExcelReaderUtil.readExcel("111.xls", new FileInputStream("/Users/taojinlong/Desktop/111.xls")); + ExcelReaderUtil.readExcel("跑步数据汇总——万马奔腾版0729.xlsx", new FileInputStream("/Users/taojinlong/Desktop/跑步数据汇总——万马奔腾版0729.xlsx")); } } diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java index 5d65ace513..6b33dd49c1 100644 --- a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java +++ b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java @@ -327,7 +327,7 @@ public class ExcelXlsxReader extends DefaultHandler { formatString = style.getDataFormatString(); short format = this.formatIndex; if (format == 14 || format == 31 || format == 57 ||format == 59|| - format == 58 || (176 <= format && format <= 178) + format == 58 || (176 < format && format < 178) || (182 <= format && format <= 196) || (210 <= format && format <= 213) || (208 == format)) { // 日期 @@ -380,7 +380,7 @@ public class ExcelXlsxReader extends DefaultHandler { break; case NUMBER: //数字 - if (formatString != null) { + if (formatString != null && isDateFormat) { thisStr = formatter.formatRawCellContents(Double.parseDouble(value), formatIndex, formatString).trim(); } else { thisStr = value; @@ -404,7 +404,7 @@ public class ExcelXlsxReader extends DefaultHandler { } if(curRow==1){ TableFiled tableFiled = new TableFiled(); - tableFiled.setFieldType(type); + tableFiled.setFieldType("TEXT"); tableFiled.setFieldSize(65533); tableFiled.setFieldName(thisStr); tableFiled.setRemarks(thisStr); @@ -413,7 +413,15 @@ public class ExcelXlsxReader extends DefaultHandler { if(CollectionUtils.isEmpty(this.getFields())){ throw new RuntimeException(Translator.get("i18n_excel_header_empty")); } - this.getFields().get(curCol).setFieldType(type); + if(type.equalsIgnoreCase("LONG") && this.getFields().get(curCol).getFieldType().equalsIgnoreCase("TEXT")){ + this.getFields().get(curCol).setFieldType(type); + } + if(type.equalsIgnoreCase("DOUBLE") && !this.getFields().get(curCol).getFieldType().equalsIgnoreCase("DATETIME")){ + this.getFields().get(curCol).setFieldType(type); + } + if(type.equalsIgnoreCase("DATETIME")){ + this.getFields().get(curCol).setFieldType(type); + } } return thisStr; } @@ -428,9 +436,7 @@ public class ExcelXlsxReader extends DefaultHandler { thisStr = String.valueOf(Double.valueOf(thisStr)/100); } Long.valueOf(thisStr); - if(this.getFields().get(curCol).getFieldType().equalsIgnoreCase("TEXT")){ - return "LONG"; - } + return "LONG"; }catch (Exception e){ try { Double.valueOf(thisStr); diff --git a/frontend/src/views/dataset/common/DatasetGroupSelectorTree.vue b/frontend/src/views/dataset/common/DatasetGroupSelectorTree.vue index a8d151cffb..8f097ea5c2 100644 --- a/frontend/src/views/dataset/common/DatasetGroupSelectorTree.vue +++ b/frontend/src/views/dataset/common/DatasetGroupSelectorTree.vue @@ -236,6 +236,7 @@ export default { this.tableData = [] if (this.currGroup) { this.dsLoading = true + this.tables = []; post('/dataset/table/list', { sort: 'type asc,name asc,create_time desc', sceneId: this.currGroup.id, @@ -351,6 +352,7 @@ export default { if (!this.isTreeSearch) { if (node.data.id) { this.dsLoading = true + this.tables = []; post('/dataset/table/listAndGroup', { sort: 'type asc,name asc,create_time desc', sceneId: node.data.id,