fix: 到期提醒提前天数;开发环境邮件发送关闭
This commit is contained in:
1 parent
377a4475f6
commit
1cfc935130
4 files changed
+23
-8
No files matched your search
+1
-1
@@ -38,7 +38,7 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
|
||||
default List<LicenseDO> selectListByExpiryDate() {
|
||||
return selectList(new LambdaQueryWrapperX<LicenseDO>()
|
||||
.gt(LicenseDO::getExpiryDate, LocalDateTime.now())
|
||||
.le(LicenseDO::getExpiryDate, LocalDateTime.now().plusDays(8))
|
||||
.le(LicenseDO::getExpiryDate, LocalDateTime.now().plusDays(7))
|
||||
.eq(LicenseDO::getStatus, LicenseStatusEnum.COMPLETED.getCode())
|
||||
.orderByAsc(LicenseDO::getExpiryDate));
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class LicenseTask {
|
||||
@Resource
|
||||
private NotifyMessageSendApi notifySendApi;
|
||||
|
||||
@Scheduled(cron = "*/6 * * * * ?")
|
||||
@Scheduled(cron = "*/5 * * * * ?")
|
||||
public void task() {
|
||||
licenseService.genLicenseTask();
|
||||
}
|
||||
|
||||
+19
-6
@@ -1,6 +1,10 @@
|
||||
package org.agt.module.system.service.mail;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.agt.framework.common.enums.CommonStatusEnum;
|
||||
import org.agt.framework.common.enums.UserTypeEnum;
|
||||
import org.agt.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
@@ -10,17 +14,19 @@ import org.agt.module.system.mq.message.mail.MailSendMessage;
|
||||
import org.agt.module.system.mq.producer.mail.MailProducer;
|
||||
import org.agt.module.system.service.member.MemberService;
|
||||
import org.agt.module.system.service.user.AdminUserService;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.hutool.extra.mail.*;
|
||||
import org.dromara.hutool.extra.mail.MailAccount;
|
||||
import org.dromara.hutool.extra.mail.MailUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.agt.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static org.agt.module.system.enums.ErrorCodeConstants.*;
|
||||
import static org.agt.module.system.enums.ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS;
|
||||
import static org.agt.module.system.enums.ErrorCodeConstants.MAIL_SEND_MAIL_NOT_EXISTS;
|
||||
import static org.agt.module.system.enums.ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS;
|
||||
import static org.agt.module.system.enums.ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 邮箱发送 Service 实现类
|
||||
@@ -48,6 +54,13 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
@Resource
|
||||
private MailProducer mailProducer;
|
||||
|
||||
/**
|
||||
* 邮件的开关,默认为 true
|
||||
*/
|
||||
@Value("${agt.mail.enable:true}")
|
||||
@Setter // 为了开发环境关闭邮件发送
|
||||
private Boolean mailEnable;
|
||||
|
||||
@Override
|
||||
public Long sendSingleMailToAdmin(String mail, Long userId,
|
||||
String templateCode, Map<String, Object> templateParams) {
|
||||
@@ -92,7 +105,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
Long sendLogId = mailLogService.createMailLog(userId, userType, mail,
|
||||
account, template, content, templateParams, isSend);
|
||||
// 发送 MQ 消息,异步执行发送短信
|
||||
if (isSend) {
|
||||
if (isSend && mailEnable) {
|
||||
mailProducer.sendMailSendMessage(sendLogId, mail, account.getId(),
|
||||
template.getNickname(), title, content);
|
||||
}
|
||||
|
||||
@@ -203,6 +203,8 @@ wx:
|
||||
agt:
|
||||
captcha:
|
||||
enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试;
|
||||
mail:
|
||||
enable: false # 本地环境,暂时关闭邮件发送;
|
||||
security:
|
||||
mock-enable: true
|
||||
pay:
|
||||
|
||||
Reference in new issue
Block a user