邮箱模块:优化注释 + 方法名

pull/2/head
YunaiV 2023-01-27 21:31:30 +08:00
parent 1a4bea8ca2
commit 7e65ede92d
8 changed files with 51 additions and 9 deletions

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -31,7 +31,7 @@ public class MailProducer {
}
/**
* {@link MailTemplateRefreshMessage}
* {@link MailAccountRefreshMessage}
*/
public void sendMailAccountRefreshMessage() {
MailAccountRefreshMessage message = new MailAccountRefreshMessage();