fix: 78190

企标--导入--导入文件夹内的excel文件与下载模板的名称不一样提示语不对
This commit is contained in:
2023-11-06 18:15:21 +08:00
parent 5c2e732889
commit bb0875bb4f
@@ -1452,7 +1452,28 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
String excelName = excelfilelist.get(0).getName();
if (tableName.equals(TableNameEnum.ENTERPRISE_STANDARDS.getTableName())) {
// 检查Excel的文件名
if (!excelName.equals("企业标准导入模板.xlsx")) {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
}
if (tableName.equals(TableNameEnum.DOMESTIC_REGULATIONS.getTableName())) {
// 检查Excel的文件名
if (!excelName.equals("国内标准导入模板.xlsx")) {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
}
if (tableName.equals(TableNameEnum.FOREIGN_REGULATIONS.getTableName())) {
// 检查Excel的文件名
if (!excelName.equals("海外标准导入模板.xlsx")) {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
}
// 数据内容格式校验
Map<String, File> fileMap = new HashMap<>();
try (Workbook workbook = new XSSFWorkbook(Files.newInputStream(excelfilelist.get(0).toPath()))) {
@@ -1967,7 +1988,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
ByteArrayOutputStream baosZip = new ByteArrayOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(baosZip)) {
// 添加第一个文件到ZIP中
ZipEntry entry1 = new ZipEntry("企标导入模板.xlsx");
ZipEntry entry1 = new ZipEntry("企标标准导入模板.xlsx");
zos.putNextEntry(entry1);
zos.write(mainWorkbookBytes);
zos.closeEntry();