dubbo多层嵌套异常报错抛出会有点问题
会多很多字符
,所以可以才有报错向上抛出的原则来实现
/**
* 注册用户信息
*
* @param member 用户信息
* @return 结果
*/
Boolean registerUserInfo(Member member) throws ServiceException;
@Override
public Boolean registerUserInfo(Member member) throws ServiceException{
//判断账号是否已注册
boolean exist = TenantHelper.dynamic(member.getTenantId(), () -> {
return memberMapper.exists(new LambdaQueryWrapper<Member>()
.eq(Member::getUsername, member.getUsername()));
});
if (exist) {
throw new ServiceException("账号已存在,请勿重复注册!");
}
// //判断账号是否已注册
// boolean register = TenantHelper.dynamic(member.getTenantId(), () -> {
// return remoteMemberService.registerByMobile(registerBody.getUsername());
// });
// if (register) {
// throw new ServiceException("账号已存在,请勿重复注册!");
// }
RedisUtils.deleteObject(RedisKeyEnum.SMS.getKey() + member.getUsername() + member.getType());
String username = member.getUsername();
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
// throw new ServiceException("当前系统没有开启注册功能");
// }
member.setName("U:" + RandomUtil.randomNumbers(6));
member.setAccountStatus(0);
member.setAuthStatus(3);
member.setAuthType(0);//默认个人认证 认证类型0 未认证 1个人认证 2企业认证
//member.setShopStatus(0);
member.setAccountStatus(0);
member.setStatus(0);
member.setIsDeleted(0);
member.setShippersStatus(0);
member.setCreateBy(member.getUsername());
member.setUpdateBy(member.getUsername());
member.setCreateTime(TimeUtils.getNowDate());
boolean save = userService.save(member);
if (save) {
Company company = new Company();
company.setTenantId(member.getTenantId());
company.setMemberId(member.getId());
company.setCompanyName("个人");
company.setRoleId(1);
company.setCompanyMobile(username);
company.setCheckStatus(3);//审核状态 0 待审核 1审核通过 2审核不通过 3待提交
company.setIsDefault(1);
companyService.save(company);
}
return save;
}