提交 | 用户 | age
|
a51ba7
|
1 |
package com.platform.verification; |
C |
2 |
|
|
3 |
|
|
4 |
import com.alibaba.fastjson.JSONObject; |
|
5 |
import com.hx.redis.RedisUtil; |
ee3e39
|
6 |
import com.hx.redisson.config.RedissonUtil; |
a51ba7
|
7 |
import com.hx.util.StringUtils; |
C |
8 |
import com.platform.entity.ThirtApplication; |
|
9 |
|
|
10 |
/**应用转化 |
|
11 |
* @author CJH |
|
12 |
* @date 2021-10-20 |
|
13 |
*/ |
|
14 |
public class ApplicationTool { |
|
15 |
|
|
16 |
/**获取应用在redis上面的数据 |
|
17 |
* @param appId 用户的APPID ` |
|
18 |
* @param redisUtil redisUtil |
|
19 |
* @return |
|
20 |
*/ |
|
21 |
public static ThirtApplication jsonToEntity(String appId, RedisUtil redisUtil){ |
|
22 |
|
|
23 |
if (StringUtils.isEmpty(appId)) { |
|
24 |
return null; |
|
25 |
} |
|
26 |
|
|
27 |
JSONObject thirtApplication = (JSONObject) redisUtil.get(appId); |
|
28 |
|
|
29 |
//校验appid是否存在 |
|
30 |
if(thirtApplication == null){ |
|
31 |
return null; |
|
32 |
} |
|
33 |
ThirtApplication application = JSONObject.parseObject(thirtApplication.toString(),ThirtApplication.class); |
|
34 |
|
|
35 |
return application; |
|
36 |
} |
|
37 |
|
ee3e39
|
38 |
/**获取应用在redis上面的数据 |
C |
39 |
* @param appId 用户的APPID ` |
|
40 |
* @param redissonUtil RedissonUtil |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
public static ThirtApplication jsonToEntity(String appId, RedissonUtil redissonUtil){ |
|
44 |
|
|
45 |
if (StringUtils.isEmpty(appId)) { |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
JSONObject thirtApplication = (JSONObject) redissonUtil.get(appId); |
|
50 |
|
|
51 |
//校验appid是否存在 |
|
52 |
if(thirtApplication == null){ |
|
53 |
return null; |
|
54 |
} |
|
55 |
ThirtApplication application = JSONObject.parseObject(thirtApplication.toString(),ThirtApplication.class); |
|
56 |
|
|
57 |
return application; |
|
58 |
} |
|
59 |
|
a51ba7
|
60 |
} |