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
dacfaa5e
Commit
dacfaa5e
authored
Dec 29, 2016
by
lee_mingzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete nerver used import
parent
332a7ba0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+3
-9
No files found.
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
dacfaa5e
...
...
@@ -2,7 +2,6 @@ package cn.quantgroup.xyqb.service.session.impl;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.session.SessionStruct
;
import
cn.quantgroup.xyqb.model.session.SessionValue
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
...
...
@@ -25,8 +24,6 @@ import java.util.UUID;
@Service
public
class
SessionServiceImpl
implements
ISessionService
{
private
static
final
Long
ONE_DAY
=
24
*
60
*
60L
;
@Autowired
@Qualifier
(
"stringRedisTemplate"
)
private
RedisTemplate
<
String
,
String
>
stringRedisTemplate
;
...
...
@@ -53,13 +50,12 @@ public class SessionServiceImpl implements ISessionService{
@Override
public
String
findSessionIdByUserId
(
Long
userId
)
{
//TODO 暂时写死
return
stringRedisTemplate
.
opsForValue
().
get
(
"userid-sessionvalue:cache:"
+
userId
.
toString
());
return
stringRedisTemplate
.
opsForValue
().
get
(
Constants
.
Session
.
USERS_ESSIONID_CACHE
+
userId
.
toString
());
}
@Override
public
String
findSessionValueBySessionId
(
String
sessionId
){
String
result
=
stringRedisTemplate
.
opsForValue
().
get
(
"userid-sessionvalue:cache:"
+
sessionId
);
String
result
=
stringRedisTemplate
.
opsForValue
().
get
(
Constants
.
Session
.
USERS_ESSIONID_CACHE
+
sessionId
);
return
StringUtils
.
defaultString
(
result
,
""
);
}
...
...
@@ -82,9 +78,7 @@ public class SessionServiceImpl implements ISessionService{
public
void
PersistSession
(
String
token
,
SessionValue
sessionValue
){
Timestamp
current
=
new
Timestamp
(
System
.
currentTimeMillis
());
sessionValue
.
setLastAccessTime
(
current
);
// todo: session转换
String
json
=
JSON
.
toJSONString
(
sessionValue
);
// String json = Constants.GSON.toJson(sessionValue);
stringRedisTemplate
.
opsForValue
().
set
(
"userid-sessionvalue:cache:"
+
token
,
json
,
ONE_DAY
);
stringRedisTemplate
.
opsForValue
().
set
(
Constants
.
Session
.
USERS_ESSIONID_CACHE
+
token
,
json
,
Constants
.
Session
.
ONE_DAY
);
}
}
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