TASK: 1.affiliate 新增referral新增、查询、修改以及其他相关的自动结算佣金的功能;2.删除affiliate_income表及相关mapper

This commit is contained in:
2025-08-19 17:44:34 +08:00
parent 552ec828ab
commit caa9985d11
23 changed files with 499 additions and 105 deletions

View File

@@ -102,6 +102,12 @@ public class PaymentTask {
affiliateService.updateAffiliateInfoWithPayment();
}
// 定时同步(每分钟一次)
@Scheduled(fixedRate = 60000)
public void syncLinkViewCountToDB(){
affiliateService.syncLinkViewCountToDB();
}
// @Scheduled(cron = "0 0 8 28-31 * ?")
public void commissionSummaryReminder(){
// 每个月末的最后一天的早上八点执行

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
@@ -379,6 +380,15 @@ public class RedisUtil {
return redisTemplate.opsForValue().increment(key, 0);
}
public Long getAndSetKey(String key, Long count) {
try {
String val = redisTemplate.opsForValue().getAndSet(key, count.toString());
return StringUtil.isNullOrEmpty(val) ? 0L : Long.parseLong(val);
} catch (NumberFormatException e) {
return 0L; // 或 throw new BusinessException("非法的数值格式");
}
}
/**
* 记录任务的耗时到Redis
* @param taskKey 任务标识,如 "taskA"

View File

@@ -762,7 +762,7 @@ public class SendEmailUtil {
try {
String merchantEmail = "kimwong@code-create.com.hk";
String developer = "xupei3360@163.com";
String[] receiverEmail = {merchantEmail, developer};
String[] receiverEmail = {/*merchantEmail,*/ developer};
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
@@ -932,7 +932,7 @@ public class SendEmailUtil {
req.setFromEmailAddress(SEND_ADDRESS);
String merchantEmail = "kimwong@code-create.com.hk";
String developerEmail = "xupei@code-create.com.hk";
req.setDestination(new String[]{merchantEmail, developerEmail});
req.setDestination(new String[]{/*merchantEmail,*/ developerEmail});
Template template = new Template();
req.setSubject("New Credit Purchase Order");
template.setTemplateID(CREDITS_PURCHASE_MERCHANT);