forked from github/dataease
fix: 精简模式Excel数据集在单元格中包含特殊符号或空值时会报错
This commit is contained in:
parent
a3ff9c9459
commit
ab5b1be514
@ -310,6 +310,9 @@ public class ExcelXlsxReader extends DefaultHandler {
|
||||
maxRef = ref;
|
||||
}
|
||||
if(curRow>1){
|
||||
for (int i=cellList.size();i<this.fields.size();i++){
|
||||
cellList.add("");
|
||||
}
|
||||
List<String> tmp = new ArrayList<>(cellList);
|
||||
this.getData().add(tmp);
|
||||
}
|
||||
|
@ -40,8 +40,12 @@ public class DDLProviderImpl extends DDLProvider {
|
||||
|
||||
Integer realSize = page * pageNumber < dataList.size() ? page * pageNumber : dataList.size();
|
||||
for (String[] strings : dataList.subList((page - 1) * pageNumber, realSize)) {
|
||||
String[] strings1 = new String[strings.length];
|
||||
for(int i=0; i< strings.length;i++){
|
||||
strings1[i] = strings[i].replace("'","\\'");
|
||||
}
|
||||
values.append("('").append(UUID.randomUUID())
|
||||
.append("','" ).append(String.join("','", Arrays.asList(strings)))
|
||||
.append("','" ).append(String.join("','", Arrays.asList(strings1)))
|
||||
.append("'),");
|
||||
}
|
||||
return insertSql + values.substring(0, values.length() - 1);
|
||||
|
@ -1930,8 +1930,7 @@ public class DataSetTableService {
|
||||
inputStream.close();
|
||||
excelSheetDataList.forEach(excelSheetData -> {
|
||||
List<List<String>> data = excelSheetData.getData();
|
||||
String[] fieldArray = excelSheetData.getFields().stream().map(TableField::getFieldName)
|
||||
.toArray(String[]::new);
|
||||
String[] fieldArray = excelSheetData.getFields().stream().map(TableField::getFieldName).toArray(String[]::new);
|
||||
List<Map<String, Object>> jsonArray = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(data)) {
|
||||
jsonArray = data.stream().map(ele -> {
|
||||
|
Loading…
Reference in New Issue
Block a user