diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java index 4b65efe..338913d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java @@ -72,15 +72,20 @@ public class SysUserExamineController extends BaseController { /** * 审核保存 - * @param sysUser + * @param userId * @return */ @RequiresPermissions("system:userexamine:examine") @Log(title = "用户审核", businessType = BusinessType.EXAMINE) - @GetMapping("/saveexamine") + @GetMapping("/saveexamine/{userId}/{examine}/{examinedate}/{examineuser}") @ResponseBody - public AjaxResult editSave(@Validated SysUser sysUser) + public AjaxResult editSave(@PathVariable("userId") Long userId,@PathVariable("examine") + String examine,@PathVariable("examinedate") String examinedate,@PathVariable("examineuser") String examineuser) { + SysUser sysUser = userService.selectUserById(userId); + sysUser.setExamine(examine); + sysUser.setExaminedate(examinedate); + sysUser.setExamineuser(examineuser); return toAjax(userService.updateUser(sysUser)); } } diff --git a/ruoyi-admin/src/main/resources/static/i18n/messages.properties b/ruoyi-admin/src/main/resources/static/i18n/messages.properties index 8f65ed2..408552c 100644 --- a/ruoyi-admin/src/main/resources/static/i18n/messages.properties +++ b/ruoyi-admin/src/main/resources/static/i18n/messages.properties @@ -6,6 +6,7 @@ user.password.not.match=用户不存在/密码错误 user.password.retry.limit.count=密码输入错误{0}次 user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 user.password.delete=对不起,您的账号已被删除 +user.examine.disabled=抱歉,你的用户未经过审核 user.blocked=用户已封禁,请联系管理员 role.blocked=角色已封禁,请联系管理员 login.blocked=很遗憾,访问IP已被列入系统黑名单 diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index 02ee79f..d6e2c3a 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -4,7 +4,7 @@ 登录保密业务辅助管理系统系统 - + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ExamineState.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ExamineState.java new file mode 100644 index 0000000..2cb64e0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ExamineState.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.enums; + +public enum ExamineState { + ENABLE("0", "通过"), DISABLE("1", "未通过"), DEFAULT("2", "未审核"); + + private final String code; + private final String info; + + ExamineState(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDisableException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDisableException.java new file mode 100644 index 0000000..49201ac --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDisableException.java @@ -0,0 +1,10 @@ +package com.ruoyi.common.exception.user; + +public class UserDisableException extends UserException{ + private static final long serialVersionUID = 1L; + + public UserDisableException() + { + super("user.examine.disabled", null); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java index c36f700..399bdc0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java @@ -2,6 +2,9 @@ package com.ruoyi.framework.shiro.service; import java.util.List; import java.util.Set; + +import com.ruoyi.common.enums.ExamineState; +import com.ruoyi.common.exception.user.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.ruoyi.common.constant.Constants; @@ -10,12 +13,6 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.UserStatus; -import com.ruoyi.common.exception.user.BlackListException; -import com.ruoyi.common.exception.user.CaptchaException; -import com.ruoyi.common.exception.user.UserBlockedException; -import com.ruoyi.common.exception.user.UserDeleteException; -import com.ruoyi.common.exception.user.UserNotExistsException; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.IpUtils; import com.ruoyi.common.utils.MessageUtils; @@ -115,6 +112,15 @@ public class SysLoginService AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.delete"))); throw new UserDeleteException(); } + + /** + * 用户审核状态检测 + */ + if (ExamineState.DISABLE.getCode().equals(user.getExamine()) || ExamineState.DEFAULT.getCode().equals(user.getExamine())) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.examine.disabled"))); + throw new UserDisableException(); + } if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {