Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
74724637
提交
74724637
authored
5月 25, 2019
作者:
sin-ning@aliyun.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 各短信平台兼容问题,放弃 sign 和 template 模板审核过程
- 增加短信类型 - 云片ok - 阿里云 未完成
上级
e8e4a478
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
382 行增加
和
169 行删除
+382
-169
OrderServiceImpl.java
...a/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java
+1
-1
SmsPlatform.java
.../src/main/java/cn/iocoder/mall/admin/api/SmsPlatform.java
+0
-116
SmsService.java
...i/src/main/java/cn/iocoder/mall/admin/api/SmsService.java
+20
-11
AdminErrorCodeEnum.java
...n/iocoder/mall/admin/api/constant/AdminErrorCodeEnum.java
+1
-0
DictKeyConstants.java
.../cn/iocoder/mall/admin/api/constant/DictKeyConstants.java
+11
-0
SmsApplyStatusEnum.java
...n/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java
+8
-8
SmsPlatformEnum.java
...a/cn/iocoder/mall/admin/api/constant/SmsPlatformEnum.java
+30
-0
SmsTypeEnum.java
.../java/cn/iocoder/mall/admin/api/constant/SmsTypeEnum.java
+31
-0
pom.xml
system/system-service-impl/pom.xml
+10
-1
SmsAliYunClient.java
...in/java/cn/iocoder/mall/admin/client/SmsAliYunClient.java
+83
-0
SmsClient.java
...src/main/java/cn/iocoder/mall/admin/client/SmsClient.java
+41
-0
SmsYunPianClient.java
...n/java/cn/iocoder/mall/admin/client/SmsYunPianClient.java
+0
-0
SmsClientLog.java
...n/java/cn/iocoder/mall/admin/dataobject/SmsClientLog.java
+33
-0
SmsSignDO.java
...main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java
+7
-4
SmsTemplateDO.java
.../java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java
+9
-1
SmsServiceImpl.java
...in/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java
+0
-0
application.yaml
...m-service-impl/src/main/resources/config/application.yaml
+7
-1
SmsYunPianClientTest.java
...va/cn/iocoder/mall/admin/client/SmsYunPianClientTest.java
+56
-0
SmsServiceImplTest.java
...ava/cn/iocoder/mall/admin/service/SmsServiceImplTest.java
+34
-26
没有找到文件。
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java
浏览文件 @
74724637
...
...
@@ -330,7 +330,7 @@ public class OrderServiceImpl implements OrderService {
// if (commonResult.isError()) {
// //手动开启事务回滚
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_PAY_FAIL.get
Cod
e());
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_PAY_FAIL.get
Valu
e());
// }
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息,业务扩展和统计
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/SmsPlatform.java
deleted
100644 → 0
浏览文件 @
e8e4a478
package
cn
.
iocoder
.
mall
.
admin
.
api
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
/**
* 短信平台
*
* @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 template 模板内容
* @param tplType 1 为验证码类型,其他为 null
*/
Result
createTemplate
(
String
template
,
Integer
tplType
);
/**
* 模板 - 获取
*
* @param tplId
*/
Result
getTemplate
(
String
tplId
);
/**
* 模板 - 更新
*
* @param tplId 选用的哪个签名
* @param template 模板内容
* @param tplType 1 为验证码类型,其他为 null
*/
Result
updateTemplate
(
String
tplId
,
String
template
,
Integer
tplType
);
/**
* 模板 - 删除
*
* @param tplId
* @return
*/
Result
deleteTemplate
(
String
tplId
);
@Data
@Accessors
(
chain
=
true
)
class
SendResult
{
private
Boolean
hasSuccess
;
private
Integer
code
;
private
String
message
;
private
List
<
String
>
success
;
private
List
<
String
>
fail
;
}
/**
* 短信发送 - 单个
*
* @return
*/
SendResult
singleSend
(
String
mobile
,
String
template
);
/**
* 短信发送 - 批量
*
* @return
*/
SendResult
batchSend
(
List
<
String
>
mobileList
,
String
template
);
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/SmsService.java
浏览文件 @
74724637
...
...
@@ -39,47 +39,56 @@ public interface SmsService {
*
* @param sign
*/
void
createSign
(
String
sign
);
void
createSign
(
String
sign
,
Integer
platform
);
/**
* 签名 - 获取
*
* @param
sign
* @param
id
*/
SmsSignBO
getSign
(
String
sign
);
SmsSignBO
getSign
(
Integer
id
);
/**
* 签名 - 更新
*
* @param oldSign
* @param sign
* @param id
* @param newSign
* @param platform
*/
void
updateSign
(
Integer
id
,
String
newSign
,
Integer
platform
);
/**
* 签名 - 更新
*
* @param id
*/
void
updateSign
(
String
oldSign
,
String
sign
);
void
deleteSign
(
Integer
id
);
/**
* 模板 - 创建
*
* @param smsSignId 选用的哪个签名
* @param template 模板内容
* @param
tplType 1 为验证码类型,其他为 null
* @param
platform 平台
*/
void
createTemplate
(
Integer
smsSignId
,
String
template
,
Integer
tpl
Type
);
void
createTemplate
(
Integer
smsSignId
,
String
template
,
Integer
platform
,
Integer
sms
Type
);
/**
* 模板 - 获取
*
* @param id
*/
SmsTemplateBO
getTemplate
(
Integer
id
);
SmsTemplateBO
getTemplate
(
Integer
id
,
Integer
platform
);
/**
* 模板 - 更新
*
* @param id 模板id
* @param smsSignId 短期签名
* @param template 模板内容
* @param
tplType 1 为验证码类型,其他为 null
* @param
platform 短信平台
*/
void
updateTemplate
(
Integer
id
,
String
template
,
Integer
tpl
Type
);
void
updateTemplate
(
Integer
id
,
Integer
smsSignId
,
String
template
,
Integer
platform
,
Integer
sms
Type
);
/**
* 模板 - 删除
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/AdminErrorCodeEnum.java
浏览文件 @
74724637
...
...
@@ -56,6 +56,7 @@ public enum AdminErrorCodeEnum {
SMS_SIGN_IS_EXISTENT
(
1002006002
,
"短信签名已存在"
),
SMS_TEMPLATE_NOT_EXISTENT
(
1002006020
,
"短信签名不存在"
),
SMS_TEMPLATE_IS_EXISTENT
(
1002006021
,
"短信签名不存在"
),
SMS_NOT_SEND_CLIENT
(
1002006030
,
"短信没有发送的client"
),
;
private
final
int
code
;
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/DictKeyConstants.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
api
.
constant
;
/**
* 字典 key
*
* @author Sin
* @time 2019/5/25 3:36 PM
*/
public
class
DictKeyConstants
{
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java
浏览文件 @
74724637
...
...
@@ -13,19 +13,19 @@ public enum SmsApplyStatusEnum {
FAIL
(
3
,
"审核失败"
),
;
private
final
int
cod
e
;
private
final
String
messag
e
;
private
final
Integer
valu
e
;
private
final
String
nam
e
;
SmsApplyStatusEnum
(
int
code
,
String
message
)
{
this
.
cod
e
=
code
;
this
.
messag
e
=
message
;
this
.
valu
e
=
code
;
this
.
nam
e
=
message
;
}
public
int
get
Cod
e
()
{
return
cod
e
;
public
int
get
Valu
e
()
{
return
valu
e
;
}
public
String
get
Messag
e
()
{
return
messag
e
;
public
String
get
Nam
e
()
{
return
nam
e
;
}
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsPlatformEnum.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
api
.
constant
;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public
enum
SmsPlatformEnum
{
YunPian
(
1
,
"云片"
),
AliYun
(
2
,
"阿里云"
),
;
private
final
Integer
value
;
private
final
String
name
;
SmsPlatformEnum
(
Integer
code
,
String
message
)
{
this
.
value
=
code
;
this
.
name
=
message
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsTypeEnum.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
api
.
constant
;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public
enum
SmsTypeEnum
{
VERIFICATION_CODE
(
1
,
"验证码"
),
NOTICE
(
1
,
"通知"
),
MARKETING
(
2
,
"营销"
),
;
private
final
Integer
value
;
private
final
String
name
;
SmsTypeEnum
(
Integer
code
,
String
message
)
{
this
.
value
=
code
;
this
.
name
=
message
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
system/system-service-impl/pom.xml
浏览文件 @
74724637
...
...
@@ -31,7 +31,6 @@
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
...
...
@@ -72,12 +71,22 @@
<artifactId>
yunpian-java-sdk
</artifactId>
<version>
1.2.7
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-core
</artifactId>
<version>
4.1.0
</version>
</dependency>
<!-- test -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-api
</artifactId>
<version>
5.4.0
</version>
</dependency>
</dependencies>
<build>
...
...
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/client/SmsAliYunClient.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
client
;
import
com.aliyuncs.CommonRequest
;
import
com.aliyuncs.CommonResponse
;
import
com.aliyuncs.DefaultAcsClient
;
import
com.aliyuncs.IAcsClient
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.exceptions.ServerException
;
import
com.aliyuncs.http.MethodType
;
import
com.aliyuncs.profile.DefaultProfile
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
* 短信 AliYun client
*
* @author Sin
* @time 2019/5/25 12:28 PM
*/
@Component
public
class
SmsAliYunClient
implements
SmsClient
{
@Value
(
"sms.aliYun.accessKeyId"
)
private
String
accessKeyId
;
@Value
(
"sms.aliYun.accessSecret"
)
private
String
accessSecret
;
private
static
final
String
DOMAIN
=
"dysmsapi.aliyuncs.com"
;
@Override
public
SendResult
singleSend
(
String
mobile
,
String
sign
,
String
template
,
Map
<
String
,
String
>
params
)
{
IAcsClient
client
=
getClient
();
CommonRequest
request
=
new
CommonRequest
();
request
.
setMethod
(
MethodType
.
POST
);
request
.
setDomain
(
DOMAIN
);
request
.
setVersion
(
"2017-05-25"
);
request
.
setAction
(
"SendSms"
);
try
{
CommonResponse
response
=
client
.
getCommonResponse
(
request
);
System
.
out
.
println
(
response
.
getData
());
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
public
SendResult
batchSend
(
List
<
String
>
mobileList
,
String
sign
,
String
template
,
Map
<
String
,
String
>
params
)
{
// 获取 client
IAcsClient
client
=
getClient
();
// params
CommonRequest
request
=
new
CommonRequest
();
request
.
setMethod
(
MethodType
.
POST
);
request
.
setDomain
(
DOMAIN
);
request
.
setVersion
(
"2017-05-25"
);
request
.
setAction
(
"SendBatchSms"
);
try
{
CommonResponse
response
=
client
.
getCommonResponse
(
request
);
System
.
out
.
println
(
response
.
getData
());
}
catch
(
ServerException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取 client
*
* @return
*/
private
IAcsClient
getClient
()
{
return
new
DefaultAcsClient
(
DefaultProfile
.
getProfile
(
"default"
,
accessKeyId
,
accessSecret
));
}
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/client/SmsClient.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
client
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
import
java.util.Map
;
/**
* 短信平台
*
* @author Sin
* @time 2019/5/16 6:33 PM
*/
public
interface
SmsClient
{
@Data
@Accessors
(
chain
=
true
)
class
SendResult
{
private
Boolean
isSuccess
;
private
Integer
code
;
private
String
message
;
}
/**
* 短信发送 - 单个
*
* @return
*/
SendResult
singleSend
(
String
mobile
,
String
sign
,
String
template
,
Map
<
String
,
String
>
params
);
/**
* 短信发送 - 批量
*
* @return
*/
SendResult
batchSend
(
List
<
String
>
mobileList
,
String
sign
,
String
template
,
Map
<
String
,
String
>
params
);
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/
service/SmsYunPianPlatform
.java
→
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/
client/SmsYunPianClient
.java
浏览文件 @
74724637
差异被折叠。
点击展开。
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsClientLog.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
dataobject
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 短信 client log
*
* @author Sin
* @time 2019/5/25 12:36 PM
*/
@Data
@Accessors
(
chain
=
true
)
public
class
SmsClientLog
extends
BaseDO
{
/**
* 编号
*/
private
Integer
id
;
/**
* 短信模板
*/
private
Integer
templateId
;
/**
* 短信
*/
private
String
template
;
/**
* 发送信息
*/
private
String
message
;
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java
浏览文件 @
74724637
...
...
@@ -22,14 +22,17 @@ public class SmsSignDO extends DeletableDO {
* 编号
*/
private
Integer
id
;
/**
* 签名id 这个是第三方的
*/
private
String
platformId
;
/**
* 签名名称
*/
private
String
sign
;
/**
* 平台
*
* 1、云片
* 2、阿里云
*/
private
Integer
platform
;
/**
* 审核状态
*
...
...
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java
浏览文件 @
74724637
...
...
@@ -28,11 +28,19 @@ public class SmsTemplateDO extends DeletableDO {
/**
* 短信签名 id
*/
private
String
platformId
;
private
Integer
platform
;
/**
* 短信模板
*/
private
String
template
;
/**
* 短信类型
*
* - 验证码类
* - 通知类
* - 营销类
*/
private
Integer
smsType
;
/**
* 审核状态
*
...
...
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java
浏览文件 @
74724637
差异被折叠。
点击展开。
system/system-service-impl/src/main/resources/config/application.yaml
浏览文件 @
74724637
...
...
@@ -26,7 +26,13 @@ mybatis-plus:
# sms
sms
:
apiKey
:
d4705399e71e822fe3a90f801ed95bd9
yunPian
:
apiKey
:
d4705399e71e822fe3a90f801ed95bd9
aliYun
:
accessKeyId
:
d4705399e71e822fe3a90f801ed95bd9
accessSecret
:
d4705399e71e822fe3a90f801ed95bd9
# dubbo
dubbo
:
...
...
system/system-service-impl/src/test/java/cn/iocoder/mall/admin/client/SmsYunPianClientTest.java
0 → 100644
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
client
;
import
cn.iocoder.mall.admin.SystemApplicationTest
;
import
com.aliyuncs.CommonRequest
;
import
com.aliyuncs.CommonResponse
;
import
com.aliyuncs.DefaultAcsClient
;
import
com.aliyuncs.IAcsClient
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.exceptions.ServerException
;
import
com.aliyuncs.http.MethodType
;
import
com.aliyuncs.profile.DefaultProfile
;
import
com.google.common.collect.ImmutableMap
;
import
org.assertj.core.util.Lists
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Map
;
/**
* 短信 sms client test
*
* @author Sin
* @time 2019/5/25 12:46 PM
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
SystemApplicationTest
.
class
)
public
class
SmsYunPianClientTest
{
@Autowired
private
SmsYunPianClient
smsYunPianClient
;
private
String
sign
=
null
;
@Before
public
void
setup
()
{
sign
=
"悦跑运动"
;
}
@Test
public
void
sendMobileTest
()
{
String
mobile
=
"13302926050"
;
String
template
=
"您的验证码是#code#,打死也不告诉别人哦。"
;
smsYunPianClient
.
singleSend
(
mobile
,
sign
,
template
,
ImmutableMap
.
of
(
"code"
,
"1111"
));
}
@Test
public
void
batchSendTest
()
{
String
mobile
=
"13302926050"
;
String
template
=
"您的验证码是#code#,打死也不告诉别人哦。"
;
smsYunPianClient
.
batchSend
(
Lists
.
newArrayList
(
mobile
),
sign
,
template
,
ImmutableMap
.
of
(
"code"
,
"2222"
));
}
}
system/system-service-impl/src/test/java/cn/iocoder/mall/admin/service/SmsServiceImplTest.java
浏览文件 @
74724637
package
cn
.
iocoder
.
mall
.
admin
.
service
;
import
cn.iocoder.common.framework.exception.ServiceException
;
import
cn.iocoder.mall.admin.SystemApplicationTest
;
import
cn.iocoder.mall.admin.api.SmsService
;
import
cn.iocoder.mall.admin.api.bo.sms.SmsSignBO
;
import
cn.iocoder.mall.admin.api.bo.sms.SmsTemplateBO
;
import
cn.iocoder.mall.admin.api.constant.SmsPlatformEnum
;
import
cn.iocoder.mall.admin.api.constant.SmsTypeEnum
;
import
com.google.common.collect.ImmutableMap
;
import
org.assertj.core.util.Lists
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Assertions
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -21,55 +27,57 @@ import org.springframework.test.context.junit4.SpringRunner;
public
class
SmsServiceImplTest
{
@Autowired
private
SmsService
Impl
smsService
;
private
SmsService
smsService
;
@Test
public
void
createSignTest
()
{
smsService
.
createSign
(
"
测试签名1"
);
// smsService.createSign("悦跑会");
smsService
.
createSign
(
"
悦跑运动"
,
SmsPlatformEnum
.
YunPian
.
getValue
()
);
}
@Test
public
void
getSignTest
()
{
SmsSignBO
smsSignBO
=
smsService
.
getSign
(
"悦跑会"
);
Assert
.
assertNotNull
(
smsSignBO
);
SmsSignBO
smsSignBO
=
smsService
.
getSign
(
3
);
Assert
.
assertNotNull
(
"不能为空!"
,
smsSignBO
);
}
@Test
public
void
updateSignTest
()
{
smsService
.
updateSign
(
"测试签名2"
,
"测试签名3"
);
SmsSignBO
newSmsSignBO
=
smsService
.
getSign
(
"测试签名3"
);
Assert
.
assertNotNull
(
newSmsSignBO
);
String
oldSign
=
"悦跑运动2"
;
String
newSign
=
"悦跑运动"
;
smsService
.
updateSign
(
3
,
newSign
,
SmsPlatformEnum
.
YunPian
.
getValue
());
SmsSignBO
smsSignBO
=
smsService
.
getSign
(
3
);
Assert
.
assertTrue
(
"更新不成功!"
,
smsSignBO
.
getSign
().
equals
(
newSign
));
}
///
/// template
@Test
public
void
createTemplateTest
()
{
smsService
.
createTemplate
(
1
,
"打死也不要告诉别人哦002 #code# "
,
1
);
}
@Test
public
void
getTemplateTest
()
{
SmsTemplateBO
smsTemplateBO
=
smsService
.
getTemplate
(
3
);
Assert
.
assertNotNull
(
smsTemplateBO
);
public
void
deletedSignTest
()
{
smsService
.
deleteSign
(
3
);
Assertions
.
assertThrows
(
ServiceException
.
class
,
()
->
{
smsService
.
getSign
(
3
);
});
}
@Test
public
void
updateTemplateTest
()
{
smsService
.
updateTemplate
(
3
,
"打死也不要告诉别人哦444 #code# "
,
1
);
public
void
createTemplateTest
()
{
String
template
=
"您的验证码是#code#,打死也不告诉别人哦。"
;
smsService
.
createTemplate
(
3
,
template
,
SmsPlatformEnum
.
YunPian
.
getValue
(),
SmsTypeEnum
.
VERIFICATION_CODE
.
getValue
());
}
@Test
public
void
deleteTemplateTest
()
{
smsService
.
deleteTemplate
(
3
);
public
void
singleSendTest
()
{
String
mobile
=
"13302926050"
;
Integer
templateId
=
5
;
smsService
.
singleSend
(
mobile
,
templateId
,
ImmutableMap
.
of
(
"code"
,
"8888"
));
}
@Test
public
void
single
SendTest
()
{
public
void
batch
SendTest
()
{
String
mobile
=
"13302926050"
;
smsService
.
singleSend
(
mobile
,
1
);
Integer
templateId
=
5
;
smsService
.
batchSend
(
Lists
.
newArrayList
(
mobile
),
templateId
,
ImmutableMap
.
of
(
"code"
,
"8888"
));
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论