Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
aserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
15所TongWeb
aserver
Commits
39dafc01
Commit
39dafc01
authored
Dec 03, 2020
by
李德才
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用JFinal 默认的JSON 转换器转换对象
parent
8cfa25ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
InfoUser.java
src/main/java/com/archser/aserver/util/redis/InfoUser.java
+2
-2
RedisConvert.java
...ain/java/com/archser/aserver/util/redis/RedisConvert.java
+8
-8
config-pro.properties
src/main/resources/config-pro.properties
+1
-1
SN.properties
src/main/webapp/SN.properties
+1
-1
No files found.
src/main/java/com/archser/aserver/util/redis/InfoUser.java
View file @
39dafc01
package
com
.
archser
.
aserver
.
util
.
redis
;
import
com.alibaba.fastjson.JSONObject
;
import
com.archser.aserver.model.User
;
import
com.jfinal.kit.JsonKit
;
/**
* 20201127 lidecai 操作redis中的用户信息
...
...
@@ -19,7 +19,7 @@ public class InfoUser {
*/
public
static
User
getUser
(
String
userName
)
{
Object
object
=
RedisConvert
.
getObject
(
USER
+
userName
+
_INFO
);
User
user
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
),
User
.
class
);
User
user
=
JsonKit
.
parse
(
JsonKit
.
toJson
(
object
),
User
.
class
);
if
(
user
.
getId
()
==
null
)
{
User
userByDataBase
=
getUserByDataBase
(
userName
);
saveUser
(
userByDataBase
);
...
...
src/main/java/com/archser/aserver/util/redis/RedisConvert.java
View file @
39dafc01
package
com
.
archser
.
aserver
.
util
.
redis
;
import
com.
alibaba.fastjson.JSONObjec
t
;
import
com.
jfinal.kit.JsonKi
t
;
import
com.jfinal.plugin.redis.Redis
;
import
java.util.Map
;
...
...
@@ -8,7 +8,7 @@ import java.util.Map;
/**
* Redis常用工具类 20201126 lidecai
*/
public
class
RedisConvert
{
public
class
RedisConvert
{
/**
* 单独存储对象属性
...
...
@@ -17,7 +17,7 @@ public class RedisConvert {
* @param attribute
* @param value
*/
public
static
void
saveObjectAttr
(
String
key
,
String
attribute
,
String
value
)
{
public
static
void
saveObjectAttr
(
String
key
,
String
attribute
,
String
value
)
{
Redis
.
use
().
hset
(
key
,
attribute
,
value
);
}
...
...
@@ -38,7 +38,7 @@ public class RedisConvert {
* @param key
* @param object
*/
public
static
boolean
saveObject
(
String
key
,
Object
object
)
{
public
static
boolean
saveObject
(
String
key
,
Object
object
)
{
String
hamlet
=
Redis
.
use
().
hmset
(
key
,
objectToMap
(
object
));
return
hamlet
.
equalsIgnoreCase
(
"Ok"
);
}
...
...
@@ -54,19 +54,19 @@ public class RedisConvert {
}
public
static
Long
deleteKey
(
String
key
){
return
Redis
.
use
().
del
(
key
);
public
static
Long
deleteKey
(
String
key
)
{
return
Redis
.
use
().
del
(
key
);
}
/**
* 对象转map
*
* @param obj
* @return
*/
public
static
Map
objectToMap
(
Object
obj
)
{
return
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
obj
),
Map
.
class
);
return
JsonKit
.
parse
(
JsonKit
.
toJson
(
obj
),
Map
.
class
);
}
}
src/main/resources/config-pro.properties
View file @
39dafc01
...
...
@@ -11,7 +11,7 @@ engineDevMode=true
## 是否同步Redis中的数据
updateRedis
=
fals
e
updateRedis
=
tru
e
authUrl
=
http://125.77.26.133:7001/auth/token
userInfoUrl
=
http://125.77.26.133:7001/api/info/user_info
...
...
src/main/webapp/SN.properties
View file @
39dafc01
#III
#
Wed Dec 02 15:35:36
CST 2020
#
Thu Dec 03 09:31:25
CST 2020
AAA
=
数字档案室3,cdcsdcdscd
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