邮箱模块:完善 account 账号的增删改查功能

This commit is contained in:
YunaiV
2023-01-25 17:48:09 +08:00
parent c9c5a818ec
commit 0262fa5c15
28 changed files with 555 additions and 272 deletions

View File

@ -1,4 +1,34 @@
package cn.iocoder.yudao.module.system.api.mail;
import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
import javax.validation.Valid;
/**
* 邮箱发送 API 接口
*
* @author 芋道源码
*/
public interface MailSendApi {
/**
* 发送单条邮箱给 Admin 用户
*
* 在 mail 为空时,使用 userId 加载对应 Admin 的邮箱
*
* @param reqDTO 发送请求
* @return 发送日志编号
*/
Long sendSingleSmsToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
/**
* 发送单条邮箱给 Member 用户
*
* 在 mail 为空时,使用 userId 加载对应 Member 的邮箱
*
* @param reqDTO 发送请求
* @return 发送日志编号
*/
Long sendSingleSmsToMember(@Valid MailSendSingleToUserReqDTO reqDTO);
}

View File

@ -1,38 +0,0 @@
package cn.iocoder.yudao.module.system.api.mail.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
@ApiModel("管理后台 - 邮件发送 Req VO")
@Data
public class MailSendReqDTO { // TODO @wangjingqi1, 不用空格2应该只要传递 templateCode、参数就好title、from、content、附件应该都是参数里的
@ApiModelProperty(value = "用户编码",required = true)
@NotNull(message = "用户编码不能为空")
private String userId;
@ApiModelProperty(value = "用户类型",required = true)
@NotNull(message = "用户类型不能为空")
private String userType;
@ApiModelProperty(value = "邮箱模版id",example = "1024")
@NotNull(message = "邮箱模版编码不能为空")
private Integer templateCode;
@ApiModelProperty(value = "邮箱参数")
@NotNull(message = "模版参数不能为空")
private Map<String,Object> templateParams;
@ApiModelProperty(value = "收件人",required = true,example = "yudaoyuanma@123.com")
@NotNull(message = "收件人不能为空")
private List<String> tos;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.system.api.mail.dto;
import lombok.Data;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.util.Map;
/**
* 邮件发送 Request DTO
*
* @author wangjingqi
*/
@Data
public class MailSendSingleToUserReqDTO {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private String userId;
/**
* 邮箱
*/
@Email
private String mail;
/**
* 邮件模板编号
*/
@NotNull(message = "邮件模板编号不能为空")
private String templateCode;
/**
* 邮件模板参数
*/
@NotNull(message = "邮件模板参数不能为空")
private Map<String, Object> templateParams;
}

View File

@ -141,16 +141,13 @@ public interface ErrorCodeConstants {
ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在");
ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022001, "code 已过期");
// TODO @芋艿:需要重新搞下 mail 错误码
// ========== 邮箱账号 1002020000 ==========
ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002020000, "邮箱账号不存在");
ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002020001, "邮箱账号存在");
// ========== 邮箱账号 1002023000 ==========
ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002023000, "邮箱账号不存在");
ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002023001, "无法删除,该邮箱账号还有邮件模板");
// ========== 邮箱模版 1002021000 ==========
ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002021000, "邮箱模版不存在");
ErrorCode MAIL_TEMPLATE_EXISTS = new ErrorCode(1002021001, "邮箱模版存在");
ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002021002, "存在关联邮箱模版");
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002021003, "模板参数({})缺失");
}

View File

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.system.enums.mail;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 邮件日志用户类型
*
* @author wangjingyi
*/
@Getter
@AllArgsConstructor
public enum MailLogUserTypeEnum {
COMMON (10),
VIP (20);
/**
* 类型
*/
private final int userType;
}