Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
76d3d63e
提交
76d3d63e
编写于
2月 18, 2022
作者:
wenhao.qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加注释 flag=9患者查询检测报告列表
上级
8ff3f6ee
流水线
#42370
已取消 于阶段
变更
1
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
14 行删除
+18
-14
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+18
-14
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
76d3d63e
...
@@ -32,6 +32,8 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -32,6 +32,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Objects
;
@Api
(
description
=
"短信验证码资源"
)
@Api
(
description
=
"短信验证码资源"
)
@RestController
@RestController
public
class
AutoCodeController
extends
AccountBaseController
{
public
class
AutoCodeController
extends
AccountBaseController
{
...
@@ -107,10 +109,10 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -107,10 +109,10 @@ public class AutoCodeController extends AccountBaseController {
@PostMapping
(
value
=
"/authCode"
)
@PostMapping
(
value
=
"/authCode"
)
public
PicaResponse
getAuthCode
(
@RequestBody
AesAuthCodeReq
authCodeReq
,
HttpServletRequest
req
)
throws
Exception
{
public
PicaResponse
getAuthCode
(
@RequestBody
AesAuthCodeReq
authCodeReq
,
HttpServletRequest
req
)
throws
Exception
{
// 验证码类型 0默认 1注册 2微信登录绑定手机 3修改手机
// 验证码类型 0默认 1注册 2微信登录绑定手机 3修改手机
// 4重置密码 5忘记密码 7患者招募提交问卷(效验) 8Appe登录绑定手机
// 4重置密码 5忘记密码 7患者招募提交问卷(效验) 8Appe登录绑定手机
9患者查询检测报告列表
EncryptEntity
entity
=
new
EncryptEntity
();
EncryptEntity
entity
=
new
EncryptEntity
();
if
(
StringUtils
.
isEmpty
(
authCodeReq
.
getKey
())
&&
StringUtils
.
isEmpty
(
authCodeReq
.
getContent
()))
{
if
(
StringUtils
.
isEmpty
(
authCodeReq
.
getKey
())
&&
StringUtils
.
isEmpty
(
authCodeReq
.
getContent
()))
{
//明文时处理
//明文时处理
entity
=
RSAUtil
.
getAuthCodeEncrypt
(
authCodeReq
);
entity
=
RSAUtil
.
getAuthCodeEncrypt
(
authCodeReq
);
logger
.
info
(
"AesAuthCodeReq getAuthCode:"
+
JSONObject
.
toJSONString
(
authCodeReq
));
logger
.
info
(
"AesAuthCodeReq getAuthCode:"
+
JSONObject
.
toJSONString
(
authCodeReq
));
...
@@ -123,7 +125,7 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -123,7 +125,7 @@ public class AutoCodeController extends AccountBaseController {
loginAes
.
setMobile
(
authCodeReq
.
getMobile
());
loginAes
.
setMobile
(
authCodeReq
.
getMobile
());
loginAes
.
setDeviceInfo
(
super
.
getDeviceInfoLow
(
"deviceinfo"
));
loginAes
.
setDeviceInfo
(
super
.
getDeviceInfoLow
(
"deviceinfo"
));
loginService
.
insertLoginAesLog
(
loginAes
);
loginService
.
insertLoginAesLog
(
loginAes
);
}
else
{
}
else
{
//执行原逻辑
//执行原逻辑
entity
.
setKey
(
authCodeReq
.
getKey
());
entity
.
setKey
(
authCodeReq
.
getKey
());
entity
.
setContent
(
authCodeReq
.
getContent
());
entity
.
setContent
(
authCodeReq
.
getContent
());
...
@@ -131,12 +133,15 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -131,12 +133,15 @@ public class AutoCodeController extends AccountBaseController {
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
request
.
setSourceType
(
super
.
getSourceType
());
request
.
setSourceType
(
super
.
getSourceType
());
logger
.
info
(
"authCode/getAuthCode:{}"
,
JSONObject
.
toJSONString
(
request
));
logger
.
info
(
"authCode/getAuthCode:{}"
,
JSONObject
.
toJSONString
(
request
));
AccountUtils
.
checkMobilePhone
(
request
.
getMobile
());
AccountUtils
.
checkMobilePhone
(
request
.
getMobile
());
if
(
request
.
getBizType
()
!=
null
&&
request
.
getBizType
().
equals
(
1
))
{
if
(
request
.
getBizType
()
!=
null
&&
request
.
getBizType
().
equals
(
1
))
{
logger
.
info
(
"app-rcValidate-start"
);
logger
.
info
(
"app-rcValidate-start"
);
if
(
Objects
.
equals
(
9
,
request
.
getFlag
()))
{
logger
.
info
(
"input select patient record "
);
}
// 调用风控接口
// 调用风控接口
authCodeService
.
rcValidate
(
req
,
request
,
super
.
getDeviceInfo
(),
super
.
getSourceType
());
authCodeService
.
rcValidate
(
req
,
request
,
super
.
getDeviceInfo
(),
super
.
getSourceType
());
// 发送短信验证码
// 发送短信验证码
...
@@ -209,7 +214,7 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -209,7 +214,7 @@ public class AutoCodeController extends AccountBaseController {
//验证码保存到redis,失效时间10分钟
//验证码保存到redis,失效时间10分钟
cacheClient
.
set
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
),
authCode
,
600
);
cacheClient
.
set
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
),
authCode
,
600
);
//处理验证码原子性的问题
//处理验证码原子性的问题
cacheClient
.
set
(
RegisterCodeKeyUtils
.
getRegisterKey
(
mobilePhone
,
authCode
),
100
,
600
);
cacheClient
.
set
(
RegisterCodeKeyUtils
.
getRegisterKey
(
mobilePhone
,
authCode
),
100
,
600
);
logger
.
info
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
));
logger
.
info
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
));
//发送短信
//发送短信
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
...
@@ -285,7 +290,7 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -285,7 +290,7 @@ public class AutoCodeController extends AccountBaseController {
private
void
processSendAuthCode
(
String
mobilePhone
,
Integer
flag
,
String
authCodeKeySecure
)
{
private
void
processSendAuthCode
(
String
mobilePhone
,
Integer
flag
,
String
authCodeKeySecure
)
{
//接入新旭事务一致性
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"processSendAuthCode"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"mobilePhone:"
+
mobilePhone
+
",flag:"
+
flag
+
",authCodeKeySecure:"
+
authCodeKeySecure
);
intactUtil
.
sendIntact
(
batchNo
,
"processSendAuthCode"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"mobilePhone:"
+
mobilePhone
+
",flag:"
+
flag
+
",authCodeKeySecure:"
+
authCodeKeySecure
);
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
String
authCode
=
CommonUtil
.
createValidateCode
();
String
authCode
=
CommonUtil
.
createValidateCode
();
String
message
=
"您的验证码是"
+
authCode
+
",在10分钟内有效。如非本人操作,请忽略本短信!"
;
String
message
=
"您的验证码是"
+
authCode
+
",在10分钟内有效。如非本人操作,请忽略本短信!"
;
...
@@ -294,17 +299,17 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -294,17 +299,17 @@ public class AutoCodeController extends AccountBaseController {
String
authCodeKey
=
getAuthCodeKey
(
mobilePhone
,
flag
.
toString
());
String
authCodeKey
=
getAuthCodeKey
(
mobilePhone
,
flag
.
toString
());
boolean
set
=
cacheClient
.
set
(
authCodeKey
,
authCode
,
600
);
boolean
set
=
cacheClient
.
set
(
authCodeKey
,
authCode
,
600
);
logger
.
info
(
cacheClient
.
get
(
authCodeKey
));
logger
.
info
(
cacheClient
.
get
(
authCodeKey
));
logger
.
info
(
"验证码缓存是否成功----->:"
+
set
);
logger
.
info
(
"验证码缓存是否成功----->:"
+
set
);
logger
.
info
(
"验证码缓存信息----->:"
+
authCodeKey
);
logger
.
info
(
"验证码缓存信息----->:"
+
authCodeKey
);
cacheClient
.
set
(
authCodeKeySecure
,
System
.
currentTimeMillis
(),
60
);
cacheClient
.
set
(
authCodeKeySecure
,
System
.
currentTimeMillis
(),
60
);
//处理验证码原子性的问题
//处理验证码原子性的问题
cacheClient
.
set
(
RegisterCodeKeyUtils
.
getRegisterKey
(
mobilePhone
,
authCode
),
100
,
600
);
cacheClient
.
set
(
RegisterCodeKeyUtils
.
getRegisterKey
(
mobilePhone
,
authCode
),
100
,
600
);
long
end1
=
System
.
currentTimeMillis
();
long
end1
=
System
.
currentTimeMillis
();
logger
.
info
(
"processSendAuthCode-1 used {} million seconds"
,
end1
-
start
);
logger
.
info
(
"processSendAuthCode-1 used {} million seconds"
,
end1
-
start
);
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
long
end2
=
System
.
currentTimeMillis
();
long
end2
=
System
.
currentTimeMillis
();
logger
.
info
(
"processSendAuthCode-2 used {} million seconds"
,
end2
-
start
);
logger
.
info
(
"processSendAuthCode-2 used {} million seconds"
,
end2
-
start
);
intactUtil
.
sendIntact
(
batchNo
,
"processSendAuthCode"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"mobilePhone:"
+
mobilePhone
+
",flag:"
+
flag
+
",authCodeKeySecure:"
+
authCodeKeySecure
);
intactUtil
.
sendIntact
(
batchNo
,
"processSendAuthCode"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"mobilePhone:"
+
mobilePhone
+
",flag:"
+
flag
+
",authCodeKeySecure:"
+
authCodeKeySecure
);
}
}
...
@@ -322,11 +327,10 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -322,11 +327,10 @@ public class AutoCodeController extends AccountBaseController {
@ApiOperation
(
"微信获取验证码"
)
@ApiOperation
(
"微信获取验证码"
)
@PostMapping
(
value
=
"/authCode/get"
)
@PostMapping
(
value
=
"/authCode/get"
)
public
PicaResponse
getAuthCode
(){
public
PicaResponse
getAuthCode
()
{
String
cacheCode
=
cacheClient
.
get
(
"authCode-j1VrU5MSc1uuZaEa82ZKfQ=="
);
String
cacheCode
=
cacheClient
.
get
(
"authCode-j1VrU5MSc1uuZaEa82ZKfQ=="
);
return
PicaResponse
.
toResponse
(
cacheCode
);
return
PicaResponse
.
toResponse
(
cacheCode
);
}
}
}
}
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录