use of com.paascloud.provider.model.exceptions.UacBizException 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.exceptions.UacBizException in project paascloud-master by paascloud.
the class SmsProducer method sendSmsCodeMq.
public MqMessageData sendSmsCodeMq(SmsMessage smsMessage, AliyunSmsConstants.SmsTempletEnum templetEnum) {
log.info("sendSmsCodeMq - 发送短信验证码. smsMessage={}", smsMessage);
String msgBody;
try {
PcSendSmsRequest request = new PcSendSmsRequest();
Map<String, String> map = Maps.newHashMap();
// 模板参数
String smsParamName = templetEnum.getSmsParamName();
// 模板编码
String templetCode = templetEnum.getTempletCode();
// 替换模板验证码
map.put(smsParamName, smsMessage.getSmsCode());
String param = JSON.toJSONString(map);
request.setPhoneNumbers(smsMessage.getMobileNo());
request.setTemplateCode(templetCode);
request.setTemplateParam(param);
request.setOutId(smsMessage.getOutId());
msgBody = JSON.toJSONString(request);
} catch (Exception e) {
log.error("发送短信验证码 smsMessage转换为json字符串失败", e);
throw new UacBizException(ErrorCodeEnum.UAC10011022);
}
String topic = AliyunMqTopicConstants.MqTopicEnum.SEND_SMS_TOPIC.getTopic();
String tag = AliyunMqTopicConstants.MqTagEnum.REGISTER_USER_AUTH_CODE.getTag();
String key = RedisKeyUtil.createMqKey(topic, tag, smsMessage.getMobileNo(), msgBody);
return new MqMessageData(msgBody, topic, tag, key);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class EmailServiceImpl method decryptEmail.
private String decryptEmail(final String loginName, String email) {
try {
email = HttpAesUtil.decrypt(email, KEY_STR, false, IV_STR);
log.info("发送短信 解密loginName={}", loginName);
log.info("发送短信 解密email={}", email);
} catch (Exception ex) {
log.info("发送短信 解密手机号码失败 密文loginName={}, email={}", loginName, email);
throw new UacBizException(ErrorCodeEnum.UAC10011031);
}
return email;
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacActionServiceImpl method deleteActionById.
@Override
public int deleteActionById(Long actionId) {
// 查询该角色下是否有用户绑定, 有的话提醒不能删除
if (null == actionId) {
throw new IllegalArgumentException("权限ID不能为空");
}
UacAction uacAction = uacActionMapper.selectByPrimaryKey(actionId);
if (uacAction == null) {
logger.error("找不到权限信息 actionId={}", actionId);
throw new UacBizException(ErrorCodeEnum.UAC10014001, actionId);
}
// 删除角色权限表数据 不查询了 直接删除了
uacRoleActionMapper.deleteByActionId(actionId);
return uacActionMapper.deleteByPrimaryKey(actionId);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacGroupServiceImpl method saveUacGroup.
@Override
public int saveUacGroup(UacGroup group, LoginAuthDto loginAuthDto) {
int result;
Preconditions.checkArgument(!StringUtils.isEmpty(group.getPid()), "上级节点不能为空");
UacGroup parenGroup = uacGroupMapper.selectByPrimaryKey(group.getPid());
if (PublicUtil.isEmpty(parenGroup)) {
throw new UacBizException(ErrorCodeEnum.UAC10015009, group.getPid());
}
setGroupAddress(group);
group.setUpdateInfo(loginAuthDto);
if (group.isNew()) {
Long groupId = super.generateId();
group.setId(groupId);
group.setLevel(parenGroup.getLevel() + 1);
result = this.addUacGroup(group);
} else {
result = this.editUacGroup(group);
}
return result;
}
Aggregations