use of com.albedo.java.common.core.exception.BizException in project albedo by somowhere.
the class RoleResource method checkRole.
/**
* 检查角色是否有用户信息
*
* @return
*/
private void checkRole(Long roleId, String roleName) {
List<UserDo> userDoList = userService.findListByRoleId(roleId);
ArgumentAssert.notEmpty(userDoList, () -> new BizException("操作失败!用户:" + CollUtil.convertToString(userDoList, UserDo.F_USERNAME, StringUtil.COMMA) + "所属要操作的角色:" + roleName));
}
use of com.albedo.java.common.core.exception.BizException in project albedo by somowhere.
the class RoleServiceImpl method verification.
public void verification(Set<Long> ids) {
List<UserDo> userDoList = userRepository.findListByRoleIds(ids);
ArgumentAssert.notEmpty(userDoList, () -> new BizException("所选角色存在用户关联,请解除关联再试!"));
}
use of com.albedo.java.common.core.exception.BizException in project albedo by somowhere.
the class UserServiceImpl method save.
@Override
public void save(@Valid UserExcelVo userExcelVo) {
UserDto user = new UserDto();
BeanUtils.copyProperties(userExcelVo, user);
DeptDo deptDo = deptService.getOne(Wrappers.<DeptDo>query().lambda().eq(DeptDo::getName, userExcelVo.getDeptName()));
if (deptDo != null) {
user.setDeptId(deptDo.getId());
}
RoleDo roleDo = roleService.getOne(Wrappers.<RoleDo>query().lambda().eq(RoleDo::getName, userExcelVo.getRoleName()));
ArgumentAssert.notNull(roleDo, () -> new BizException("无法获取角色" + userExcelVo.getRoleName() + "信息"));
user.setRoleIdList(Lists.newArrayList(roleDo.getId()));
saveOrUpdate(user);
}
use of com.albedo.java.common.core.exception.BizException in project albedo by somowhere.
the class DeptServiceImpl method checkDept.
/**
* 检查角色是否有用户信息
*
* @return
*/
private void checkDept(Long deptId, String deptName) {
List<UserDo> userDoList = userRepository.selectList(Wrappers.<UserDo>lambdaQuery().eq(UserDo::getDeptId, deptId));
ArgumentAssert.notEmpty(userDoList, "操作失败!用户:" + CollUtil.convertToString(userDoList, UserDo.F_USERNAME, StringUtil.COMMA) + "所属要操作的部门:" + deptName);
List<RoleDo> roleDoList = roleRepository.findListByDeptId(deptId);
ArgumentAssert.notEmpty(roleDoList, () -> new BizException("操作失败!角色:" + CollUtil.convertToString(roleDoList, RoleDo.F_NAME, StringUtil.COMMA) + "的权限信息属于要操作的部门:" + deptName));
}
use of com.albedo.java.common.core.exception.BizException in project albedo by somowhere.
the class MenuServiceImpl method removeByIds.
@Override
public void removeByIds(Set<Long> ids) {
ids.forEach(id -> {
SysCacheUtil.delMenuCaches(id);
// 查询父节点为当前节点的节点
List<MenuDo> menuDoList = this.list(Wrappers.<MenuDo>query().lambda().eq(MenuDo::getParentId, id));
ArgumentAssert.notEmpty(menuDoList, () -> new BizException("菜单含有下级不能删除"));
roleMenuRepository.delete(Wrappers.<RoleMenuDo>query().lambda().eq(RoleMenuDo::getMenuId, id));
// 删除当前菜单及其子菜单
this.removeById(id);
});
}
Aggregations