use of com.paascloud.provider.model.domain.UacRoleUser in project paascloud-master by paascloud.
the class UserManager method activeUser.
@MqProducerStore
public void activeUser(final MqMessageData mqMessageData, final UacUser uacUser, final String activeUserKey) {
log.info("激活用户. mqMessageData={}, user={}", mqMessageData, uacUser);
int result = uacUserMapper.updateByPrimaryKeySelective(uacUser);
if (result < 1) {
throw new UacBizException(ErrorCodeEnum.UAC10011038, uacUser.getId());
}
// 绑定一个访客角色默认值roleId=10000
final Long userId = uacUser.getId();
Preconditions.checkArgument(userId != null, "用戶Id不能爲空");
final Long roleId = 10000L;
UacRoleUser roleUser = new UacRoleUser();
roleUser.setUserId(userId);
roleUser.setRoleId(roleId);
uacRoleUserMapper.insertSelective(roleUser);
// 绑定一个组织
UacGroupUser groupUser = new UacGroupUser();
groupUser.setUserId(userId);
groupUser.setGroupId(GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID);
uacGroupUserMapper.insertSelective(groupUser);
// 删除 activeUserToken
redisService.deleteKey(activeUserKey);
}
use of com.paascloud.provider.model.domain.UacRoleUser in project paascloud-master by paascloud.
the class UacRoleMainController method modifyUacRoleStatusById.
/**
* 修改角色状态.
*
* @param modifyStatusDto the modify status dto
*
* @return the wrapper
*/
@LogAnnotation
@PostMapping(value = "/modifyRoleStatusById")
@ApiOperation(httpMethod = "POST", value = "根据角色Id修改角色状态")
public Wrapper modifyUacRoleStatusById(@ApiParam(name = "modifyRoleStatusDto", value = "修改角色状态数据") @RequestBody ModifyStatusDto modifyStatusDto) {
logger.info("根据角色Id修改角色状态 modifyStatusDto={}", modifyStatusDto);
Long roleId = modifyStatusDto.getId();
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
LoginAuthDto loginAuthDto = getLoginAuthDto();
Long userId = loginAuthDto.getUserId();
UacRoleUser ru = uacRoleUserService.getByUserIdAndRoleId(userId, roleId);
if (ru != null && UacRoleStatusEnum.DISABLE.getType().equals(modifyStatusDto.getStatus())) {
throw new UacBizException(ErrorCodeEnum.UAC10012002);
}
UacRole uacRole = new UacRole();
uacRole.setId(roleId);
uacRole.setStatus(modifyStatusDto.getStatus());
uacRole.setUpdateInfo(loginAuthDto);
int result = uacRoleService.update(uacRole);
return super.handleResult(result);
}
use of com.paascloud.provider.model.domain.UacRoleUser in project paascloud-master by paascloud.
the class UacRoleUserServiceImpl method saveRoleUser.
@Override
public int saveRoleUser(Long userId, Long roleId) {
if (userId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10011001);
}
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleUser roleUser = new UacRoleUser();
roleUser.setUserId(userId);
roleUser.setRoleId(roleId);
return uacRoleUserMapper.insertSelective(roleUser);
}
use of com.paascloud.provider.model.domain.UacRoleUser 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);
}
Aggregations