Merge remote-tracking branch 'origin/master'

This commit is contained in:
liyawei
2022-06-10 17:07:16 +08:00
2 changed files with 47 additions and 30 deletions
@@ -1047,6 +1047,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
headerSb.append(key + ",");
}
} else if(i > 2){
// 校验头部是否符合模板
String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith(",")){
substring = headerSb.substring(0, headerSb.length() - 1);
}
String excelHeader = substring.toString();
if (!title.equals(excelHeader)) {
workbook.close();
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
}else{
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
}
}
List<String> headList = Arrays.asList(headerSb.toString().split(","));
String field ="";
if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
@@ -1092,23 +1108,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
}
}
// 校验头部是否符合模板
String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith(",")){
substring = headerSb.substring(0, headerSb.length() - 1);
}
String excelHeader = substring.toString();
if (!title.equals(excelHeader)) {
workbook.close();
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
}else{
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
}
}
// String substring = headerSb.toString();
// if (substring.endsWith(",") || substring.endsWith(",")){
// substring = headerSb.substring(0, headerSb.length() - 1);
// }
// String excelHeader = substring.toString();
// if (!title.equals(excelHeader)) {
// workbook.close();
// //删除原上传文件
// FileUnZip.deleteDir(saveDirectory);
// if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
// throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
// }else{
// throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
// }
//
// }
}
}
workbook.close();