use of com.paascloud.provider.model.exceptions.UacBizException 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.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacMenuServiceImpl method getViewVoById.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ViewMenuVo getViewVoById(Long id) {
Preconditions.checkArgument(id != null, "菜单ID不能为空");
UacMenu menu = uacMenuMapper.selectByPrimaryKey(id);
if (menu == null) {
logger.error("找不到菜单信息id={}", id);
throw new UacBizException(ErrorCodeEnum.UAC10013003, id);
}
// 获取父级菜单信息
UacMenu parentMenu = uacMenuMapper.selectByPrimaryKey(menu.getPid());
ModelMapper modelMapper = new ModelMapper();
ViewMenuVo menuVo = modelMapper.map(menu, ViewMenuVo.class);
if (parentMenu != null) {
menuVo.setParentMenuName(parentMenu.getMenuName());
}
return menuVo;
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacMenuServiceImpl method disableMenuList.
@Override
public int disableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto) {
UacMenu uacMenuUpdate = new UacMenu();
int sum = 0;
for (UacMenu menu : menuList) {
uacMenuUpdate.setId(menu.getId());
uacMenuUpdate.setVersion(menu.getVersion() + 1);
uacMenuUpdate.setStatus(UacMenuStatusEnum.DISABLE.getType());
uacMenuUpdate.setLastOperator(loginAuthDto.getLoginName());
uacMenuUpdate.setLastOperatorId(loginAuthDto.getUserId());
uacMenuUpdate.setUpdateTime(new Date());
int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);
if (result > 0) {
sum += 1;
} else {
throw new UacBizException(ErrorCodeEnum.UAC10013005, menu.getId());
}
}
return sum;
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacMenuServiceImpl method saveUacMenu.
@Override
public int saveUacMenu(UacMenu menu, LoginAuthDto loginAuthDto) {
Long pid = menu.getPid();
menu.setUpdateInfo(loginAuthDto);
UacMenu parentMenu = mapper.selectByPrimaryKey(pid);
if (PublicUtil.isEmpty(parentMenu)) {
throw new UacBizException(ErrorCodeEnum.UAC10013001, pid);
}
if (menu.isNew()) {
UacMenu updateMenu = new UacMenu();
menu.setLevel(parentMenu.getLevel() + 1);
updateMenu.setLeaf(MenuConstant.MENU_LEAF_NO);
updateMenu.setId(pid);
Long menuId = super.generateId();
menu.setId(menuId);
int result = mapper.updateByPrimaryKeySelective(updateMenu);
if (result < 1) {
throw new UacBizException(ErrorCodeEnum.UAC10013002, menuId);
}
menu.setStatus(UacMenuStatusEnum.ENABLE.getType());
menu.setCreatorId(loginAuthDto.getUserId());
menu.setCreator(loginAuthDto.getUserName());
menu.setLastOperatorId(loginAuthDto.getUserId());
menu.setLastOperator(loginAuthDto.getUserName());
// 新增的菜单是叶子节点
menu.setLeaf(MenuConstant.MENU_LEAF_YES);
return uacMenuMapper.insertSelective(menu);
} else {
return uacMenuMapper.updateByPrimaryKeySelective(menu);
}
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacMenuServiceImpl method enableMenuList.
@Override
public int enableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto) {
UacMenu uacMenuUpdate = new UacMenu();
int sum = 0;
for (UacMenu menu : menuList) {
uacMenuUpdate.setId(menu.getId());
uacMenuUpdate.setVersion(menu.getVersion() + 1);
uacMenuUpdate.setStatus(UacMenuStatusEnum.ENABLE.getType());
uacMenuUpdate.setLastOperator(loginAuthDto.getLoginName());
uacMenuUpdate.setLastOperatorId(loginAuthDto.getUserId());
uacMenuUpdate.setUpdateTime(new Date());
int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);
if (result > 0) {
sum += 1;
} else {
throw new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId());
}
}
return sum;
}
Aggregations