Merge branch 'release/3.0' into dev/dev

This commit is contained in:
2024-12-10 10:04:27 +08:00
6 changed files with 26 additions and 17 deletions

View File

@@ -545,7 +545,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
// .like(TrialOrder::getUserName, accountTrialDTO.getUserName()));
List<TrialOrder> trialOrders = trialOrderMapper.selectList(trialOrderQueryWrapper);
if (CollectionUtil.isNotEmpty(trialOrders)) {
throw new BusinessException("You have submitted a trial application, please wait for approval.");
TrialOrder trialOrder = trialOrders.get(0);
if (trialOrder.getStatus() == 1) {
throw new BusinessException("You have submitted a trial application, please wait for approval.");
}else {
throw new BusinessException("You have already been approved for a trial, please do not apply for the trial again");
}
}
// 先检测用户名和邮箱
QueryWrapper<Account> qw = new QueryWrapper<>();
@@ -1456,19 +1461,23 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
queryWrapper.in("user_email", allEmail).select("user_email");
// 重复的邮箱
List<String> collect = baseMapper.selectList(queryWrapper).stream().map(Account::getUserEmail).collect(Collectors.toList());
if (!collect.isEmpty()){
List<String> duplicateEmails = baseMapper.selectList(queryWrapper).stream().map(Account::getUserEmail).collect(Collectors.toList());
if (!duplicateEmails.isEmpty()){
// 移除Code-Create新增用户中在AiDA已有账号的邮箱allEmail中剩余邮箱均为新用户邮箱
allEmail.removeAll(collect);
allEmail.removeIf(item -> duplicateEmails.stream()
.anyMatch(removeItem -> removeItem.equalsIgnoreCase(item)));
if (!allEmail.isEmpty()){
for (Map<String,String> userInfo : newUsersInfo){
Iterator<Map<String, String>> iterator = newUsersInfo.iterator();
while (iterator.hasNext()) {
Map<String, String> userInfo = iterator.next();
String email = userInfo.get("email");
if (!allEmail.contains(email)) {
newUsersInfo.remove(userInfo); // 移除不在 allEmail 中的用户
iterator.remove(); // 使用迭代器安全地移除元素
}
}
}else {
newUsersInfo.clear();
}
}
// 将新增用户添加到AiDA身份为游客
if (!newUsersInfo.isEmpty()){