BUGFIX:管理员系统 添加新用户邮箱校验,相同的邮箱只能创建一个账号
This commit is contained in:
@@ -437,8 +437,16 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
public Boolean addUser(AccountAddDTO accountAddDTO) {
|
public Boolean addUser(AccountAddDTO accountAddDTO) {
|
||||||
// 需要给的数据 用户邮箱、用户名、账号有效期截止时间、账号类型
|
// 需要给的数据 用户邮箱、用户名、账号有效期截止时间、账号类型
|
||||||
Account account = CopyUtil.copyObject(accountAddDTO, Account.class);
|
Account account = CopyUtil.copyObject(accountAddDTO, Account.class);
|
||||||
|
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("user_email", account.getUserEmail());
|
||||||
|
|
||||||
|
Account existsAccount = accountMapper.selectOne(queryWrapper);
|
||||||
|
if (!Objects.isNull(existsAccount)){
|
||||||
|
throw new BusinessException("The email address already exists. One email address can only register one AiDA account");
|
||||||
|
}
|
||||||
|
|
||||||
// 添加正式用户
|
// 添加正式用户
|
||||||
|
assert accountAddDTO != null;
|
||||||
if (Objects.isNull(accountAddDTO.getSystemUser())) {
|
if (Objects.isNull(accountAddDTO.getSystemUser())) {
|
||||||
throw new BusinessException("you have to choose user type");
|
throw new BusinessException("you have to choose user type");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user