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;
}
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;
}
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;
}
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, "操作成功");
}
}
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);
}
Aggregations