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
提交
28a32e48
提交
28a32e48
编写于
9月 03, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20190903 日志模块代码优化
上级
2173c002
流水线
#13965
已失败 于阶段
in 0 second
变更
9
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
61 行增加
和
38 行删除
+61
-38
LoginController.java
...ud/account/account/server/controller/LoginController.java
+2
-5
AccountLogEntityUtils.java
...oud/account/account/server/log/AccountLogEntityUtils.java
+12
-4
AccountUserInfoMapper.java
.../account/account/server/mapper/AccountUserInfoMapper.java
+11
-1
UserInfoService.java
...cloud/account/account/server/service/UserInfoService.java
+8
-0
LoginServiceImpl.java
...account/account/server/service/impl/LoginServiceImpl.java
+7
-11
PasswordServiceImpl.java
...ount/account/server/service/impl/PasswordServiceImpl.java
+5
-10
RegisterServiceImpl.java
...ount/account/server/service/impl/RegisterServiceImpl.java
+3
-6
UserInfoServerImpl.java
...count/account/server/service/impl/UserInfoServerImpl.java
+5
-0
AccountUserInfoEntityMapper.xml
...rc/main/resources/mybatis/AccountUserInfoEntityMapper.xml
+8
-1
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/LoginController.java
浏览文件 @
28a32e48
...
...
@@ -147,11 +147,8 @@ public class LoginController extends AccountBaseController {
if
(
StringUtils
.
isNotEmpty
(
token
))
{
Integer
id
=
accountUser
.
getAcctId
();
//记录登录日志
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
id
,
super
.
getProductType
(),
super
.
getSourceType
());
entity
.
setLoginType
(
AccountEnumType
.
LOGIN_OUT
.
getCode
());
entity
.
setLoginIp
(
super
.
getIpAddr
());
entity
.
setLoginStatus
(
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
());
entity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
id
,
super
.
getProductType
(),
super
.
getSourceType
(),
AccountEnumType
.
LOGIN_OUT
.
getCode
(),
super
.
getIpAddr
(),
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
picaLogUtils
.
info
(
entity
);
if
(
redisClient
.
deleteToken
(
token
))
{
return
PicaResponse
.
toResponse
();
...
...
server/src/main/java/com/pica/cloud/account/account/server/log/AccountLogEntityUtils.java
浏览文件 @
28a32e48
...
...
@@ -2,6 +2,7 @@ package com.pica.cloud.account.account.server.log;
import
com.pica.cloud.account.account.server.entity.LogLoginEntity
;
import
com.pica.cloud.account.account.server.entity.LogPWDModifyEntity
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
java.util.Date
;
...
...
@@ -15,7 +16,8 @@ public class AccountLogEntityUtils {
* @param sourceType
* @return
*/
public
static
LogLoginEntity
getLogLoginEntity
(
Integer
acctId
,
Integer
productType
,
Integer
sourceType
)
{
public
static
LogLoginEntity
getLogLoginEntity
(
Integer
acctId
,
Integer
productType
,
Integer
sourceType
,
int
code
,
String
ipAddr
,
int
code1
,
int
code2
)
{
LogLoginEntity
entity
=
new
LogLoginEntity
();
Date
currentTime
=
new
Date
();
entity
.
setAcctId
(
acctId
);
...
...
@@ -27,6 +29,10 @@ public class AccountLogEntityUtils {
entity
.
setLoginTime
(
currentTime
);
entity
.
setProductType
(
productType
);
entity
.
setSourceType
(
sourceType
);
entity
.
setLoginType
(
code
);
entity
.
setLoginIp
(
ipAddr
);
entity
.
setLoginStatus
(
code1
);
entity
.
setLogType
(
code2
);
return
entity
;
}
...
...
@@ -36,7 +42,7 @@ public class AccountLogEntityUtils {
* @param acctId
* @return
*/
public
static
LogPWDModifyEntity
getLogPWDModifyEntity
(
Integer
acctId
)
{
public
static
LogPWDModifyEntity
getLogPWDModifyEntity
(
Integer
acctId
,
String
mobile
,
String
oldpwd
,
String
newPwd
,
Integer
logType
)
{
LogPWDModifyEntity
entity
=
new
LogPWDModifyEntity
();
Date
currentTime
=
new
Date
();
entity
.
setCreatedId
(
acctId
);
...
...
@@ -44,8 +50,10 @@ public class AccountLogEntityUtils {
entity
.
setDeleteFlag
(
1
);
entity
.
setModifiedId
(
acctId
);
entity
.
setModifiedTime
(
currentTime
);
entity
.
setMobilePhone
(
mobile
);
entity
.
setOldPwd
(
oldpwd
);
entity
.
setNewPwd
(
EncryptCreateUtil
.
encrypt
(
newPwd
));
entity
.
setLogType
(
logType
);
return
entity
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountUserInfoMapper.java
浏览文件 @
28a32e48
...
...
@@ -14,13 +14,22 @@ public interface AccountUserInfoMapper {
AccountUserInfoEntity
selectByPrimaryKey
(
Integer
id
);
/**
* 通过
账
户id查询居民信息
* 通过
用
户id查询居民信息
*
* @param id 用户id
* @return
*/
AccountUserInfoEntity
selectByUserId
(
Integer
id
);
/**
* 通过账户id查询账户信息
*
* @param acctId
* @return
*/
AccountUserInfoEntity
selectByAcctId
(
Integer
acctId
);
/**
* 更新居民信息接口
*
...
...
@@ -29,6 +38,7 @@ public interface AccountUserInfoMapper {
*/
int
updateByPrimaryKeySelective
(
AccountUserInfoEntity
record
);
int
insertSelective
(
AccountUserInfoEntity
record
);
int
updateByPrimaryKey
(
AccountUserInfoEntity
record
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/UserInfoService.java
浏览文件 @
28a32e48
...
...
@@ -20,4 +20,12 @@ public interface UserInfoService {
* @return
*/
AccountUserInfoEntity
getUserInfo
(
Integer
userId
);
/**
* 获取用户信息接口
*
* @param acctId 账户id
* @return
*/
AccountUserInfoEntity
getUserInfoByAcctId
(
Integer
acctId
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/LoginServiceImpl.java
浏览文件 @
28a32e48
...
...
@@ -98,11 +98,9 @@ public class LoginServiceImpl implements LoginService {
jsonObject
.
put
(
Constants
.
TOKEN
,
newToken
);
jsonObject
.
put
(
Constants
.
USER_ID
,
accountUserInfoEntity
.
getId
().
longValue
());
//记录登录日志
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
request
.
getSourceType
());
entity
.
setLoginType
(
AccountEnumType
.
LOGIN_PWD
.
getCode
());
entity
.
setLoginIp
(
request
.
getLoginIp
());
entity
.
setLoginStatus
(
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
());
entity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
request
.
getSourceType
(),
AccountEnumType
.
LOGIN_PWD
.
getCode
(),
request
.
getLoginIp
(),
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
picaLogUtils
.
info
(
entity
);
return
jsonObject
.
toJSONString
();
}
else
{
...
...
@@ -133,7 +131,7 @@ public class LoginServiceImpl implements LoginService {
*/
private
String
processLogin
(
BaseRequest
baseRequest
,
Integer
acctId
,
Integer
loginType
)
{
Date
currentTime
=
new
Date
();
AccountUserInfoEntity
accountUserInfoEntity
=
accountUserInfoMapper
.
selectBy
Acct
Id
(
acctId
);
AccountUserInfoEntity
accountUserInfoEntity
=
accountUserInfoMapper
.
selectBy
User
Id
(
acctId
);
//验证码登陆:只要相同即可成功
AccountReq
accountReq
=
new
AccountReq
();
accountReq
.
setAuthCode
(
baseRequest
.
getSysCode
());
...
...
@@ -151,11 +149,9 @@ public class LoginServiceImpl implements LoginService {
jsonObject
.
put
(
Constants
.
TOKEN
,
newToken
);
jsonObject
.
put
(
Constants
.
USER_ID
,
accountUserInfoEntity
.
getId
().
longValue
());
//记录登录日志
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
baseRequest
.
getProductType
(),
baseRequest
.
getSourceType
());
entity
.
setLoginType
(
loginType
);
entity
.
setLoginIp
(
baseRequest
.
getLoginIp
());
entity
.
setLoginStatus
(
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
());
entity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
baseRequest
.
getProductType
(),
baseRequest
.
getSourceType
(),
loginType
,
baseRequest
.
getLoginIp
(),
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
;
picaLogUtils
.
info
(
entity
);
return
jsonObject
.
toJSONString
();
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/PasswordServiceImpl.java
浏览文件 @
28a32e48
...
...
@@ -36,11 +36,8 @@ public class PasswordServiceImpl implements PasswordService {
accountInfoEntity
.
setPassword
(
EncryptCreateUtil
.
encrypt
(
pwd
));
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
//密码修改日志
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
acctId
);
logPWDModifyEntity
.
setMobilePhone
(
entity
.
getMobilePhone
());
logPWDModifyEntity
.
setOldPwd
(
EncryptCreateUtil
.
encrypt
(
oldPwd
));
logPWDModifyEntity
.
setNewPwd
(
EncryptCreateUtil
.
encrypt
(
pwd
));
logPWDModifyEntity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_PASSWORD
.
getCode
());
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
acctId
,
entity
.
getMobilePhone
(),
EncryptCreateUtil
.
encrypt
(
oldPwd
),
EncryptCreateUtil
.
encrypt
(
pwd
),
AccountEnumType
.
LOG_TYPE_PASSWORD
.
getCode
());
picaLogUtils
.
info
(
logPWDModifyEntity
);
}
else
{
throw
new
AccountException
(
AccountExceptionType
.
PICA_PASSWORD_ERROR
);
...
...
@@ -58,12 +55,10 @@ public class PasswordServiceImpl implements PasswordService {
accountInfoEntity
.
setModifiedTime
(
new
Date
());
accountInfoEntity
.
setPassword
(
EncryptCreateUtil
.
encrypt
(
request
.
getPassword
()));
accountInfoDetailMapper
.
updatePasswordByPrimaryKey
(
accountInfoEntity
);
//密码修改日志
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
accId
);
logPWDModifyEntity
.
setMobilePhone
(
entity
.
getMobilePhone
());
logPWDModifyEntity
.
setOldPwd
(
""
);
logPWDModifyEntity
.
setNewPwd
(
EncryptCreateUtil
.
encrypt
(
request
.
getPassword
()));
logPWDModifyEntity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_PASSWORD
.
getCode
());
LogPWDModifyEntity
logPWDModifyEntity
=
AccountLogEntityUtils
.
getLogPWDModifyEntity
(
accId
,
entity
.
getMobilePhone
(),
""
,
EncryptCreateUtil
.
encrypt
(
request
.
getPassword
()),
AccountEnumType
.
LOG_TYPE_PASSWORD
.
getCode
());
picaLogUtils
.
info
(
logPWDModifyEntity
);
}
else
{
//未注册,请先注册
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/RegisterServiceImpl.java
浏览文件 @
28a32e48
...
...
@@ -16,7 +16,6 @@ import com.pica.cloud.account.account.server.mapper.AccountUserInfoMapper;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.service.RegisterService
;
import
com.pica.cloud.account.account.server.util.AccountUtils
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -95,11 +94,9 @@ public class RegisterServiceImpl implements RegisterService {
jsonObject
.
put
(
Constants
.
TOKEN
,
newToken
);
jsonObject
.
put
(
Constants
.
USER_ID
,
userId
);
//记录登录日志
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
baseRequest
.
getSourceType
());
entity
.
setLoginType
(
AccountEnumType
.
LOGIN_REGISTER
.
getCode
());
entity
.
setLoginIp
(
baseRequest
.
getLoginIp
());
entity
.
setLoginStatus
(
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
());
entity
.
setLogType
(
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
baseRequest
.
getSourceType
(),
AccountEnumType
.
LOGIN_REGISTER
.
getCode
(),
baseRequest
.
getLoginIp
(),
AccountEnumType
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountEnumType
.
LOG_TYPE_LOGIN
.
getCode
());
picaLogUtils
.
info
(
entity
);
return
jsonObject
.
toJSONString
();
}
else
{
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/UserInfoServerImpl.java
浏览文件 @
28a32e48
...
...
@@ -47,4 +47,9 @@ public class UserInfoServerImpl implements UserInfoService {
public
AccountUserInfoEntity
getUserInfo
(
Integer
userId
)
{
return
accountUserInfoMapper
.
selectByUserId
(
userId
);
}
@Override
public
AccountUserInfoEntity
getUserInfoByAcctId
(
Integer
acctId
)
{
return
accountUserInfoMapper
.
selectByAcctId
(
acctId
);
}
}
server/src/main/resources/mybatis/AccountUserInfoEntityMapper.xml
浏览文件 @
28a32e48
...
...
@@ -45,7 +45,7 @@
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过
账
户id查询信息-->
<!--通过
用
户id查询信息-->
<select
id=
"selectByUserId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
@@ -53,6 +53,13 @@
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过账户id查询信息-->
<select
id=
"selectByAcctId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from p_patient
where acct_id = #{AcctId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_patient
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录