This commit is contained in:
PQZ 2024-08-28 19:04:41 +08:00
parent 32ff36ca08
commit 8ac68b20b7

View File

@ -105,11 +105,16 @@ public class AuthController {
}
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<String> roleNames = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).map(item -> item.getName()).collect(Collectors.toList());
// Boolean flag = (loginBody.getType().equals("0") && roleNames.contains("救援业务管理员")) || (loginBody.getType().equals("1") && roleNames.contains("交警"));
// 角色认证登录
// if (!flag) {
// return error(new ErrorCode(2_002_000_005, "登录账号不存在"));
// }
if (roleList.isEmpty()){
return error(new ErrorCode(2_002_000_005, "登录失败,当前登录用户未分配任何角色"));
}
if (loginBody.getTypes().equals("3") && !roleNames.contains("教练")){
return error(new ErrorCode(2_002_000_005, "当前登录用户未分配教练角色"));
}
if (loginBody.getTypes().equals("2") && !roleNames.contains("驾校管理员")){
return error(new ErrorCode(2_002_000_005, "当前登录用户未分配驾校管理员角色"));
}
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());