Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
23864fac
提交
23864fac
authored
5月 26, 2019
作者:
sin-ning@aliyun.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 添加短信服务 admin api
上级
fa2fd777
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
263 行增加
和
12 行删除
+263
-12
SmsSignController.java
...dmin/application/controller/admins/SmsSignController.java
+53
-0
SmsTemplateController.java
.../application/controller/admins/SmsTemplateController.java
+64
-0
package-info.java
...va/cn/iocoder/mall/admin/application/po/package-info.java
+6
-0
SmsTemplateAddPO.java
...coder/mall/admin/application/po/sms/SmsTemplateAddPO.java
+49
-0
SmsTemplateUpdatePO.java
...er/mall/admin/application/po/sms/SmsTemplateUpdatePO.java
+53
-0
SmsService.java
...i/src/main/java/cn/iocoder/mall/admin/api/SmsService.java
+5
-3
SmsPlatformEnum.java
...a/cn/iocoder/mall/admin/api/constant/SmsPlatformEnum.java
+12
-1
SmsTypeEnum.java
.../java/cn/iocoder/mall/admin/api/constant/SmsTypeEnum.java
+12
-1
SmsServiceImpl.java
...in/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java
+6
-4
SmsServiceImplTest.java
...ava/cn/iocoder/mall/admin/service/SmsServiceImplTest.java
+3
-3
没有找到文件。
system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsSignController.java
0 → 100644
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
application
.
controller
.
admins
;
import
cn.iocoder.mall.admin.api.SmsService
;
import
cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsSignDTO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 短信服务
*
* @author Sin
* @time 2019/5/26 12:26 PM
*/
@RestController
@RequestMapping
(
"sms/sign"
)
@Api
(
"短信服务(签名)"
)
public
class
SmsSignController
{
@Autowired
private
SmsService
smsService
;
@PostMapping
(
"page"
)
@ApiOperation
(
"签名-page"
)
public
void
pageSign
(
PageQuerySmsSignDTO
querySmsSignDTO
)
{
smsService
.
pageSmsSign
(
querySmsSignDTO
);
}
@PostMapping
(
"add"
)
@ApiOperation
(
"签名-添加"
)
public
void
addSign
(
@RequestParam
(
"sign"
)
String
sign
,
@RequestParam
(
"platform"
)
Integer
platform
)
{
smsService
.
addSign
(
sign
,
platform
);
}
@PostMapping
(
"update"
)
@ApiOperation
(
"签名-更新"
)
public
void
updateSign
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"sign"
)
String
sign
,
@RequestParam
(
"platform"
)
Integer
platform
)
{
smsService
.
updateSign
(
id
,
sign
,
platform
);
}
@PostMapping
(
"deleted"
)
@ApiOperation
(
"签名-删除"
)
public
void
deletedSign
(
@RequestParam
(
"id"
)
Integer
id
)
{
smsService
.
deleteSign
(
id
);
}
}
system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsTemplateController.java
0 → 100644
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
application
.
controller
.
admins
;
import
cn.iocoder.mall.admin.api.SmsService
;
import
cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsSignDTO
;
import
cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsTemplateDTO
;
import
cn.iocoder.mall.admin.application.po.sms.SmsTemplateAddPO
;
import
cn.iocoder.mall.admin.application.po.sms.SmsTemplateUpdatePO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 短信服务
*
* @author Sin
* @time 2019/5/26 12:26 PM
*/
@RestController
@RequestMapping
(
"sms/template"
)
@Api
(
"短信服务(短信模板)"
)
public
class
SmsTemplateController
{
@Autowired
private
SmsService
smsService
;
@PostMapping
(
"page"
)
@ApiOperation
(
"短信模板-page"
)
public
void
pageSign
(
PageQuerySmsTemplateDTO
pageQuerySmsTemplateDTO
)
{
smsService
.
pageSmsTemplate
(
pageQuerySmsTemplateDTO
);
}
@PostMapping
(
"add"
)
@ApiOperation
(
"短信模板-添加"
)
public
void
addSign
(
SmsTemplateAddPO
smsTemplateAddPO
)
{
smsService
.
addTemplate
(
smsTemplateAddPO
.
getSmsSignId
(),
smsTemplateAddPO
.
getTemplateCode
(),
smsTemplateAddPO
.
getTemplate
(),
smsTemplateAddPO
.
getPlatform
(),
smsTemplateAddPO
.
getSmsType
());
}
@PostMapping
(
"update"
)
@ApiOperation
(
"短信模板-更新"
)
public
void
updateSign
(
SmsTemplateUpdatePO
smsTemplateUpdatePO
)
{
smsService
.
updateTemplate
(
smsTemplateUpdatePO
.
getId
(),
smsTemplateUpdatePO
.
getSmsSignId
(),
smsTemplateUpdatePO
.
getTemplateCode
(),
smsTemplateUpdatePO
.
getTemplate
(),
smsTemplateUpdatePO
.
getPlatform
(),
smsTemplateUpdatePO
.
getSmsType
());
}
@PostMapping
(
"deleted"
)
@ApiOperation
(
"短信模板-删除"
)
public
void
deletedSign
(
@RequestParam
(
"id"
)
Integer
id
)
{
smsService
.
deleteTemplate
(
id
);
}
}
system/system-application/src/main/java/cn/iocoder/mall/admin/application/po/package-info.java
0 → 100644
浏览文件 @
23864fac
/**
* @author Sin
* @time 2019/5/26 12:36 PM
*/
package
cn
.
iocoder
.
mall
.
admin
.
application
.
po
;
\ No newline at end of file
system/system-application/src/main/java/cn/iocoder/mall/admin/application/po/sms/SmsTemplateAddPO.java
0 → 100644
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
application
.
po
.
sms
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.admin.api.constant.SmsPlatformEnum
;
import
cn.iocoder.mall.admin.api.constant.SmsTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
/**
* 短信模板 add
*
* @author Sin
* @time 2019/5/26 12:37 PM
*/
@ApiModel
(
"短信模板-添加"
)
@Data
@Accessors
(
chain
=
true
)
public
class
SmsTemplateAddPO
implements
Serializable
{
@ApiModelProperty
(
"短信签名id"
)
@NotNull
(
message
=
"短信短信签名id不能为空!"
)
private
Integer
smsSignId
;
@ApiModelProperty
(
"短信模板code"
)
@NotNull
@Size
(
min
=
3
,
max
=
50
,
message
=
"短信code在 3-50 之间"
)
private
String
templateCode
;
@ApiModelProperty
(
"短信模板"
)
@NotNull
@Size
(
min
=
3
,
max
=
255
,
message
=
"短信在 3-255 之间"
)
private
String
template
;
@ApiModelProperty
(
"短信模板-平台"
)
@NotNull
@InEnum
(
value
=
SmsPlatformEnum
.
class
)
private
Integer
platform
;
@ApiModelProperty
(
"短信模板-平台"
)
@NotNull
@InEnum
(
value
=
SmsTypeEnum
.
class
)
private
Integer
smsType
;
}
system/system-application/src/main/java/cn/iocoder/mall/admin/application/po/sms/SmsTemplateUpdatePO.java
0 → 100644
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
application
.
po
.
sms
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.admin.api.constant.SmsPlatformEnum
;
import
cn.iocoder.mall.admin.api.constant.SmsTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
/**
* 短信模板 add
*
* @author Sin
* @time 2019/5/26 12:37 PM
*/
@ApiModel
(
"短信模板-添加"
)
@Data
@Accessors
(
chain
=
true
)
public
class
SmsTemplateUpdatePO
implements
Serializable
{
@ApiModelProperty
(
"短信模板id"
)
@NotNull
(
message
=
"短信模板不能为空!"
)
private
Integer
id
;
@ApiModelProperty
(
"短信签名id"
)
@NotNull
(
message
=
"短信短信签名id不能为空!"
)
private
Integer
smsSignId
;
@ApiModelProperty
(
"短信模板code"
)
@NotNull
@Size
(
min
=
3
,
max
=
50
,
message
=
"短信code在 3-50 之间"
)
private
String
templateCode
;
@ApiModelProperty
(
"短信模板"
)
@NotNull
@Size
(
min
=
3
,
max
=
255
,
message
=
"短信在 3-255 之间"
)
private
String
template
;
@ApiModelProperty
(
"短信模板-平台"
)
@NotNull
@InEnum
(
value
=
SmsPlatformEnum
.
class
)
private
Integer
platform
;
@ApiModelProperty
(
"短信模板-平台"
)
@NotNull
@InEnum
(
value
=
SmsTypeEnum
.
class
)
private
Integer
smsType
;
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/SmsService.java
浏览文件 @
23864fac
...
...
@@ -39,7 +39,7 @@ public interface SmsService {
*
* @param sign
*/
void
create
Sign
(
String
sign
,
Integer
platform
);
void
add
Sign
(
String
sign
,
Integer
platform
);
/**
* 签名 - 获取
...
...
@@ -72,7 +72,8 @@ public interface SmsService {
* @param template 模板内容
* @param platform 平台
*/
void
createTemplate
(
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
);
void
addTemplate
(
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
);
/**
* 模板 - 获取
...
...
@@ -89,7 +90,8 @@ public interface SmsService {
* @param template 模板内容
* @param platform 短信平台
*/
void
updateTemplate
(
Integer
id
,
Integer
smsSignId
,
String
template
,
Integer
platform
,
Integer
smsType
);
void
updateTemplate
(
Integer
id
,
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
);
/**
* 模板 - 删除
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsPlatformEnum.java
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
api
.
constant
;
import
cn.iocoder.common.framework.core.IntArrayValuable
;
import
java.util.Arrays
;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public
enum
SmsPlatformEnum
{
public
enum
SmsPlatformEnum
implements
IntArrayValuable
{
YunPian
(
1
,
"云片"
),
AliYun
(
2
,
"阿里云"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
SmsPlatformEnum:
:
getValue
).
toArray
();
private
final
Integer
value
;
private
final
String
name
;
...
...
@@ -27,4 +33,9 @@ public enum SmsPlatformEnum {
public
String
getName
()
{
return
name
;
}
@Override
public
int
[]
array
()
{
return
ARRAYS
;
}
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsTypeEnum.java
浏览文件 @
23864fac
package
cn
.
iocoder
.
mall
.
admin
.
api
.
constant
;
import
cn.iocoder.common.framework.core.IntArrayValuable
;
import
java.util.Arrays
;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public
enum
SmsTypeEnum
{
public
enum
SmsTypeEnum
implements
IntArrayValuable
{
VERIFICATION_CODE
(
1
,
"验证码"
),
NOTICE
(
1
,
"通知"
),
MARKETING
(
2
,
"营销"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
SmsTypeEnum:
:
getValue
).
toArray
();
private
final
Integer
value
;
private
final
String
name
;
...
...
@@ -28,4 +34,9 @@ public enum SmsTypeEnum {
public
String
getName
()
{
return
name
;
}
@Override
public
int
[]
array
()
{
return
ARRAYS
;
}
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java
浏览文件 @
23864fac
...
...
@@ -111,7 +111,7 @@ public class SmsServiceImpl implements SmsService {
@Override
@Transactional
public
void
create
Sign
(
String
sign
,
Integer
platform
)
{
public
void
add
Sign
(
String
sign
,
Integer
platform
)
{
// 避免重复
SmsSignDO
smsSignDO
=
smsSignMapper
.
selectOne
(
...
...
@@ -196,8 +196,8 @@ public class SmsServiceImpl implements SmsService {
@Override
@Transactional
public
void
create
Template
(
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
)
{
public
void
add
Template
(
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
)
{
SmsSignDO
smsSignDO
=
smsSignMapper
.
selectOne
(
new
QueryWrapper
<
SmsSignDO
>().
eq
(
"id"
,
smsSignId
));
...
...
@@ -240,7 +240,8 @@ public class SmsServiceImpl implements SmsService {
@Override
@Transactional
public
void
updateTemplate
(
Integer
id
,
Integer
smsSignId
,
String
template
,
Integer
platform
,
Integer
smsType
)
{
public
void
updateTemplate
(
Integer
id
,
Integer
smsSignId
,
String
templateCode
,
String
template
,
Integer
platform
,
Integer
smsType
)
{
SmsTemplateDO
smsTemplateDO
=
smsTemplateMapper
.
selectOne
(
new
QueryWrapper
<
SmsTemplateDO
>().
eq
(
"id"
,
id
));
...
...
@@ -260,6 +261,7 @@ public class SmsServiceImpl implements SmsService {
smsTemplateMapper
.
update
(
(
SmsTemplateDO
)
new
SmsTemplateDO
()
.
setSmsSignId
(
smsSignId
)
.
setTemplateCode
(
templateCode
)
.
setTemplate
(
template
)
.
setPlatform
(
platform
)
.
setSmsType
(
smsType
)
...
...
system/system-service-impl/src/test/java/cn/iocoder/mall/admin/service/SmsServiceImplTest.java
浏览文件 @
23864fac
...
...
@@ -31,8 +31,8 @@ public class SmsServiceImplTest {
@Test
public
void
createSignTest
()
{
// smsService.
create
Sign("悦跑运动", SmsPlatformEnum.YunPian.getValue());
smsService
.
create
Sign
(
"登录确认验证码"
,
SmsPlatformEnum
.
AliYun
.
getValue
());
// smsService.
add
Sign("悦跑运动", SmsPlatformEnum.YunPian.getValue());
smsService
.
add
Sign
(
"登录确认验证码"
,
SmsPlatformEnum
.
AliYun
.
getValue
());
}
@Test
...
...
@@ -63,7 +63,7 @@ public class SmsServiceImplTest {
Integer
sign
=
4
;
String
templateCode
=
"SMS_137110043"
;
String
template
=
"验证码#code#,您正在登录,若非本人操作,请勿泄露。"
;
smsService
.
create
Template
(
smsService
.
add
Template
(
sign
,
templateCode
,
template
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论