TASK:AiDA

This commit is contained in:
shahaibo
2024-12-20 11:44:21 +08:00
parent 7fb74bc7d8
commit 15cde37af7

View File

@@ -384,7 +384,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
if (Objects.isNull(authenticationOperationTypeEnum)) { if (Objects.isNull(authenticationOperationTypeEnum)) {
throw new BusinessException("unknown.authentication.operation.type"); throw new BusinessException("unknown.authentication.operation.type");
} }
Account emailAccount = getOneByEmail(emailSendDTO.getEmail()); // Account emailAccount = getOneByEmail(emailSendDTO.getEmail());
String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L); String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L);
LocalCacheUtils.setVerifyCodeCache( LocalCacheUtils.setVerifyCodeCache(
emailSendDTO.getOperationType() + "_" + emailSendDTO.getEmail(), randomVerifyCode); emailSendDTO.getOperationType() + "_" + emailSendDTO.getEmail(), randomVerifyCode);
@@ -403,6 +403,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
SendEmailUtil.EXCEPTION_ID_TEMPLATE_ID, randomVerifyCode); SendEmailUtil.EXCEPTION_ID_TEMPLATE_ID, randomVerifyCode);
break; break;
case BIND_MAILBOX: case BIND_MAILBOX:
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.lambda().eq(Account::getUserEmail, emailSendDTO.getEmail());
List<Account> accounts = accountMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accounts)) {
throw new BusinessException("This email has been bound");
}
result = SendEmailUtil.send(emailSendDTO.getEmail(), null, result = SendEmailUtil.send(emailSendDTO.getEmail(), null,
SendEmailUtil.BIND_MAILBOX_TEMPLATE_ID, randomVerifyCode); SendEmailUtil.BIND_MAILBOX_TEMPLATE_ID, randomVerifyCode);
break; break;
@@ -2468,6 +2474,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
String name = (String) payload.get("name"); String name = (String) payload.get("name");
String pictureUrl = (String) payload.get("picture"); String pictureUrl = (String) payload.get("picture");
QueryWrapper<AccountExtend> qw = new QueryWrapper<>();
qw.lambda().eq(AccountExtend::getAuth, userId);
qw.lambda().eq(AccountExtend::getAuthType, "Google");
List<AccountExtend> accountExtends = accountExtendMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountExtends)) {
throw new BusinessException("The Google has been bound.");
}
AccountExtend accountExtendInsert = new AccountExtend(); AccountExtend accountExtendInsert = new AccountExtend();
accountExtendInsert.setAuth(userId); accountExtendInsert.setAuth(userId);
@@ -2512,6 +2526,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
if (unionId == null) { if (unionId == null) {
throw new IllegalArgumentException("无法获取 unionid请检查微信开发平台配置"); throw new IllegalArgumentException("无法获取 unionid请检查微信开发平台配置");
} }
QueryWrapper<AccountExtend> qw = new QueryWrapper<>();
qw.lambda().eq(AccountExtend::getAuth, unionId);
qw.lambda().eq(AccountExtend::getAuthType, "WeChat");
List<AccountExtend> accountExtends = accountExtendMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountExtends)) {
throw new BusinessException("The WeChat has been bound.");
}
AccountExtend accountExtendInsert = new AccountExtend(); AccountExtend accountExtendInsert = new AccountExtend();
accountExtendInsert.setAuth(unionId); accountExtendInsert.setAuth(unionId);
accountExtendInsert.setAuthType("WeChat"); accountExtendInsert.setAuthType("WeChat");