Affiliate功能-数据库表设计更新

This commit is contained in:
2024-12-18 11:53:41 +08:00
parent bf8af41f3f
commit 7d8f047087
16 changed files with 338 additions and 72 deletions

View File

@@ -2,16 +2,14 @@ package com.ai.da.common.task;
import com.ai.da.common.enums.PayTypeEnum;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.service.AliPayService;
import com.ai.da.service.OrderInfoService;
import com.ai.da.service.PayPalCheckoutService;
import com.ai.da.service.StripeService;
import com.ai.da.service.*;
import com.paypal.http.exceptions.SerializeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
@Slf4j
@@ -24,6 +22,10 @@ public class PaymentTask {
@Resource
private StripeService stripeService;
@Resource
private AffiliateService affiliateService;
// 考虑删除该定时任务(原因:之后的订单列允许用户查看发票,发票未过期时仍可以支付,所以不需要手动使订单过期)
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirmForStripe() throws SerializeException {
@@ -89,8 +91,31 @@ public class PaymentTask {
}
// 每天凌晨检查subscription中有哪些已过期更新状态
@Scheduled(cron = "0 0 0 * * ?")
public void checkSubscriptionExpiration(){
stripeService.checkSubscriptionExpiration();
// @Scheduled(cron = "0 0 0 * * ?")
// public void checkSubscriptionExpiration(){
// stripeService.checkSubscriptionExpiration();
// }
// 如果有订阅已创建,但是没有发邮件通知的,需要主动获取回调信息并向用户发送邮件
public void checkSubscriptionPayment(){
//
}
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void updateAffiliateInfoWithPayment(){
affiliateService.updateAffiliateInfoWithPayment();
}
@Scheduled(cron = "0 0 8 28-31 * ?")
public void commissionSummaryReminder(){
// 每个月末的最后一天的早上八点执行
LocalDate today = LocalDate.now();
// 判断是否为月底
if (today.plusDays(1).getDayOfMonth() == 1) {
log.info("今天是月底,执行佣金结算提醒任务!");
affiliateService.commissionCalculation(null, null);
}
}
}

View File

@@ -279,7 +279,7 @@ public class RedisUtil {
redisTemplate.expire(redisKey, 5, TimeUnit.MINUTES);
}
public final static String PAYMENT_INFO_LAST_SCAN_TIME = "PaymentInfoLastScanTime:";
public final static String PAYMENT_INFO_LAST_SCAN_TIME = "PaymentInfoLastScanTime";
public final static String AFFILIATE_LINK_VIEW_KEY = "AffiliateLink:view:";