use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method listByRoleId.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<UacRoleMenu> listByRoleId(Long roleId) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu roleMenu = new UacRoleMenu();
roleMenu.setRoleId(roleId);
return uacRoleMenuMapper.select(roleMenu);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method deleteByRoleId.
@Override
public void deleteByRoleId(Long roleId) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu roleMenu = new UacRoleMenu();
roleMenu.setRoleId(roleId);
uacRoleMenuMapper.delete(roleMenu);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method insert.
@Override
public void insert(Long roleId, Set<Long> menuIdList) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu uacRoleMenu = new UacRoleMenu();
uacRoleMenu.setRoleId(roleId);
for (Long menuId : menuIdList) {
uacRoleMenu.setMenuId(menuId);
uacRoleMenuMapper.insertSelective(uacRoleMenu);
}
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleUserServiceImpl method deleteByUserId.
@Override
public int deleteByUserId(Long userId) {
if (null == userId) {
throw new UacBizException(ErrorCodeEnum.UAC10011001);
}
UacRoleUser param = new UacRoleUser();
param.setUserId(userId);
return uacRoleUserMapper.delete(param);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacUserServiceImpl method resetLoginPwd.
@Override
public void resetLoginPwd(ResetLoginPwdDto resetLoginPwdDto) {
String confirmPwd = resetLoginPwdDto.getConfirmPwd();
String newPassword = resetLoginPwdDto.getNewPassword();
String resetPwdKey = resetLoginPwdDto.getResetPwdKey();
Preconditions.checkArgument(!StringUtils.isEmpty(newPassword), ErrorCodeEnum.UAC10011014.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(confirmPwd), ErrorCodeEnum.UAC10011009.msg());
Preconditions.checkArgument(!StringUtils.isEmpty(resetPwdKey), "链接已失效");
Preconditions.checkArgument(newPassword.equals(confirmPwd), "两次输入密码不一致");
String resetPwdTokenKey = RedisKeyUtil.getResetPwdTokenKey(resetPwdKey);
UacUser uacUser = (UacUser) redisTemplate.opsForValue().get(resetPwdTokenKey);
if (StringUtils.isEmpty(uacUser)) {
throw new UacBizException(ErrorCodeEnum.UAC10011028);
}
LoginAuthDto loginAuthDto = new LoginAuthDto();
loginAuthDto.setUserName(uacUser.getUserName());
loginAuthDto.setLoginName(uacUser.getLoginName());
loginAuthDto.setUserId(uacUser.getId());
UacUser update = new UacUser();
String salt = generateId() + "";
update.setLoginPwd(Md5Util.encrypt(newPassword));
update.setSalt(salt);
update.setId(uacUser.getId());
// 该用户已经修改过密码
update.setIsChangedPwd((Short.valueOf("1")));
update.setUpdateInfo(loginAuthDto);
int result = uacUserMapper.updateByPrimaryKeySelective(update);
if (result < 1) {
throw new UacBizException(ErrorCodeEnum.UAC10011029);
}
redisTemplate.delete(resetPwdTokenKey);
}
Aggregations