From 1a120cd07c8cb1bfa71c6cce6c9dc27c2c6b8b4d Mon Sep 17 00:00:00 2001 From: wangjingyi Date: Wed, 30 Mar 2022 14:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mail/vo/send/{MailSendVO.java => MailReqVO.java} | 12 +++++++++++- .../system/convert/mail/MailAccountConvert.java | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) rename yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/{MailSendVO.java => MailReqVO.java} (60%) diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailReqVO.java similarity index 60% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailReqVO.java index 4d1bd9a5f..0bd9d5d22 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailReqVO.java @@ -1,13 +1,18 @@ package cn.iocoder.yudao.module.system.controller.admin.mail.vo.send; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; import java.util.List; + +@ApiModel("管理后台 - 邮件发送 Req VO") @Data -public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO +public class MailReqVO { // TODO @wangjingyi:1)参数校验;2)ReqVO @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") + @NotNull(message = "邮箱账号不能为空") private String from; @ApiModelProperty(value = "标题" , example = "标题") @@ -16,7 +21,12 @@ public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO @ApiModelProperty(value = "内容" , example = "内容") private String content; + @ApiModelProperty(value = "邮箱模版id" , example = "1024") + @NotNull(message = "邮箱模版id不能为空") + private Integer templateId; + @ApiModelProperty(value = "收件人" , required = true , example = "yudaoyuanma@123.com") + @NotNull(message = "收件人不能为空") private List tos; @ApiModelProperty(value = "附件" , example = "附件编码") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java index fe768efbd..8dbfbc58d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java @@ -7,7 +7,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Mapper public interface MailAccountConvert { @@ -31,4 +33,13 @@ public interface MailAccountConvert { .setPass(mailAccountDO.getPassword()) .setSslEnable(mailAccountDO.getSslEnable()); }; + + default Map convertToMap(MailAccountDO mailAccountDO , String content) { + Map map = new HashMap<>(); + map.put("from" , mailAccountDO.getFrom()); + map.put("username" , mailAccountDO.getUsername()); + map.put("content" , content); + return map; + }; + }