Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
park
extend
Commits
3d6f6650
Commit
3d6f6650
authored
Jun 19, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加短信发送功能
parent
256fc793
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
1 deletions
+78
-1
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/intercept/EncryptResponseBodyAdvice.java
+4
-1
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
+25
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/CheckVerifyCodeMicReq.java
+15
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendMicReq.java
+19
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendVerifyCodeMicReq.java
+15
-0
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/intercept/EncryptResponseBodyAdvice.java
View file @
3d6f6650
...
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.hikcreate.edl.common.sdk.util.EncryptStringAes
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BaseEncryptRes
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.MethodParameter
;
...
...
@@ -35,8 +36,9 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
try
{
log
.
info
(
"Response body 明文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
if
(
methodParameter
.
getMethod
().
isAnnotationPresent
(
ResponseEncryptAnnotation
.
class
)
&&
o
instanceof
Result
)
{
//进行加密
Result
<
Object
>
result
=
(
Result
<
Object
>)
o
;
if
(
ResultCode
.
SUCCESS
.
getCode
().
equals
(
result
.
getCode
())
)
{
//进行加密
Object
data
=
result
.
getData
();
String
dataStr
=
objectMapper
.
writeValueAsString
(
data
);
String
encryptStr
=
EncryptStringAes
.
encryptAes
(
dataStr
,
"AES/ECB/PKCS5Padding"
);
...
...
@@ -46,6 +48,7 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
o
=
result
;
log
.
info
(
"Response body 密文: {}"
,
objectMapper
.
writeValueAsString
(
o
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Response body 加密异常:{}"
,
e
);
}
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
0 → 100644
View file @
3d6f6650
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendMicReq
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
/**
* 短信feign
*/
@FeignClient
(
value
=
"${biz.feign.service.sms}"
,
path
=
"sms"
)
public
interface
SmsFeign
{
@PostMapping
(
{
"send"
}
)
Result
<
Void
>
send
(
@RequestBody
SendMicReq
var1
);
@PostMapping
(
{
"verifyCode/send"
}
)
Result
<
Void
>
sendVerifyCode
(
@RequestBody
SendVerifyCodeMicReq
var1
);
@PostMapping
(
{
"verifyCode/check"
}
)
Result
<
Void
>
checkVerifyCode
(
@RequestBody
CheckVerifyCodeMicReq
var1
);
}
\ No newline at end of file
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/CheckVerifyCodeMicReq.java
0 → 100644
View file @
3d6f6650
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
.
param
.
request
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
public
class
CheckVerifyCodeMicReq
{
private
String
phone
;
// 手机号码
private
String
templateCode
;
// 短信模板编码
private
String
extraKey
;
// 附加的键,主要用于一辆机动车被多个人绑定的场景。
// 比如车辆持有人是A,被B和C两个人绑定,这时需要将验证码短信发送给A,值被记录到redis的时候需要区分B和C。
private
String
verifyCode
;
// 短信验证码
}
\ No newline at end of file
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendMicReq.java
0 → 100644
View file @
3d6f6650
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
.
param
.
request
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Map
;
@Data
@NoArgsConstructor
public
class
SendMicReq
{
private
String
phone
;
// 手机号码
private
String
extraKey
;
// 附加的键,主要用于一辆机动车被多个人绑定的场景。
// 比如车辆持有人是A,被B和C两个人绑定,这时需要将验证码短信发送给A,值被记录到redis的时候需要区分B和C。
private
String
templateCode
;
// 短信模板编码
private
Map
<
String
,
String
>
templateParamMap
;
// 短信模板参数
private
String
signName
;
//短信签名,默认是斑马信用
}
\ No newline at end of file
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/param/request/SendVerifyCodeMicReq.java
0 → 100644
View file @
3d6f6650
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
.
edl_pub_service_sms
.
param
.
request
;
import
lombok.Data
;
@Data
public
class
SendVerifyCodeMicReq
{
private
String
phone
;
// 手机号码
private
String
templateCode
;
// 短信模板编码
private
String
extraKey
;
// 附加的键,主要用于一辆机动车被多个人绑定的场景。
// 比如车辆持有人是A,被B和C两个人绑定,这时需要将验证码短信发送给A,值被记录到redis的时候需要区分B和C。
private
String
verifyCode
;
// 短信验证码
private
String
signName
;
//短信签名,默认是斑马信用
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment