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
提交
f5a75439
提交
f5a75439
编写于
1月 13, 2020
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20200113 验证码删除逻辑的处理
上级
ad6a1f8b
流水线
#20717
已失败 于阶段
in 0 second
变更
4
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
45 行增加
和
17 行删除
+45
-17
Test.java
...main/java/com/pica/cloud/account/account/server/Test.java
+18
-0
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+16
-2
AESUtil.java
...a/com/pica/cloud/account/account/server/util/AESUtil.java
+3
-3
AccountUtils.java
.../pica/cloud/account/account/server/util/AccountUtils.java
+8
-12
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/Test.java
浏览文件 @
f5a75439
...
...
@@ -196,6 +196,24 @@ public class Test {
changeMobileEntity
.
setContent
(
changeMobileContent
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
changeMobileEntity
));
System
.
out
.
println
(
"---------------------------------------------------------------"
);
BaseRequest
changeMobileu
=
new
BaseRequest
();
changeMobileu
.
setMobile
(
"13024112588"
);
changeMobileu
.
setAuthCode
(
"871756"
);
changeMobileu
.
setUnionId
(
"o3EP_wNH2g4FGcUNByXJIbQyUVPI"
);
changeMobileu
.
setFlag
(
2
);
String
string1u
=
JSONObject
.
toJSONString
(
changeMobileu
);
System
.
out
.
println
(
string1u
);
String
changeMobileContentu
=
AESUtil
.
aesEncrypt
(
string1u
,
"YCPQPx4qpQjEjDea"
);
String
changeMobileKeyu
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
changeMobileEntityu
=
new
EncryptEntity
();
changeMobileEntityu
.
setKey
(
changeMobileKeyu
);
changeMobileEntityu
.
setContent
(
changeMobileContentu
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
changeMobileEntityu
));
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
f5a75439
...
...
@@ -151,8 +151,11 @@ public class AutoCodeController extends AccountBaseController {
String
message
=
"您的验证码是"
+
authCode
+
",在10分钟内有效。如非本人操作,请忽略本短信!"
;
Integer
accountIdByMobilePhone
=
accountService
.
getAccountIdByMobilePhone
(
mobilePhone
);
long
senderId
=
accountIdByMobilePhone
==
null
?
0L
:
accountIdByMobilePhone
;
cacheClient
.
set
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
.
toString
()),
authCode
,
600
);
logger
.
info
(
"验证码缓存信息----->:"
+
this
.
getAuthCodeKey
(
mobilePhone
,
flag
.
toString
()));
String
authCodeKey
=
getAuthCodeKey
(
mobilePhone
,
flag
.
toString
());
boolean
set
=
cacheClient
.
set
(
authCodeKey
,
authCode
,
600
);
logger
.
info
(
cacheClient
.
get
(
authCodeKey
));
logger
.
info
(
"验证码缓存是否成功----->:"
+
set
);
logger
.
info
(
"验证码缓存信息----->:"
+
authCodeKey
);
cacheClient
.
set
(
authCodeKeySecure
,
System
.
currentTimeMillis
(),
60
);
//处理验证码原子性的问题
cacheClient
.
set
(
RegisterCodeKeyUtils
.
getRegisterKey
(
mobilePhone
,
authCode
),
100
,
600
);
...
...
@@ -170,4 +173,15 @@ public class AutoCodeController extends AccountBaseController {
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"请输入正确的手机号"
);
}
}
@ApiOperation
(
"微信获取验证码"
)
@PostMapping
(
value
=
"/authCode/get"
)
public
PicaResponse
getAuthCode
(){
String
cacheCode
=
cacheClient
.
get
(
"authCode-2-j1VrU5MSc1uuZaEa82ZKfQ=="
);
return
PicaResponse
.
toResponse
(
cacheCode
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/AESUtil.java
浏览文件 @
f5a75439
...
...
@@ -194,10 +194,10 @@ public class AESUtil {
// System.out.println("解密后:" + decrypt);
//请求参数解密处理
String
key
=
"
bOceDio5f9p8xZfCqVxI+VVHWpGDGP/xDg01FlKi97he2Tovv66hTLzNOgPv7/RbLm2TLzmI1Y8FjAl5Fcr0j3HvHZBLLpgiNBtw+gfbtEde7JsnVo58/mKTm5HBGyB0TWhOq8GZouetmHqC88d8zyNkxIp1fDEs2OSrYMCb1ZY
="
;
String
decrypt
=
RSAUtil
.
decrypt
(
key
,
pr
ocPr
ivateKey
);
String
key
=
"
am1pnysCRlz80Rl/eTDj/UE/Pe8zkxb2yP73jvrUWEk3x5/lK9hi104MSmsKbl45cPzJfJXBxO+VeItkA63ZqfaUNA0ezdMd7Ord7rGqvWK+4RqAm1T3Qo3lw/5bT0GwgWMWZBrDr30NHCYLmjg6vwVbv3YCEewwQK+rL7bUXu0
="
;
String
decrypt
=
RSAUtil
.
decrypt
(
key
,
privateKey
);
System
.
out
.
println
(
decrypt
);
String
content
=
"
UBcV7wk/VsXm+fcU6fP2qqo/UfYc0M9M184daTGofmfrQAif/hnjO15AdcGiAZMRJEo0y9fOCFy+eTAUAum0Nma4Ylbme4CdyOKI2w5aq8A=
"
;
String
content
=
"
d9eKA7DGhNx7295N0g82rqzaUOeAvBeuR2gXtOX3Y+VV3ei+zW0BQn9moQgN4mRT8XIzq3x2n3qiqCuOzcDvrlGC0kIcUClM0gt8xDaBw+haVpMAw/7R4FgWNPeVRL5k
"
;
String
result
=
AESUtil
.
aesDecrypt
(
content
,
decrypt
);
System
.
out
.
println
(
result
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/util/AccountUtils.java
浏览文件 @
f5a75439
...
...
@@ -85,15 +85,12 @@ public class AccountUtils {
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
sysCode
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
String
authCodeKey
=
AccountUtils
.
getAuthCodeKey
(
mobile
,
flag
);
//验证码3次校验测试不通过,直接删除
String
authCodeKey
=
getAuthCodeKey
(
mobile
,
flag
);
String
authCodeCount
=
AUTH_CODE_COUNT_PREFIX
+
flag
+
"-"
+
AESUtil
.
encryptV0
(
mobile
);
logger
.
info
(
"验证码缓存信息----->:"
+
this
.
getAuthCodeKey
(
mobile
,
flag
));
if
(
cacheClient
.
exists
(
authCodeCount
)
&&
Integer
.
parseInt
(
cacheClient
.
get
(
authCodeCount
))
>
2
)
{
cacheClient
.
del
(
authCodeKey
);
}
// if (cacheClient.exists(authCodeCount) && Integer.parseInt(cacheClient.get(authCodeCount)) > 2) {
// cacheClient.del(authCodeKey);
// }
String
cacheCode
=
cacheClient
.
get
(
authCodeKey
);
//从redis获取验证码
// if (org.apache.commons.lang.StringUtils.isBlank(cacheCode)) {
...
...
@@ -101,7 +98,6 @@ public class AccountUtils {
// cacheClient.del(authCodeCount);
// throw new PicaException(PicaResultCode.RESULE_DATA_NONE.code(), "短信验证码已失效,请重新获取");
// }
if
(!
org
.
apache
.
commons
.
lang
.
StringUtils
.
equals
(
sysCode
,
cacheCode
))
{
cacheClient
.
incr
(
authCodeCount
);
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
...
...
@@ -120,7 +116,6 @@ public class AccountUtils {
}
//获取验证码的key
String
authCodeKey
=
RegisterCodeKeyUtils
.
getRegisterKey
(
mobile
,
sysCode
);
//从redis中删除短信验证码,如果能够删除成功,说明验证码正确
//100,99
Long
num
=
cacheClient
.
decr
(
authCodeKey
);
...
...
@@ -185,10 +180,11 @@ public class AccountUtils {
Long
userId
=
null
;
if
(
productType
==
AccountTypeEnum
.
PRODUCT_TYPE_DOCTOR
.
getCode
())
{
userId
=
doctorInfoMapper
.
selectUserIdByAcctId
(
AcctId
);
}
else
if
(
productType
==
AccountTypeEnum
.
PRODUCT_TYPE_HEALTH
.
getCode
())
{
AccountPatientInfoEntity
accountPatientInfoEntity
=
accountPatientInfoMapper
.
selectByAcctId
(
AcctId
);
userId
=
accountPatientInfoEntity
.
getId
().
longValue
();
}
// else if (productType == AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
// AccountPatientInfoEntity accountPatientInfoEntity = accountPatientInfoMapper.selectByAcctId(AcctId);
// userId = accountPatientInfoEntity.getId().longValue();
// }
return
userId
;
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录