邮箱模块:优化注释 + 方法名
parent
1a4bea8ca2
commit
7e65ede92d
|
@ -19,7 +19,7 @@ public interface MailSendApi {
|
|||
* @param reqDTO 发送请求
|
||||
* @return 发送日志编号
|
||||
*/
|
||||
Long sendSingleSmsToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
Long sendSingleMailToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 发送单条邮箱给 Member 用户
|
||||
|
@ -29,6 +29,6 @@ public interface MailSendApi {
|
|||
* @param reqDTO 发送请求
|
||||
* @return 发送日志编号
|
||||
*/
|
||||
Long sendSingleSmsToMember(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
Long sendSingleMailToMember(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ public class MailSendApiImpl implements MailSendApi {
|
|||
private MailSendService mailSendService;
|
||||
|
||||
@Override
|
||||
public Long sendSingleSmsToAdmin(MailSendSingleToUserReqDTO reqDTO) {
|
||||
public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) {
|
||||
return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long sendSingleSmsToMember(MailSendSingleToUserReqDTO reqDTO) {
|
||||
public Long sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) {
|
||||
return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||
import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage;
|
||||
import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 针对 {@link MailAccountRefreshMessage} 的消费者
|
||||
*
|
||||
* @author wangjingyi
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MailAccountRefreshConsumer extends AbstractChannelMessageListener<MailAccountRefreshMessage> {
|
||||
|
||||
@Resource
|
||||
private MailAccountService mailAccountService;
|
||||
|
||||
@Override
|
||||
public void onMessage(MailAccountRefreshMessage message) {
|
||||
log.info("[onMessage][收到 Mail Account 刷新信息]");
|
||||
mailAccountService.initLocalCache();
|
||||
}
|
||||
|
||||
}
|
|
@ -2,19 +2,25 @@ package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
|||
|
||||
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
|
||||
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
||||
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 针对 {@link MailSendMessage} 的消费者
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> {
|
||||
|
||||
@Resource
|
||||
private MailSendService mailSendService;
|
||||
|
||||
@Override
|
||||
public void onMessage(MailSendMessage message) {
|
||||
log.info("[onMessage][消息内容({})]", message);
|
||||
|
|
|
@ -22,7 +22,8 @@ public class MailTemplateRefreshConsumer extends AbstractChannelMessageListener<
|
|||
|
||||
@Override
|
||||
public void onMessage(MailTemplateRefreshMessage message) {
|
||||
log.info("[onMessage][收到 MailTemplate 刷新信息]");
|
||||
log.info("[onMessage][收到 Mail Template 刷新信息]");
|
||||
mailTemplateService.initLocalCache();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,15 +5,17 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邮箱账号的数据刷新 Message
|
||||
* 邮箱账号的数据刷新 Message
|
||||
*
|
||||
* @author wangjingyi
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MailAccountRefreshMessage extends AbstractChannelMessage {
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "system.mail-account.refresh";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,15 +5,17 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邮箱模板的数据刷新 Message
|
||||
* 邮箱模板的数据刷新 Message
|
||||
*
|
||||
* @author wangjingyi
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MailTemplateRefreshMessage extends AbstractChannelMessage {
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "system.mail-template.refresh";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MailProducer {
|
|||
}
|
||||
|
||||
/**
|
||||
* 发送 {@link MailTemplateRefreshMessage} 消息
|
||||
* 发送 {@link MailAccountRefreshMessage} 消息
|
||||
*/
|
||||
public void sendMailAccountRefreshMessage() {
|
||||
MailAccountRefreshMessage message = new MailAccountRefreshMessage();
|
||||
|
|
Loading…
Reference in New Issue