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
提交
d8678e11
提交
d8678e11
编写于
10月 22, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20191022 解决bug
上级
0c9cebe2
流水线
#16172
已失败 于阶段
in 0 second
变更
4
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
70 行增加
和
13 行删除
+70
-13
Test.java
...main/java/com/pica/cloud/account/account/server/Test.java
+59
-10
AccountController.java
.../account/account/server/controller/AccountController.java
+6
-3
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+4
-0
AccountServiceImpl.java
...count/account/server/service/impl/AccountServiceImpl.java
+1
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/Test.java
浏览文件 @
d8678e11
...
...
@@ -15,15 +15,16 @@ public class Test {
// " }";
//获取验证码参数
// BaseRequest request = new BaseRequest();
// request.setFlag(1);
// request.setMobile("13024112588");
// String string = JSONObject.toJSONString(request);
// System.out.println(string);
// EncryptEntity encryptEntity = new EncryptEntity();
// encryptEntity.setContent(string);
// System.out.println(JSONObject.toJSONString(encryptEntity));
// System.out.println("------------------------------>");
BaseRequest
request
=
new
BaseRequest
();
request
.
setFlag
(
1
);
request
.
setMobile
(
"13024112070"
);
String
string
=
JSONObject
.
toJSONString
(
request
);
System
.
out
.
println
(
string
);
EncryptEntity
encryptEntity
=
new
EncryptEntity
();
encryptEntity
.
setContent
(
string
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
encryptEntity
));
System
.
out
.
println
(
"------------------------------>"
);
//获取注册参数
// BaseRequest register = null;
...
...
@@ -79,7 +80,7 @@ public class Test {
System
.
out
.
println
(
"--------------------登录接口-------------"
);
String
publicKey
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB"
;
BaseRequest
login
=
new
BaseRequest
();
login
.
setMobile
(
"130241120
62
"
);
login
.
setMobile
(
"130241120
80
"
);
login
.
setPassword
(
"D0DCBF0D12A6B1E7FBFA2CE5848F3EFF"
);
String
con
=
JSONObject
.
toJSONString
(
login
);
String
contentResult
=
AESUtil
.
aesEncrypt
(
con
,
"YCPQPx4qpQjEjDea"
);
...
...
@@ -94,12 +95,60 @@ public class Test {
changePwd
.
setOldPwd
(
"D0DCBF0D12A6B1E7FBFA2CE5848F3EFF"
);
changePwd
.
setPassword
(
"0B9A75D6A88721A4BCF94F0FD668C56B"
);
String
changePwdStr
=
JSONObject
.
toJSONString
(
changePwd
);
System
.
out
.
println
(
changePwdStr
);
String
contentResult1
=
AESUtil
.
aesEncrypt
(
changePwdStr
,
"YCPQPx4qpQjEjDea"
);
String
keyResult1
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
encryptTest1
=
new
EncryptEntity
();
encryptTest1
.
setContent
(
contentResult1
);
encryptTest1
.
setKey
(
keyResult1
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
encryptTest1
));
System
.
out
.
println
(
"--------------------获取验证码接口-------------"
);
BaseRequest
authCode
=
new
BaseRequest
();
authCode
.
setFlag
(
1
);
authCode
.
setMobile
(
"13024112081"
);
String
authCodeStr
=
JSONObject
.
toJSONString
(
authCode
);
System
.
out
.
println
(
authCodeStr
);
String
contentResult2
=
AESUtil
.
aesEncrypt
(
authCodeStr
,
"YCPQPx4qpQjEjDea"
);
String
keyResult2
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
encryptTest2
=
new
EncryptEntity
();
encryptTest2
.
setContent
(
contentResult2
);
encryptTest2
.
setKey
(
keyResult2
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
encryptTest2
));
System
.
out
.
println
(
"--------------------注册接口-------------"
);
//获取注册参数
BaseRequest
register
=
null
;
register
=
new
BaseRequest
();
register
.
setMobile
(
"13024112080"
);
register
.
setPassword
(
"D0DCBF0D12A6B1E7FBFA2CE5848F3EFF"
);
register
.
setAuthCode
(
"012082"
);
String
registerString3
=
JSONObject
.
toJSONString
(
register
);
String
contentResult3
=
AESUtil
.
aesEncrypt
(
registerString3
,
"YCPQPx4qpQjEjDea"
);
String
keyResult3
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
encryptTest3
=
new
EncryptEntity
();
encryptTest3
.
setContent
(
contentResult3
);
encryptTest3
.
setKey
(
keyResult3
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
encryptTest3
));
System
.
out
.
println
(
"--------------------一键登录接口-------------"
);
BaseRequest
loginRegister
=
null
;
loginRegister
=
new
BaseRequest
();
loginRegister
.
setMobile
(
"13024112081"
);
loginRegister
.
setAuthCode
(
"393791"
);
String
registerString4
=
JSONObject
.
toJSONString
(
loginRegister
);
String
contentResult4
=
AESUtil
.
aesEncrypt
(
registerString4
,
"YCPQPx4qpQjEjDea"
);
String
keyResult4
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
encryptTest4
=
new
EncryptEntity
();
encryptTest4
.
setContent
(
contentResult4
);
encryptTest4
.
setKey
(
keyResult4
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
encryptTest4
));
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/AccountController.java
浏览文件 @
d8678e11
...
...
@@ -120,7 +120,7 @@ public class AccountController extends AccountBaseController {
this
.
checkAuthCode
(
req
);
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
Account
account
=
new
Account
();
account
.
setMobilePhone
(
req
.
getMobilePhone
(
));
account
.
setMobilePhone
(
EncryptUtils
.
encryptContent
(
req
.
getMobilePhone
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
));
switch
(
deviceType
)
{
//注册来源
case
"1"
:
account
.
setRegisterSource
(
CommonConstants
.
SYSTEM_TYPE_P024_NO_3
);
//pc
...
...
@@ -150,11 +150,11 @@ public class AccountController extends AccountBaseController {
public
PicaResponse
loginRegister
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
this
.
checkMobilePhone
(
request
.
getMobile
());
AccountReq
req
=
new
AccountReq
();
req
.
setMobilePhone
(
request
.
getMobile
());
req
.
setPassword
(
null
);
//登录或注册,只能使用验证码
req
.
setAuthCode
(
request
.
getAuthCode
());
req
.
setFlag
(
"1"
);
req
.
setUnionid
(
request
.
getUnionId
());
//判断账号是否已经存在
...
...
@@ -181,6 +181,7 @@ public class AccountController extends AccountBaseController {
//获取验证码redis key
private
String
getAuthCodeKey
(
String
mobilePhone
,
String
flag
)
{
logger
.
info
(
AUTH_CODE_PREFIX
+
flag
+
"-"
+
EncryptUtils
.
encryptContent
(
mobilePhone
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
));
return
AUTH_CODE_PREFIX
+
flag
+
"-"
+
EncryptUtils
.
encryptContent
(
mobilePhone
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
}
...
...
@@ -193,7 +194,9 @@ public class AccountController extends AccountBaseController {
}
String
authCodeKey
=
this
.
getAuthCodeKey
(
req
.
getMobilePhone
(),
flag
);
logger
.
info
(
authCodeKey
);
String
cacheCode
=
redisClient
.
get
(
authCodeKey
);
//从redis获取验证码
if
(
StringUtils
.
isBlank
(
cacheCode
))
{
throw
new
PicaException
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"短信验证码已过期,请重新获取"
);
}
...
...
@@ -285,7 +288,7 @@ public class AccountController extends AccountBaseController {
this
.
checkAuthCode
(
req
);
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
Account
account
=
new
Account
();
account
.
setMobilePhone
(
req
.
getMobilePhone
(
));
account
.
setMobilePhone
(
EncryptUtils
.
encryptContent
(
req
.
getMobilePhone
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
));
switch
(
deviceType
)
{
//注册来源
case
"1"
:
account
.
setRegisterSource
(
CommonConstants
.
SYSTEM_TYPE_P024_NO_3
);
//pc
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
d8678e11
...
...
@@ -24,6 +24,8 @@ import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -36,6 +38,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
AutoCodeController
extends
AccountBaseController
{
private
final
String
AUTH_CODE_PREFIX
=
"authCode-"
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountController
.
class
);
@Autowired
private
AccountInfoDetailMapper
accountInfoDetailMapper
;
...
...
@@ -83,6 +86,7 @@ public class AutoCodeController extends AccountBaseController {
long
senderId
=
account
==
null
?
0L
:
account
.
getId
();
//验证码保存到redis,失效时间10分钟
cacheClient
.
set
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
),
authCode
,
600
);
logger
.
info
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
));
//发送短信
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
return
PicaResponse
.
toResponse
(
StringUtils
.
EMPTY
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountServiceImpl.java
浏览文件 @
d8678e11
...
...
@@ -69,6 +69,7 @@ public class AccountServiceImpl implements AccountService {
//账户表
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
Date
currentTime
=
new
Date
();
accountInfo
.
setMobilePhone
(
account
.
getMobilePhone
());
accountInfo
.
setPassword
(
""
);
accountInfo
.
setCreatedTime
(
currentTime
);
accountInfo
.
setCreatedId
(
0
);
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录