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

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 * @param reqDTO
* @return * @return
*/ */
Long sendSingleSmsToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO); Long sendSingleMailToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
/** /**
* Member * Member
@ -29,6 +29,6 @@ public interface MailSendApi {
* @param reqDTO * @param reqDTO
* @return * @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; private MailSendService mailSendService;
@Override @Override
public Long sendSingleSmsToAdmin(MailSendSingleToUserReqDTO reqDTO) { public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) {
return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(), return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(),
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()); reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
} }
@Override @Override
public Long sendSingleSmsToMember(MailSendSingleToUserReqDTO reqDTO) { public Long sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) {
return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(), return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(),
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()); 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.framework.mq.core.stream.AbstractStreamMessageListener;
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage; 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 cn.iocoder.yudao.module.system.service.mail.MailSendService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
/**
* {@link MailSendMessage}
*
* @author
*/
@Component @Component
@Slf4j @Slf4j
public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> { public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> {
@Resource @Resource
private MailSendService mailSendService; private MailSendService mailSendService;
@Override @Override
public void onMessage(MailSendMessage message) { public void onMessage(MailSendMessage message) {
log.info("[onMessage][消息内容({})]", message); log.info("[onMessage][消息内容({})]", message);

View File

@ -25,4 +25,5 @@ public class MailTemplateRefreshConsumer extends AbstractChannelMessageListener<
log.info("[onMessage][收到 Mail Template 刷新信息]"); log.info("[onMessage][收到 Mail Template 刷新信息]");
mailTemplateService.initLocalCache(); mailTemplateService.initLocalCache();
} }
} }

View File

@ -12,8 +12,10 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class MailAccountRefreshMessage extends AbstractChannelMessage { public class MailAccountRefreshMessage extends AbstractChannelMessage {
@Override @Override
public String getChannel() { public String getChannel() {
return "system.mail-account.refresh"; return "system.mail-account.refresh";
} }
} }

View File

@ -12,8 +12,10 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class MailTemplateRefreshMessage extends AbstractChannelMessage { public class MailTemplateRefreshMessage extends AbstractChannelMessage {
@Override @Override
public String getChannel() { public String getChannel() {
return "system.mail-template.refresh"; return "system.mail-template.refresh";
} }
} }

View File

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