Authored by caoyan

物权转移

1 package com.yohoufo.user.constants; 1 package com.yohoufo.user.constants;
2 2
  3 +import org.apache.commons.lang3.StringUtils;
  4 +
3 import com.yoho.core.config.ConfigReaderUtil; 5 import com.yoho.core.config.ConfigReaderUtil;
4 import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; 6 import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
5 -import org.apache.commons.lang3.StringUtils;  
6 7
7 /** 8 /**
8 * Created by shengguo.cai on 2018/9/18. 9 * Created by shengguo.cai on 2018/9/18.
@@ -16,7 +17,12 @@ public enum CacheEnum { @@ -16,7 +17,12 @@ public enum CacheEnum {
16 /** 17 /**
17 * 消息盒子-消息,缓存5分钟 18 * 消息盒子-消息,缓存5分钟
18 */ 19 */
19 - USERS_INBOX_LIST("yh:users:inbox_list", 5 * 60, "users.cachetime.inbox_list"), 20 +// USERS_INBOX_LIST("yh:users:inbox_list", 5 * 60, "users.cachetime.inbox_list"),
  21 +
  22 + /**
  23 + * 消息盒子-消息,缓存5分钟
  24 + */
  25 + USERS_INBOX_VO_LIST("yh:users:inbox_vo_list", 5 * 60, "users.cachetime.inbox_vo_list"),
20 26
21 /** 27 /**
22 * 消息盒子-消息总数,缓存5分钟 28 * 消息盒子-消息总数,缓存5分钟
@@ -227,9 +227,9 @@ public class InBoxServiceImpl implements IInBoxService { @@ -227,9 +227,9 @@ public class InBoxServiceImpl implements IInBoxService {
227 } 227 }
228 228
229 private void setInboxByRedis(ListInboxReqVO reqVO, List<InBox> inBoxes, int total) { 229 private void setInboxByRedis(ListInboxReqVO reqVO, List<InBox> inBoxes, int total) {
230 - RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid()); 230 + RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(reqVO.getUid());
231 redisTemplate.put(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()), 231 redisTemplate.put(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),
232 - inBoxes,CacheEnum.USERS_INBOX_LIST.getCacheTime()); 232 + inBoxes,CacheEnum.USERS_INBOX_VO_LIST.getCacheTime());
233 RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType()); 233 RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType());
234 redisTemplate.setEx(inboxTotalKey,total,CacheEnum.USERS_INBOX_LIST_TOTAL.getCacheTime()); 234 redisTemplate.setEx(inboxTotalKey,total,CacheEnum.USERS_INBOX_LIST_TOTAL.getCacheTime());
235 } 235 }
@@ -245,7 +245,7 @@ public class InBoxServiceImpl implements IInBoxService { @@ -245,7 +245,7 @@ public class InBoxServiceImpl implements IInBoxService {
245 245
246 private PageResponseVO<InBoxVO> listInboxByRedis(ListInboxReqVO reqVO) { 246 private PageResponseVO<InBoxVO> listInboxByRedis(ListInboxReqVO reqVO) {
247 PageResponseVO<InBoxVO> response = new PageResponseVO<>(); 247 PageResponseVO<InBoxVO> response = new PageResponseVO<>();
248 - RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid()); 248 + RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(reqVO.getUid());
249 List<InBoxVO> inboxes = redisTemplate.getList(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),InBoxVO.class); 249 List<InBoxVO> inboxes = redisTemplate.getList(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),InBoxVO.class);
250 RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType()); 250 RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType());
251 Integer total = redisTemplate.get(inboxTotalKey,Integer.class); 251 Integer total = redisTemplate.get(inboxTotalKey,Integer.class);
@@ -327,7 +327,7 @@ public class InBoxServiceImpl implements IInBoxService { @@ -327,7 +327,7 @@ public class InBoxServiceImpl implements IInBoxService {
327 327
328 private void deleteIboxsByRedis(int uid,int type){ 328 private void deleteIboxsByRedis(int uid,int type){
329 log.info("deleteIboxsByRedis params uid is {} type is {}",uid,type); 329 log.info("deleteIboxsByRedis params uid is {} type is {}",uid,type);
330 - RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(uid); 330 + RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(uid);
331 redisTemplate.delete(inboxKey); 331 redisTemplate.delete(inboxKey);
332 RedisKeyBuilder key = CacheEnum.USERS_INBOX_TYPE_UNREADCOUNT.generateKey(uid,type); 332 RedisKeyBuilder key = CacheEnum.USERS_INBOX_TYPE_UNREADCOUNT.generateKey(uid,type);
333 redisTemplate.delete(key); 333 redisTemplate.delete(key);