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
提交
bbd53501
提交
bbd53501
编写于
12月 15, 2020
作者:
Peijun.zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev-1223' into dev-1223
上级
3e46595b
f0f457ec
流水线
#33459
已失败 于阶段
in 0 second
变更
10
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
503 行增加
和
65 行删除
+503
-65
pom.xml
server/pom.xml
+5
-0
LoginV1Controller.java
.../account/account/server/controller/LoginV1Controller.java
+4
-23
LogOneChlickCheck.java
...loud/account/account/server/entity/LogOneChlickCheck.java
+115
-0
LoginResult.java
...pica/cloud/account/account/server/entity/LoginResult.java
+29
-0
LogOneChlickCheckMapper.java
...ccount/account/server/mapper/LogOneChlickCheckMapper.java
+21
-0
OneClickLoginReq.java
...ca/cloud/account/account/server/req/OneClickLoginReq.java
+10
-0
LoginV1Service.java
.../cloud/account/account/server/service/LoginV1Service.java
+1
-1
LoginV1ServiceImpl.java
...count/account/server/service/impl/LoginV1ServiceImpl.java
+141
-41
mybatis-generator.xml
server/src/main/resources/mybatis-generator.xml
+2
-0
LogOneChlickCheckMapper.xml
...er/src/main/resources/mybatis/LogOneChlickCheckMapper.xml
+175
-0
未找到文件。
server/pom.xml
浏览文件 @
bbd53501
...
@@ -253,6 +253,11 @@
...
@@ -253,6 +253,11 @@
<!-- </exclusions>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- </dependency>-->
<dependency>
<groupId>
com.pica.cloud.foundation
</groupId>
<artifactId>
pica-cloud-message-client
</artifactId>
<version>
1.0.6-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/LoginV1Controller.java
浏览文件 @
bbd53501
...
@@ -38,30 +38,11 @@ public class LoginV1Controller extends AccountBaseController {
...
@@ -38,30 +38,11 @@ public class LoginV1Controller extends AccountBaseController {
private
LoginService
loginService
;
private
LoginService
loginService
;
@ApiOperation
(
value
=
"app端手机号码一键登录 v1"
)
@ApiOperation
(
value
=
"app端手机号码一键登录 v1"
)
@PostMapping
(
"one
-
click"
)
@PostMapping
(
"one
_
click"
)
public
PicaResponse
<
LoginResult
>
oneClickLogin
(
@RequestBody
AesAuthCodeReq
aesReq
)
throws
Exception
{
public
PicaResponse
<
LoginResult
>
oneClickLogin
(
@RequestBody
AesAuthCodeReq
aesReq
)
throws
Exception
{
//added by joy begin
EncryptEntity
entity
=
new
EncryptEntity
();
EncryptEntity
entity
=
new
EncryptEntity
();
if
(
StringUtils
.
isEmpty
(
aesReq
.
getKey
())
&&
StringUtils
.
isEmpty
(
aesReq
.
getContent
()))
{
entity
.
setKey
(
aesReq
.
getKey
());
//明文时处理
entity
.
setContent
(
aesReq
.
getContent
());
entity
=
RSAUtil
.
getOneClickEncrypt
(
aesReq
);
logger
.
info
(
"AesAuthCodeReq oneClickLogin:"
+
JSONObject
.
toJSONString
(
aesReq
));
logger
.
info
(
"AesAuthCodeReq oneClickLogin encrypt:"
+
JSONObject
.
toJSONString
(
entity
));
//个别报错数据记流水
LogLoginAes
loginAes
=
new
LogLoginAes
();
loginAes
.
setChannel
(
3
);
loginAes
.
setDeviceToken
(
aesReq
.
getDevice_token
());
loginAes
.
setSourceType
(
null
==
super
.
getSourceType
()
?
0
:
super
.
getSourceType
());
loginAes
.
setOneToken
(
aesReq
.
getToken
());
loginAes
.
setMobile
(
aesReq
.
getMobile
());
loginAes
.
setDeviceInfo
(
super
.
getDeviceInfoLow
(
"deviceinfo"
));
loginService
.
insertLoginAesLog
(
loginAes
);
}
else
{
//执行原逻辑
entity
.
setKey
(
aesReq
.
getKey
());
entity
.
setContent
(
aesReq
.
getContent
());
}
//added by joy end
OneClickLoginReq
req
=
CryptoUtil
.
decrypt
(
entity
,
OneClickLoginReq
.
class
);
OneClickLoginReq
req
=
CryptoUtil
.
decrypt
(
entity
,
OneClickLoginReq
.
class
);
req
.
setProductType
(
super
.
getProductType
());
req
.
setProductType
(
super
.
getProductType
());
...
@@ -69,7 +50,7 @@ public class LoginV1Controller extends AccountBaseController {
...
@@ -69,7 +50,7 @@ public class LoginV1Controller extends AccountBaseController {
req
.
setLoginIp
(
super
.
getIpAddr
());
req
.
setLoginIp
(
super
.
getIpAddr
());
req
.
setUserTokenTourist
(
super
.
getUserTokenTourist
());
req
.
setUserTokenTourist
(
super
.
getUserTokenTourist
());
logger
.
info
(
"one-click req:{}"
,
JSONObject
.
toJSONString
(
req
));
logger
.
info
(
"one-click req:{}"
,
JSONObject
.
toJSONString
(
req
));
LoginResult
oneClickLoginResultVo
=
loginV1Service
.
oneClickLogin
(
req
);
LoginResult
oneClickLoginResultVo
=
loginV1Service
.
oneClickLogin
V1
(
req
);
return
PicaResponse
.
toResponse
(
oneClickLoginResultVo
);
return
PicaResponse
.
toResponse
(
oneClickLoginResultVo
);
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/entity/LogOneChlickCheck.java
0 → 100644
浏览文件 @
bbd53501
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
import
java.util.Date
;
public
class
LogOneChlickCheck
{
private
Integer
id
;
private
String
deviceToken
;
private
String
lastMobilePhone
;
private
String
currMobilePhone
;
private
Boolean
usedShanyan
;
private
String
keepBack
;
private
Byte
deleteFlag
;
private
Integer
createdId
;
private
Date
createdTime
;
private
Integer
modifiedId
;
private
Date
modifiedTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getDeviceToken
()
{
return
deviceToken
;
}
public
void
setDeviceToken
(
String
deviceToken
)
{
this
.
deviceToken
=
deviceToken
==
null
?
null
:
deviceToken
.
trim
();
}
public
String
getLastMobilePhone
()
{
return
lastMobilePhone
;
}
public
void
setLastMobilePhone
(
String
lastMobilePhone
)
{
this
.
lastMobilePhone
=
lastMobilePhone
==
null
?
null
:
lastMobilePhone
.
trim
();
}
public
String
getCurrMobilePhone
()
{
return
currMobilePhone
;
}
public
void
setCurrMobilePhone
(
String
currMobilePhone
)
{
this
.
currMobilePhone
=
currMobilePhone
==
null
?
null
:
currMobilePhone
.
trim
();
}
public
Boolean
getUsedShanyan
()
{
return
usedShanyan
;
}
public
void
setUsedShanyan
(
Boolean
usedShanyan
)
{
this
.
usedShanyan
=
usedShanyan
;
}
public
String
getKeepBack
()
{
return
keepBack
;
}
public
void
setKeepBack
(
String
keepBack
)
{
this
.
keepBack
=
keepBack
==
null
?
null
:
keepBack
.
trim
();
}
public
Byte
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Byte
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Integer
getCreatedId
()
{
return
createdId
;
}
public
void
setCreatedId
(
Integer
createdId
)
{
this
.
createdId
=
createdId
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
Integer
getModifiedId
()
{
return
modifiedId
;
}
public
void
setModifiedId
(
Integer
modifiedId
)
{
this
.
modifiedId
=
modifiedId
;
}
public
Date
getModifiedTime
()
{
return
modifiedTime
;
}
public
void
setModifiedTime
(
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/entity/LoginResult.java
浏览文件 @
bbd53501
...
@@ -30,6 +30,35 @@ public class LoginResult {
...
@@ -30,6 +30,35 @@ public class LoginResult {
@ApiModelProperty
(
"accountinfo表主键id"
)
@ApiModelProperty
(
"accountinfo表主键id"
)
private
Integer
acctId
;
private
Integer
acctId
;
private
Boolean
checkStatus
=
true
;
private
String
suggestMessage
;
private
String
differentMessage
;
public
Boolean
getCheckStatus
()
{
return
checkStatus
;
}
public
void
setCheckStatus
(
Boolean
checkStatus
)
{
this
.
checkStatus
=
checkStatus
;
}
public
String
getSuggestMessage
()
{
return
suggestMessage
;
}
public
void
setSuggestMessage
(
String
suggestMessage
)
{
this
.
suggestMessage
=
suggestMessage
;
}
public
String
getDifferentMessage
()
{
return
differentMessage
;
}
public
void
setDifferentMessage
(
String
differentMessage
)
{
this
.
differentMessage
=
differentMessage
;
}
public
String
getToken
()
{
public
String
getToken
()
{
return
token
;
return
token
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/LogOneChlickCheckMapper.java
0 → 100644
浏览文件 @
bbd53501
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
import
com.pica.cloud.account.account.server.entity.LogOneChlickCheck
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
LogOneChlickCheckMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
LogOneChlickCheck
record
);
int
insertSelective
(
LogOneChlickCheck
record
);
LogOneChlickCheck
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
LogOneChlickCheck
record
);
int
updateByPrimaryKey
(
LogOneChlickCheck
record
);
int
insertOne
(
LogOneChlickCheck
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/req/OneClickLoginReq.java
浏览文件 @
bbd53501
...
@@ -20,6 +20,16 @@ public class OneClickLoginReq {
...
@@ -20,6 +20,16 @@ public class OneClickLoginReq {
// 是否需要校验该设备登录的手机号
// 是否需要校验该设备登录的手机号
private
Boolean
checkFlag
=
false
;
private
Boolean
checkFlag
=
false
;
private
String
deviceToken
;
public
String
getDeviceToken
()
{
return
deviceToken
;
}
public
void
setDeviceToken
(
String
deviceToken
)
{
this
.
deviceToken
=
deviceToken
;
}
public
Boolean
getCheckFlag
()
{
public
Boolean
getCheckFlag
()
{
return
checkFlag
;
return
checkFlag
;
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/LoginV1Service.java
浏览文件 @
bbd53501
...
@@ -7,7 +7,7 @@ import com.pica.cloud.account.account.server.req.BaseRequest;
...
@@ -7,7 +7,7 @@ import com.pica.cloud.account.account.server.req.BaseRequest;
public
interface
LoginV1Service
{
public
interface
LoginV1Service
{
LoginResult
oneClickLogin
(
OneClickLoginReq
req
);
LoginResult
oneClickLogin
V1
(
OneClickLoginReq
req
);
void
mobileValidate
(
BaseRequest
request
);
void
mobileValidate
(
BaseRequest
request
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/LoginV1ServiceImpl.java
浏览文件 @
bbd53501
...
@@ -5,13 +5,14 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,13 +5,14 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.enums.SourceTypeEnum
;
import
com.pica.cloud.account.account.server.enums.SourceTypeEnum
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.log.AccountLogEntityUtils
;
import
com.pica.cloud.account.account.server.log.AccountLogEntityUtils
;
import
com.pica.cloud.account.account.server.log.AccountLogUtils
;
import
com.pica.cloud.account.account.server.log.AccountLogUtils
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.DoctorMapper
;
import
com.pica.cloud.account.account.server.mapper.DoctorMapper
;
import
com.pica.cloud.account.account.server.mapper.LogOneChlickCheckMapper
;
import
com.pica.cloud.account.account.server.model.OneClickProcessor
;
import
com.pica.cloud.account.account.server.model.OneClickProcessor
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.req.OneClickLoginReq
;
import
com.pica.cloud.account.account.server.req.OneClickLoginReq
;
...
@@ -26,14 +27,18 @@ import com.pica.cloud.foundation.completeness.contract.constants.CommonConstants
...
@@ -26,14 +27,18 @@ import com.pica.cloud.foundation.completeness.contract.constants.CommonConstants
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaWarnException
;
import
com.pica.cloud.foundation.entity.PicaWarnException
;
import
com.pica.cloud.foundation.message.client.EquipmentService
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.utils.ValidateUtils
;
import
com.pica.cloud.foundation.utils.utils.ValidateUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -70,6 +75,19 @@ public class LoginV1ServiceImpl implements LoginV1Service {
...
@@ -70,6 +75,19 @@ public class LoginV1ServiceImpl implements LoginV1Service {
@Autowired
@Autowired
private
ICacheClient
cacheClient
;
private
ICacheClient
cacheClient
;
@Autowired
private
AccountInfoDetailMapper
accountInfoDetailMapper
;
@Qualifier
(
"accountThreadPool"
)
@Autowired
private
ThreadPoolTaskExecutor
poolTaskExecutor
;
@Autowired
private
LogOneChlickCheckMapper
logOneChlickCheckMapper
;
@Autowired
private
EquipmentService
equipmentService
;
/**
/**
* 新版一键登录
* 新版一键登录
*
*
...
@@ -77,38 +95,155 @@ public class LoginV1ServiceImpl implements LoginV1Service {
...
@@ -77,38 +95,155 @@ public class LoginV1ServiceImpl implements LoginV1Service {
* @return
* @return
*/
*/
@Override
@Override
public
LoginResult
oneClickLogin
(
OneClickLoginReq
req
)
{
public
LoginResult
oneClickLogin
V1
(
OneClickLoginReq
req
)
{
QueryMobileEntity
queryMobileEntity
=
oneClickProcessor
.
tokenExchangeMobile
(
req
.
getToken
(),
req
.
getSourceType
());
QueryMobileEntity
queryMobileEntity
=
oneClickProcessor
.
tokenExchangeMobile
(
req
.
getToken
(),
req
.
getSourceType
());
if
(
queryMobileEntity
==
null
||
StringUtils
.
isBlank
(
queryMobileEntity
.
getMobile
())
||
!
ValidateUtils
.
isMobile
(
queryMobileEntity
.
getMobile
()))
{
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
(),
"获取手机号失败!"
);
throw
new
PicaException
(
PicaResultCode
.
INTERFACE_INVOKE_EXCEPTION
.
code
(),
"获取手机号失败!"
);
}
}
queryMobileEntity
.
setSourceType
(
req
.
getSourceType
());
queryMobileEntity
.
setSourceType
(
req
.
getSourceType
());
AccountInfoEntity
accountInfoEntity
=
accountInfoMapper
.
selectByMobile
(
AESUtil
.
encryptV0
(
queryMobileEntity
.
getMobile
()));
AccountInfoEntity
accountInfoEntity
=
accountInfo
Detail
Mapper
.
selectByMobile
(
AESUtil
.
encryptV0
(
queryMobileEntity
.
getMobile
()));
BaseRequest
baseRequest
=
new
BaseRequest
();
BaseRequest
baseRequest
=
new
BaseRequest
();
baseRequest
.
setMobile
(
queryMobileEntity
.
getMobile
());
baseRequest
.
setMobile
(
queryMobileEntity
.
getMobile
());
baseRequest
.
setSourceType
(
req
.
getSourceType
());
baseRequest
.
setSourceType
(
req
.
getSourceType
());
baseRequest
.
setProductType
(
req
.
getProductType
());
baseRequest
.
setProductType
(
req
.
getProductType
());
baseRequest
.
setLoginIp
(
req
.
getLoginIp
());
baseRequest
.
setLoginIp
(
req
.
getLoginIp
());
baseRequest
.
setUserTokenTourist
(
req
.
getUserTokenTourist
());
baseRequest
.
setUserTokenTourist
(
req
.
getUserTokenTourist
());
System
.
out
.
println
(
JSONObject
.
toJSONString
(
baseRequest
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
queryMobileEntity
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
accountInfoEntity
));
LoginResult
result
;
LoginResult
result
;
if
(
accountInfoEntity
==
null
)
{
if
(
accountInfoEntity
==
null
)
{
//说明是注册功能
//说明是注册功能
result
=
registerService
.
register
(
baseRequest
,
queryMobileEntity
);
result
=
registerService
.
register
(
baseRequest
,
queryMobileEntity
);
}
else
{
}
else
{
//登录功能
String
deviceToken
=
req
.
getDeviceToken
();
result
=
processLogin
(
baseRequest
,
accountInfoEntity
.
getId
(),
AccountTypeEnum
.
LOGIN_ONE_CLICK
.
getCode
(),
queryMobileEntity
);
logger
.
info
(
"oneClickLoginV1-用户传入的deviceToken为{}"
,
JSONObject
.
toJSONString
(
baseRequest
));
if
(
StringUtils
.
isEmpty
(
deviceToken
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_BLANK
.
code
(),
PicaResultCode
.
PARAM_IS_BLANK
.
message
());
}
// 根据deviceToken获取该设备上一次登录的手机号
Integer
userId
=
getUserId
(
deviceToken
);
logger
.
info
(
"oneClickLoginV1-该设备上次登录的用户id为:{}"
,
userId
);
if
(
req
.
getCheckFlag
())
{
if
(
req
.
getCheckFlag
())
{
// 直接登录,不需要校验手机号
// 直接登录,不需要校验手机号(点击了继续一键登录)
logger
.
info
(
"oneClickLoginV1-用户直接登录, {}"
,
JSONObject
.
toJSONString
(
baseRequest
));
result
=
processLoginV1
(
baseRequest
,
accountInfoEntity
.
getId
(),
AccountTypeEnum
.
LOGIN_ONE_CLICK
.
getCode
(),
queryMobileEntity
);
// 记录继续一键登录日志
poolTaskExecutor
.
execute
(()
->
insertLog
(
userId
,
queryMobileEntity
.
getMobile
(),
deviceToken
));
}
else
{
}
else
{
// 第一次点"一键登录"接口,需要比对上次登录的手机号与这次是否一样
// 第一次点"一键登录"接口,需要比对上次登录的手机号与这次是否一样
if
(
userId
==
null
)
{
// 直接登录
result
=
processLoginV1
(
baseRequest
,
accountInfoEntity
.
getId
(),
AccountTypeEnum
.
LOGIN_ONE_CLICK
.
getCode
(),
queryMobileEntity
);
}
else
{
// 根据userId获取手机号
PICAPDoctor
doctor
=
doctorInfoMapper
.
queryDoctor
(
userId
);
if
(
doctor
==
null
)
{
// 医生不存在
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
PicaResultCode
.
PARAM_IS_INVALID
.
message
());
}
else
{
String
mobilePhone
=
doctor
.
getMobile_phone
();
mobilePhone
=
EncryptUtils
.
decryptContent
(
mobilePhone
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
if
(
queryMobileEntity
.
getMobile
().
equals
(
mobilePhone
))
{
// 手机号匹配,直接登录
result
=
processLoginV1
(
baseRequest
,
accountInfoEntity
.
getId
(),
AccountTypeEnum
.
LOGIN_ONE_CLICK
.
getCode
(),
queryMobileEntity
);
}
else
{
// 该设备本次登录手机号与上次登录手机号不是同一手机号,需用户进行确认
result
=
new
LoginResult
();
result
.
setCheckStatus
(
false
);
result
.
setSuggestMessage
(
"为保证学习记录完整,建议使用同一手机号进行登录"
);
String
begin
=
mobilePhone
.
substring
(
0
,
3
);
String
end
=
mobilePhone
.
substring
(
7
,
11
);
String
last
=
begin
+
"****"
+
end
;
String
differentMessage
=
"当前设备上次使用"
+
last
+
"登录,为保证学习记录完整,建议使用同一手机号登录"
;
result
.
setDifferentMessage
(
differentMessage
);
}
}
}
}
}
}
}
return
result
;
return
result
;
}
}
private
void
insertLog
(
Integer
userId
,
String
currMobilePhone
,
String
deviceToken
)
{
// 获取上一次登录的手机号
String
lastMobilePhone
=
""
;
PICAPDoctor
doctor
=
doctorInfoMapper
.
queryDoctor
(
userId
);
if
(
doctor
!=
null
)
{
lastMobilePhone
=
doctor
.
getMobile_phone
();
}
LogOneChlickCheck
logOneChlickCheck
=
new
LogOneChlickCheck
();
logOneChlickCheck
.
setCreatedId
(
99999999
);
logOneChlickCheck
.
setModifiedId
(
99999999
);
Date
now
=
new
Date
();
logOneChlickCheck
.
setCreatedTime
(
now
);
logOneChlickCheck
.
setModifiedTime
(
now
);
logOneChlickCheck
.
setCurrMobilePhone
(
currMobilePhone
);
logOneChlickCheck
.
setLastMobilePhone
(
lastMobilePhone
);
logOneChlickCheck
.
setDeleteFlag
((
byte
)
1
);
logOneChlickCheck
.
setUsedShanyan
(
true
);
logOneChlickCheck
.
setDeviceToken
(
deviceToken
);
logOneChlickCheck
.
setKeepBack
(
""
);
logOneChlickCheckMapper
.
insertOne
(
logOneChlickCheck
);
}
private
Integer
getUserId
(
String
deviceToken
)
{
Integer
userId
=
null
;
try
{
PicaResponse
<
Integer
>
response
=
equipmentService
.
getUserIdByDeviceToken
(
deviceToken
);
userId
=
response
.
getData
();
}
catch
(
Exception
e
)
{
// 防止message服务出问题影响一键登录流程
logger
.
error
(
"调用message服务出错!"
);
e
.
printStackTrace
();
}
return
userId
;
}
private
LoginResult
processLoginV1
(
BaseRequest
baseRequest
,
Integer
acctId
,
Integer
loginType
,
QueryMobileEntity
queryMobileEntity
)
{
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"processLoginV1"
,
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
();
account
.
setId
(
userId
);
account
.
setAcctId
(
acctId
);
account
.
setCreatTime
(
currentTime
);
account
.
setMobilePhone
(
baseRequest
.
getMobile
());
account
.
setRegisterSource
(
baseRequest
.
getSourceType
());
String
newToken
=
tokenUtils
.
generateToken
(
account
);
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
newToken
);
result
.
setUserId
(
userId
);
result
.
setMobile
(
baseRequest
.
getMobile
());
result
.
setDoctorId
(
EncryptUtils
.
encryptContent
(
userId
+
""
,
EncryptConstants
.
ENCRYPT_TYPE_ID
));
//是否完善过个人信息(云鹊医app才需要)
if
(
baseRequest
.
getProductType
()
!=
AccountTypeEnum
.
PRODUCT_TYPE_HEALTH
.
getCode
())
{
Doctor
doctorEntity
=
doctorInfoMapper
.
selectByPrimaryKey
(
userId
.
intValue
());
result
.
setEntireFlag
(
doctorEntity
.
getEntireFlag
());
}
//记录登录日志
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
());
if
(
queryMobileEntity
!=
null
)
{
entity
.
setQueryMobileEntity
(
queryMobileEntity
);
}
picaLogUtils
.
info
(
entity
);
intactUtil
.
sendIntact
(
batchNo
,
"processLoginV1"
,
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
;
}
/**
/**
* 手机号 统一check
* 手机号 统一check
*
*
...
@@ -322,39 +457,4 @@ public class LoginV1ServiceImpl implements LoginV1Service {
...
@@ -322,39 +457,4 @@ public class LoginV1ServiceImpl implements LoginV1Service {
return
result
;
return
result
;
}
}
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
));
Date
currentTime
=
new
Date
();
Long
userId
=
accountUtils
.
getUserIdByAcctId
(
baseRequest
.
getProductType
(),
acctId
);
Account
account
=
new
Account
();
account
.
setId
(
userId
);
account
.
setAcctId
(
acctId
);
account
.
setCreatTime
(
currentTime
);
account
.
setMobilePhone
(
baseRequest
.
getMobile
());
account
.
setRegisterSource
(
baseRequest
.
getSourceType
());
String
newToken
=
tokenUtils
.
generateToken
(
account
);
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
newToken
);
result
.
setUserId
(
userId
);
result
.
setMobile
(
baseRequest
.
getMobile
());
result
.
setDoctorId
(
EncryptUtils
.
encryptContent
(
userId
+
""
,
EncryptConstants
.
ENCRYPT_TYPE_ID
));
//是否完善过个人信息(云鹊医app才需要)
if
(
baseRequest
.
getProductType
()
!=
AccountTypeEnum
.
PRODUCT_TYPE_HEALTH
.
getCode
())
{
Doctor
doctorEntity
=
doctorInfoMapper
.
selectByPrimaryKey
(
userId
.
intValue
());
result
.
setEntireFlag
(
doctorEntity
.
getEntireFlag
());
}
//记录登录日志
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
());
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
));
return
result
;
}
}
}
server/src/main/resources/mybatis-generator.xml
浏览文件 @
bbd53501
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<!-- <classPathEntry location="/Users/wangyongbo/Downloads/software/mysql-connector-java-5.1.39.jar"/>-->
<!-- <classPathEntry location="/Users/wangyongbo/Downloads/software/mysql-connector-java-5.1.39.jar"/>-->
<!-- <classPathEntry location="D:\programer\reponsitory\maven\mysql\mysql-connector-java\5.1.39\mysql-connector-java-5.1.39.jar"/>-->
<!-- <classPathEntry location="D:\programer\reponsitory\maven\mysql\mysql-connector-java\5.1.39\mysql-connector-java-5.1.39.jar"/>-->
<!--<classPathEntry location="E:\mysql_jar/mysql-connector-java-5.1.39.jar"/>-->
<!--<classPathEntry location="E:\mysql_jar/mysql-connector-java-5.1.39.jar"/>-->
<classPathEntry
location=
"/Users/zhoupengcheng/mysql_jar/mysql-connector-java-5.1.49.jar"
/>
<context
id=
"tableEntity"
targetRuntime=
"MyBatis3"
>
<context
id=
"tableEntity"
targetRuntime=
"MyBatis3"
>
<commentGenerator>
<commentGenerator>
...
@@ -43,6 +44,7 @@
...
@@ -43,6 +44,7 @@
<!-- <table tableName="account_apple_info" domainObjectName="AccountAppleInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!-- <table tableName="account_apple_info" domainObjectName="AccountAppleInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!-- <table tableName="account_pat_family_record" domainObjectName="AccountPatFamilyRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!-- <table tableName="account_pat_family_record" domainObjectName="AccountPatFamilyRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<table
tableName=
"log_one_chlick_check"
domainObjectName=
"LogOneChlickCheck"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
></table>
</context>
</context>
</generatorConfiguration>
</generatorConfiguration>
...
...
server/src/main/resources/mybatis/LogOneChlickCheckMapper.xml
0 → 100644
浏览文件 @
bbd53501
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.LogOneChlickCheckMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"device_token"
property=
"deviceToken"
jdbcType=
"VARCHAR"
/>
<result
column=
"last_mobile_phone"
property=
"lastMobilePhone"
jdbcType=
"VARCHAR"
/>
<result
column=
"curr_mobile_phone"
property=
"currMobilePhone"
jdbcType=
"VARCHAR"
/>
<result
column=
"used_shanyan"
property=
"usedShanyan"
jdbcType=
"BIT"
/>
<result
column=
"keep_back"
property=
"keepBack"
jdbcType=
"VARCHAR"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"TINYINT"
/>
<result
column=
"created_id"
property=
"createdId"
jdbcType=
"INTEGER"
/>
<result
column=
"created_time"
property=
"createdTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modified_id"
property=
"modifiedId"
jdbcType=
"INTEGER"
/>
<result
column=
"modified_time"
property=
"modifiedTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, device_token, last_mobile_phone, curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from log_one_chlick_check
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from log_one_chlick_check
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
insert into log_one_chlick_check (id, device_token, last_mobile_phone,
curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{id,jdbcType=INTEGER}, #{deviceToken,jdbcType=VARCHAR}, #{lastMobilePhone,jdbcType=VARCHAR},
#{currMobilePhone,jdbcType=VARCHAR}, #{usedShanyan,jdbcType=BIT}, #{keepBack,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=TINYINT}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
insert into log_one_chlick_check
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"deviceToken != null"
>
device_token,
</if>
<if
test=
"lastMobilePhone != null"
>
last_mobile_phone,
</if>
<if
test=
"currMobilePhone != null"
>
curr_mobile_phone,
</if>
<if
test=
"usedShanyan != null"
>
used_shanyan,
</if>
<if
test=
"keepBack != null"
>
keep_back,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"createdId != null"
>
created_id,
</if>
<if
test=
"createdTime != null"
>
created_time,
</if>
<if
test=
"modifiedId != null"
>
modified_id,
</if>
<if
test=
"modifiedTime != null"
>
modified_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"deviceToken != null"
>
#{deviceToken,jdbcType=VARCHAR},
</if>
<if
test=
"lastMobilePhone != null"
>
#{lastMobilePhone,jdbcType=VARCHAR},
</if>
<if
test=
"currMobilePhone != null"
>
#{currMobilePhone,jdbcType=VARCHAR},
</if>
<if
test=
"usedShanyan != null"
>
#{usedShanyan,jdbcType=BIT},
</if>
<if
test=
"keepBack != null"
>
#{keepBack,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=TINYINT},
</if>
<if
test=
"createdId != null"
>
#{createdId,jdbcType=INTEGER},
</if>
<if
test=
"createdTime != null"
>
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
#{modifiedId,jdbcType=INTEGER},
</if>
<if
test=
"modifiedTime != null"
>
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
update log_one_chlick_check
<set
>
<if
test=
"deviceToken != null"
>
device_token = #{deviceToken,jdbcType=VARCHAR},
</if>
<if
test=
"lastMobilePhone != null"
>
last_mobile_phone = #{lastMobilePhone,jdbcType=VARCHAR},
</if>
<if
test=
"currMobilePhone != null"
>
curr_mobile_phone = #{currMobilePhone,jdbcType=VARCHAR},
</if>
<if
test=
"usedShanyan != null"
>
used_shanyan = #{usedShanyan,jdbcType=BIT},
</if>
<if
test=
"keepBack != null"
>
keep_back = #{keepBack,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
<if
test=
"createdId != null"
>
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if
test=
"modifiedTime != null"
>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
update log_one_chlick_check
set device_token = #{deviceToken,jdbcType=VARCHAR},
last_mobile_phone = #{lastMobilePhone,jdbcType=VARCHAR},
curr_mobile_phone = #{currMobilePhone,jdbcType=VARCHAR},
used_shanyan = #{usedShanyan,jdbcType=BIT},
keep_back = #{keepBack,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=TINYINT},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<insert
id=
"insertOne"
parameterType=
"com.pica.cloud.account.account.server.entity.LogOneChlickCheck"
>
insert into log_one_chlick_check (device_token, last_mobile_phone,
curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{deviceToken,jdbcType=VARCHAR}, #{lastMobilePhone,jdbcType=VARCHAR},
#{currMobilePhone,jdbcType=VARCHAR}, #{usedShanyan,jdbcType=BIT}, #{keepBack,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=TINYINT}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
</mapper>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录