Parcourir la source

新增上传考勤文件报错判定

anderx il y a 1 an
Parent
commit
e273af9236

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -296,6 +296,9 @@ public class SysUserController extends BaseController
     public AjaxResult importUserClock( @RequestParam("file") MultipartFile file) throws Exception{
         ExcelUtil<Map> util = new ExcelUtil<>(Map.class);
         List<Map<Integer, String>> maps = util.importMapExcel(file.getInputStream(), 0);
+        if (maps == null || maps.isEmpty()){
+            return error("您上传的文件格式不匹配,请重新上传!");
+        }
         userService.pushUserClock(maps);
         return success();
     }