用户表里添加两个属性
连续密码输错次数private Integer loginFailCount;/** 登录失败禁用时间 */ private Date missDate;
/ 如果登录错误次数大于5次 规定时间内禁止登录if(dbUser.getLoginFailCount() != null && dbUser.getLoginFailCount() >= 3){if(DateUtils.getCurrentDateTime().getTime() < dbUser.getMissDate().getTime()){return LYResultVO.errorResultVO(AlertConstant.FAIL_LOGIN_COUNT_ALERT);}dbUser.setLoginFailCount(0);systemUserJpaRepository.save(dbUser);}if (!dbUser.getPassword().equals(MD5Utils.MD5(user.getPassWord()))) {if(dbUser.getLoginFailCount() != null){dbUser.setLoginFailCount(dbUser.getLoginFailCount() + 1);}else{dbUser.setLoginFailCount(1); }systemUserJpaRepository.save(dbUser);if(dbUser.getLoginFailCount() == 3){dbUser.setMissDate(DateUtils.getAfterCurrentDateTime(1440));}return LYResultVO.errorResultVO("密码有误!");}