Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
smartDevices-platform-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bd19f8f5
authored
May 13, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码规范
1 parent
0b77c658
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
20 deletions
src/main/java/cn/com/glsx/modules/model/param/AccessToken.java
src/main/java/cn/com/glsx/smartplat/common/redis/AccessTokenRedis.java
src/main/java/cn/com/glsx/smartplat/modules/model/param/AccessToken.java
src/main/java/cn/com/glsx/smartplat/modules/service/AccessTokenService.java
src/main/java/cn/com/glsx/modules/model/param/AccessToken.java
0 → 100644
View file @
bd19f8f
package
cn
.
com
.
glsx
.
modules
.
model
.
param
;
import
lombok.Data
;
/**
* @author zhouhaibao
* @date 2021/3/4 10:10
*/
@Data
public
class
AccessToken
{
private
String
access_token
;
private
Long
expire_time
;
private
String
refresh_token
;
private
String
uid
;
}
src/main/java/cn/com/glsx/smartplat/common/redis/AccessTokenRedis.java
deleted
100644 → 0
View file @
0b77c65
package
cn
.
com
.
glsx
.
smartplat
.
common
.
redis
;
import
cn.com.glsx.smartplat.modules.model.param.AccessToken
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
@Component
public
class
AccessTokenRedis
extends
RedisService
{
public
AccessToken
readCache
(
String
key
){
Object
alarmObject
=
redisTemplate
.
opsForValue
().
get
(
key
);
String
jsonString
=
JSONObject
.
toJSONString
(
alarmObject
);
return
JSONObject
.
parseObject
(
jsonString
,
AccessToken
.
class
);
}
}
src/main/java/cn/com/glsx/smartplat/modules/model/param/AccessToken.java
View file @
bd19f8f
...
@@ -13,4 +13,5 @@ public class AccessToken {
...
@@ -13,4 +13,5 @@ public class AccessToken {
private
Long
expire_time
;
private
Long
expire_time
;
private
String
refresh_token
;
private
String
refresh_token
;
private
String
uid
;
private
String
uid
;
}
}
src/main/java/cn/com/glsx/smartplat/modules/service/AccessTokenService.java
View file @
bd19f8f
package
cn
.
com
.
glsx
.
smartplat
.
modules
.
service
;
package
cn
.
com
.
glsx
.
smartplat
.
modules
.
service
;
import
cn.com.glsx.modules.model.param.AccessToken
;
import
cn.com.glsx.smartplat.common.constant.Constants
;
import
cn.com.glsx.smartplat.common.constant.Constants
;
import
cn.com.glsx.smartplat.common.redis.AccessTokenRedis
;
import
cn.com.glsx.smartplat.common.redis.RedisService
;
import
cn.com.glsx.smartplat.modules.model.param.AccessToken
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Service;
...
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Service;
public
class
AccessTokenService
{
public
class
AccessTokenService
{
@Autowired
@Autowired
private
AccessTokenRedis
accessTokenRedis
;
private
RedisService
redisService
;
/**
/**
* 获取涂鸦令牌
* 获取涂鸦令牌
...
@@ -27,7 +27,7 @@ public class AccessTokenService {
...
@@ -27,7 +27,7 @@ public class AccessTokenService {
* @return accesstoken
* @return accesstoken
*/
*/
public
String
getAccessToken
()
{
public
String
getAccessToken
()
{
AccessToken
accessToken
=
accessTokenRedis
.
readCache
(
Constants
.
ACCESSTOKEN_REDISKEY
);
AccessToken
accessToken
=
(
AccessToken
)
redisService
.
get
(
Constants
.
ACCESSTOKEN_REDISKEY
);
if
(
accessToken
==
null
){
if
(
accessToken
==
null
){
return
null
;
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment