Merge branch 'release/3.0' into dev/dev
# Conflicts: # src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
This commit is contained in:
@@ -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<Account> 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);
|
||||
|
||||
@@ -19,21 +19,21 @@ public class AccountTask {
|
||||
/**
|
||||
* 每周日晚上刷新 年付用户、月付用户的积分
|
||||
*/
|
||||
// @Scheduled(cron = "59 59 23 ? * SUN")
|
||||
@Scheduled(cron = "59 59 23 ? * SUN")
|
||||
// @Scheduled(cron = "59 59 23 * * ?")
|
||||
public void refreshCreditsMonthly() {
|
||||
log.info("每周日晚11:59:59刷新付费用户积分为 6000");
|
||||
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<Account> 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<Account> 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();
|
||||
}
|
||||
|
||||
@@ -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 被执行......");
|
||||
|
||||
@@ -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分钟以上仍未支付的订单 置为超时订单
|
||||
|
||||
@@ -116,9 +116,9 @@ public class ThirdPartyController {
|
||||
return Response.success(accountService.updateNoLoginRequiredNew(noLoginRequiredDTO, request));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("/auth/google_callback")
|
||||
public Response<String> googleCallback(@RequestParam("code") String code, HttpSession session) {
|
||||
return Response.success(accountService.googleCallback(code, session));
|
||||
}
|
||||
// @CrossOrigin
|
||||
// @GetMapping("/auth/google_callback")
|
||||
// public Response<String> googleCallback(@RequestParam("code") String code, HttpSession session) {
|
||||
// return Response.success(accountService.googleCallback(code, session));
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public interface AccountService extends IService<Account> {
|
||||
|
||||
void halfPricePromotion();
|
||||
|
||||
String googleCallback(String code, HttpSession session);
|
||||
// String googleCallback(String code, HttpSession session);
|
||||
|
||||
List<String> getPaidCustomerEmail();
|
||||
}
|
||||
|
||||
@@ -1392,7 +1392,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
private static final String QUERY_MAXIMUM_USERID = "SELECT MAX(ID) AS max_id FROM pmr_users;";
|
||||
|
||||
private static final String QUERY_NEW_USER_EMAIL = "SELECT user_email FROM pmr_users " +
|
||||
private static final String QUERY_NEW_USER_EMAIL = "SELECT user_email, user_nicename FROM pmr_users " +
|
||||
"WHERE ID > ? ";
|
||||
|
||||
@Value("${redis.key.maximumUserId}")
|
||||
@@ -1404,7 +1404,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void registerUserToVisitor(){
|
||||
ArrayList<String> newUserEmails = new ArrayList<>();
|
||||
ArrayList<Map<String, String>> newUsersInfo = new ArrayList<>();
|
||||
ArrayList<String> allEmail = new ArrayList<>();
|
||||
long maxUserId = CommonConstant.MAXIMUM_USER_ID;
|
||||
try (Connection connection = dataSource.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(QUERY_MAXIMUM_USERID)) {
|
||||
@@ -1420,9 +1421,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// 填充参数 - 历史最大用户ID
|
||||
newUserEmail.setLong(1, maxUserIdHistory);
|
||||
try (ResultSet queryEmailResultSet = newUserEmail.executeQuery()) {
|
||||
if (queryEmailResultSet.next()) {
|
||||
while (queryEmailResultSet.next()) {
|
||||
String email = queryEmailResultSet.getString("user_email");
|
||||
newUserEmails.add(email);
|
||||
String username = queryEmailResultSet.getString("user_nicename");
|
||||
HashMap<String, String> info = new HashMap<>();
|
||||
info.put("email", email);
|
||||
info.put("username", username);
|
||||
newUsersInfo.add(info);
|
||||
allEmail.add(email);
|
||||
} /*else {
|
||||
log.error("未知错误。code-create的用户表中没有付费用户的信息");
|
||||
throw new BusinessException("user info missing");
|
||||
@@ -1437,22 +1443,32 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// return null;
|
||||
}
|
||||
|
||||
if (!newUserEmails.isEmpty()){
|
||||
if (!newUsersInfo.isEmpty()){
|
||||
// 查询这些邮箱在aida上是否有账号
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("user_email", newUserEmails).select("user_email");
|
||||
queryWrapper.in("user_email", allEmail).select("user_email");
|
||||
|
||||
// 重复的邮箱
|
||||
List<String> collect = baseMapper.selectList(queryWrapper).stream().map(Account::getUserEmail).collect(Collectors.toList());
|
||||
if (!collect.isEmpty()){
|
||||
// 移除Code-Create新增用户中在AiDA已有账号的邮箱
|
||||
newUserEmails.removeAll(collect);
|
||||
// 移除Code-Create新增用户中在AiDA已有账号的邮箱,allEmail中剩余邮箱均为新用户邮箱
|
||||
allEmail.removeAll(collect);
|
||||
if (!allEmail.isEmpty()){
|
||||
for (Map<String,String> userInfo : newUsersInfo){
|
||||
String email = userInfo.get("email");
|
||||
if (!allEmail.contains(email)) {
|
||||
newUsersInfo.remove(userInfo); // 移除不在 allEmail 中的用户
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 将新增用户添加到AiDA,身份为游客
|
||||
if (!newUserEmails.isEmpty()){
|
||||
newUserEmails.forEach(email -> {
|
||||
if (!newUsersInfo.isEmpty()){
|
||||
newUsersInfo.forEach(userInfo -> {
|
||||
Account account = new Account();
|
||||
account.setUserEmail(email);
|
||||
account.setUserName(email);
|
||||
account.setUserEmail(userInfo.get("email"));
|
||||
account.setUserName(userInfo.get("username"));
|
||||
account.setUserPassword("Third-000000");
|
||||
account.setLanguage(Language.ENGLISH.name());
|
||||
account.setValidStartTime(Instant.now().toEpochMilli());
|
||||
@@ -1463,7 +1479,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setSystemUser(0);
|
||||
baseMapper.insert(account);
|
||||
// 邮件通知用户
|
||||
SendEmailUtil.notificationForRegisterUser(email);
|
||||
SendEmailUtil.notificationForRegisterUser(userInfo.get("email"));
|
||||
});
|
||||
}
|
||||
// 记录当前最大的用户id
|
||||
|
||||
Reference in New Issue
Block a user