Search in sources :

Example 1 with UacGroup

use of com.paascloud.provider.model.domain.UacGroup in project paascloud-master by paascloud.

the class UacGroupServiceImpl method buildNode.

private List<GroupZtreeVo> buildNode(List<UacGroup> groupList, List<GroupZtreeVo> tree) {
    for (UacGroup group : groupList) {
        GroupZtreeVo groupZTreeVo = buildGroupZTreeVoByGroup(group);
        if (0L == group.getPid()) {
            groupZTreeVo.setOpen(true);
        }
        // 设置根节点
        tree.add(groupZTreeVo);
        UacGroup query = new UacGroup();
        query.setPid(group.getId());
        List<UacGroup> groupChildrenList = uacGroupMapper.select(query);
        // 有子节点 递归查询
        if (PublicUtil.isNotEmpty(groupChildrenList)) {
            buildNode(groupChildrenList, tree);
        }
    }
    return tree;
}
Also used : GroupZtreeVo(com.paascloud.provider.model.vo.GroupZtreeVo) UacGroup(com.paascloud.provider.model.domain.UacGroup)

Example 2 with UacGroup

use of com.paascloud.provider.model.domain.UacGroup in project paascloud-master by paascloud.

the class UacGroupServiceImpl method saveUacGroup.

@Override
public int saveUacGroup(UacGroup group, LoginAuthDto loginAuthDto) {
    int result;
    Preconditions.checkArgument(!StringUtils.isEmpty(group.getPid()), "上级节点不能为空");
    UacGroup parenGroup = uacGroupMapper.selectByPrimaryKey(group.getPid());
    if (PublicUtil.isEmpty(parenGroup)) {
        throw new UacBizException(ErrorCodeEnum.UAC10015009, group.getPid());
    }
    setGroupAddress(group);
    group.setUpdateInfo(loginAuthDto);
    if (group.isNew()) {
        Long groupId = super.generateId();
        group.setId(groupId);
        group.setLevel(parenGroup.getLevel() + 1);
        result = this.addUacGroup(group);
    } else {
        result = this.editUacGroup(group);
    }
    return result;
}
Also used : UacGroup(com.paascloud.provider.model.domain.UacGroup) UacBizException(com.paascloud.provider.model.exceptions.UacBizException)

Example 3 with UacGroup

use of com.paascloud.provider.model.domain.UacGroup 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)

Example 4 with UacGroup

use of com.paascloud.provider.model.domain.UacGroup in project paascloud-master by paascloud.

the class UacGroupMainController method modifyGroupStatus.

/**
 * 根据id修改组织状态
 *
 * @param idStatusDto the id status dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyStatus")
@LogAnnotation
@ApiOperation(httpMethod = "POST", value = "根据id修改组织状态")
public Wrapper modifyGroupStatus(@ApiParam(name = "modifyGroupStatus", value = "修改状态") @RequestBody IdStatusDto idStatusDto) {
    logger.info("根据id修改组织状态 idStatusDto={}", idStatusDto);
    UacGroup uacGroup = new UacGroup();
    uacGroup.setId(idStatusDto.getId());
    LoginAuthDto loginAuthDto = super.getLoginAuthDto();
    Integer status = idStatusDto.getStatus();
    uacGroup.setStatus(status);
    int result = uacGroupService.updateUacGroupStatusById(idStatusDto, loginAuthDto);
    if (result < 1) {
        return WrapMapper.wrap(Wrapper.ERROR_CODE, "操作失败");
    } else {
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE, "操作成功");
    }
}
Also used : UacGroup(com.paascloud.provider.model.domain.UacGroup) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 5 with UacGroup

use of com.paascloud.provider.model.domain.UacGroup in project paascloud-master by paascloud.

the class UacGroupCommonController method getGroupTreeById.

/**
 * 根据当前登录人查询组织列表
 *
 * @return the group tree by id
 */
@PostMapping(value = "/getGroupTree")
@ApiOperation(httpMethod = "POST", value = "根据当前登录人查询组织列表")
public Wrapper<List<GroupZtreeVo>> getGroupTreeById() {
    logger.info("根据当前登录人查询组织列表");
    LoginAuthDto loginAuthDto = super.getLoginAuthDto();
    Long groupId = loginAuthDto.getGroupId();
    UacGroup uacGroup = uacGroupService.queryById(groupId);
    List<GroupZtreeVo> tree = uacGroupService.getGroupTree(uacGroup.getId());
    return WrapMapper.wrap(Wrapper.SUCCESS_CODE, "操作成功", tree);
}
Also used : GroupZtreeVo(com.paascloud.provider.model.vo.GroupZtreeVo) UacGroup(com.paascloud.provider.model.domain.UacGroup) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

UacGroup (com.paascloud.provider.model.domain.UacGroup)12 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)6 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)5 GroupZtreeVo (com.paascloud.provider.model.vo.GroupZtreeVo)5 Transactional (org.springframework.transaction.annotation.Transactional)5 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)2 ApiOperation (io.swagger.annotations.ApiOperation)2 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 UacUser (com.paascloud.provider.model.domain.UacUser)1 GroupBindUserDto (com.paascloud.provider.model.dto.group.GroupBindUserDto)1 BindUserDto (com.paascloud.provider.model.dto.role.BindUserDto)1