Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
5554fd61
Commit
5554fd61
authored
Jul 03, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化登录的消息推送kafka
parent
42acd470
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+16
-16
No files found.
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
5554fd61
...
...
@@ -19,9 +19,9 @@ import org.springframework.web.context.request.RequestContextHolder;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
com.alibaba.fastjson.JSON
;
import
cn.quantgroup.acolyte.buddhistscriptures.pojo.Login
;
import
lombok.extern.slf4j.Slf4j
;
import
cn.quantgroup.acolyte.buddhistscriptures.pojo.Login
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.event.StatisticsEvent
;
...
...
@@ -98,19 +98,6 @@ public class SessionServiceImpl implements ISessionService {
}
else
{
sessionStruct
=
newSession
(
user
,
properties
);
persistSession
(
sessionStruct
.
getSid
(),
sessionStruct
.
getValues
());
// 发送登陆成功统计消息
/*
* 部分免密渠道登录统计,用户中心不需识别,由统计平台来过滤
* 贷款导航(84660);壹账通H5(159384)
*/
user
.
setRegisteredFrom
(
properties
.
getCreatedFrom
());
UserStatistics
statistics
=
new
UserStatistics
(
user
,
null
,
properties
.
getAction
(),
properties
.
getChannelId
());
// 推送老的登陆统计信息
MqUtils
.
sendLoanVest
(
statistics
);
// 发布新的登录统计信息事件
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
Login
login
=
new
Login
(
user
.
getId
(),
properties
.
getCreatedFrom
(),
properties
.
getChannelId
(),
IPUtil
.
getRemoteIP
(
request
),
properties
.
getAction
(),
System
.
currentTimeMillis
());
applicationEventPublisher
.
publishEvent
(
new
StatisticsEvent
(
this
,
login
));
}
return
sessionStruct
;
}
...
...
@@ -132,7 +119,7 @@ public class SessionServiceImpl implements ISessionService {
return
StringUtils
.
defaultString
(
result
,
""
);
}
private
SessionStruct
newSession
(
User
user
,
LoginProperties
loginP
roperties
)
{
private
SessionStruct
newSession
(
User
user
,
LoginProperties
p
roperties
)
{
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
SessionStruct
sessionStruct
=
new
SessionStruct
();
SessionValue
sessionValue
=
new
SessionValue
();
...
...
@@ -140,10 +127,23 @@ public class SessionServiceImpl implements ISessionService {
sessionValue
.
setCreatedAt
(
now
);
sessionValue
.
setLastAccessTime
(
now
);
sessionValue
.
setUser
(
user
);
sessionValue
.
setLoginProperties
(
loginP
roperties
);
sessionValue
.
setLoginProperties
(
p
roperties
);
Map
<
String
,
String
>
values
=
new
HashMap
<>();
sessionValue
.
setValues
(
values
);
sessionStruct
.
setValues
(
sessionValue
);
// 发送登陆成功统计消息
/*
* 部分免密渠道登录统计,用户中心不需识别,由统计平台来过滤
* 贷款导航(84660);壹账通H5(159384)
*/
user
.
setRegisteredFrom
(
properties
.
getCreatedFrom
());
UserStatistics
statistics
=
new
UserStatistics
(
user
,
null
,
properties
.
getAction
(),
properties
.
getChannelId
());
// 推送老的登陆统计信息
MqUtils
.
sendLoanVest
(
statistics
);
// 发布新的登录统计信息事件
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
Login
login
=
new
Login
(
user
.
getId
(),
properties
.
getCreatedFrom
(),
properties
.
getChannelId
(),
IPUtil
.
getRemoteIP
(
request
),
properties
.
getAction
(),
System
.
currentTimeMillis
());
applicationEventPublisher
.
publishEvent
(
new
StatisticsEvent
(
this
,
login
));
return
sessionStruct
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment