From 0bd92a76eb39613d8535e31f563aad6733f8ef2a Mon Sep 17 00:00:00 2001 From: sunzheng Date: Mon, 23 Sep 2024 11:33:20 +0800 Subject: [PATCH] =?UTF-8?q?update:=E8=A1=A5=E5=85=85=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E8=A1=A8=E5=A4=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../laws/club/service/impl/LawsClubServiceImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubServiceImpl.java index b6394189..6e3b5d89 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/club/service/impl/LawsClubServiceImpl.java @@ -789,6 +789,8 @@ public class LawsClubServiceImpl extends ServiceImpl i Map fileMap = multipartRequest.getFileMap(); for (Map.Entry entity : fileMap.entrySet()) { MultipartFile file = entity.getValue();// 获取上传文件对象 + // 校验模板表头 + excelHeadVerify(file, LawsClubExcel.class, 0 ,0); try { ImportParams params = new ImportParams(); params.setNeedSave(true); @@ -960,4 +962,15 @@ public class LawsClubServiceImpl extends ServiceImpl i )); } + private void excelHeadVerify(MultipartFile file, Class clazz, int titleRows, int i) { + try { + if (!(boolean) ImportExcelUtil.checkTemplateTitle(file, clazz, titleRows, i)){ + throw new JeroBootException(ResultCommon.IMPORT_TEMPLATE_ERROR); + } + }catch (Exception e) { + e.printStackTrace(); + throw new JeroBootException(ResultCommon.IMPORT_TEMPLATE_ERROR); + } + } + }