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
提交
6f59d520
提交
6f59d520
编写于
2月 18, 2022
作者:
wenhao.qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
校验短信验证码(不清缓存)
上级
76d3d63e
流水线
#42374
已取消 于阶段
变更
2
流水线
1
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
91 行增加
和
50 行删除
+91
-50
CaptchaClient.java
.../com/pica/cloud/account/account/client/CaptchaClient.java
+6
-1
AccountController.java
.../account/account/server/controller/AccountController.java
+85
-49
未找到文件。
client/src/main/java/com/pica/cloud/account/account/client/CaptchaClient.java
浏览文件 @
6f59d520
...
...
@@ -21,4 +21,9 @@ public interface CaptchaClient {
PicaResponse
checkAuthCode
(
@RequestParam
(
"mobilePhone"
)
String
mobilePhone
,
@RequestParam
(
"flag"
)
String
flag
,
@RequestParam
(
"authCode"
)
String
authCode
);
@GetMapping
(
"/account/account/checkMobile/authCode"
)
PicaResponse
checkDetectionCode
(
@RequestParam
(
"mobilePhone"
)
String
mobilePhone
,
@RequestParam
(
"flag"
)
String
flag
,
@RequestParam
(
"authCode"
)
String
authCode
);
}
server/src/main/java/com/pica/cloud/account/account/server/controller/AccountController.java
浏览文件 @
6f59d520
...
...
@@ -114,6 +114,21 @@ public class AccountController extends AccountBaseController {
return
PicaResponse
.
toResponse
();
}
@ApiOperation
(
"校验短信验证码(不清缓存)"
)
@GetMapping
(
"/checkMobile/authCode"
)
public
PicaResponse
checkDetectionCode
(
@ApiParam
(
value
=
"手机号"
,
required
=
true
)
@RequestParam
(
"mobilePhone"
)
String
mobilePhone
,
@ApiParam
(
value
=
"验证码类型 0默认 1注册 2修改密码 4微信登录绑定手机 5修改手机 6重置密码 7患者招募提交问卷(效验 9患者报告"
)
@RequestParam
(
value
=
"flag"
,
defaultValue
=
"0"
)
String
flag
,
@ApiParam
(
value
=
"短信验证码"
,
required
=
true
)
@RequestParam
(
"authCode"
)
String
authCode
)
{
this
.
checkMobilePhone
(
mobilePhone
);
AccountReq
accountReq
=
new
AccountReq
();
accountReq
.
setMobilePhone
(
mobilePhone
);
accountReq
.
setFlag
(
flag
);
accountReq
.
setAuthCode
(
authCode
);
this
.
checkAuthCodeV2
(
accountReq
);
return
PicaResponse
.
toResponse
();
}
@EnabledLoginValidate
@ApiOperation
(
"校验登录用户的短信验证码"
)
@GetMapping
(
"/check/H5/authCode/login"
)
...
...
@@ -136,25 +151,25 @@ public class AccountController extends AccountBaseController {
@ApiOperation
(
"微信登录"
)
@PostMapping
(
"/login/wechat"
)
public
PicaResponse
<
String
>
wechatLogin
(
@RequestBody
AccountReq
req
)
{
logger
.
info
(
"wechatLogin:{}"
,
JSONObject
.
toJSONString
(
req
));
logger
.
info
(
"wechatLogin:{}"
,
JSONObject
.
toJSONString
(
req
));
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
if
(
StringUtils
.
isBlank
(
req
.
getUnionid
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"确认unionId"
);
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"确认unionId"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"缺少unionid"
);
}
Account
account
=
accountService
.
getByUnionid
(
req
.
getUnionid
());
//获取账号信息
if
(
account
==
null
)
{
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该unionid未绑定云鹊医账号"
);
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该unionid未绑定云鹊医账号"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"该unionid未绑定云鹊医账号"
);
}
//已经绑定过云鹊医账号,登录成功,返回token
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
String
newToken
=
this
.
generateToken
(
account
,
deviceType
);
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"wechatLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
return
PicaResponse
.
toResponse
(
newToken
);
}
...
...
@@ -166,22 +181,22 @@ public class AccountController extends AccountBaseController {
logger
.
info
(
"login:{}"
,
JSONObject
.
toJSONString
(
req
));
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
Account
account
=
accountService
.
getByMobilePhone
(
req
.
getMobilePhone
());
//获取账号信息
if
(
account
==
null
)
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"未注册,请验证码登录"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"未注册,请验证码登录"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"未注册,请验证码登录"
);
}
if
(
StringUtils
.
isBlank
(
req
.
getPassword
()))
{
//验证码登录
req
.
setFlag
(
"0"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"校验验证码前的返回,因为验证码可能校验不通过,就直接返回了"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"校验验证码前的返回,因为验证码可能校验不通过,就直接返回了"
);
//校验验证码
this
.
checkAuthCode
(
req
);
}
else
{
//密码登录
if
(!
StringUtils
.
equals
(
req
.
getPassword
(),
account
.
getPassword
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"请输入正确的密码"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"请输入正确的密码"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"请输入正确的密码"
);
}
}
...
...
@@ -201,13 +216,13 @@ public class AccountController extends AccountBaseController {
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
// String newToken = this.generateToken(account, deviceType);
String
newToken
=
""
;
if
(
deviceType
.
equals
(
"1"
))
{
if
(
deviceType
.
equals
(
"1"
))
{
newToken
=
this
.
generateToken
(
account
,
"4"
);
//pc端注册,目前无法生成新token
}
else
{
}
else
{
newToken
=
this
.
generateToken
(
account
,
deviceType
);
}
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
return
PicaResponse
.
toResponse
(
newToken
);
}
...
...
@@ -215,10 +230,10 @@ public class AccountController extends AccountBaseController {
// @PostMapping("/register")
public
PicaResponse
<
LoginResult
>
register
(
@RequestBody
AccountReq
req
)
{
this
.
checkMobilePhone
(
req
.
getMobilePhone
());
accountUtils
.
checkRegisterMobilePhoneAndAuthCode
(
req
.
getMobilePhone
(),
req
.
getFlag
(),
req
.
getAuthCode
());
accountUtils
.
checkRegisterMobilePhoneAndAuthCode
(
req
.
getMobilePhone
(),
req
.
getFlag
(),
req
.
getAuthCode
());
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
Account
account
=
new
Account
();
account
.
setMobilePhone
(
EncryptUtils
.
encryptContent
(
req
.
getMobilePhone
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
));
...
...
@@ -236,19 +251,19 @@ public class AccountController extends AccountBaseController {
account
.
setRegisterSource
(
AccountTypeEnum
.
DEVICE_TYPE_H5
.
getCode
());
//H5注册
}
//创建账号
accountService
.
createAccount
(
account
,
null
);
accountService
.
createAccount
(
account
,
null
);
//生成token并返回
String
newToken
=
""
;
if
(
deviceType
.
equals
(
"1"
))
{
if
(
deviceType
.
equals
(
"1"
))
{
newToken
=
this
.
generateToken
(
account
,
"4"
);
//pc端注册,目前无法生成新token
}
else
{
}
else
{
newToken
=
this
.
generateToken
(
account
,
deviceType
);
}
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
newToken
);
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
return
PicaResponse
.
toResponse
(
result
);
}
...
...
@@ -261,7 +276,7 @@ public class AccountController extends AccountBaseController {
this
.
checkMobilePhone
(
request
.
getMobile
());
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"entity:"
+
JSON
.
toJSONString
(
entity
));
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"entity:"
+
JSON
.
toJSONString
(
entity
));
AccountReq
req
=
new
AccountReq
();
req
.
setMobilePhone
(
request
.
getMobile
());
// 登录或注册,只能使用验证码
...
...
@@ -278,15 +293,15 @@ public class AccountController extends AccountBaseController {
try
{
response
=
this
.
login
(
req
);
}
catch
(
PicaException
e
)
{
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
response
));
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
response
));
}
throw
e
;
}
if
(
response
.
getData
()
!=
null
)
{
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
response
.
getData
().
toString
());
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"登录成功,返回值:"
+
JSON
.
toJSONString
(
response
.
getData
()));
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"登录成功,返回值:"
+
JSON
.
toJSONString
(
response
.
getData
()));
return
PicaResponse
.
toResponse
(
result
);
}
...
...
@@ -297,12 +312,12 @@ public class AccountController extends AccountBaseController {
try
{
result
=
this
.
register
(
req
);
}
catch
(
PicaException
e
)
{
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
result
));
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
result
));
}
throw
e
;
}
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"注册成功,返回值:"
+
JSON
.
toJSONString
(
result
));
intactUtil
.
sendIntact
(
batchNo
,
"h5-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"注册成功,返回值:"
+
JSON
.
toJSONString
(
result
));
return
result
;
}
}
...
...
@@ -316,7 +331,7 @@ public class AccountController extends AccountBaseController {
this
.
checkMobilePhone
(
request
.
getMobile
());
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"entity:"
+
JSON
.
toJSONString
(
entity
));
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"entity:"
+
JSON
.
toJSONString
(
entity
));
AccountReq
req
=
new
AccountReq
();
req
.
setMobilePhone
(
request
.
getMobile
());
// 登录或注册,只能使用验证码
...
...
@@ -337,22 +352,22 @@ public class AccountController extends AccountBaseController {
logger
.
info
(
"login:{}"
,
JSONObject
.
toJSONString
(
req
));
//接入新旭事务一致性
String
batchNo1
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
Account
account1
=
accountService
.
getByMobilePhone
(
req
.
getMobilePhone
());
//获取账号信息
if
(
account1
==
null
)
{
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"未注册,请验证码登录"
);
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"未注册,请验证码登录"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"未注册,请验证码登录"
);
}
if
(
StringUtils
.
isBlank
(
req
.
getPassword
()))
{
//验证码登录
req
.
setFlag
(
"0"
);
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"校验验证码前的返回,因为验证码可能校验不通过,就直接返回了"
);
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"校验验证码前的返回,因为验证码可能校验不通过,就直接返回了"
);
//校验验证码
this
.
checkAuthCode
(
req
);
}
else
{
//密码登录
if
(!
StringUtils
.
equals
(
req
.
getPassword
(),
account1
.
getPassword
()))
{
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"请输入正确的密码"
);
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"请输入正确的密码"
);
return
PicaResponse
.
toResponse
(
null
,
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"请输入正确的密码"
);
}
}
...
...
@@ -371,20 +386,20 @@ public class AccountController extends AccountBaseController {
//登录成功,清除旧token,生成新token
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
String
newToken
=
this
.
generateTokenWebLive
(
account1
,
deviceType
);
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo1
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
response
=
PicaResponse
.
toResponse
(
newToken
);
}
catch
(
PicaException
e
)
{
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
response
));
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
response
));
}
throw
e
;
}
if
(
response
.
getData
()
!=
null
)
{
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
response
.
getData
().
toString
());
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"登录成功,返回值:"
+
JSON
.
toJSONString
(
response
.
getData
()));
intactUtil
.
sendIntact
(
batchNo
,
"webLive-loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"登录成功,返回值:"
+
JSON
.
toJSONString
(
response
.
getData
()));
return
PicaResponse
.
toResponse
(
result
);
}
...
...
@@ -396,10 +411,10 @@ public class AccountController extends AccountBaseController {
// result = this.register(req);
this
.
checkMobilePhone
(
req
.
getMobilePhone
());
accountUtils
.
checkRegisterMobilePhoneAndAuthCode
(
req
.
getMobilePhone
(),
req
.
getFlag
(),
req
.
getAuthCode
());
accountUtils
.
checkRegisterMobilePhoneAndAuthCode
(
req
.
getMobilePhone
(),
req
.
getFlag
(),
req
.
getAuthCode
());
//接入新旭事务一致性
String
batchNo2
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo2
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo2
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"req:"
+
JSON
.
toJSONString
(
req
));
String
deviceType
=
super
.
getDeviceInfo
(
"device_type"
);
//1:pc 2:android 3:ios
Account
account2
=
new
Account
();
account2
.
setMobilePhone
(
EncryptUtils
.
encryptContent
(
req
.
getMobilePhone
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
));
...
...
@@ -418,32 +433,32 @@ public class AccountController extends AccountBaseController {
}
//创建web live账号
accountService
.
createAccount
(
account2
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
accountService
.
createAccount
(
account2
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
//生成token并返回
String
newToken
=
this
.
generateTokenWebLive
(
account2
,
deviceType
);
LoginResult
result1
=
new
LoginResult
();
result1
.
setToken
(
newToken
);
intactUtil
.
sendIntact
(
batchNo2
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
intactUtil
.
sendIntact
(
batchNo2
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"req:"
+
JSON
.
toJSONString
(
req
));
// return PicaResponse.toResponse(result);
result
=
PicaResponse
.
toResponse
(
result1
);
}
catch
(
PicaException
e
)
{
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"webLive--loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
result
));
if
(
e
.
getCode
().
equals
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
())
||
e
.
getCode
().
equals
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"webLive--loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"验证码错误或过期-不加入提醒,返回值:"
+
JSON
.
toJSONString
(
result
));
}
throw
e
;
}
intactUtil
.
sendIntact
(
batchNo
,
"webLive--loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"注册成功,返回值:"
+
JSON
.
toJSONString
(
result
));
intactUtil
.
sendIntact
(
batchNo
,
"webLive--loginRegister"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"注册成功,返回值:"
+
JSON
.
toJSONString
(
result
));
return
result
;
}
}
@ApiOperation
(
"获取内部机构医生ids"
)
@GetMapping
(
"/innerDoctors"
)
public
PicaResponse
<
List
<
Integer
>>
getDoctorsByInnerOrg
(){
public
PicaResponse
<
List
<
Integer
>>
getDoctorsByInnerOrg
()
{
return
PicaResponse
.
toResponse
(
doctorService
.
getDoctorsByInnerOrg
());
}
...
...
@@ -481,6 +496,27 @@ public class AccountController extends AccountBaseController {
redisClient
.
del
(
authCodeKey
);
//清除验证码
}
//校验验证码(注释删除逻辑)
private
void
checkAuthCodeV2
(
AccountReq
req
)
{
String
flag
=
StringUtils
.
isBlank
(
req
.
getFlag
())
?
"0"
:
req
.
getFlag
();
if
(
StringUtils
.
isBlank
(
req
.
getAuthCode
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
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
(),
"短信验证码已过期,请重新获取"
);
}
if
(!
StringUtils
.
equals
(
req
.
getAuthCode
(),
cacheCode
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
redisClient
.
del
(
authCodeKey
);
//清除验证码
}
//生成H5 token
private
String
generateH5Token
(
Account
account
)
{
String
newToken
=
StringUtils
.
EMPTY
;
...
...
@@ -554,7 +590,7 @@ public class AccountController extends AccountBaseController {
private
String
generateToken
(
Account
account
,
String
deviceType
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"account:"
+
JSON
.
toJSONString
(
account
)+
",deviceType:"
+
deviceType
);
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"account:"
+
JSON
.
toJSONString
(
account
)
+
",deviceType:"
+
deviceType
);
String
newToken
;
switch
(
deviceType
)
{
//设备信息
case
"1"
:
//pc
...
...
@@ -569,14 +605,14 @@ public class AccountController extends AccountBaseController {
default
:
//H5
newToken
=
this
.
generateH5Token
(
account
);
}
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"newToken:"
+
newToken
);
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"newToken:"
+
newToken
);
return
newToken
;
}
private
String
generateTokenWebLive
(
Account
account
,
String
deviceType
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"account:"
+
JSON
.
toJSONString
(
account
)+
",deviceType:"
+
deviceType
);
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"account:"
+
JSON
.
toJSONString
(
account
)
+
",deviceType:"
+
deviceType
);
String
newToken
;
switch
(
deviceType
)
{
//设备信息
case
"1"
:
//pc
...
...
@@ -591,7 +627,7 @@ public class AccountController extends AccountBaseController {
default
:
//H5
newToken
=
this
.
generateH5TokenWebLive
(
account
);
}
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"newToken:"
+
newToken
);
intactUtil
.
sendIntact
(
batchNo
,
"generateToken"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"newToken:"
+
newToken
);
return
newToken
;
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录