Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
scsm
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
scsm
Commits
4826be2d
提交
4826be2d
authored
12月 30, 2020
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
1d264c8d
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
115 行增加
和
69 行删除
+115
-69
pom.xml
com.zrqx.core/pom.xml
+5
-0
MessageService.java
...java/com/zrqx/core/components/message/MessageService.java
+0
-27
MessageServiceImpl.java
...x/core/components/message/service/MessageServiceImpl.java
+0
-42
MessageBusinessTypeEnum.java
.../com/zrqx/core/enums/message/MessageBusinessTypeEnum.java
+55
-0
PhoneTypeEnum.java
.../main/java/com/zrqx/core/enums/message/PhoneTypeEnum.java
+55
-0
没有找到文件。
com.zrqx.core/pom.xml
浏览文件 @
4826be2d
...
...
@@ -25,6 +25,11 @@
<version>
2.1.1.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
<version>
2.2.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.1.0
</version>
...
...
com.zrqx.core/src/main/java/com/zrqx/core/components/message/MessageService.java
deleted
100644 → 0
浏览文件 @
1d264c8d
package
com
.
zrqx
.
core
.
components
.
message
;
import
com.zrqx.core.components.message.form.PhoneMessageForm
;
import
com.zrqx.core.exception.BaseException
;
/**
* 接口响应统一结果处理
* 接口响应失败抛出异常
* @author lpf
* @date 2020-06-22
*/
public
interface
MessageService
{
/**
* 手机发送短信,发送失败处理抛出异常
* @param form
* @throws BaseException
*/
void
sendPhone
(
PhoneMessageForm
form
)
throws
BaseException
;
/**
* 手机发送短信验证码,发送失败处理抛出异常
* @param form
* @return
* @throws BaseException
*/
String
sendPhoneCaptcha
(
PhoneMessageForm
form
)
throws
BaseException
;
}
com.zrqx.core/src/main/java/com/zrqx/core/components/message/service/MessageServiceImpl.java
deleted
100644 → 0
浏览文件 @
1d264c8d
package
com
.
zrqx
.
core
.
components
.
message
.
service
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.zrqx.core.components.message.MessageService
;
import
com.zrqx.core.components.message.form.PhoneMessageForm
;
import
com.zrqx.core.exception.BaseException
;
import
com.zrqx.core.message.MessageClient
;
import
com.zrqx.core.util.response.CallBack
;
/**
* @author lpf
* @date 2020-06-22
*/
@Component
public
class
MessageServiceImpl
implements
MessageService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
MessageServiceImpl
.
class
);
@Autowired
private
MessageClient
client
;
@Override
public
void
sendPhone
(
PhoneMessageForm
form
)
throws
BaseException
{
CallBack
<?>
callBack
=
client
.
sendPhone
(
form
);
if
(
callBack
.
isStatus
())
{
return
;
}
throw
new
BaseException
(
"手机发送短信失败,失败原因:"
+
callBack
.
getMsg
()
+
";"
);
}
@Override
public
String
sendPhoneCaptcha
(
PhoneMessageForm
form
)
throws
BaseException
{
CallBack
<
String
>
callBack
=
client
.
sendPhoneCaptcha
(
form
);
if
(
callBack
.
hasEntity
())
{
return
callBack
.
getData
();
}
throw
new
BaseException
(
"手机发送短信验证码失败,失败原因:"
+
callBack
.
getMsg
()
+
";"
);
}
}
com.zrqx.core/src/main/java/com/zrqx/core/enums/message/MessageBusinessTypeEnum.java
0 → 100644
浏览文件 @
4826be2d
package
com
.
zrqx
.
core
.
enums
.
message
;
import
java.util.HashMap
;
import
java.util.stream.Stream
;
/**
* @author lpf
* @date 2020-06-22
*/
public
enum
MessageBusinessTypeEnum
{
/** */
REGISTER_CAPTCHA
(
"captcha_reg"
,
"注册验证码"
),
LOGIN_CAPTCHA
(
"captcha_login"
,
"登录验证码"
),
RESET_PASSWORD_CAPTCHA
(
"captcha_reset_password"
,
"找回密码验证码"
);
private
final
String
code
;
private
final
String
name
;
private
static
final
HashMap
<
String
,
String
>
MAP
=
new
HashMap
<
String
,
String
>();
static
{
stream
().
forEach
(
e
->
{
MAP
.
put
(
e
.
code
,
e
.
name
);
});
}
public
static
Stream
<
MessageBusinessTypeEnum
>
stream
(){
return
Stream
.
of
(
values
());
}
private
MessageBusinessTypeEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
boolean
isExist
(
String
code
)
{
return
stream
().
anyMatch
(
e
->
e
.
code
.
equals
(
code
));
}
public
static
String
getName
(
String
code
)
{
return
stream
().
filter
(
e
->
e
.
code
.
equals
(
code
)).
findFirst
().
map
(
e
->
e
.
name
).
orElse
(
null
);
}
public
String
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
public
static
HashMap
<
String
,
String
>
getMap
()
{
return
MAP
;
}
}
com.zrqx.core/src/main/java/com/zrqx/core/enums/message/PhoneTypeEnum.java
0 → 100644
浏览文件 @
4826be2d
package
com
.
zrqx
.
core
.
enums
.
message
;
import
com.zrqx.core.enums.captcha.CaptchaBusinessTypeEnum
;
import
com.zrqx.core.enums.interfaces.EnumsInterface
;
import
java.util.HashMap
;
import
java.util.stream.Stream
;
/**
* @author lpf
* @date 2020-06-19
*/
public
enum
PhoneTypeEnum
implements
EnumsInterface
<
String
>
{
/** */
ALi
(
"ali"
,
"阿里云短信"
),
HUAWEI
(
"huawei"
,
"华为云短信服务"
),
MANDAO
(
"mandao"
,
"漫道科技短信服务"
);
private
final
String
code
;
private
final
String
name
;
private
static
final
HashMap
<
String
,
String
>
MAP
=
new
HashMap
<
String
,
String
>();
static
{
stream
().
forEach
(
e
->
{
MAP
.
put
(
e
.
code
,
e
.
name
);
});
}
public
static
Stream
<
PhoneTypeEnum
>
stream
(){
return
Stream
.
of
(
values
());
}
private
PhoneTypeEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
boolean
isExist
(
String
code
)
{
return
stream
().
anyMatch
(
e
->
e
.
code
.
equals
(
code
));
}
public
static
String
getName
(
String
code
)
{
return
stream
().
filter
(
e
->
e
.
code
.
equals
(
code
)).
findFirst
().
map
(
e
->
e
.
name
).
orElse
(
null
);
}
@Override
public
String
getCode
()
{
return
code
;
}
@Override
public
String
getName
()
{
return
name
;
}
public
static
HashMap
<
String
,
String
>
getMap
()
{
return
MAP
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论