This commit is contained in:
Vinjor 2024-11-21 13:50:53 +08:00
parent 5924aea9da
commit 291360d2e6
3 changed files with 5 additions and 5 deletions

View File

@ -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, "身份有误");
}

View File

@ -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());
}
}
}

View File

@ -94,7 +94,7 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
// 获取登录用户的角色信息
List<Long> 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<RoleReqDTO> 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;
}