diff --git a/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java b/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java index 67159a1cb..1b41943c3 100644 --- a/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java @@ -11,11 +11,13 @@ import org.springframework.data.redis.core.ValueOperations; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.iformall.domain.po.WxCUser; +import com.iformall.domain.po.base.BaseCUserEntity; public class RedisCacheUtils { private static T parseJson(String json,Class clazz) { - return JSON.parseObject(json,new TypeReference() {}); + return JSON.parseObject(json,clazz); } private static List parseListJson(String json,Class clazz) { @@ -63,12 +65,7 @@ public class RedisCacheUtils { } public static Map getCacheMap(RedisTemplate template,String key) { - if (template.hasKey(key)) { - ValueOperations operations = template.opsForValue(); - Object o = operations.get(key); - return parseJson(JSON.toJSONString(o), Map.class); - } - return null; + return getCacheObject(template,key,Map.class); } public static String getCacheString(RedisTemplate template,String key) { @@ -129,13 +126,7 @@ public class RedisCacheUtils { } public static Map getMapFieldObject(Object o,String property) { - String json = JSON.toJSONString(o); - JSONObject jsonObject = JSON.parseObject(json); - Object p = jsonObject.get(property); - if (null != p ) { - return parseJson(JSON.toJSONString(p), Map.class); - } - return null; + return getFieldObject(o,property,Map.class); } public static void removeCache(RedisTemplate template,String key) {