diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml index 42c887c561..73bb614cd7 100644 --- a/yudao-framework/pom.xml +++ b/yudao-framework/pom.xml @@ -30,7 +30,6 @@ yudao-spring-boot-starter-biz-operatelog yudao-spring-boot-starter-biz-dict yudao-spring-boot-starter-biz-sms - yudao-spring-boot-starter-biz-mail yudao-spring-boot-starter-activiti yudao-spring-boot-starter-biz-pay yudao-spring-boot-starter-biz-weixin diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-mail/pom.xml deleted file mode 100644 index 8cca217789..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - cn.iocoder.boot - yudao-framework - ${revision} - - 4.0.0 - yudao-spring-boot-starter-biz-mail - jar - - - - cn.iocoder.boot - yudao-common - - - - - org.springframework.boot - spring-boot-starter - - - - - io.opentracing - opentracing-util - - - - - cn.iocoder.boot - yudao-spring-boot-starter-test - test - - - - - com.google.guava - guava - true - - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-core - - - - jakarta.validation - jakarta.validation-api - - - org.projectlombok - lombok - - - - \ No newline at end of file diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/config/YudaoMailAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/config/YudaoMailAutoConfiguration.java deleted file mode 100644 index c83b1e5f1e..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/config/YudaoMailAutoConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.framework.mail.config; - -import cn.iocoder.yudao.framework.mail.core.client.MailClientFactory; -import cn.iocoder.yudao.framework.mail.core.client.impl.MailClientFactoryImpl; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * 邮箱配置类 - * - * @author 芋道源码 - */ -@Configuration -public class YudaoMailAutoConfiguration { - - @Bean - public MailClientFactory mailClientFactory() { - return new MailClientFactoryImpl(); - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClient.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClient.java deleted file mode 100644 index a17260410a..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClient.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client; - -import java.util.List; - -/** - * 邮件客户端,用于对接各邮箱平台的 SDK,实现邮件发送等功能 - * - * @author wangjingyi - * @date 2021/4/19 19:21 - */ -public interface MailClient { - - /** - * 发送邮件 - * - * @param from 邮箱账号 - * @param content 内容 - * @param title 标题 - * @param tos 收件人 - * @return 邮件发送结果 - */ - String sendMail(String from, String content, String title, List tos); -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClientFactory.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClientFactory.java deleted file mode 100644 index 3244dfe761..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailClientFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client; - -public interface MailClientFactory { - MailClient getMailClient(); -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCodeMapping.java deleted file mode 100644 index c33b4be3e3..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCodeMapping.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client; - -import cn.iocoder.yudao.framework.common.exception.ErrorCode; -import cn.iocoder.yudao.framework.mail.core.enums.MailFrameworkErrorCodeConstants; - -import java.util.function.Function; - -/** - * 将 API 的错误码,转换为通用的错误码 - * - * @see MailCommonResult - * @see MailFrameworkErrorCodeConstants - * - * @author 芋道源码 - */ -public interface MailCodeMapping extends Function { -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCommonResult.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCommonResult.java deleted file mode 100644 index a53a3b9897..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/MailCommonResult.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client; - -import cn.hutool.core.exceptions.ExceptionUtil; -import cn.hutool.core.lang.Assert; -import cn.iocoder.yudao.framework.common.exception.ErrorCode; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import cn.iocoder.yudao.framework.mail.core.enums.MailFrameworkErrorCodeConstants; - -/** - * 短信的 CommonResult 拓展类 - * - * 考虑到不同的平台,返回的 code 和 msg 是不同的,所以统一额外返回 {@link #apiCode} 和 {@link #apiMsg} 字段 - * - * 另外,一些短信平台(例如说阿里云、腾讯云)会返回一个请求编号,用于排查请求失败的问题,我们设置到 {@link #apiRequestId} 字段 - * - * @author 芋道源码 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class MailCommonResult extends CommonResult { - - /** - * API 返回错误码 - * - * 由于第三方的错误码可能是字符串,所以使用 String 类型 - */ - private String apiCode; - /** - * API 返回提示 - */ - private String apiMsg; - - /** - * API 请求编号 - */ - private String apiRequestId; - - private MailCommonResult() { - } - - public static MailCommonResult build(String apiCode, String apiMsg, String apiRequestId, - T data, MailCodeMapping codeMapping) { - Assert.notNull(codeMapping, "参数 codeMapping 不能为空"); - MailCommonResult result = new MailCommonResult().setApiCode(apiCode).setApiMsg(apiMsg).setApiRequestId(apiRequestId); - result.setData(data); - // 翻译错误码 - if (codeMapping != null) { - ErrorCode errorCode = codeMapping.apply(apiCode); - if (errorCode == null) { - errorCode = MailFrameworkErrorCodeConstants.MAIL_UNKNOWN; - } - result.setCode(errorCode.getCode()).setMsg(errorCode.getMsg()); - } - return result; - } - - public static MailCommonResult error(Throwable ex) { - MailCommonResult result = new MailCommonResult<>(); - result.setCode(MailFrameworkErrorCodeConstants.EXCEPTION.getCode()); - result.setMsg(ExceptionUtil.getRootCauseMessage(ex)); - return result; - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailReceiveRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailReceiveRespDTO.java deleted file mode 100644 index 11f27f58a6..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailReceiveRespDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.dto; - -import lombok.Data; - -import java.util.Date; - -/** - * 消息接收 Response DTO - * - * @author 芋道源码 - */ -@Data -public class MailReceiveRespDTO { - - /** - * 是否接收成功 - */ - private Boolean success; - /** - * API 接收结果的编码 - */ - private String errorCode; - /** - * API 接收结果的说明 - */ - private String errorMsg; - - /** - * 手机号 - */ - private String mobile; - /** - * 用户接收时间 - */ - private Date receiveTime; - - /** - * 短信 API 发送返回的序号 - */ - private String serialNo; - /** - * 短信日志编号 - * - * 对应 SysSmsLogDO 的编号 - */ - private Long logId; - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailSendRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailSendRespDTO.java deleted file mode 100644 index b4a94a6347..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailSendRespDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.dto; - -import lombok.Data; - -/** - * 短信发送 Response DTO - * - * @author 芋道源码 - */ -@Data -public class MailSendRespDTO { - - /** - * 短信 API 发送返回的序号 - */ - private String serialNo; - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailTemplateRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailTemplateRespDTO.java deleted file mode 100644 index 14bdeacd89..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/dto/MailTemplateRespDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.dto; - -import lombok.Data; - -/** - * 短信模板 Response DTO - * - * @author 芋道源码 - */ -@Data -public class MailTemplateRespDTO { - - /** - * 模板编号 - */ - private String id; - /** - * 短信内容 - */ - private String content; - /** - * 审核状态 - * - */ - private Integer auditStatus; - /** - * 审核未通过的理由 - */ - private String auditReason; - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/AbstractMailClient.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/AbstractMailClient.java deleted file mode 100644 index 097c8e095f..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/AbstractMailClient.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.impl; - -import lombok.extern.slf4j.Slf4j; -import cn.iocoder.yudao.framework.mail.core.client.MailClient; - -/** - * 短信客户端的抽象类,提供模板方法,减少子类的冗余代码 - * - * @author zzf - * @date 2021/2/1 9:28 - */ -@Slf4j -public abstract class AbstractMailClient implements MailClient { -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/MailClientFactoryImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/MailClientFactoryImpl.java deleted file mode 100644 index 9923bd3df4..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/MailClientFactoryImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.impl; - -import cn.iocoder.yudao.framework.mail.core.client.MailClient; -import cn.iocoder.yudao.framework.mail.core.client.impl.hutool.HutoolMailClient; -import lombok.extern.slf4j.Slf4j; -import cn.iocoder.yudao.framework.mail.core.client.MailClientFactory; -import cn.iocoder.yudao.framework.mail.core.enums.MailChannelEnum; -import org.springframework.validation.annotation.Validated; - -import java.util.Arrays; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -@Validated -@Slf4j -public class MailClientFactoryImpl implements MailClientFactory { - - private final ConcurrentMap channelCodeClients = new ConcurrentHashMap<>(); - - public MailClientFactoryImpl (){ - Arrays.stream(MailChannelEnum.values()).forEach(mailChannelEnum -> { - AbstractMailClient abstractMailClient = createMailClient(mailChannelEnum); - channelCodeClients.put(mailChannelEnum.getCode() , abstractMailClient); - }); - } - - private AbstractMailClient createMailClient(MailChannelEnum mailChannelEnum) { - switch (mailChannelEnum){ - case HUTOOL: return new HutoolMailClient(); - } - // 创建失败,错误日志 + 抛出异常 - log.error("[createMailClient][配置({}) 找不到合适的客户端实现]" , mailChannelEnum); - throw new IllegalArgumentException(String.format("配置(%s) 找不到合适的客户端实现", mailChannelEnum)); - } - - @Override - public MailClient getMailClient() { - return channelCodeClients.get("HUTOOL"); - } -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailClient.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailClient.java deleted file mode 100644 index 457ad7e370..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailClient.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.impl.hutool; - -import cn.hutool.extra.mail.MailUtil; -import cn.iocoder.yudao.framework.mail.core.client.impl.AbstractMailClient; -import lombok.extern.slf4j.Slf4j; - -import java.util.List; - - -/** - * 邮件客户端实现 - * - * @author wangjingyi - * @date 2021/4/25 14:25 - */ -@Slf4j -public class HutoolMailClient extends AbstractMailClient { - - @Override - public String sendMail(String from, String content, String title, List tos) { - try{ - return MailUtil.send(from , title , content , false , null); - }catch (Exception e){ - log.error(e.getMessage()); - } - return ""; - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailCodeMapping.java deleted file mode 100644 index 711d369502..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/client/impl/hutool/HutoolMailCodeMapping.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.client.impl.hutool; - -import cn.iocoder.yudao.framework.common.exception.ErrorCode; -import cn.iocoder.yudao.framework.mail.core.client.MailCodeMapping; - -/** - * 阿里云的 SmsCodeMapping 实现类 - * - * 参见 https://help.aliyun.com/document_detail/101346.htm 文档 - * - * @author 芋道源码 - */ -public class HutoolMailCodeMapping implements MailCodeMapping { - - @Override - public ErrorCode apply(String apiCode) { - return null; - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailChannelEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailChannelEnum.java deleted file mode 100644 index 51d2f1fcae..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailChannelEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.enums; - -import cn.hutool.core.util.ArrayUtil; -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * 短信渠道枚举 - * - * @author zzf - * @date 2021/1/25 10:56 - */ -@Getter -@AllArgsConstructor -public enum MailChannelEnum { - HUTOOL("HUTOOL" , "HUTOOL"), - ; - - /** - * 编码 - */ - private final String code; - /** - * 名字 - */ - private final String name; - - public static MailChannelEnum getByCode(String code) { - return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailFrameworkErrorCodeConstants.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailFrameworkErrorCodeConstants.java deleted file mode 100644 index e5ef74cf33..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailFrameworkErrorCodeConstants.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.enums; - -import cn.iocoder.yudao.framework.common.exception.ErrorCode; - -/** - * 短信框架的错误码枚举 - * - * 短信框架,使用 2-001-000-000 段 - * - * @author 芋道源码 - */ -public interface MailFrameworkErrorCodeConstants { - - ErrorCode MAIL_UNKNOWN = new ErrorCode(2001000000, "未知错误,需要解析"); - - // ========== 权限 / 限流等相关 2001000100 ========== - - ErrorCode SMS_PERMISSION_DENY = new ErrorCode(2001000100, "没有发送短信的权限"); - // 云片:可以配置 IP 白名单,只有在白名单中才可以发送短信 - ErrorCode SMS_IP_DENY = new ErrorCode(2001000100, "IP 不允许发送短信"); - - // 阿里云:将短信发送频率限制在正常的业务限流范围内。默认短信验证码:使用同一签名,对同一个手机号验证码,支持 1 条 / 分钟,5 条 / 小时,累计 10 条 / 天。 - ErrorCode SMS_SEND_BUSINESS_LIMIT_CONTROL = new ErrorCode(2001000102, "指定手机的发送限流"); - // 阿里云:已经达到您在控制台设置的短信日发送量限额值。在国内消息设置 > 安全设置,修改发送总量阈值。 - ErrorCode SMS_SEND_DAY_LIMIT_CONTROL = new ErrorCode(2001000103, "每天的发送限流"); - - ErrorCode SMS_SEND_CONTENT_INVALID = new ErrorCode(2001000104, "短信内容有敏感词"); - - // ========== 模板相关 2001000200 ========== - ErrorCode SMS_TEMPLATE_INVALID = new ErrorCode(2001000200, "短信模板不合法"); // 包括短信模板不存在 - ErrorCode SMS_TEMPLATE_PARAM_ERROR = new ErrorCode(2001000201, "模板参数不正确"); - - // ========== 签名相关 2001000300 ========== - ErrorCode SMS_SIGN_INVALID = new ErrorCode(2001000300, "短信签名不可用"); - - // ========== 账户相关 2001000400 ========== - ErrorCode SMS_ACCOUNT_MONEY_NOT_ENOUGH = new ErrorCode(2001000400, "账户余额不足"); - ErrorCode SMS_ACCOUNT_INVALID = new ErrorCode(2001000401, "apiKey 不存在"); - - // ========== 其它相关 2001000900 开头 ========== - ErrorCode SMS_API_PARAM_ERROR = new ErrorCode(2001000900, "请求参数缺失"); - ErrorCode SMS_MOBILE_INVALID = new ErrorCode(2001000901, "手机格式不正确"); - ErrorCode SMS_MOBILE_BLACK = new ErrorCode(2001000902, "手机号在黑名单中"); - - ErrorCode EXCEPTION = new ErrorCode(2001000999, "调用异常"); - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailTemplateAuditStatusEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailTemplateAuditStatusEnum.java deleted file mode 100644 index 95c3c31a3e..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/enums/MailTemplateAuditStatusEnum.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * 短信模板的审核状态枚举 - * - * @author 芋道源码 - */ -@AllArgsConstructor -@Getter -public enum MailTemplateAuditStatusEnum { - - CHECKING(1), - SUCCESS(2), - FAIL(3); - - private final Integer status; - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/property/MailChannelProperties.java b/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/property/MailChannelProperties.java deleted file mode 100644 index 1f19ac12bd..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-mail/src/main/java/cn/iocoder/yudao/framework/mail/core/property/MailChannelProperties.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.framework.mail.core.property; - -import lombok.Data; -import cn.iocoder.yudao.framework.mail.core.enums.MailChannelEnum; -import org.springframework.validation.annotation.Validated; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * 短信渠道配置类 - * - * @author zzf - * @date 2021/1/25 17:01 - */ -@Data -@Validated -public class MailChannelProperties { - - /** - * 渠道编号 - */ - @NotNull(message = "短信渠道 ID 不能为空") - private Long id; - /** - * 短信签名 - */ - @NotEmpty(message = "短信签名不能为空") - private String signature; - /** - * 渠道编码 - * - * 枚举 {@link MailChannelEnum} - */ - @NotEmpty(message = "渠道编码不能为空") - private String code; - /** - * 短信 API 的账号 - */ - @NotEmpty(message = "短信 API 的账号不能为空") - private String apiKey; - /** - * 短信 API 的秘钥 - */ - @NotEmpty(message = "短信 API 的秘钥不能为空") - private String apiSecret; - /** - * 短信发送回调 URL - */ - private String callbackUrl; - -} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 07322ccd72..d514345dab 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -119,13 +119,17 @@ public interface ErrorCodeConstants { ErrorCode SOCIAL_USER_UNBIND_NOT_SELF = new ErrorCode(1002018001, "社交解绑失败,非当前用户绑定"); ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1002018002, "社交授权失败,找不到对应的用户"); - // ========== 邮箱账号 1002019000 ========== - ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002019000, "邮箱账号不存在"); - ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002019001, "邮箱账号存在"); + // ========== 系统铭感词 1002019000 ========= + ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1002019000, "系统敏感词在所有标签中都不存在"); + ErrorCode SENSITIVE_WORD_EXISTS = new ErrorCode(1002019001, "系统敏感词已在标签中存在"); - // ========== 邮箱模版 1002020000 ========== - ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002020000 , "邮箱模版不存在"); - ErrorCode MAIL_TEMPLATE_EXISTS = new ErrorCode(1002020001, "邮箱模版存在"); - ErrorCode MAIL_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002020002, "存在关联邮箱模版"); + // ========== 邮箱账号 1002020000 ========== + ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002020000, "邮箱账号不存在"); + ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002020001, "邮箱账号存在"); + + // ========== 邮箱模版 1002021000 ========== + ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002021000 , "邮箱模版不存在"); + ErrorCode MAIL_TEMPLATE_EXISTS = new ErrorCode(1002021001, "邮箱模版存在"); + ErrorCode MAIL_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002021002, "存在关联邮箱模版"); } diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml index 2240f3b955..e23ba8ab86 100644 --- a/yudao-module-system/yudao-module-system-biz/pom.xml +++ b/yudao-module-system/yudao-module-system-biz/pom.xml @@ -42,10 +42,6 @@ cn.iocoder.boot yudao-spring-boot-starter-biz-dict - - cn.iocoder.boot - yudao-spring-boot-starter-biz-mail - cn.iocoder.boot yudao-spring-boot-starter-biz-data-permission diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java index 3f4693bcb0..35c6c0a9bc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java @@ -1,11 +1,7 @@ package cn.iocoder.yudao.module.system.convert.mail; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountBaseVO; import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateBaseVO; -import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; -import cn.iocoder.yudao.module.system.convert.errorcode.ErrorCodeConvertImpl; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailSendServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailSendServiceImpl.java index f2146f0270..bc4b496f1e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailSendServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailSendServiceImpl.java @@ -13,10 +13,8 @@ import cn.iocoder.yudao.module.system.service.mail.MailLogService; import cn.iocoder.yudao.module.system.service.mail.MailSendService; import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; import lombok.extern.slf4j.Slf4j; -import cn.iocoder.yudao.framework.mail.core.client.MailClientFactory; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import cn.iocoder.yudao.framework.mail.core.client.MailClient; import javax.annotation.Resource; import java.util.List; @@ -46,8 +44,6 @@ public class MailSendServiceImpl implements MailSendService { @Resource private MailLogService mailLogService; @Resource - private MailClientFactory mailClientFactory; - @Resource private MailProducer mailProducer; @@ -80,9 +76,9 @@ public class MailSendServiceImpl implements MailSendService { @Override public void doSendMail(MailSendMessage message) { // TODO @wangjingyi:直接使用 hutool 发送,不要封装 mail client 哈,因为短信的客户端都是比较统一的 - MailClient mailClient = mailClientFactory.getMailClient(); - String result = mailClient.sendMail(message.getFrom() , message.getContent() , message.getTitle() , message.getTos()); - mailLogService.updateSmsSendResult(message.getLogId() , result); + //MailClient mailClient = mailClientFactory.getMailClient(); + //String result = mailClient.sendMail(message.getFrom() , message.getContent() , message.getTitle() , message.getTos()); + //mailLogService.updateSmsSendResult(message.getLogId() , result); } private MailTemplateDO checkMailTemplateValid(String templateCode) {