From ba71b20da8f6cd6b98eaed1165432c004cc3ae39 Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Fri, 10 Jun 2022 16:02:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=B8=85=E5=8D=95=E5=AF=BC?= =?UTF-8?q?=E5=85=A5--=E8=A1=A8=E5=A4=B4=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DummyInventoryInfoEOServiceImpl.java | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java index 31533aa9c..c7a3c2fab 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java @@ -1047,6 +1047,22 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl 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 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