Procházet zdrojové kódy

up:导人学员判断

yangdamao před 3 roky
rodič
revize
ffdecd3c93

+ 7 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -156,7 +156,13 @@ public class UserController extends BaseController {
     public AjaxResult<Map<String,Object>> importData(MultipartFile file, String importNo) throws Exception
     {
         ExcelUtil<UserImportAddBo> util = new ExcelUtil<UserImportAddBo>(UserImportAddBo.class);
-        List<UserImportAddBo> userList = util.importExcel(file.getInputStream());
+        List<UserImportAddBo> userList = null;
+        try{
+            userList = util.importExcel(file.getInputStream());
+        }catch (Exception e){
+            e.printStackTrace();
+            throw new IllegalArgumentException("模板格式不正确,请重新下载模板");
+        }
         Collections.reverse(userList);
         if (userList.stream().allMatch(item -> ObjectUtils.isNull(item))){
             throw new IllegalArgumentException("模板格式不正确,请重新下载模板");