package com.platform.verification;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.hx.redis.RedisUtil;
|
import com.hx.redisson.config.RedissonUtil;
|
import com.hx.util.StringUtils;
|
import com.platform.entity.ThirtApplication;
|
|
/**应用转化
|
* @author CJH
|
* @date 2021-10-20
|
*/
|
public class ApplicationTool {
|
|
/**获取应用在redis上面的数据
|
* @param appId 用户的APPID `
|
* @param redisUtil redisUtil
|
* @return
|
*/
|
public static ThirtApplication jsonToEntity(String appId, RedisUtil redisUtil){
|
|
if (StringUtils.isEmpty(appId)) {
|
return null;
|
}
|
|
JSONObject thirtApplication = (JSONObject) redisUtil.get(appId);
|
|
//校验appid是否存在
|
if(thirtApplication == null){
|
return null;
|
}
|
ThirtApplication application = JSONObject.parseObject(thirtApplication.toString(),ThirtApplication.class);
|
|
return application;
|
}
|
|
/**获取应用在redis上面的数据
|
* @param appId 用户的APPID `
|
* @param redissonUtil RedissonUtil
|
* @return
|
*/
|
public static ThirtApplication jsonToEntity(String appId, RedissonUtil redissonUtil){
|
|
if (StringUtils.isEmpty(appId)) {
|
return null;
|
}
|
|
JSONObject thirtApplication = (JSONObject) redissonUtil.get(appId);
|
|
//校验appid是否存在
|
if(thirtApplication == null){
|
return null;
|
}
|
ThirtApplication application = JSONObject.parseObject(thirtApplication.toString(),ThirtApplication.class);
|
|
return application;
|
}
|
|
}
|