fix(数据集): DataEase v1.18.14,simple 模式部署,Excel 文件上传失败 #7534
This commit is contained in:
parent
c542642f6e
commit
3488ec0f26
@ -8,6 +8,7 @@ import com.alibaba.excel.metadata.CellData;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
@ -2355,7 +2356,7 @@ public class DataSetTableService {
|
||||
}
|
||||
String json = JSON.toJSONString(noModelDataListener.getData());
|
||||
List<List<String>> data = JSON.parseObject(json, new TypeReference<List<List<String>>>() {
|
||||
});
|
||||
}, Feature.IgnoreNotMatch);
|
||||
data = (isPreview && noModelDataListener.getData().size() > 1000 ? new ArrayList<>(data.subList(0, 1000)) : data);
|
||||
if (isPreview) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
@ -2379,15 +2380,7 @@ public class DataSetTableService {
|
||||
public List<ExcelSheetData> parseExcel(String filename, InputStream inputStream, boolean isPreview) throws Exception {
|
||||
List<ExcelSheetData> excelSheetDataList = new ArrayList<>();
|
||||
String suffix = filename.substring(filename.lastIndexOf(".") + 1);
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
|
||||
ExcelXlsReader excelXlsReader = new ExcelXlsReader();
|
||||
excelXlsReader.setObtainedNum(1000);
|
||||
excelXlsReader.process(inputStream);
|
||||
excelSheetDataList = excelXlsReader.totalSheets;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
|
||||
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
|
||||
}
|
||||
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
||||
List<TableField> fields = new ArrayList<>();
|
||||
|
||||
@ -757,14 +757,7 @@ public class ExtractDataService {
|
||||
for (ExcelSheetData excelSheetData : excelSheetDataList) {
|
||||
String suffix = excelSheetData.getPath().substring(excelSheetData.getPath().lastIndexOf(".") + 1);
|
||||
List<ExcelSheetData> totalSheets = new ArrayList<>();
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
|
||||
ExcelXlsReader excelXlsReader = new ExcelXlsReader();
|
||||
excelXlsReader.process(new FileInputStream(excelSheetData.getPath()));
|
||||
totalSheets = excelXlsReader.totalSheets;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
|
||||
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
|
||||
}
|
||||
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
||||
List<TableField> fields = new ArrayList<>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user