- 添加 SmsPlatform
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.mall.admin.api;
|
||||
|
||||
import cn.iocoder.mall.admin.api.bo.sms.SmsSignBO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 短信平台
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/16 6:33 PM
|
||||
*/
|
||||
public interface SmsPlatform {
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
class Result {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private Integer applyStatus;
|
||||
/**
|
||||
* 审核内容
|
||||
*/
|
||||
private String applyMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名 - 创建
|
||||
*
|
||||
* @param sign
|
||||
*/
|
||||
Result createSign(String sign);
|
||||
|
||||
/**
|
||||
* 签名 - 获取
|
||||
*
|
||||
* @param sign
|
||||
*/
|
||||
Result getSign(String sign);
|
||||
|
||||
/**
|
||||
* 签名 - 更新
|
||||
*
|
||||
* @param oldSign
|
||||
* @param sign
|
||||
*/
|
||||
Result updateSign(String oldSign, String sign);
|
||||
|
||||
/**
|
||||
* 模板 - 创建
|
||||
*
|
||||
* @param sign 选用的哪个签名
|
||||
* @param template 模板内容
|
||||
* @param tplType 1 为验证码类型,其他为 null
|
||||
*/
|
||||
Result createTemplate(String sign, String template, Integer tplType);
|
||||
|
||||
/**
|
||||
* 获取模板信息
|
||||
*
|
||||
* @param tipId
|
||||
*/
|
||||
Result getTemplate(String tipId);
|
||||
|
||||
/**
|
||||
* 更新模板内容
|
||||
*
|
||||
* @param tipId 选用的哪个签名
|
||||
* @param template 模板内容
|
||||
* @param tplType 1 为验证码类型,其他为 null
|
||||
*/
|
||||
Result updateTemplate(String tipId, String template, Integer tplType);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.mall.admin.api;
|
||||
|
||||
import cn.iocoder.mall.admin.api.bo.sms.SmsSignBO;
|
||||
import cn.iocoder.mall.admin.api.bo.sms.SmsTemplateBO;
|
||||
|
||||
/**
|
||||
* 短信服务
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/16 9:54 AM
|
||||
*/
|
||||
public interface SmsService {
|
||||
|
||||
/**
|
||||
* 签名 - 创建
|
||||
*
|
||||
* @param sign
|
||||
*/
|
||||
void createSign(String sign);
|
||||
|
||||
/**
|
||||
* 签名 - 获取
|
||||
*
|
||||
* @param sign
|
||||
*/
|
||||
SmsSignBO getSign(String sign);
|
||||
|
||||
/**
|
||||
* 签名 - 更新
|
||||
*
|
||||
* @param oldSign
|
||||
* @param sign
|
||||
*/
|
||||
void updateSign(String oldSign, String sign);
|
||||
|
||||
/**
|
||||
* 模板 - 创建
|
||||
*
|
||||
* @param smsSignId 选用的哪个签名
|
||||
* @param template 模板内容
|
||||
* @param tplType 1 为验证码类型,其他为 null
|
||||
*/
|
||||
void createTemplate(Integer smsSignId, String template, Integer tplType);
|
||||
|
||||
/**
|
||||
* 获取模板信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
SmsTemplateBO getTemplate(String id);
|
||||
|
||||
/**
|
||||
* 更新模板内容
|
||||
*
|
||||
* @param id 模板id
|
||||
* @param template 模板内容
|
||||
* @param tplType 1 为验证码类型,其他为 null
|
||||
*/
|
||||
void updateTemplate(String id, String template, Integer tplType);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.admin.api.bo.sms;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/16 6:30 PM
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsSignBO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 签名id 这个是第三方的
|
||||
*/
|
||||
private Integer signId;
|
||||
/**
|
||||
* 签名名称
|
||||
*/
|
||||
private String sign;
|
||||
/**
|
||||
* 审核状态
|
||||
*
|
||||
* - 1、审核中
|
||||
* - 2、审核成功
|
||||
* - 3、审核失败
|
||||
*/
|
||||
private Integer applyStatus;
|
||||
/**
|
||||
* 审核信息
|
||||
*/
|
||||
private String applyMessage;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.mall.admin.api.bo.sms;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 短信 template
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/16 7:41 PM
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsTemplateBO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 模板编号 (第三方的)
|
||||
*/
|
||||
private Integer smsSignId;
|
||||
/**
|
||||
* 短信签名 id
|
||||
*/
|
||||
private String platformId;
|
||||
/**
|
||||
* 短信模板
|
||||
*/
|
||||
private String template;
|
||||
/**
|
||||
* 审核状态
|
||||
*
|
||||
* 1、审核中
|
||||
* 2、审核成功
|
||||
* 3、审核失败
|
||||
*/
|
||||
private Integer applyStatus;
|
||||
/**
|
||||
* 审核信息
|
||||
*/
|
||||
private String applyMessage;
|
||||
}
|
||||
@@ -46,6 +46,15 @@ public enum AdminErrorCodeEnum {
|
||||
DATA_DICT_EXISTS(1002005000, "该数据字典已经存在"),
|
||||
DATA_DICT_NOT_EXISTS(1002005001, "该数据字典不存在"),
|
||||
|
||||
// ========== 短信模板 1002006000 ==========
|
||||
SMS_SIGN_ADD_FAIL(1002006000, "短信签名添加失败"),
|
||||
SMS_SIGN_NOT_EXISTENT(1002006001, "短信签名不存在"),
|
||||
SMS_SIGN_IS_EXISTENT(1002006002, "短信签名已存在"),
|
||||
SMS_SIGN_UPDATE_FAIL(1002006003, "短信更新失败"),
|
||||
|
||||
SMS_TEMPLATE_ADD_FAIL(1002006020, "短信签名不存在"),
|
||||
SMS_TEMPLATE_NOT_EXISTENT(1002006021, "短信签名不存在"),
|
||||
SMS_TEMPLATE_IS_EXISTENT(1002006022, "短信签名不存在"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.mall.admin.api.constant;
|
||||
|
||||
/**
|
||||
* 短信审核状态
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/16 12:48 PM
|
||||
*/
|
||||
public enum SmsApplyStatusEnum {
|
||||
|
||||
CHECKING(1, "审核中"),
|
||||
SUCCESS(2, "审核成功"),
|
||||
FAIL(3, "审核失败"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
SmsApplyStatusEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.mall.admin.api.exception;
|
||||
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
|
||||
/**
|
||||
* @author Sin
|
||||
* @time 2019/5/16 11:17 AM
|
||||
*/
|
||||
public class SmsFailException extends ServiceException {
|
||||
|
||||
public SmsFailException(Integer code, String message) {
|
||||
super(code, message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user