init
This commit is contained in:
49
src/main/java/com/newyetai/sdk/sms/config/SmsConfig.java
Normal file
49
src/main/java/com/newyetai/sdk/sms/config/SmsConfig.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.newyetai.sdk.sms.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 短信sms配置
|
||||
*
|
||||
* @author on 2019-11-05
|
||||
*/
|
||||
@ConfigurationProperties(prefix = SmsConfig.PREFIX)
|
||||
@Data
|
||||
@Component
|
||||
public class SmsConfig {
|
||||
|
||||
public static final String PREFIX = "sms";
|
||||
|
||||
private Boolean enable;
|
||||
|
||||
/** 次数限制 **/
|
||||
private Long numLimit;
|
||||
|
||||
private String domain;
|
||||
|
||||
private String accessKeyId;
|
||||
|
||||
private String accessSecret;
|
||||
|
||||
private String regionId;
|
||||
|
||||
private String version;
|
||||
|
||||
/** 签名 **/
|
||||
private String signName;
|
||||
|
||||
|
||||
@Bean
|
||||
public IAcsClient defaultProfile() {
|
||||
DefaultProfile defaultProfile = DefaultProfile.getProfile(regionId, accessKeyId, accessSecret);
|
||||
return new DefaultAcsClient(defaultProfile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.newyetai.sdk.sms.constant;
|
||||
|
||||
/**
|
||||
* 阿里云action
|
||||
*
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
public enum AliSmsActionEnum {
|
||||
|
||||
/** 发送短信 **/
|
||||
SEND_SMS("SendSms"),
|
||||
/** 批量发送短信 **/
|
||||
SEND_BATCH_SMS("SendBatchSms"),
|
||||
/** 查询短信发送的状态 **/
|
||||
QUERY_SEND_DETAILS("QuerySendDetails"),
|
||||
/** 申请短信签名 **/
|
||||
ADD_SMS_SIGN("AddSmsSign"),
|
||||
/** 删除短信签名 **/
|
||||
DELETE_SMS_SIGN("DeleteSmsSign"),
|
||||
/** 查询短信签名申请状态 **/
|
||||
QUERY_SMS_SIGN("QuerySmsSign"),
|
||||
/** 修改未审核通过的短信签名,并重新提交审核 **/
|
||||
MODIFY_SMS_SIGN("ModifySmsSign"),
|
||||
/** 修改未通过审核的短信模板 **/
|
||||
MODIFY_SMS_TEMPLATE("ModifySmsTemplate"),
|
||||
/** 查询短信模板的审核状态 **/
|
||||
QUERY_SMS_TEMPLATE("QuerySmsTemplate"),
|
||||
/** 申请短信模板 **/
|
||||
ADD_SMS_TEMPLATE("AddSmsTemplate"),
|
||||
/** 删除短信模板 **/
|
||||
DELETE_SMS_TEMPLATE("DeleteSmsTemplate");
|
||||
|
||||
private String value;
|
||||
|
||||
private AliSmsActionEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.newyetai.sdk.sms.constant;
|
||||
|
||||
/**
|
||||
* 短信常量类
|
||||
*
|
||||
* @author sr on 2019-09-16
|
||||
*/
|
||||
public interface SmsConstants {
|
||||
|
||||
/** 成功码 **/
|
||||
String SUCCESS_CODE = "OK";
|
||||
|
||||
/** ================ sms 调起真实服务前异常msg ================= **/
|
||||
String TEMPLATE_CODE_KEY_EMPTY = "sms短信模版配置健为空";
|
||||
String TEMPLATE_CODE_EMPTY = "sms短信模版为空";
|
||||
/** ================ sms 调起真实服务前异常msg ================= **/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.newyetai.sdk.sms.constant;
|
||||
|
||||
/**
|
||||
* 短信服务提供者
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
public enum SmsProviderEnum {
|
||||
|
||||
/** 阿里云 **/
|
||||
ALIYAN("aliyun");
|
||||
|
||||
private String providerName;
|
||||
|
||||
SmsProviderEnum(String providerName){
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return this.providerName;
|
||||
}
|
||||
|
||||
}
|
||||
64
src/main/java/com/newyetai/sdk/sms/dto/ISendDTO.java
Normal file
64
src/main/java/com/newyetai/sdk/sms/dto/ISendDTO.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.newyetai.sdk.sms.dto;
|
||||
|
||||
import com.newyetai.sdk.sms.constant.SmsProviderEnum;
|
||||
|
||||
/**
|
||||
* 发送短信对象接口
|
||||
*
|
||||
* @author sr on 2020-07-02
|
||||
* @param <T>
|
||||
*/
|
||||
public interface ISendDTO<T> {
|
||||
|
||||
/**
|
||||
* 短信服务商提供者,默认阿里云
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
default SmsProviderEnum getSmsProvider() {
|
||||
return SmsProviderEnum.ALIYAN;
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信模版配置key,获取配置时内部会自动加上(sms)前缀, 如配置文件中添加sms.someTemplateCode,此处配置someTemplateCode
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
String getTemplateCodeKey();
|
||||
|
||||
/**
|
||||
* 阿里云模版code,如SMS_19522****
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
default String getTemplateCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
String getPhone();
|
||||
|
||||
/**
|
||||
* 短信模版参数
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
T getParameters();
|
||||
|
||||
/**
|
||||
* 获取签名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSignName();
|
||||
|
||||
}
|
||||
18
src/main/java/com/newyetai/sdk/sms/dto/ITemplateCode.java
Normal file
18
src/main/java/com/newyetai/sdk/sms/dto/ITemplateCode.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.newyetai.sdk.sms.dto;
|
||||
|
||||
/**
|
||||
* 短信模版对象
|
||||
*
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
public interface ITemplateCode {
|
||||
|
||||
/**
|
||||
* 模版属性配置键,不带sms.前缀
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
String getTemplateCodeKey();
|
||||
|
||||
}
|
||||
31
src/main/java/com/newyetai/sdk/sms/dto/SimpleSendDTO.java
Normal file
31
src/main/java/com/newyetai/sdk/sms/dto/SimpleSendDTO.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.newyetai.sdk.sms.dto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 发送sms对象,模版参数对象为map
|
||||
*
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SimpleSendDTO implements ISendDTO<Map<String, Object>> {
|
||||
|
||||
private String templateCodeKey;
|
||||
|
||||
private String templateCode;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Map<String, Object> parameters;
|
||||
|
||||
private String signName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.sdk.sms.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 验证码短信参数对象
|
||||
*
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class VerificationCodeParamDTO implements Serializable {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = 2431795846055282684L;
|
||||
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.newyetai.sdk.sms.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 发送验证码sms对象
|
||||
*
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class VerificationCodeSendDTO implements ISendDTO<VerificationCodeParamDTO> {
|
||||
|
||||
/** 短信模版配置key **/
|
||||
private String templateCodeKey;
|
||||
|
||||
/** 短信模版号 **/
|
||||
private String templateCode;
|
||||
|
||||
/** 手机号 **/
|
||||
private String phone;
|
||||
|
||||
/** 验证码参数 **/
|
||||
private VerificationCodeParamDTO parameters;
|
||||
|
||||
private String signName;
|
||||
|
||||
/** 验证码 **/
|
||||
@JsonIgnore
|
||||
private String code;
|
||||
|
||||
@Override
|
||||
public String getSignName() {
|
||||
return signName;
|
||||
}
|
||||
|
||||
public VerificationCodeParamDTO getParameters() {
|
||||
if (parameters != null) {
|
||||
return parameters;
|
||||
}
|
||||
if (code != null) {
|
||||
parameters = VerificationCodeParamDTO.builder().code(code).build();
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
|
||||
}
|
||||
62
src/main/java/com/newyetai/sdk/sms/model/AddSmsSign.java
Normal file
62
src/main/java/com/newyetai/sdk/sms/model/AddSmsSign.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
public class AddSmsSign implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5401737524288272902L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名名称。 **说明**
|
||||
* 签名必须符合[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)或[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:1<br>
|
||||
* 描述:签名来源。其中: - 0:企事业单位的全称或简称。 - 1:工信部备案网站的全称或简称。 - 2:APP 应用的全称或简称。 - 3:公众号或小程序的全称或简称。 -
|
||||
* 4:电商平台店铺名的全称或简称。 - 5:商标名的全称或简称 说明** 签名来源为 1 时,请在申请说明中添加网站域名,加快审核速度。<br>
|
||||
*/
|
||||
@JsonProperty("SignSource")
|
||||
private Integer signSource;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:当前的短信签名应用于双 11 大促推广营销<br>
|
||||
* 描述:短信签名申请说明。请在申请说明中详细描述您的业务使用场景,申请工信部备案网站的全称或简称请在此处填写域名,长度不超过 200 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("Remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:jpg<br>
|
||||
* 描述:签名的证明文件格式,支持上传多张图片。当前支持 jpg、png、gif 或 jpeg
|
||||
* 格式的图片。个别场景下,申请签名需要上传证明文件。详细说明请参考[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)和[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignFileList.N.FileSuffix")
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:R0lGODlhHAAmAKIHAKqqqsvLy0hISObm5vf394uLiwAA<br>
|
||||
* 描述:签名的资质证明文件经 base64 编码后的字符串。图片不超过 2
|
||||
* MB。个别场景下,申请签名需要上传证明文件。详细说明请参考[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)和[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignFileList.N.FileContents")
|
||||
private String fileContents;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class AddSmsSignResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4121769016752821993L;
|
||||
|
||||
/**
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名名称。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:状态码的描述。<br>
|
||||
*/
|
||||
@JsonProperty("Message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 事例:F655A8D5-B967-440B-8683-DAD6FF8DE990<br>
|
||||
* 描述:请求 ID。<br>
|
||||
*/
|
||||
@JsonProperty("RequestId")
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:请求状态码。 - 返回 OK 代表请求成功。 -
|
||||
* 其他错误码详见[错误码列表](https://help.aliyun.com/document_detail/101346.html)。<br>
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
private String code;
|
||||
}
|
||||
51
src/main/java/com/newyetai/sdk/sms/model/AddSmsTemplate.java
Normal file
51
src/main/java/com/newyetai/sdk/sms/model/AddSmsTemplate.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class AddSmsTemplate implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5868722985393802890L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:1<br>
|
||||
* 描述:短信类型。其中: - 0:验证码。 - 1:短信通知。 - 2:推广短信。 - 3:国际 / 港澳台消息。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateType")
|
||||
private Integer templateType;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云短信测试模板<br>
|
||||
* 描述:模板名称,长度为 1~30 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateName")
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:您正在申请手机注册,验证码为:${code},5 分钟内有效!<br>
|
||||
* 描述:模板内容,长度为 1~500
|
||||
* 个字符。模板内容需要符合[文本短信模板规范](https://help.aliyun.com/document_detail/108253.html)或[国际 /
|
||||
* 港澳台短信模板规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateContent")
|
||||
private String templateContent;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:当前的短信模板应用于双 11 大促推广营销<br>
|
||||
* 描述:短信模板申请说明。请在申请说明中描述您的业务使用场景,长度为 1~100 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("Remark")
|
||||
private String remark;
|
||||
}
|
||||
25
src/main/java/com/newyetai/sdk/sms/model/DeleteSmsSign.java
Normal file
25
src/main/java/com/newyetai/sdk/sms/model/DeleteSmsSign.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
public class DeleteSmsSign implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6841147861661592533L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云<br>
|
||||
* 描述:短信签名。 **说明** 必须是本账号已申请的短信签名。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*
|
||||
*/
|
||||
public class DeleteSmsSignResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8836559705606969786L;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:请求状态码。 - 返回 OK 代表请求成功。 -
|
||||
* 其他错误码详见[错误码列表](https://help.aliyun.com/document_detail/101346.html)。<br>
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:状态码的描述。<br>
|
||||
*/
|
||||
@JsonProperty("Message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 事例:F655A8D5-B967-440B-8683-DAD6FF8DE990<br>
|
||||
* 描述:请求 ID。<br>
|
||||
*/
|
||||
@JsonProperty("RequestId")
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名名称。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class DeleteSmsTemplate implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3423181148483950846L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:SMS\_152550005<br>
|
||||
* 描述:短信模板 CODE。您可以在控制台 **模板管理** 页面或 API 接口 ** AddSmsTemplate** 的返回参数中获取短信模板 CODE。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
}
|
||||
61
src/main/java/com/newyetai/sdk/sms/model/ModifySmsSign.java
Normal file
61
src/main/java/com/newyetai/sdk/sms/model/ModifySmsSign.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class ModifySmsSign implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7033519742117645850L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名内容。 **说明**
|
||||
* 签名内容必须符合[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)或[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:1<br>
|
||||
* 描述:签名来源。其中: - 0:企事业单位的全称或简称。 - 1:工信部备案网站的全称或简称。 - 2:APP 应用的全称或简称。 - 3:公众号或小程序的全称或简称。 -
|
||||
* 4:电商平台店铺名的全称或简称。 - 5:商标名的全称或简称 说明** 签名来源为 1 时,请在申请说明中添加网站域名,加快审核速度。<br>
|
||||
*/
|
||||
@JsonProperty("SignSource")
|
||||
private Integer signSource;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:当前的短信签名应用于双 11 大促推广营销<br>
|
||||
* 描述:短信签名申请说明。请在申请说明中详细描述您的业务使用场景,申请工信部备案网站的全称或简称请在此处填写域名,长度不超过 200 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("Remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:jpg<br>
|
||||
* 描述:签名的证明文件格式,支持上传多张图片。当前支持 jpg、png、gif 或 jpeg
|
||||
* 格式的图片。个别场景下,申请签名需要上传证明文件。详细说明请参考[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)和[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignFileList.N.FileSuffix")
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:R0lGODlhHAAmAKIHAKqqqsvLy0hISObm5vf394uLiwAA<br>
|
||||
* 描述:签名的质证明文件经 base64 编码后的字符串。图片不超过 2
|
||||
* MB。个别场景下,申请签名需要上传证明文件。详细说明请参考[个人用户签名规范](https://help.aliyun.com/document_detail/108076.html)和[企业用户签名规范](https://help.aliyun.com/document_detail/108254.html)。<br>
|
||||
*/
|
||||
@JsonProperty("SignFileList.N.FileContents")
|
||||
private String fileContents;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class ModifySmsSignResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2556874115950958951L;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:请求状态码。 - 返回 OK 代表请求成功。 -
|
||||
* 其他错误码详见[错误码列表](https://help.aliyun.com/document_detail/101346.html)。<br>
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:状态码的描述。<br>
|
||||
*/
|
||||
@JsonProperty("Message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 事例:F655A8D5-B967-440B-8683-DAD6FF8DE990<br>
|
||||
* 描述:请求 ID。<br>
|
||||
*/
|
||||
@JsonProperty("RequestId")
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名名称。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class ModifySmsTemplate implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4824423254878168505L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:1<br>
|
||||
* 描述:短信类型。其中: - 0 表示验证码。 - 1 表示短信通知。 - 2 表示推广短信。 - 3 国际 / 港澳台消息。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateType")
|
||||
private Integer templateType;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云短信测试模板<br>
|
||||
* 描述:模板名称,长度为 1~30 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateName")
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:您正在申请手机注册,验证码为:${code},5 分钟内有效!<br>
|
||||
* 描述:模板内容,长度为 1~500
|
||||
* 个字符。模板内容需要符合[文本短信模板规范](https://help.aliyun.com/document_detail/108253.html)或[国际 /
|
||||
* 港澳台短信模板规范](https://help.aliyun.com/document_detail/108254.html)。 **说明**
|
||||
* 修改模板时,请针对审核意见合理设计模板内容。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateContent")
|
||||
private String templateContent;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:当前的短信模板应用于双 11 大促推广营销<br>
|
||||
* 描述:短信模板申请说明。请在申请说明中描述您的业务使用场景,长度为 1~100 个字符。<br>
|
||||
*/
|
||||
@JsonProperty("Remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:SMS\_152550005<br>
|
||||
* 描述:短信模板 CODE。您可以在控制台 **模板管理** 页面或 API 接口 ** AddSmsTemplate** 的返回参数中获取短信模板 CODE。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询发送记录
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class QuerySendDetails implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6796100129790552341L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:1<br>
|
||||
* 描述:分页查看发送记录,指定发送记录的的当前页码。<br>
|
||||
*/
|
||||
@JsonProperty("CurrentPage")
|
||||
private Long currentPage;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:10<br>
|
||||
* 描述:分页查看发送记录,指定每页显示的短信记录数量。取值范围为 1~50。<br>
|
||||
*/
|
||||
@JsonProperty("PageSize")
|
||||
private Long pageSize;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:15900000000<br>
|
||||
* 描述:接收短信的手机号码。格式: - 国内短信:11 位手机号码,例如 15900000000。 - 国际 / 港澳台消息:国际区号 + 号码,例如 85200000000。<br>
|
||||
*/
|
||||
@JsonProperty("PhoneNumber")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:20181228<br>
|
||||
* 描述:短信发送日期,支持查询最近 30 天的记录。格式为 yyyyMMdd,例如 20181225。<br>
|
||||
*/
|
||||
@JsonProperty("SendDate")
|
||||
private String sendDate;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:134523^4351232<br>
|
||||
* 描述:发送回执 ID,即发送流水号。调用发送接口 SendSms 或 SendBatchSms 发送短信时,返回值中的 BizId 字段。<br>
|
||||
*/
|
||||
@JsonProperty("BizId")
|
||||
private String bizId;
|
||||
}
|
||||
26
src/main/java/com/newyetai/sdk/sms/model/QuerySmsSign.java
Normal file
26
src/main/java/com/newyetai/sdk/sms/model/QuerySmsSign.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class QuerySmsSign implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7244896668246210132L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云<br>
|
||||
* 描述:签名名称。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class QuerySmsSignResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3695802019215175700L;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:请求状态码。 - 返回 OK 代表请求成功。 -
|
||||
* 其他错误码详见[错误码列表](https://help.aliyun.com/document_detail/101346.html)。<br>
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 事例:2019-01-08 16:44:13<br>
|
||||
* 描述:短信签名的创建日期和时间。<br>
|
||||
*/
|
||||
@JsonProperty("CreateDate")
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:状态码描述。<br>
|
||||
*/
|
||||
@JsonProperty("Message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 事例:文件不能证明信息真实性,请重新上传<br>
|
||||
* 描述:审核备注。 - 如果审核状态为 **审核通过** 或 **审核中** ,参数 Reason 显示为 "无审核备注"。 - 如果审核状态为 **审核未通过** ,参数
|
||||
* Reason 显示审核的具体原因。<br>
|
||||
*/
|
||||
@JsonProperty("Reason")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 事例:CC89A90C-978F-46AC-B80D-54738371E7CA<br>
|
||||
* 描述:请求 ID。<br>
|
||||
*/
|
||||
@JsonProperty("RequestId")
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 事例:阿里云<br>
|
||||
* 描述:短信签名。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 事例:1<br>
|
||||
* 描述:签名审核状态。其中: - 0:审核中。 - 1:审核通过。 - 2:审核失败,请在返回参数 Reason 中查看审核失败原因。<br>
|
||||
*/
|
||||
@JsonProperty("SignStatus")
|
||||
private Integer signStatus;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
public class QuerySmsTemplate implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7787624013394982501L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:SMS\_152550005<br>
|
||||
* 描述:短信模板 CODE。您可以在控制台 **模板管理** 页面或 API 接口 ** AddSmsTemplate** 的返回参数中获取短信模板 CODE。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* 查询查询短信模板的审核状态响应体
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
public class QuerySmsTemplateResponse extends SmsResponse {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = 4855274472484572364L;
|
||||
|
||||
/**
|
||||
* 事例:2019-06-04 11:42:17<br>
|
||||
* 描述:短信模板的创建日期和时间。<br>
|
||||
*/
|
||||
@JsonProperty("CreateDate")
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 事例:非验证码类型短信,请选择短信通知类型为推广短信。<br>
|
||||
* 描述:审核备注。 - 如果审核状态为 **审核通过** 或 **审核中** ,参数 Reason 显示为 "无审核备注"。 - 如果审核状态为 **审核未通过** ,参数
|
||||
* Reason 显示审核的具体原因。<br>
|
||||
*/
|
||||
@JsonProperty("Reason")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 事例:SMS\_167035184<br>
|
||||
* 描述:短信模板 CODE。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 事例:亲爱的会员!阿里云短信服务祝您新年快乐!<br>
|
||||
* 描述:模板内容。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateContent")
|
||||
private String templateContent;
|
||||
|
||||
/**
|
||||
* 事例:阿里云短信测试模板<br>
|
||||
* 描述:模板名称。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateName")
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 事例:1<br>
|
||||
* 描述:模板审核状态。其中: - 0:审核中。 - 1:审核通过。 - 2:审核失败,请在返回参数 Reason 中查看审核失败原因。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateStatus")
|
||||
private Integer templateStatus;
|
||||
|
||||
/**
|
||||
* 事例:1<br>
|
||||
* 描述:短信类型。其中: - 0:验证码。 - 1:短信通知。 - 2:推广短信。 - 3:国际 / 港澳台消息。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateType")
|
||||
private Integer templateType;
|
||||
}
|
||||
70
src/main/java/com/newyetai/sdk/sms/model/SendBatchSms.java
Normal file
70
src/main/java/com/newyetai/sdk/sms/model/SendBatchSms.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SendBatchSms implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -721415853051957784L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:["15900000000","13500000000"]<br>
|
||||
* 描述:接收短信的手机号码,JSON 数组格式。手机号码格式: - 国内短信:11 位手机号码,例如 15900000000。 - 国际 / 港澳台消息:国际区号 + 号码,例如
|
||||
* 85200000000。 说明** 验证码类型短信,建议使用接口 SendSms 单独发送。<br>
|
||||
*/
|
||||
@JsonProperty("PhoneNumberJson")
|
||||
private String phoneNumberJson;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:["阿里云","阿里巴巴"]<br>
|
||||
* 描述:短信签名名称,JSON 数组格式。请在控制台 **签名管理** 页面 **签名名称** 一列查看。 **说明**
|
||||
* 必须是已添加、并通过审核的短信签名;且短信签名的个数必须与手机号码的个数相同、内容一一对应。<br>
|
||||
*/
|
||||
@JsonProperty("SignNameJson")
|
||||
private String signNameJson;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:SMS\_152550005<br>
|
||||
* 描述:短信模板 CODE。请在控制台 **模板管理** 页面 **模板 CODE** 一列查看。 **说明** 必须是已添加、并通过审核的模板 CODE;且发送国际 /
|
||||
* 港澳台消息时,请使用国际 / 港澳台短信模版。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:["90999","90998"]<br>
|
||||
* 描述:上行短信扩展码,JSON 数组格式。无特殊需要此字段的用户请忽略此字段。<br>
|
||||
*/
|
||||
@JsonProperty("SmsUpExtendCodeJson")
|
||||
private String smsUpExtendCodeJson;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:[{"name":"TemplateParamJson"},{"name":"TemplateParamJson"}]<br>
|
||||
* 描述:短信模板变量对应的实际值,JSON 格式。 **说明** 如果 JSON 中需要带换行符,请参照标准的 JSON
|
||||
* 协议处理;且模板变量值的个数必须与手机号码、签名的个数相同、内容一一对应,表示向指定手机号码中发对应签名的短信,且短信模板中的变量参数替换为对应的值。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateParamJson")
|
||||
private String templateParamJson;
|
||||
}
|
||||
77
src/main/java/com/newyetai/sdk/sms/model/SendSms.java
Normal file
77
src/main/java/com/newyetai/sdk/sms/model/SendSms.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SendSms implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4127513146153674808L;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:15900000000<br>
|
||||
* 描述:接收短信的手机号码。格式: - 国内短信:11 位手机号码,例如 15951955195。 - 国际 / 港澳台消息:国际区号 + 号码,例如 85200000000。
|
||||
* 支持对多个手机号码发送短信,手机号码之间以英文逗号(,)分隔。上限为 1000 个手机号码。批量调用相对于单条调用及时性稍有延迟。 **说明**
|
||||
* 验证码类型短信,建议使用单独发送的方式。<br>
|
||||
*/
|
||||
@JsonProperty("PhoneNumbers")
|
||||
private String phoneNumbers;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:阿里云<br>
|
||||
* 描述:短信签名名称。请在控制台 **签名管理** 页面 **签名名称** 一列查看。 **说明** 必须是已添加、并通过审核的短信签名。<br>
|
||||
*/
|
||||
@JsonProperty("SignName")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 是否必填:是<br>
|
||||
* 事例:SMS\_153055065<br>
|
||||
* 描述:短信模板 ID。请在控制台 **模板管理** 页面 **模板 CODE** 一列查看。 **说明** 必须是已添加、并通过审核的短信签名;且发送国际 / 港澳台消息时,请使用国际 /
|
||||
* 港澳台短信模版。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:abcdefgh<br>
|
||||
* 描述:外部流水扩展字段。<br>
|
||||
*/
|
||||
@JsonProperty("OutId")
|
||||
private String outId;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:90999<br>
|
||||
* 描述:上行短信扩展码,无特殊需要此字段的用户请忽略此字段。<br>
|
||||
*/
|
||||
@JsonProperty("SmsUpExtendCode")
|
||||
private String smsUpExtendCode;
|
||||
|
||||
/**
|
||||
* 是否必填:否<br>
|
||||
* 事例:{"code":"1111"}<br>
|
||||
* 描述:短信模板变量对应的实际值,JSON 格式。 **说明** 如果 JSON 中需要带换行符,请参照标准的 JSON 协议处理。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateParam")
|
||||
private String templateParam;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 发送短信(单个/批量)响应体
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
public class SendSmsResponse extends SmsResponse {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = -1884360556092571210L;
|
||||
|
||||
}
|
||||
40
src/main/java/com/newyetai/sdk/sms/model/SmsResponse.java
Normal file
40
src/main/java/com/newyetai/sdk/sms/model/SmsResponse.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 短信响应体
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class SmsResponse implements Serializable{
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:请求状态码。 - 返回 OK 代表请求成功。 -
|
||||
* 其他错误码详见[错误码列表](https://help.aliyun.com/document_detail/101346.html)。<br>
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 事例:OK<br>
|
||||
* 描述:状态码的描述。<br>
|
||||
*/
|
||||
@JsonProperty("Message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 事例:F655A8D5-B967-440B-8683-DAD6FF8DE990<br>
|
||||
* 描述:请求 ID。<br>
|
||||
*/
|
||||
@JsonProperty("RequestId")
|
||||
private String requestId;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信发送明细
|
||||
*
|
||||
* @author Rey(leijiaping@newyetai.com) {@link undefined}
|
||||
*/
|
||||
public class SmsSendDetailResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4473285026346918644L;
|
||||
|
||||
/**
|
||||
* 事例:【阿里云】验证码为:123,您正在登录,若非本人操作,请勿泄露<br>
|
||||
* 描述:短信内容。<br>
|
||||
*/
|
||||
@JsonProperty("Content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 事例:DELIVRD<br>
|
||||
* 描述:运营商短信状态码。 - 短信发送成功:DELIVRD。 -
|
||||
* 短信发送失败:失败错误码请参考[错误码文档](https://help.aliyun.com/document_detail/101347.html)。<br>
|
||||
*/
|
||||
@JsonProperty("ErrCode")
|
||||
private String errCode;
|
||||
|
||||
/**
|
||||
* 事例:123<br>
|
||||
* 描述:外部流水扩展字段。<br>
|
||||
*/
|
||||
@JsonProperty("OutId")
|
||||
private String outId;
|
||||
|
||||
/**
|
||||
* 事例:15200000000<br>
|
||||
* 描述:接收短信的手机号码。<br>
|
||||
*/
|
||||
@JsonProperty("PhoneNum")
|
||||
private String phoneNum;
|
||||
|
||||
/**
|
||||
* 事例:2019-01-08 16:44:13<br>
|
||||
* 描述:短信接收日期和时间。<br>
|
||||
*/
|
||||
@JsonProperty("ReceiveDate")
|
||||
private String receiveDate;
|
||||
|
||||
/**
|
||||
* 事例:2019-01-08 16:44:10<br>
|
||||
* 描述:短信发送日期和时间。<br>
|
||||
*/
|
||||
@JsonProperty("SendDate")
|
||||
private String sendDate;
|
||||
|
||||
/**
|
||||
* 事例:3<br>
|
||||
* 描述:短信发送状态,包括: - 1:等待回执。 - 2:发送失败。 - 3:发送成功。<br>
|
||||
*/
|
||||
@JsonProperty("SendStatus")
|
||||
private Long sendStatus;
|
||||
|
||||
/**
|
||||
* 事例:SMS\_122310183<br>
|
||||
* 描述:短信模板 ID。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.newyetai.sdk.sms.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* 短信模板响应体
|
||||
* @author Rey(leijiaping@newyetai.com)
|
||||
*{@link undefined}
|
||||
*/
|
||||
public class SmsTemplateResponse extends SmsResponse{
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = -8499116525368789422L;
|
||||
/**
|
||||
* 事例:SMS\_152550005<br>
|
||||
* 描述:短信模板 CODE。您可以使用模板 CODE 通过 API 接口 ** QuerySmsTemplate** 或在控制台查看模板申请状态和结果。<br>
|
||||
*/
|
||||
@JsonProperty("TemplateCode")
|
||||
private String templateCode;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.newyetai.sdk.sms.service;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.sdk.sms.constant.SmsProviderEnum;
|
||||
import com.newyetai.sdk.sms.dto.ISendDTO;
|
||||
|
||||
/**
|
||||
* 短信服务提供者
|
||||
*
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
public interface SdkSmsProvider {
|
||||
|
||||
/**
|
||||
* 提供者类型
|
||||
*
|
||||
* @return
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
SmsProviderEnum getType();
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param <T>
|
||||
* @param iSendDTO
|
||||
* @return
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
<T> AlitaResult<Boolean> send(ISendDTO<T> iSendDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.newyetai.sdk.sms.service;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.sdk.sms.dto.ISendDTO;
|
||||
import com.newyetai.sdk.sms.dto.ITemplateCode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 短信
|
||||
*
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
public interface SdkSmsService {
|
||||
|
||||
/**
|
||||
* 发送短信(使用配置文件配置)
|
||||
*
|
||||
* @param <T>
|
||||
* @param iSendDTO 发送对象
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
<T> AlitaResult<Boolean> send(ISendDTO<T> iSendDTO);
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*
|
||||
* @param <T>
|
||||
* @param iTemplateCode 获取templateCodeKey 短信模版配置key,获取配置时内部会自动加上(sms)前缀;如配置文件中添加sms.someTemplate,此处配置someTemplate
|
||||
* @param phone
|
||||
* @param code 验证码
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
AlitaResult<Boolean> sendVerificationCode(ITemplateCode iTemplateCode, String phone, String code);
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*
|
||||
* @param <T>
|
||||
* @param iTemplateCode 获取templateCodeKey 短信模版配置key,获取配置时内部会自动加上(sms)前缀;如配置文件中添加sms.someTemplate,此处配置someTemplate
|
||||
* @param phone
|
||||
* @param code 验证码
|
||||
* @param signName 验证码签名
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
AlitaResult<Boolean> sendVerificationCode(ITemplateCode iTemplateCode, String phone, String code, String signName);
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*
|
||||
* @param <T>
|
||||
* @param templateCode 模版code
|
||||
* @param phone
|
||||
* @param code 验证码
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
AlitaResult<Boolean> sendVerificationCode(String templateCode, String phone, String code);
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param iTemplateCode 短信模版配置key,获取配置时内部会自动加上(sms)前缀;如配置文件中添加sms.someTemplate,此处配置someTemplate
|
||||
* @param phone
|
||||
* @param params
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
AlitaResult<Boolean> sendSimple(ITemplateCode iTemplateCode, String phone, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param templateCode 模版code
|
||||
* @param phone
|
||||
* @param params
|
||||
* @return success-false真实调用第三方未成功,未拿到返回值;
|
||||
* success-true获取到第三方返回,data-true发送成功,data-false发送失败并返回失败原因(msg)
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
AlitaResult<Boolean> sendSimple(String templateCode, String phone, Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.newyetai.sdk.sms.service.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.sdk.sms.config.SmsConfig;
|
||||
import com.newyetai.sdk.sms.constant.SmsProviderEnum;
|
||||
import com.newyetai.sdk.sms.dto.*;
|
||||
import com.newyetai.sdk.sms.service.SdkSmsProvider;
|
||||
import com.newyetai.sdk.sms.service.SdkSmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author sr on 2020-07-02
|
||||
*/
|
||||
@Service
|
||||
public class SdkSmsServiceImpl implements SdkSmsService {
|
||||
@Autowired
|
||||
private SmsConfig smsConfig;
|
||||
|
||||
private final Map<SmsProviderEnum, SdkSmsProvider> smsProviders = Maps.newHashMap();
|
||||
|
||||
@Autowired
|
||||
SdkSmsServiceImpl(List<SdkSmsProvider> providers) {
|
||||
providers.forEach(provider -> smsProviders.put(provider.getType(), provider));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> AlitaResult<Boolean> send(ISendDTO<T> iSendDTO) {
|
||||
Assert.isTrue(Boolean.TRUE.equals(smsConfig.getEnable()), "暂不支持短信功能");
|
||||
SdkSmsProvider sdkSmsProvider = smsProviders.get(iSendDTO.getSmsProvider());
|
||||
// 默认阿里云
|
||||
if (sdkSmsProvider == null) {
|
||||
sdkSmsProvider = smsProviders.get(SmsProviderEnum.ALIYAN);
|
||||
}
|
||||
|
||||
return sdkSmsProvider.send(iSendDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlitaResult<Boolean> sendVerificationCode(ITemplateCode iTemplateCode, String phone,
|
||||
String code) {
|
||||
return this.sendVerificationCode(iTemplateCode, phone, code, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlitaResult<Boolean> sendVerificationCode(ITemplateCode iTemplateCode, String phone, String code, String signName) {
|
||||
VerificationCodeSendDTO sendDto = VerificationCodeSendDTO.builder().phone(phone)
|
||||
.templateCodeKey(iTemplateCode.getTemplateCodeKey())
|
||||
.parameters(new VerificationCodeParamDTO(code))
|
||||
.signName(signName)
|
||||
.build();
|
||||
return this.send(sendDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlitaResult<Boolean> sendSimple(ITemplateCode iTemplateCode, String phone,
|
||||
Map<String, Object> params) {
|
||||
SimpleSendDTO sendDto =
|
||||
SimpleSendDTO.builder().templateCodeKey(iTemplateCode.getTemplateCodeKey()).phone(phone)
|
||||
.parameters(params).build();
|
||||
return this.send(sendDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlitaResult<Boolean> sendVerificationCode(String templateCode, String phone,
|
||||
String code) {
|
||||
VerificationCodeSendDTO sendDto = VerificationCodeSendDTO.builder().phone(phone)
|
||||
.templateCode(templateCode).parameters(new VerificationCodeParamDTO(code))
|
||||
.build();
|
||||
return this.send(sendDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlitaResult<Boolean> sendSimple(String templateCode, String phone,
|
||||
Map<String, Object> params) {
|
||||
SimpleSendDTO sendDto = SimpleSendDTO.builder().templateCode(templateCode).phone(phone)
|
||||
.parameters(params).build();
|
||||
return this.send(sendDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.newyetai.sdk.sms.service.provider;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.aliyuncs.CommonRequest;
|
||||
import com.aliyuncs.CommonResponse;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.http.MethodType;
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.annotation.CheckAndMock;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.sdk.common.constant.SdkConstants;
|
||||
import com.newyetai.sdk.sms.config.SmsConfig;
|
||||
import com.newyetai.sdk.sms.constant.AliSmsActionEnum;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 短信sms调用
|
||||
*
|
||||
* @author on 2019-11-05
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AliyunSmsInvoker {
|
||||
|
||||
@Autowired
|
||||
private IAcsClient client;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@CheckAndMock(mockClass = MockAliyunSmsInvoker.class, propertyPrefix = "sms")
|
||||
public <T> AlitaResult<T> invoke(SmsConfig smsConfig, AliSmsActionEnum action, Object params,
|
||||
Class<T> responseClazz) {
|
||||
|
||||
CommonRequest request = new CommonRequest();
|
||||
request.setMethod(MethodType.POST);
|
||||
request.setDomain(smsConfig.getDomain());
|
||||
request.setVersion(smsConfig.getVersion());
|
||||
request.setAction(action.getValue());
|
||||
|
||||
if (params instanceof Map) {
|
||||
((Map<String, String>) params).forEach(request::putQueryParameter);
|
||||
} else {
|
||||
Map<String, String> paramMap = JsonUtils.objToClassObj(params, Map.class);
|
||||
paramMap.forEach(request::putQueryParameter);
|
||||
|
||||
}
|
||||
try {
|
||||
log.info("sendSms request:{}", params);
|
||||
CommonResponse response = client.getCommonResponse(request);
|
||||
String data = response.getData();
|
||||
log.info("sendSms reponse:{}", data);
|
||||
return AlitaResult.success(JsonUtils.toObject(data, responseClazz));
|
||||
} catch (ClientException e) {
|
||||
return AlitaResult.error(SdkConstants.SDK_INVOKE_NOT_REACH_CODE, e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return AlitaResult.error(SdkConstants.SDK_HTTP_INVOKE_ERROR_CODE,
|
||||
StringUtils.join(SdkConstants.SMS_CODE, SdkConstants.INVOKE_FAIL, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.newyetai.sdk.sms.service.provider;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.constant.CommonConstants;
|
||||
import com.newyetai.common.util.EnvironmentUtils;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.sdk.common.constant.SdkConstants;
|
||||
import com.newyetai.sdk.sms.config.SmsConfig;
|
||||
import com.newyetai.sdk.sms.constant.AliSmsActionEnum;
|
||||
import com.newyetai.sdk.sms.constant.SmsConstants;
|
||||
import com.newyetai.sdk.sms.constant.SmsProviderEnum;
|
||||
import com.newyetai.sdk.sms.dto.ISendDTO;
|
||||
import com.newyetai.sdk.sms.model.SendSms;
|
||||
import com.newyetai.sdk.sms.model.SendSmsResponse;
|
||||
import com.newyetai.sdk.sms.service.SdkSmsProvider;
|
||||
import com.newyetai.sdk.sms.util.SmsUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 阿里云服务商提供者
|
||||
*
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
@Service
|
||||
public class AliyunSmsProvider implements SdkSmsProvider {
|
||||
|
||||
@Autowired
|
||||
private SmsConfig smsConfig;
|
||||
|
||||
@Autowired
|
||||
private AliyunSmsInvoker aliyunSmsInvoker;
|
||||
|
||||
@Override
|
||||
public SmsProviderEnum getType() {
|
||||
return SmsProviderEnum.ALIYAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> AlitaResult<Boolean> send(ISendDTO<T> iSendDTO) {
|
||||
// 处理模版
|
||||
String templateCode = this.dealTemplateCode(iSendDTO);
|
||||
if (templateCode == null) {
|
||||
return AlitaResult.error(SdkConstants.SDK_INVOKE_NOT_REACH_CODE,
|
||||
SmsConstants.TEMPLATE_CODE_EMPTY);
|
||||
}
|
||||
SendSms sendSms =
|
||||
SendSms.builder().phoneNumbers(iSendDTO.getPhone()).templateCode(templateCode)
|
||||
.templateParam(JsonUtils.toJsonString(iSendDTO.getParameters()))
|
||||
.signName(StringUtils.isEmpty(iSendDTO.getSignName()) ? smsConfig.getSignName()
|
||||
: iSendDTO.getSignName())
|
||||
.build();
|
||||
|
||||
AlitaResult<SendSmsResponse> result =
|
||||
aliyunSmsInvoker.invoke(smsConfig, AliSmsActionEnum.SEND_SMS, sendSms,
|
||||
SendSmsResponse.class);
|
||||
// 失败,success-false
|
||||
if (!result.getSuccess()) {
|
||||
return AlitaResult.error(result.getCode(), result.getMsg());
|
||||
}
|
||||
SendSmsResponse responseData = result.getData();
|
||||
// sms状态码成功,success-true,data-true
|
||||
if (SmsConstants.SUCCESS_CODE.equals(responseData.getCode())) {
|
||||
return AlitaResult.success(Boolean.TRUE);
|
||||
}
|
||||
// sms状态码失败,success-true,data-false
|
||||
return AlitaResult.success(responseData.getMessage(), Boolean.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理短信发送模版
|
||||
* @param iSendDTO
|
||||
* @return
|
||||
* @author sr on 2021-06-16
|
||||
*/
|
||||
private String dealTemplateCode(ISendDTO<?> iSendDTO) {
|
||||
String templateCode = iSendDTO.getTemplateCode();
|
||||
String templateCodeKey = iSendDTO.getTemplateCodeKey();
|
||||
// 模版为空 且 模版属性键不为空,去环境配置中获取模版
|
||||
if (StringUtils.isBlank(templateCode) && StringUtils.isNotBlank(templateCodeKey)) {
|
||||
templateCode = EnvironmentUtils
|
||||
.getProperty(String.join(CommonConstants.POINT, SmsConfig.PREFIX, templateCodeKey));
|
||||
}
|
||||
if (StringUtils.isBlank(templateCode)) {
|
||||
return null;
|
||||
}
|
||||
return templateCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.newyetai.sdk.sms.service.provider;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.sdk.sms.config.SmsConfig;
|
||||
import com.newyetai.sdk.sms.constant.AliSmsActionEnum;
|
||||
import com.newyetai.sdk.sms.constant.SmsConstants;
|
||||
import com.newyetai.sdk.sms.model.SendSmsResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 模拟短信调用
|
||||
*
|
||||
* @author sr on 2020-05-28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MockAliyunSmsInvoker {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> AlitaResult<T> invoke(SmsConfig smsConfig, AliSmsActionEnum action, Object params,
|
||||
Class<T> responseClazz) {
|
||||
log.info("mock sms params:{}", params);
|
||||
if (action == AliSmsActionEnum.SEND_SMS) {
|
||||
SendSmsResponse response = new SendSmsResponse();
|
||||
response.setCode(SmsConstants.SUCCESS_CODE);
|
||||
return (AlitaResult<T>) AlitaResult.success(response);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
26
src/main/java/com/newyetai/sdk/sms/util/SmsUtils.java
Normal file
26
src/main/java/com/newyetai/sdk/sms/util/SmsUtils.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.sdk.sms.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.newyetai.sdk.sms.service.SdkSmsService;
|
||||
|
||||
/**
|
||||
* sms工具类
|
||||
*
|
||||
* @author sr on 2020-07-03
|
||||
*/
|
||||
@Component
|
||||
public class SmsUtils {
|
||||
|
||||
private static SdkSmsService sdkSmsService;
|
||||
|
||||
private SmsUtils(SdkSmsService sdkSmsService) {
|
||||
SmsUtils.sdkSmsService = sdkSmsService;
|
||||
}
|
||||
|
||||
public static SdkSmsService getService() {
|
||||
return sdkSmsService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user