Search in sources :

Example 21 with UacBizException

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);
}
Also used : UacRoleMenu(com.paascloud.provider.model.domain.UacRoleMenu) UacBizException(com.paascloud.provider.model.exceptions.UacBizException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 22 with UacBizException

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);
}
Also used : UacRoleMenu(com.paascloud.provider.model.domain.UacRoleMenu) UacBizException(com.paascloud.provider.model.exceptions.UacBizException)

Example 23 with UacBizException

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);
    }
}
Also used : UacRoleMenu(com.paascloud.provider.model.domain.UacRoleMenu) UacBizException(com.paascloud.provider.model.exceptions.UacBizException)

Example 24 with UacBizException

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);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleUser(com.paascloud.provider.model.domain.UacRoleUser)

Example 25 with UacBizException

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);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto)

Aggregations

UacBizException (com.paascloud.provider.model.exceptions.UacBizException)37 Transactional (org.springframework.transaction.annotation.Transactional)8 UacGroup (com.paascloud.provider.model.domain.UacGroup)6 UacMenu (com.paascloud.provider.model.domain.UacMenu)6 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)5 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)5 MqMessageData (com.paascloud.provider.model.domain.MqMessageData)4 UacRoleMenu (com.paascloud.provider.model.domain.UacRoleMenu)4 UacRoleUser (com.paascloud.provider.model.domain.UacRoleUser)4 MenuVo (com.paascloud.provider.model.vo.MenuVo)4 UacRoleAction (com.paascloud.provider.model.domain.UacRoleAction)3 UacUser (com.paascloud.provider.model.domain.UacUser)3 BindAuthVo (com.paascloud.provider.model.vo.BindAuthVo)2 UserBindRoleVo (com.paascloud.provider.model.vo.UserBindRoleVo)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Date (java.util.Date)2 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 MqProducerStore (com.paascloud.provider.annotation.MqProducerStore)1 UacAction (com.paascloud.provider.model.domain.UacAction)1 UacRole (com.paascloud.provider.model.domain.UacRole)1