fix(数据集): 上传csv文件失败

This commit is contained in:
taojinlong 2024-03-07 17:15:41 +08:00
parent ec5cec2e21
commit ccfbc61a07
2 changed files with 4 additions and 4 deletions

View File

@ -2375,8 +2375,6 @@ 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);
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
List<TableField> fields = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
@ -2418,6 +2416,8 @@ public class DataSetTableService {
excelSheetData.setExcelLabel(filename);
excelSheetData.setFieldsMd5(Md5Utils.md5(StringUtils.join(fieldArray, ",")));
excelSheetDataList.add(excelSheetData);
}else {
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
}
inputStream.close();

View File

@ -757,8 +757,6 @@ public class ExtractDataService {
for (ExcelSheetData excelSheetData : excelSheetDataList) {
String suffix = excelSheetData.getPath().substring(excelSheetData.getPath().lastIndexOf(".") + 1);
List<ExcelSheetData> totalSheets = new ArrayList<>();
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
List<TableField> fields = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(excelSheetData.getPath()), StandardCharsets.UTF_8));
@ -796,6 +794,8 @@ public class ExtractDataService {
csvSheetData.setExcelLabel(excelSheetData.getExcelLabel());
csvSheetData.setFieldsMd5(Md5Utils.md5(StringUtils.join(fieldArray, ",")));
totalSheets = Arrays.asList(csvSheetData);
}else {
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
}