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
155ac9ad
Commit
155ac9ad
authored
Nov 07, 2017
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改注销逻辑
parent
2b4d3b48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
Constants.java
src/main/java/cn/quantgroup/xyqb/Constants.java
+2
-0
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+17
-2
No files found.
src/main/java/cn/quantgroup/xyqb/Constants.java
View file @
155ac9ad
...
@@ -62,6 +62,8 @@ public interface Constants {
...
@@ -62,6 +62,8 @@ public interface Constants {
String
USER_SESSION_ID_CACHE
=
"userid-sessionvalue:cache:"
;
String
USER_SESSION_ID_CACHE
=
"userid-sessionvalue:cache:"
;
String
USER_SESSION_KEY_SET
=
"userid-keys:set:"
;
String
USER_SESSION_KEY_SET
=
"userid-keys:set:"
;
Long
ONE_DAY
=
24
*
60
*
60L
;
Long
ONE_DAY
=
24
*
60
*
60L
;
String
USER_CATCH_KEY
=
"usercache:xyqbuser"
;
String
USER_CATCH_INFO_KEY
=
"userextinfocache:extinfo"
;
}
}
interface
WeChat
{
interface
WeChat
{
...
...
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
155ac9ad
...
@@ -9,6 +9,8 @@ import cn.quantgroup.xyqb.model.session.SessionStruct;
...
@@ -9,6 +9,8 @@ import cn.quantgroup.xyqb.model.session.SessionStruct;
import
cn.quantgroup.xyqb.model.session.SessionValue
;
import
cn.quantgroup.xyqb.model.session.SessionValue
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.session.aspect.UserBtRegisterFill
;
import
cn.quantgroup.xyqb.service.session.aspect.UserBtRegisterFill
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.impl.UserServiceImpl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
...
@@ -37,6 +39,8 @@ public class SessionServiceImpl implements ISessionService {
...
@@ -37,6 +39,8 @@ public class SessionServiceImpl implements ISessionService {
@Autowired
@Autowired
@Qualifier
(
"stringRedisTemplate"
)
@Qualifier
(
"stringRedisTemplate"
)
private
RedisTemplate
<
String
,
String
>
stringRedisTemplate
;
private
RedisTemplate
<
String
,
String
>
stringRedisTemplate
;
@Autowired
private
IUserService
userService
;
@Override
@Override
public
AuthBean
createSession
(
Long
channelId
,
Long
createdFrom
,
String
appChannel
,
User
user
,
Merchant
merchant
)
{
public
AuthBean
createSession
(
Long
channelId
,
Long
createdFrom
,
String
appChannel
,
User
user
,
Merchant
merchant
)
{
...
@@ -181,14 +185,25 @@ public class SessionServiceImpl implements ISessionService {
...
@@ -181,14 +185,25 @@ public class SessionServiceImpl implements ISessionService {
@Override
@Override
public
void
deleteByUserId
(
long
userId
)
{
public
void
deleteByUserId
(
long
userId
)
{
//1.删除session关联
Set
useIdKeys
=
stringRedisTemplate
.
opsForSet
().
members
(
Constants
.
Session
.
USER_SESSION_KEY_SET
+
userId
);
Set
useIdKeys
=
stringRedisTemplate
.
opsForSet
().
members
(
Constants
.
Session
.
USER_SESSION_KEY_SET
+
userId
);
if
(!
CollectionUtils
.
isEmpty
(
useIdKeys
))
{
if
(!
CollectionUtils
.
isEmpty
(
useIdKeys
))
{
useIdKeys
.
forEach
(
key
->
{
useIdKeys
.
forEach
(
key
->
{
log
.
info
(
"删除用户userId={}的缓存信息"
,
userId
);
log
.
info
(
"删除用户userId={}的缓存信息"
,
userId
);
stringRedisTemplate
.
delete
(
String
.
valueOf
(
key
));
stringRedisTemplate
.
delete
(
String
.
valueOf
(
key
));
});
});
//2.删除session缓存健
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_SESSION_KEY_SET
+
userId
);
//3.删除用户查询缓存
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_SESSION_KEY_SET
+
userId
);
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_SESSION_KEY_SET
+
userId
);
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_CATCH_KEY
+
userId
);
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_CATCH_INFO_KEY
+
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
null
!=
user
)
{
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_CATCH_KEY
+
user
.
getPhoneNo
());
stringRedisTemplate
.
delete
(
Constants
.
Session
.
USER_CATCH_KEY
+
user
.
getUuid
());
}
}
}
...
...
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