fix: 企标导入文件名校验

This commit is contained in:
2024-07-24 17:12:27 +08:00
parent 4c465dd2c6
commit 8223ff89ef
@@ -1670,7 +1670,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
String moduleCode = "";
if (tableName.equals(TableNameEnum.ENTERPRISE_STANDARDS.getTableName())) {
// 检查Excel的文件名
if (!excelName.equals("企业标准法规导入模板.xls") && !excelName.contains("xlsm")) {
if (!excelName.contains("企业标准法规导入模板.xls") && !excelName.contains("xlsm")) {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
@@ -1678,7 +1678,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
}
if (tableName.equals(TableNameEnum.DOMESTIC_REGULATIONS.getTableName())) {
// 检查Excel的文件名
if (!excelName.equals("外来标准法规导入模板.xls") && !excelName.contains("xlsm")) {
if (!excelName.contains("外来标准法规导入模板.xls") && !excelName.contains("xlsm")) {
FileUnZip.deleteDir(saveDirectory);
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
}
@@ -2476,7 +2476,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();