Commit 1a120cd07c8cb1bfa71c6cce6c9dc27c2c6b8b4d

Authored by wangjingyi
1 parent 082c209c

邮件发送功能

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 package cn.iocoder.yudao.module.system.controller.admin.mail.vo.send; 1 package cn.iocoder.yudao.module.system.controller.admin.mail.vo.send;
2 2
  3 +import io.swagger.annotations.ApiModel;
3 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
4 import lombok.Data; 5 import lombok.Data;
5 6
  7 +import javax.validation.constraints.NotNull;
6 import java.util.List; 8 import java.util.List;
  9 +
  10 +@ApiModel("管理后台 - 邮件发送 Req VO")
7 @Data 11 @Data
8 -public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO 12 +public class MailReqVO { // TODO @wangjingyi:1)参数校验;2)ReqVO
9 13
10 @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") 14 @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com")
  15 + @NotNull(message = "邮箱账号不能为空")
11 private String from; 16 private String from;
12 17
13 @ApiModelProperty(value = "标题" , example = "标题") 18 @ApiModelProperty(value = "标题" , example = "标题")
@@ -16,7 +21,12 @@ public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO @@ -16,7 +21,12 @@ public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO
16 @ApiModelProperty(value = "内容" , example = "内容") 21 @ApiModelProperty(value = "内容" , example = "内容")
17 private String content; 22 private String content;
18 23
  24 + @ApiModelProperty(value = "邮箱模版id" , example = "1024")
  25 + @NotNull(message = "邮箱模版id不能为空")
  26 + private Integer templateId;
  27 +
19 @ApiModelProperty(value = "收件人" , required = true , example = "yudaoyuanma@123.com") 28 @ApiModelProperty(value = "收件人" , required = true , example = "yudaoyuanma@123.com")
  29 + @NotNull(message = "收件人不能为空")
20 private List<String> tos; 30 private List<String> tos;
21 31
22 @ApiModelProperty(value = "附件" , example = "附件编码") 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 +7,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
7 import org.mapstruct.Mapper; 7 import org.mapstruct.Mapper;
8 import org.mapstruct.factory.Mappers; 8 import org.mapstruct.factory.Mappers;
9 9
  10 +import java.util.HashMap;
10 import java.util.List; 11 import java.util.List;
  12 +import java.util.Map;
11 13
12 @Mapper 14 @Mapper
13 public interface MailAccountConvert { 15 public interface MailAccountConvert {
@@ -31,4 +33,13 @@ public interface MailAccountConvert { @@ -31,4 +33,13 @@ public interface MailAccountConvert {
31 .setPass(mailAccountDO.getPassword()) 33 .setPass(mailAccountDO.getPassword())
32 .setSslEnable(mailAccountDO.getSslEnable()); 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 }