Commit 1a120cd07c8cb1bfa71c6cce6c9dc27c2c6b8b4d
1 parent
082c209c
邮件发送功能
Showing
2 changed files
with
22 additions
and
1 deletions
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.send; |
| 2 | 2 | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 3 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 4 | 5 | import lombok.Data; |
| 5 | 6 | |
| 7 | +import javax.validation.constraints.NotNull; | |
| 6 | 8 | import java.util.List; |
| 9 | + | |
| 10 | +@ApiModel("管理后台 - 邮件发送 Req VO") | |
| 7 | 11 | @Data |
| 8 | -public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO | |
| 12 | +public class MailReqVO { // TODO @wangjingyi:1)参数校验;2)ReqVO | |
| 9 | 13 | |
| 10 | 14 | @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") |
| 15 | + @NotNull(message = "邮箱账号不能为空") | |
| 11 | 16 | private String from; |
| 12 | 17 | |
| 13 | 18 | @ApiModelProperty(value = "标题" , example = "标题") |
| ... | ... | @@ -16,7 +21,12 @@ public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO |
| 16 | 21 | @ApiModelProperty(value = "内容" , example = "内容") |
| 17 | 22 | private String content; |
| 18 | 23 | |
| 24 | + @ApiModelProperty(value = "邮箱模版id" , example = "1024") | |
| 25 | + @NotNull(message = "邮箱模版id不能为空") | |
| 26 | + private Integer templateId; | |
| 27 | + | |
| 19 | 28 | @ApiModelProperty(value = "收件人" , required = true , example = "yudaoyuanma@123.com") |
| 29 | + @NotNull(message = "收件人不能为空") | |
| 20 | 30 | private List<String> tos; |
| 21 | 31 | |
| 22 | 32 | @ApiModelProperty(value = "附件" , example = "附件编码") | ... | ... |
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; |
| 7 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | |
| 10 | +import java.util.HashMap; | |
| 10 | 11 | import java.util.List; |
| 12 | +import java.util.Map; | |
| 11 | 13 | |
| 12 | 14 | @Mapper |
| 13 | 15 | public interface MailAccountConvert { |
| ... | ... | @@ -31,4 +33,13 @@ public interface MailAccountConvert { |
| 31 | 33 | .setPass(mailAccountDO.getPassword()) |
| 32 | 34 | .setSslEnable(mailAccountDO.getSslEnable()); |
| 33 | 35 | }; |
| 36 | + | |
| 37 | + default Map<String, String> convertToMap(MailAccountDO mailAccountDO , String content) { | |
| 38 | + Map<String , String> map = new HashMap<>(); | |
| 39 | + map.put("from" , mailAccountDO.getFrom()); | |
| 40 | + map.put("username" , mailAccountDO.getUsername()); | |
| 41 | + map.put("content" , content); | |
| 42 | + return map; | |
| 43 | + }; | |
| 44 | + | |
| 34 | 45 | } | ... | ... |