Search in sources :

Example 1 with BindUserDto

use of com.paascloud.provider.model.dto.role.BindUserDto in project paascloud-master by paascloud.

the class UacGroupServiceImpl method getGroupBindUserDto.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public GroupBindUserDto getGroupBindUserDto(Long groupId, Long currentUserId) {
    GroupBindUserDto groupBindUserDto = new GroupBindUserDto();
    Set<Long> alreadyBindUserIdSet = Sets.newHashSet();
    UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(groupId);
    if (PublicUtil.isEmpty(uacGroup)) {
        logger.error("找不到uacGroup={}, 的组织", uacGroup);
        throw new UacBizException(ErrorCodeEnum.UAC10015001, groupId);
    }
    // 查询所有用户包括已禁用的用户
    List<BindUserDto> bindUserDtoList = uacRoleMapper.selectAllNeedBindUser(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID, currentUserId);
    // 该组织已经绑定的用户
    List<UacGroupUser> setAlreadyBindUserSet = uacGroupUserMapper.listByGroupId(groupId);
    Set<BindUserDto> allUserSet = new HashSet<>(bindUserDtoList);
    for (UacGroupUser uacGroupUser : setAlreadyBindUserSet) {
        alreadyBindUserIdSet.add(uacGroupUser.getUserId());
    }
    groupBindUserDto.setAllUserSet(allUserSet);
    groupBindUserDto.setAlreadyBindUserIdSet(alreadyBindUserIdSet);
    return groupBindUserDto;
}
Also used : BindUserDto(com.paascloud.provider.model.dto.role.BindUserDto) GroupBindUserDto(com.paascloud.provider.model.dto.group.GroupBindUserDto) UacGroup(com.paascloud.provider.model.domain.UacGroup) UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacGroupUser(com.paascloud.provider.model.domain.UacGroupUser) GroupBindUserDto(com.paascloud.provider.model.dto.group.GroupBindUserDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

UacGroup (com.paascloud.provider.model.domain.UacGroup)1 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)1 GroupBindUserDto (com.paascloud.provider.model.dto.group.GroupBindUserDto)1 BindUserDto (com.paascloud.provider.model.dto.role.BindUserDto)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 Transactional (org.springframework.transaction.annotation.Transactional)1