This commit is contained in:
2025-09-02 20:09:37 +08:00
parent feca192f53
commit a59acb0903
21 changed files with 140 additions and 50 deletions

View File

@@ -23,6 +23,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -159,7 +160,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<>();
@@ -193,7 +194,7 @@ public class MyTaskScheduler {
}
}
}
// @Scheduled(cron = "0 0 9 * * ?")
@Scheduled(cron = "0 0 9 * * ?")
public void sendTrialOrderExcelToManagements() {
// 获取前一天日期
LocalDate yesterday = LocalDate.now().minusDays(1);
@@ -1504,7 +1505,7 @@ public class MyTaskScheduler {
Workspace workspace = new Workspace();
workspace.setAgeGroup("Adult");
if (null != design.getTemplateId()) {
project.setProcess(DesignProcess.SERIES_DESIGN.getValue());
project.setProcess(DesignProcess.SERIES_DESIGN.name());
workspace.setPosition("Overall");
// workspace设置模特
if (design.getModelType().equals("System")) {
@@ -1531,7 +1532,7 @@ public class MyTaskScheduler {
}
}
}else {
project.setProcess(DesignProcess.SINGLE_DESIGN.getValue());
project.setProcess(DesignProcess.SINGLE_DESIGN.name());
workspace.setPosition(design.getSwitchCategory());
}
workspace.setSystemDesignerPercentage(design.getSystemScale().multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP).intValueExact());
@@ -1661,6 +1662,11 @@ public class MyTaskScheduler {
project.setAccountId(userLikeGroup.getAccountId());
project.setName(userLikeGroup.getName());
project.setCreateTime(LocalDateTime.ofInstant(userLikeGroup.getCreateDate().toInstant(), ZoneId.systemDefault()));
if (Objects.isNull(userLikeGroup.getUpdateDate())){
project.setUpdateTime(LocalDateTime.ofInstant(userLikeGroup.getCreateDate().toInstant(), ZoneId.systemDefault()));
} else {
project.setUpdateTime(LocalDateTime.ofInstant(userLikeGroup.getUpdateDate().toInstant(), ZoneId.systemDefault()));
}
// project.setUpdateTime(LocalDateTime.ofInstant(userLikeGroup.getUpdateDate().toInstant(), ZoneId.systemDefault()));
project.setOriginal(userLikeGroup.getOriginal());
project.setOriginalAccountId(userLikeGroup.getOriginalAccountId());

View File

@@ -91,5 +91,6 @@ public class CommonConstant {
public static final String PARTIAL_DESIGN_PREVIEW_FILENAME = "Preview";
public static final String senderEmail = "info@aida.com.hk";
}

View File

@@ -22,16 +22,16 @@ public class AccountTask {
/**
* 每周日晚上刷新 年付用户、月付用户的积分
* 替换为
* 每个月月初只刷新年付用户的积分
* 每个月月初只刷新教育子账号的积分
*/
// @Scheduled(cron = "59 59 23 * * ?")
// @Scheduled(cron = "0 0 0 1 * ?")
@Scheduled(cron = "0 0 0 1 * ?")
public void refreshCreditsMonthly() {
log.info("每月1号0点 重置教育版子账号为默认积分");
accountService.refreshCreditsMonthly();
}
// @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();
@@ -51,7 +51,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);
@@ -74,7 +74,7 @@ public class AccountTask {
accountService.registerUserToVisitor();
}
// @Scheduled(cron = "0 0 0 1 * ?")
@Scheduled(cron = "0 0 0 1 * ?")
// 每月初刷新所有用户用户名剩余修改次数
public void resetUsernameModifyTimes(){
log.info("重置所有用户的用户名修改次数");

View File

@@ -96,6 +96,10 @@ public class GenerateTask {
apiGenerate.setUpdateTime(LocalDateTime.now());
apiGenerateService.updateById(apiGenerate);
}
// 将积分暂扣区的积分移除
if (toProductImageResult.getStatus().equals("Fail")){
creditsService.deleteCreditsDeduction(apiGenerate.getAccountId(), taskId);
}
}
}
}

View File

@@ -45,7 +45,7 @@ public class PaymentTask {
@Resource
private PayPalCheckoutService payPalCheckoutService;
// @Scheduled(cron = "0/30 * * * * ?")
@Scheduled(cron = "0/30 * * * * ?")
public void orderConfirmForPaypal() throws SerializeException {
// log.info("PayPal orderConfirm 被执行......");
@@ -120,7 +120,7 @@ public class PaymentTask {
}
}
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void calcCouponsCommission(){
log.info("优惠券佣金计算定时器");
affiliateService.calcCouponsCommission();

View File

@@ -1,5 +1,6 @@
package com.ai.da.common.utils;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.model.dto.BasicEmailParamDTO;
import com.alibaba.fastjson.JSONObject;
import com.sun.mail.smtp.SMTPTransport;
@@ -132,7 +133,8 @@ public class MailUtil {
*/
public BasicEmailParamDTO setBasicEmailParams(List<String> mailTo, JSONObject jsonObject, String templatePath, String title) throws AddressException {
BasicEmailParamDTO basicEmailParamDTO = new BasicEmailParamDTO();
basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
// basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
basicEmailParamDTO.setSenderUserMail(CommonConstant.senderEmail);
basicEmailParamDTO.setMailTo(getInternetAddressList(mailTo));
basicEmailParamDTO.setSubject(title);
// todo 邮件模板不存在的报错与重试机制

View File

@@ -372,9 +372,11 @@ public class SendEmailUtil {
return jsonObject.toJSONString();
}
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
private final static Long UPGRADE_NOTIFICATION_ID = 146605L;
// private final static Long UPGRADE_NOTIFICATION_ID = 146551L;
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID = 118856L;
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 146604L;
// private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 146552L;
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE = 122899L;
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
@@ -396,20 +398,20 @@ public class SendEmailUtil {
// 根据邮件类型设置不同的主题和模板
String subject = "";
Template template = new Template();
// if (type == 1) {
// subject = "Upcoming System Upgrade for AiDA 3.0";
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
// }else {
// subject = "即将到来的AiDA 3.0系统升级";
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
// }
if (type == 1) {
subject = "Successful System Upgrade and New Features in AiDA 3.0";
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
subject = "AiDA 3.1.0 System Maintenance Announcement";
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
}else {
subject = "系统升级成功和AiDA 3.0新功能";
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
subject = "AiDA 3.1.0 系统维护公告";
template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
}
// if (type == 1) {
// subject = "Successful System Upgrade and New Features in AiDA 3.0";
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
// }else {
// subject = "系统升级成功和AiDA 3.0新功能";
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
// }
template.setTemplateData(buildAccountData(account));
req.setSubject(subject);
@@ -417,8 +419,8 @@ public class SendEmailUtil {
// 发送邮件
SendEmailResponse resp = client.SendEmail(req);
log.info(senderAddress);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
// log.info(senderAddress);
// log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
log.info(senderAddress);
log.info("邮件发送失败###{}", e.toString());
@@ -764,7 +766,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();
@@ -934,7 +936,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);