diff --git a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java index 61e964ea..95c55e9a 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -51,7 +51,7 @@ public class MyTaskScheduler { // 定时任务,每十五天执行一次 // @Scheduled(cron = "0 0 0 ? * MON") -// @Scheduled(cron = "0 0 0 */15 * ?") + @Scheduled(cron = "0 0 0 */15 * ?") public void checkExpiry() { // 检测正式用户是否快要过期 QueryWrapper qw = new QueryWrapper<>(); @@ -85,7 +85,7 @@ public class MyTaskScheduler { } } } -// @Scheduled(cron = "0 0 9 * * ?") + @Scheduled(cron = "0 0 9 * * ?") public void sendTrialOrderExcelToManagements() { // 获取前一天日期 LocalDate yesterday = LocalDate.now().minusDays(1); diff --git a/src/main/java/com/ai/da/common/task/AccountTask.java b/src/main/java/com/ai/da/common/task/AccountTask.java index c73f8b7f..6950878d 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -26,14 +26,14 @@ public class AccountTask { accountService.refreshCreditsWeekly(); } -// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes + @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes public void getPaidUser() { // 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单 accountService.extendValidityForCC(); } // 每天凌晨0点执行一次 -// @Scheduled(cron = "0 0 0 * * ?") + @Scheduled(cron = "0 0 0 * * ?") public void cancelActivityBenefits() { // 1、查询当前所有参与了活动且过期的用户 List accountList = accountService.getExpiredUserBySystemUser(4); @@ -46,7 +46,7 @@ public class AccountTask { } // 每天检测正式用户到期情况,每天凌晨0点执行 -// @Scheduled(cron = "0 0 0 * * ?") + @Scheduled(cron = "0 0 0 * * ?") public void paidUserToVisitor() { // 1、查询当前已过期正式用户或试用用户 List accountList = accountService.getExpiredUserBySystemUser(1); @@ -63,7 +63,7 @@ public class AccountTask { /** * 将Code-Create上注册的用户添加为AiDA的游客 */ -// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes + @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes public void registerUserToVisitor() { accountService.registerUserToVisitor(); } diff --git a/src/main/java/com/ai/da/common/task/PaypalTask.java b/src/main/java/com/ai/da/common/task/PaypalTask.java index fa069971..865eaaa4 100644 --- a/src/main/java/com/ai/da/common/task/PaypalTask.java +++ b/src/main/java/com/ai/da/common/task/PaypalTask.java @@ -23,7 +23,7 @@ public class PaypalTask { @Resource private PayPalCheckoutService payPalCheckoutService; -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm() throws SerializeException { // log.info("PayPal orderConfirm 被执行......"); diff --git a/src/main/java/com/ai/da/common/task/StripeTask.java b/src/main/java/com/ai/da/common/task/StripeTask.java index d4a6fbaf..45d98997 100644 --- a/src/main/java/com/ai/da/common/task/StripeTask.java +++ b/src/main/java/com/ai/da/common/task/StripeTask.java @@ -22,7 +22,7 @@ public class StripeTask { @Resource private StripeService stripeService; -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm() throws SerializeException { // 查看超过30分钟以上仍未支付的订单 置为超时订单 diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index 5052a91d..74483e51 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -545,7 +545,12 @@ public class AccountServiceImpl extends ServiceImpl impl // .like(TrialOrder::getUserName, accountTrialDTO.getUserName())); List 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 qw = new QueryWrapper<>(); @@ -1456,19 +1461,23 @@ public class AccountServiceImpl extends ServiceImpl impl queryWrapper.in("user_email", allEmail).select("user_email"); // 重复的邮箱 - List collect = baseMapper.selectList(queryWrapper).stream().map(Account::getUserEmail).collect(Collectors.toList()); - if (!collect.isEmpty()){ + List 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 userInfo : newUsersInfo){ + Iterator> iterator = newUsersInfo.iterator(); + while (iterator.hasNext()) { + Map 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()){ diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 974fee23..8550475d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,7 +2,7 @@ #spring.profiles.active=test #����application-prod�ļ�(��������) -#spring.profiles.active=prod +spring.profiles.active=prod #����application-dev�ļ�(��������) -spring.profiles.active=dev +#spring.profiles.active=dev