use of com.paascloud.provider.model.vo.UserBindRoleVo in project paascloud-master by paascloud.
the class UacUserMainController method getBindRole.
/**
* 获取用户绑定角色页面数据.
*
* @param userId the user id
*
* @return the bind role
*/
@PostMapping(value = "/getBindRole/{userId}")
@ApiOperation(httpMethod = "POST", value = "获取用户绑定角色页面数据")
public Wrapper<UserBindRoleVo> getBindRole(@ApiParam(name = "userId", value = "角色id") @PathVariable Long userId) {
logger.info("获取用户绑定角色页面数据. userId={}", userId);
LoginAuthDto loginAuthDto = super.getLoginAuthDto();
Long currentUserId = loginAuthDto.getUserId();
if (Objects.equals(userId, currentUserId)) {
throw new UacBizException(ErrorCodeEnum.UAC10011023);
}
UserBindRoleVo bindUserDto = uacUserService.getUserBindRoleDto(userId);
return WrapMapper.ok(bindUserDto);
}
use of com.paascloud.provider.model.vo.UserBindRoleVo in project paascloud-master by paascloud.
the class UacUserServiceImpl method getUserBindRoleDto.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public UserBindRoleVo getUserBindRoleDto(Long userId) {
UserBindRoleVo userBindRoleVo = new UserBindRoleVo();
Set<Long> alreadyBindRoleIdSet = Sets.newHashSet();
UacUser uacUser = this.queryByUserId(userId);
if (uacUser == null) {
logger.error("找不到userId={}, 的用户", userId);
throw new UacBizException(ErrorCodeEnum.UAC10011003, userId);
}
// 查询所有角色包括该用户拥有的角色
List<BindRoleDto> bindRoleDtoList = uacUserMapper.selectAllNeedBindRole(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID);
// 该角色已经绑定的用户
List<UacRoleUser> setAlreadyBindRoleSet = uacRoleUserService.listByUserId(userId);
Set<BindRoleDto> allUserSet = new HashSet<>(bindRoleDtoList);
for (UacRoleUser uacRoleUser : setAlreadyBindRoleSet) {
alreadyBindRoleIdSet.add(uacRoleUser.getRoleId());
}
userBindRoleVo.setAllRoleSet(allUserSet);
userBindRoleVo.setAlreadyBindRoleIdSet(alreadyBindRoleIdSet);
return userBindRoleVo;
}
Aggregations