BUGFIX:管理员系统 添加新用户邮箱校验,相同的邮箱只能创建一个账号

This commit is contained in:
2024-08-27 11:32:47 +08:00
parent 47dc2bfc6e
commit cebc05d132

View File

@@ -437,8 +437,16 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
public Boolean addUser(AccountAddDTO accountAddDTO) {
// 需要给的数据 用户邮箱、用户名、账号有效期截止时间、账号类型
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())) {
throw new BusinessException("you have to choose user type");
} else {