diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java index 44fa0ab3..b65c6846 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java @@ -11,6 +11,7 @@ public interface CommonErrorCodeConstants extends ErrorCodeConstants { ErrorCode STAFF_NOT_CHANGE = new ErrorCode(2_002_000_003, "该员工还有工作未交接,不可删除"); ErrorCode LOGIN_ACCOUNT_EXIST = new ErrorCode(2_002_000_004, "登录账号已存在"); ErrorCode LOGIN_ACCOUNT_NOT_EXIST = new ErrorCode(2_002_000_005, "登录账号不存在"); + ErrorCode LOGIN_ACCOUNT_NOT_AUTH = new ErrorCode(2_002_000_010, "登录账号没有权限"); ErrorCode SYSTEM_ERROR = new ErrorCode(2_002_000_005, "系统错误"); ErrorCode MISTAKEN_IDENTITY = new ErrorCode(2_002_000_006, "身份有误"); } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java index ed96fabc..358c6fcb 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.staff.controller.admin; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.common.CommonErrorCodeConstants; import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -324,7 +323,7 @@ public class CompanyStaffController { rtnMap.put("loginResult",loginService.loginApp(authLoginReqVO,loginBody.getTenantId())); return success(rtnMap); }catch (Exception e){ - return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST); + return error(2_002_000_005,e.getMessage()); } } } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java index ecd2b078..b985b054 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/ApiAppLoginServiceImpl.java @@ -94,7 +94,7 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService { // 获取登录用户的角色信息 List roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId()); if (ObjectUtil.isEmpty(roleIdsByUserId) || roleIdsByUserId.size() == 0) { - throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST.getMsg()); + throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_AUTH.getMsg()); } List roleList = roleApi.getRoleList(); //所拥有的角色code集和 @@ -126,11 +126,11 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService { } else { //错误的业务系统标识 - throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST.getMsg()); + throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_AUTH.getMsg()); } // 角色是否可以登录 if (!flag) { - throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST.getMsg()); + throw new Exception(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_AUTH.getMsg()); } return user; }