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
提交
133f0cc7
提交
133f0cc7
编写于
11月 05, 2020
作者:
Peijun.zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release' into 'master'
Release See merge request
!58
上级
df6dd558
965ca4b9
流水线
#31913
已失败 于阶段
in 0 second
变更
3
流水线
1
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
703 行增加
和
669 行删除
+703
-669
DiyAcctInitReq.java
...oud/account/account/common/req/circle/DiyAcctInitReq.java
+10
-0
CircleAccountServiceImpl.java
...account/server/service/impl/CircleAccountServiceImpl.java
+36
-15
LoginServiceImpl.java
...account/account/server/service/impl/LoginServiceImpl.java
+657
-654
未找到文件。
common/src/main/java/com/pica/cloud/account/account/common/req/circle/DiyAcctInitReq.java
浏览文件 @
133f0cc7
...
...
@@ -6,6 +6,16 @@ public class DiyAcctInitReq {
private
List
<
String
>
decryMobileList
;
private
List
<
DiyAcctInit
>
diyAcctInitList
;
public
List
<
DiyAcctInit
>
getDiyAcctInitList
()
{
return
diyAcctInitList
;
}
public
void
setDiyAcctInitList
(
List
<
DiyAcctInit
>
diyAcctInitList
)
{
this
.
diyAcctInitList
=
diyAcctInitList
;
}
public
List
<
String
>
getDecryMobileList
()
{
return
decryMobileList
;
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/CircleAccountServiceImpl.java
浏览文件 @
133f0cc7
...
...
@@ -3,9 +3,9 @@ package com.pica.cloud.account.account.server.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.common.req.circle.CircleAcctInit
;
import
com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq
;
import
com.pica.cloud.account.account.common.req.circle.DiyAcctInit
;
import
com.pica.cloud.account.account.common.req.shop.ShopAcctInit
;
import
com.pica.cloud.account.account.common.req.shop.ShopAcctInitReq
;
import
com.pica.cloud.account.account.common.req.circle.DiyAcctInit
;
import
com.pica.cloud.account.account.common.req.circle.DiyAcctInitReq
;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
...
...
@@ -14,6 +14,7 @@ import com.pica.cloud.account.account.server.service.AccountService;
import
com.pica.cloud.account.account.server.service.CircleAccountService
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -78,9 +79,9 @@ public class CircleAccountServiceImpl implements CircleAccountService {
logger
.
info
(
"createDiyAccount:{}"
,
JSONObject
.
toJSONString
(
diyAcctInitReq
));
List
<
Integer
>
savedIds
=
new
ArrayList
<>();
try
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDecryMobileList
())){
for
(
String
decryMobile
:
diyAcctInitReq
.
getDecryMobileList
()){
String
encryMobile
=
EncryptUtils
.
encryptContent
(
decryMobile
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
){
Account
account
=
new
Account
();
...
...
@@ -94,6 +95,26 @@ public class CircleAccountServiceImpl implements CircleAccountService {
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDiyAcctInitList
())){
for
(
DiyAcctInit
acctInit
:
diyAcctInitReq
.
getDiyAcctInitList
()){
String
encryMobile
=
EncryptUtils
.
encryptContent
(
acctInit
.
getDecryMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
){
Account
account
=
new
Account
();
account
.
setName
(
acctInit
.
getUserName
());
account
.
setMobilePhone
(
encryMobile
);
account
.
setRegisterSource
(
5
);
//admin
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
savedIds
.
add
(
account
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
savedIds
.
add
(
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
}
}
catch
(
Exception
e
){
logger
.
error
(
"createDiyAccount error:{}"
,
e
.
getMessage
());
throw
e
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/LoginServiceImpl.java
浏览文件 @
133f0cc7
...
...
@@ -129,7 +129,7 @@ public class LoginServiceImpl implements LoginService {
public
LoginResult
login
(
BaseRequest
request
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
));
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
));
String
mobile
=
request
.
getMobile
();
Integer
sourceType
=
request
.
getSourceType
();
String
encrypt
=
AESUtil
.
encryptV0
(
mobile
);
...
...
@@ -143,11 +143,11 @@ public class LoginServiceImpl implements LoginService {
// 新版-未设置密码
if
(
StringUtils
.
isEmpty
(
oldPwd
))
{
if
(
sourceType
!=
null
&&
SourceTypeEnum
.
H5
.
getCode
().
equals
(
sourceType
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
);
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD_H5
.
getCode
(),
AccountExceptionEnum
.
PICA_MOBILE_NOT_SETED_PASSWORD_H5
.
getMessage
());
}
else
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号{mobile}尚未设置密码,请先设置密码。"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号{mobile}尚未设置密码,请先设置密码。"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PASSWORD_RULE_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_PASSWORD_RULE_ERROR
.
getMessage
()
...
...
@@ -159,12 +159,12 @@ public class LoginServiceImpl implements LoginService {
String
lockKey
=
Constants
.
ACCOUNT_LOCK_KEY
.
replace
(
"{mobile}"
,
mobile
);
if
(
redisClient
.
exists
(
lockKey
))
{
if
(
sourceType
!=
null
&&
SourceTypeEnum
.
H5
.
getCode
().
equals
(
sourceType
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5_H5
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5_H5
.
getMessage
());
}
else
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号{mobile}的密码错误次数已达上限请24小时后再试,或请使用其他登录方式或找回密码"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号{mobile}的密码错误次数已达上限请24小时后再试,或请使用其他登录方式或找回密码"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getMessage
().
replace
(
"{mobile}"
,
mobile
));
...
...
@@ -172,7 +172,7 @@ public class LoginServiceImpl implements LoginService {
}
if
(
password
.
equals
(
oldPwd
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"接下来调用pwdLoginCorrect"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"接下来调用pwdLoginCorrect"
);
return
pwdLoginCorrect
(
request
,
mobile
,
encrypt
,
accountInfoEntity
);
}
else
{
...
...
@@ -182,7 +182,7 @@ public class LoginServiceImpl implements LoginService {
errorCount
=
errorCount
+
1
;
redisClient
.
set
(
errorKey
,
errorCount
,
Constants
.
PWD_ERROR_NUM_SECONDS
);
if
(
errorCount
<=
4
)
{
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
,
"密码错误,请重试"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_4
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_4
.
getMessage
());
...
...
@@ -190,12 +190,12 @@ public class LoginServiceImpl implements LoginService {
// 设置账号锁定24h
redisClient
.
set
(
lockKey
,
mobile
,
Constants
.
PWD_ERROR_NUM_SECONDS
);
if
(
sourceType
!=
null
&&
SourceTypeEnum
.
H5
.
getCode
().
equals
(
sourceType
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5_H5
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5_H5
.
getMessage
());
}
else
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号{mobile}的密码错误次数已达上限请24小时后再试,或请使用其他登录方式或找回密码"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该账号{mobile}的密码错误次数已达上限请24小时后再试,或请使用其他登录方式或找回密码"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getMessage
().
replace
(
"{mobile}"
,
mobile
));
...
...
@@ -203,7 +203,7 @@ public class LoginServiceImpl implements LoginService {
}
}
else
{
redisClient
.
set
(
errorKey
,
1
,
Constants
.
PWD_ERROR_NUM_SECONDS
);
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
,
"密码错误,请重试"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_4
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_4
.
getMessage
());
...
...
@@ -214,12 +214,12 @@ public class LoginServiceImpl implements LoginService {
}
else
{
// 旧版本
if
(
password
.
equals
(
oldPwd
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"接下来调用pwdLoginCorrect"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"接下来调用pwdLoginCorrect"
);
return
pwdLoginCorrect
(
request
,
mobile
,
encrypt
,
accountInfoEntity
);
}
else
{
logger
.
info
(
"login failure:"
+
mobile
);
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
,
"请输入正确的密码"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PASSWORD_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_PASSWORD_ERROR
.
getMessage
());
}
...
...
@@ -228,20 +228,20 @@ public class LoginServiceImpl implements LoginService {
if
(
null
!=
request
.
getBizType
()
&&
request
.
getBizType
().
equals
(
1
))
{
if
(
sourceType
!=
null
&&
SourceTypeEnum
.
H5
.
getCode
().
equals
(
sourceType
))
{
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
);
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_MOBILE_NOT_REGIST_H5
.
getCode
(),
AccountExceptionEnum
.
PICA_MOBILE_NOT_REGIST_H5
.
getMessage
());
}
else
{
// 新版-未注册
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号{mobile}尚未设置密码,请先设置密码。"
);
intactUtil
.
sendIntact
(
batchNo
,
"login"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号{mobile}尚未设置密码,请先设置密码。"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PASSWORD_RULE_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_PASSWORD_RULE_ERROR
.
getMessage
()
.
replace
(
"{mobile}"
,
mobile
));
}
}
else
{
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
,
"未注册,请先注册"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_NOT_REGISTER
.
getCode
(),
AccountExceptionEnum
.
PICA_NOT_REGISTER
.
getMessage
());
}
...
...
@@ -259,16 +259,16 @@ public class LoginServiceImpl implements LoginService {
private
LoginResult
pwdLoginCorrect
(
BaseRequest
request
,
String
mobile
,
String
encrypt
,
AccountInfoEntity
accountInfoEntity
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
)+
",+mobile:"
+
mobile
+
",encrypt:"
+
encrypt
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
)
+
",+mobile:"
+
mobile
+
",encrypt:"
+
encrypt
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
Date
currentTime
=
new
Date
();
Integer
acctId
=
accountInfoEntity
.
getId
();
int
productType
=
request
.
getProductType
();
int
sourceType
=
request
.
getSourceType
();
Doctor
doctorInfo
=
null
;
doctorInfo
=
doctorInfoMapper
.
getDoctorInfoByMobile
(
encrypt
);
if
(
null
==
doctorInfo
)
{
logger
.
error
(
"此手机号无用户:{}"
,
mobile
);
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
)+
",+mobile 此手机号无用户:"
+
mobile
+
",encrypt:"
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
if
(
null
==
doctorInfo
)
{
logger
.
error
(
"此手机号无用户:{}"
,
mobile
);
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
)
+
",+mobile 此手机号无用户:"
+
mobile
+
",encrypt:"
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
}
Integer
userId
=
0
;
if
(
productType
!=
AccountTypeEnum
.
PRODUCT_TYPE_HEALTH
.
getCode
())
{
...
...
@@ -303,7 +303,7 @@ public class LoginServiceImpl implements LoginService {
redisClient
.
del
(
pwdErrorNum
);
}
}
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
)+
",+mobile:"
+
mobile
+
",encrypt:"
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
intactUtil
.
sendIntact
(
batchNo
,
"pwdLoginCorrect"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
)
+
",+mobile:"
+
mobile
+
",encrypt:"
+
",accountInfoEntity:"
+
JSON
.
toJSONString
(
accountInfoEntity
));
return
result
;
}
...
...
@@ -338,7 +338,7 @@ public class LoginServiceImpl implements LoginService {
private
LoginResult
processLogin
(
BaseRequest
baseRequest
,
Integer
acctId
,
Integer
loginType
,
QueryMobileEntity
queryMobileEntity
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"processLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"baseRequest:"
+
JSON
.
toJSONString
(
baseRequest
)+
",+acctId:"
+
acctId
+
",loginType:"
+
loginType
+
",queryMobileEntity:"
+
JSON
.
toJSONString
(
queryMobileEntity
));
intactUtil
.
sendIntact
(
batchNo
,
"processLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"baseRequest:"
+
JSON
.
toJSONString
(
baseRequest
)
+
",+acctId:"
+
acctId
+
",loginType:"
+
loginType
+
",queryMobileEntity:"
+
JSON
.
toJSONString
(
queryMobileEntity
));
Date
currentTime
=
new
Date
();
Long
userId
=
accountUtils
.
getUserIdByAcctId
(
baseRequest
.
getProductType
(),
acctId
);
Account
account
=
new
Account
();
...
...
@@ -360,12 +360,12 @@ public class LoginServiceImpl implements LoginService {
}
//记录登录日志
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
baseRequest
.
getProductType
(),
baseRequest
.
getSourceType
(),
loginType
,
baseRequest
.
getLoginIp
(),
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
baseRequest
.
getUserTokenTourist
());
loginType
,
baseRequest
.
getLoginIp
(),
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
baseRequest
.
getUserTokenTourist
());
if
(
queryMobileEntity
!=
null
)
{
entity
.
setQueryMobileEntity
(
queryMobileEntity
);
}
picaLogUtils
.
info
(
entity
);
intactUtil
.
sendIntact
(
batchNo
,
"processLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"baseRequest:"
+
JSON
.
toJSONString
(
baseRequest
)+
",+acctId:"
+
acctId
+
",loginType:"
+
loginType
+
",queryMobileEntity:"
+
JSON
.
toJSONString
(
queryMobileEntity
));
intactUtil
.
sendIntact
(
batchNo
,
"processLogin"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"baseRequest:"
+
JSON
.
toJSONString
(
baseRequest
)
+
",+acctId:"
+
acctId
+
",loginType:"
+
loginType
+
",queryMobileEntity:"
+
JSON
.
toJSONString
(
queryMobileEntity
));
return
result
;
}
...
...
@@ -375,7 +375,7 @@ public class LoginServiceImpl implements LoginService {
public
LoginResult
loginByWeChat
(
BaseRequest
request
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
));
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
));
WeChatEntity
weChatEntity
=
null
;
if
(
null
!=
request
.
getBizType
()
&&
request
.
getBizType
().
equals
(
1
))
{
...
...
@@ -386,7 +386,7 @@ public class LoginServiceImpl implements LoginService {
weChatEntity
=
WeChatUtils
.
getAuthorizationInfo
(
appId
,
appSecret
,
request
.
getWeChatCode
());
}
if
(
weChatEntity
==
null
||
StringUtils
.
isEmpty
(
weChatEntity
.
getOpenid
())
||
StringUtils
.
isEmpty
(
weChatEntity
.
getAccess_token
()))
{
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"微信登录授权code不正确:"
);
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"微信登录授权code不正确:"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_WECHAT_CODE_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_WECHAT_CODE_ERROR
.
getMessage
());
}
...
...
@@ -396,15 +396,15 @@ public class LoginServiceImpl implements LoginService {
map
.
put
(
"openid"
,
weChatEntity
.
getOpenid
());
Map
weChatUserInfo
=
WeChatUtils
.
getWeChatUserInfo
(
map
,
weChatURL
);
WeChatUserInfoEntity
weChatUserInfoEntity
=
WeChatUtils
.
mergeWechatUserInfo
(
weChatUserInfo
,
weChatEntity
.
getOpenid
());
logger
.
info
(
"loginByWeChat: 获取微信用户信息:{}"
,
JSONObject
.
toJSONString
(
weChatUserInfoEntity
));
logger
.
info
(
"loginByWeChat: 获取微信用户信息:{}"
,
JSONObject
.
toJSONString
(
weChatUserInfoEntity
));
String
unionId
=
weChatUserInfoEntity
.
getUnionid
();
if
(
StringUtil
.
isEmpty
(
unionId
))
{
logger
.
error
(
"loginByWeChat get unionId:{}"
,
unionId
);
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"微信登录无法获取unionId:"
);
if
(
StringUtil
.
isEmpty
(
unionId
))
{
logger
.
error
(
"loginByWeChat get unionId:{}"
,
unionId
);
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"微信登录无法获取unionId:"
);
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_WECHAT_CODE_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_WECHAT_CODE_ERROR
.
getMessage
());
}
AccountUnionEntity
accountUnionEntity
=
accountUnionMapper
.
selectByUnionId
(
unionId
);
logger
.
info
(
"loginByWeChat accountUnionEntity:{}"
,
JSONObject
.
toJSONString
(
accountUnionEntity
));
logger
.
info
(
"loginByWeChat accountUnionEntity:{}"
,
JSONObject
.
toJSONString
(
accountUnionEntity
));
//是否绑定逻辑的判断
if
(
accountUnionEntity
!=
null
)
{
Long
acctId
=
accountUnionEntity
.
getAcctId
();
...
...
@@ -414,7 +414,7 @@ public class LoginServiceImpl implements LoginService {
account
.
setAcctId
(
acctId
.
intValue
());
account
.
setCreatTime
(
new
Date
());
Doctor
d
=
doctorInfoMapper
.
selectByPrimaryKey
(
Math
.
toIntExact
(
userId
));
if
(
d
!=
null
&&
StringUtils
.
isNotBlank
(
d
.
getMobilePhone
()))
{
if
(
d
!=
null
&&
StringUtils
.
isNotBlank
(
d
.
getMobilePhone
()))
{
account
.
setMobilePhone
(
AESUtil
.
decryptV0
(
d
.
getMobilePhone
()));
}
else
{
account
.
setMobilePhone
(
""
);
...
...
@@ -439,9 +439,9 @@ public class LoginServiceImpl implements LoginService {
AccountTypeEnum
.
LOGIN_WE_CHAT
.
getCode
(),
request
.
getLoginIp
(),
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
request
.
getUserTokenTourist
());
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
request
.
getUserTokenTourist
());
picaLogUtils
.
info
(
entity
);
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
));
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
));
return
result
;
...
...
@@ -454,7 +454,7 @@ public class LoginServiceImpl implements LoginService {
LoginResult
result
=
new
LoginResult
();
result
.
setUnionId
(
unionId
);
result
.
setBindFlag
(
AccountTypeEnum
.
BIND_STATUS_FAILURE
.
getCode
()
+
""
);
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
));
intactUtil
.
sendIntact
(
batchNo
,
"loginByWeChat"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"request:"
+
JSON
.
toJSONString
(
request
));
return
result
;
}
...
...
@@ -548,9 +548,9 @@ public class LoginServiceImpl implements LoginService {
}
Integer
acctId
=
doctorInfoMapper
.
getAcctIdByDoctorId
(
doctorId
);
processAccountUnion
(
acctId
,
unionId
,
request
.
getProductType
(),
entity
);
Map
<
String
,
String
>
rtnMap
=
new
HashMap
();
rtnMap
.
put
(
"openId"
,
weChatEntity
.
getOpenid
());
rtnMap
.
put
(
"nickname"
,
weChatUserInfoEntity
.
getNickname
());
Map
<
String
,
String
>
rtnMap
=
new
HashMap
();
rtnMap
.
put
(
"openId"
,
weChatEntity
.
getOpenid
());
rtnMap
.
put
(
"nickname"
,
weChatUserInfoEntity
.
getNickname
());
return
rtnMap
;
}
...
...
@@ -564,15 +564,15 @@ public class LoginServiceImpl implements LoginService {
private
void
processAccountUnion
(
Integer
acctId
,
String
unionId
,
Integer
productType
,
AccountWeChatInfoEntity
entity
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
if
(
null
==
acctId
||
0
==
acctId
)
{
if
(
null
==
acctId
||
0
==
acctId
)
{
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_LOGIN_AGAIN
.
getCode
(),
AccountExceptionEnum
.
PICA_LOGIN_AGAIN
.
getMessage
());
}
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"acctId:"
+
acctId
+
",unionId:"
+
unionId
+
",productType:"
+
productType
);
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"acctId:"
+
acctId
+
",unionId:"
+
unionId
+
",productType:"
+
productType
);
//先查询当前产品线是否有记录?如果有就更新成delete_flag=2; 然后在插入新的绑定记录
AccountUnionEntity
accountUnionResult
=
accountUnionMapper
.
selectByUnionId
(
unionId
);
if
(
accountUnionResult
!=
null
)
{
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该微信号已绑定其他云鹊医账户,你可以使用微信登录云鹊医,在「设置」页解除绑定"
);
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该微信号已绑定其他云鹊医账户,你可以使用微信登录云鹊医,在「设置」页解除绑定"
);
if
(
entity
!=
null
)
{
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_WECHAT_UNBIND
.
getCode
(),
AccountExceptionEnum
.
PICA_WECHAT_UNBIND
.
getMessage
());
}
...
...
@@ -584,14 +584,17 @@ public class LoginServiceImpl implements LoginService {
AccountWeChatInfoEntity
entity2
=
null
;
if
(
accountUnionEntityAccount
!=
null
)
{
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号已绑定其他微信号,你可以在「设置」页解除绑定"
);
intactUtil
.
sendIntact
(
batchNo
,
"processAccountUnion"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号已绑定其他微信号,你可以在「设置」页解除绑定"
);
if
(
entity
!=
null
)
{
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_WECHAT_BIND_OTHER
.
getCode
(),
AccountExceptionEnum
.
PICA_WECHAT_BIND_OTHER
.
getMessage
());
}
}
if
(
accountUnionResult
==
null
||
accountUnionEntityAccount
==
null
)
{
/**存在刷的数据,account_wechat_info没数据,但是account_union有数据,这时候删除account_union数据重新绑定*/
if
(
entity
==
null
&&
accountUnionEntityAccount
!=
null
)
{
accountUnionMapper
.
deleteByAcctId
(
acctId
);
}
AccountUnionEntity
accountUnionEntity
=
new
AccountUnionEntity
();
accountUnionEntity
.
setAcctId
(
acctId
.
longValue
());
accountUnionEntity
.
setDeleteFlag
(
1
);
...
...
@@ -661,7 +664,7 @@ public class LoginServiceImpl implements LoginService {
public
LoginResult
oneClickLogin
(
OneClickLoginReq
req
)
{
QueryMobileEntity
queryMobileEntity
=
oneClickProcessor
.
tokenExchangeMobile
(
req
.
getToken
(),
req
.
getSourceType
());
if
(
queryMobileEntity
==
null
||
StringUtils
.
isBlank
(
queryMobileEntity
.
getMobile
())
||
!
ValidateUtils
.
isMobile
(
queryMobileEntity
.
getMobile
()))
{
logger
.
error
(
"oneClickLogin 闪验获取出错-queryMobileEntity:{}"
,
JSONObject
.
toJSONString
(
queryMobileEntity
));
logger
.
error
(
"oneClickLogin 闪验获取出错-queryMobileEntity:{}"
,
JSONObject
.
toJSONString
(
queryMobileEntity
));
throw
new
PicaException
(
PicaResultCode
.
INTERFACE_INVOKE_EXCEPTION
.
code
(),
"获取手机号失败!"
);
}
queryMobileEntity
.
setSourceType
(
req
.
getSourceType
());
...
...
@@ -776,7 +779,7 @@ public class LoginServiceImpl implements LoginService {
AccountExceptionEnum
.
PICA_PARAMS_ERROR
.
getMessage
());
}
// identifyToken校验
if
(!
checkIdentifyToken
(
request
))
{
if
(!
checkIdentifyToken
(
request
))
{
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_APPLE_TOKEN_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_APPLE_TOKEN_ERROR
.
getMessage
());
...
...
@@ -811,11 +814,11 @@ public class LoginServiceImpl implements LoginService {
AccountTypeEnum
.
LOGIN_APPLE
.
getCode
(),
request
.
getLoginIp
(),
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
request
.
getUserTokenTourist
());
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
request
.
getUserTokenTourist
());
picaLogUtils
.
info
(
entity
);
long
end1
=
System
.
currentTimeMillis
();
logger
.
info
(
"loginByApple1-duration {} millionSeconds"
,
(
end1
-
start
));
logger
.
info
(
"loginByApple1-duration {} millionSeconds"
,
(
end1
-
start
));
return
result
;
}
else
{
AccountAppleInfo
entity
=
accountAppleInfoMapper
.
selectByUserId
(
request
.
getAppleUserId
());
...
...
@@ -827,7 +830,7 @@ public class LoginServiceImpl implements LoginService {
result
.
setUnionId
(
request
.
getAppleUserId
());
result
.
setBindFlag
(
AccountTypeEnum
.
BIND_STATUS_FAILURE
.
getCode
()
+
""
);
long
end1
=
System
.
currentTimeMillis
();
logger
.
info
(
"loginByApple2-duration {} millionSeconds"
,
(
end1
-
start
));
logger
.
info
(
"loginByApple2-duration {} millionSeconds"
,
(
end1
-
start
));
return
result
;
}
}
...
...
@@ -862,9 +865,9 @@ public class LoginServiceImpl implements LoginService {
JSONObject
useAppleAuth
=
new
JSONObject
();
String
inAuth
=
new
String
(
Base64
.
decodeBase64
(
identifyToken
.
split
(
"\\."
)[
0
]));
String
inKid
=
JSONObject
.
parseObject
(
inAuth
).
get
(
"kid"
).
toString
();
for
(
Object
obj
:
keysArr
)
{
for
(
Object
obj
:
keysArr
)
{
JSONObject
appleAuth
=
JSONObject
.
parseObject
(
obj
.
toString
());
if
(
inKid
.
equals
(
appleAuth
.
getString
(
"kid"
)))
{
if
(
inKid
.
equals
(
appleAuth
.
getString
(
"kid"
)))
{
useAppleAuth
=
appleAuth
;
logger
.
info
(
"checkIdentifyToken-jsonObject1:{}"
,
useAppleAuth
);
break
;
...
...
@@ -1034,7 +1037,7 @@ public class LoginServiceImpl implements LoginService {
* @Return int
*/
@Override
public
int
insertLoginAesLog
(
LogLoginAes
aes
)
{
public
int
insertLoginAesLog
(
LogLoginAes
aes
)
{
aes
.
setDeleteFlag
(
1
);
aes
.
setCreateId
(
999999
);
aes
.
setModifyId
(
999999
);
...
...
@@ -1043,4 +1046,4 @@ public class LoginServiceImpl implements LoginService {
return
logLoginAesMapper
.
insert
(
aes
);
}
}
}
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录