Commit fb9143b4 by 朱亚洁

1002952首页内容刷新频率修改

parent fc3991c5
...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletBooklistBiz; import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletBooklistClassifyDao; import com.pcloud.book.applet.dao.AppletBooklistClassifyDao;
import com.pcloud.book.applet.dao.AppletBooklistDao; import com.pcloud.book.applet.dao.AppletBooklistDao;
import com.pcloud.book.applet.dto.AddBookParamDTO; import com.pcloud.book.applet.dto.AddBookParamDTO;
...@@ -16,7 +17,6 @@ import com.pcloud.book.book.biz.BookBiz; ...@@ -16,7 +17,6 @@ import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookRaysClassifyDao; import com.pcloud.book.book.dao.BookRaysClassifyDao;
import com.pcloud.book.consumer.app.AssistTempletConsr; import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -43,7 +43,6 @@ import java.util.stream.Collectors; ...@@ -43,7 +43,6 @@ import java.util.stream.Collectors;
@Component @Component
public class AppletBooklistBizImpl implements AppletBooklistBiz { public class AppletBooklistBizImpl implements AppletBooklistBiz {
private static final String BOOKLIST_BOOK = CacheConstant.BOOK+"APPLET:listBooklist4Wechat_";
@Autowired @Autowired
private AppletBooklistClassifyDao appletBooklistClassifyDao; private AppletBooklistClassifyDao appletBooklistClassifyDao;
...@@ -83,6 +82,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz { ...@@ -83,6 +82,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少id"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少id");
} }
appletBooklistClassifyDao.update(appletBooklistClassify); appletBooklistClassifyDao.update(appletBooklistClassify);
JedisClusterUtils.del(AppletConstants.HOME_BOOKLIST);
} }
@Override @Override
...@@ -105,7 +105,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz { ...@@ -105,7 +105,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
appletBooklistDao.deleteById(id); appletBooklistDao.deleteById(id);
appletBooklistDao.deleteConfigByBooklistId(id); appletBooklistDao.deleteConfigByBooklistId(id);
//删除客户端缓存 //删除客户端缓存
JedisClusterUtils.del(BOOKLIST_BOOK+id); JedisClusterUtils.del(AppletConstants.BOOKLIST_BOOK+id);
JedisClusterUtils.del(AppletConstants.HOME_BOOKLIST);
} }
@Override @Override
...@@ -162,7 +163,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz { ...@@ -162,7 +163,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
appletBooklistDao.deleteConfigByBooklistId(booklistId); appletBooklistDao.deleteConfigByBooklistId(booklistId);
appletBooklistDao.addBooklistConfig(configDTOS); appletBooklistDao.addBooklistConfig(configDTOS);
//删除客户端缓存 //删除客户端缓存
JedisClusterUtils.del(BOOKLIST_BOOK+booklistId); JedisClusterUtils.del(AppletConstants.BOOKLIST_BOOK+booklistId);
JedisClusterUtils.del(AppletConstants.HOME_BOOKLIST);
} }
@Override @Override
...@@ -224,6 +226,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz { ...@@ -224,6 +226,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
@Override @Override
public PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId) { public PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId) {
PageBeanNew<AppletBooklistDTO> pageBeanNew = new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (null == classifyId) {//首页书单推荐 if (null == classifyId) {//首页书单推荐
List<Long> classifyIds = appletBooklistClassifyDao.getClassifyIdsByUserId(wechatUserId); List<Long> classifyIds = appletBooklistClassifyDao.getClassifyIdsByUserId(wechatUserId);
...@@ -237,17 +240,28 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz { ...@@ -237,17 +240,28 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
} }
map.put("classifyIdList", classifyIds); map.put("classifyIdList", classifyIds);
map.put("order", 1); map.put("order", 1);
//首页3条缓存5小时
if (currentPage==0 && numPerPage==3){
List<AppletBooklistDTO> homeList = JedisClusterUtils.getJsonList(AppletConstants.HOME_BOOKLIST, AppletBooklistDTO.class);
if (!ListUtils.isEmpty(homeList)) {
pageBeanNew = new PageBeanNew<>(0, 3, homeList.size(), homeList);
} else {
pageBeanNew = appletBooklistDao.listPageNew(new PageParam(0, 3), map, "listBooklist4Wechat");
JedisClusterUtils.setJsonList(AppletConstants.HOME_BOOKLIST, pageBeanNew.getRecordList(), 5 * 3600);
}
}
} else { } else {
map.put("classifyId", classifyId); map.put("classifyId", classifyId);
} }
PageBeanNew<AppletBooklistDTO> pageBeanNew = appletBooklistDao.listPageNew( if (ListUtils.isEmpty(pageBeanNew.getRecordList())){
new PageParam(currentPage, numPerPage), map, "listBooklist4Wechat"); pageBeanNew = appletBooklistDao.listPageNew(new PageParam(currentPage, numPerPage), map, "listBooklist4Wechat");
}
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) { if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
for (AppletBooklistDTO booklistDTO : pageBeanNew.getRecordList()) { for (AppletBooklistDTO booklistDTO : pageBeanNew.getRecordList()) {
Long booklistId = booklistDTO.getId(); Long booklistId = booklistDTO.getId();
String key = BOOKLIST_BOOK + booklistId; String key = AppletConstants.BOOKLIST_BOOK + booklistId;
List<BookDTO4Booklist> bookList = JedisClusterUtils.getJsonList(key, BookDTO4Booklist.class); List<BookDTO4Booklist> bookList = JedisClusterUtils.getJsonList(key, BookDTO4Booklist.class);
if (ListUtils.isEmpty(bookList)) { if (ListUtils.isEmpty(bookList)) {
bookList = appletBooklistDao.getBookBaseByBooklistId(booklistId, 0, 3); bookList = appletBooklistDao.getBookBaseByBooklistId(booklistId, 0, 3);
......
package com.pcloud.book.applet.biz.impl; package com.pcloud.book.applet.biz.impl;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz; import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletGroupSearchRecordDao; import com.pcloud.book.applet.dao.AppletGroupSearchRecordDao;
import com.pcloud.book.applet.dao.AppletGroupStatementDao; import com.pcloud.book.applet.dao.AppletGroupStatementDao;
import com.pcloud.book.applet.dto.AppletGroupSearchRecordDTO; import com.pcloud.book.applet.dto.AppletGroupSearchRecordDTO;
...@@ -54,9 +55,6 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi ...@@ -54,9 +55,6 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
private static final Logger LOGGER = LoggerFactory.getLogger(AppletGroupSearchRecordBizImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(AppletGroupSearchRecordBizImpl.class);
private static final String GROUP_HEAD_URL_REDIS = CacheConstant.BOOK + "APPLET:pcloudGroupActivity_groupHeadUrl";
private static final String GROUP_STATEMENT_REDIS = CacheConstant.BOOK + "APPLET:pcloudGroupActivity_statement";
@Autowired @Autowired
private AppletGroupSearchRecordDao appletGroupSearchRecordDao; private AppletGroupSearchRecordDao appletGroupSearchRecordDao;
@Autowired @Autowired
...@@ -199,11 +197,11 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi ...@@ -199,11 +197,11 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
@Override @Override
public List<String> getHeadUrlList(Integer userNum, Long groupQrcodeId) { public List<String> getHeadUrlList(Integer userNum, Long groupQrcodeId) {
List<String> headUrlList = JedisClusterUtils.hgetJson2List(GROUP_HEAD_URL_REDIS, groupQrcodeId.toString(), String.class); List<String> headUrlList = JedisClusterUtils.hgetJson2List(AppletConstants.GROUP_HEAD_URL_REDIS, groupQrcodeId.toString(), String.class);
if (ListUtils.isEmpty(headUrlList) || (headUrlList.size() < 9 && !userNum.equals(headUrlList.size()))) { if (ListUtils.isEmpty(headUrlList) || (headUrlList.size() < 9 && !userNum.equals(headUrlList.size()))) {
headUrlList = readerConsr.getRandomHeadUrlList(userNum > 9 ? 9 : userNum); headUrlList = readerConsr.getRandomHeadUrlList(userNum > 9 ? 9 : userNum);
JedisClusterUtils.hset2Json(GROUP_HEAD_URL_REDIS, groupQrcodeId.toString(), headUrlList); JedisClusterUtils.hset2Json(AppletConstants.GROUP_HEAD_URL_REDIS, groupQrcodeId.toString(), headUrlList);
JedisClusterUtils.expire(GROUP_HEAD_URL_REDIS, 3600); JedisClusterUtils.expire(AppletConstants.GROUP_HEAD_URL_REDIS, 3600);
} }
return headUrlList; return headUrlList;
} }
...@@ -213,7 +211,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi ...@@ -213,7 +211,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
if (userNum <= 0) { if (userNum <= 0) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<AppletGroupStatementDTO> statementDTOS = JedisClusterUtils.hgetJson2List(GROUP_STATEMENT_REDIS, groupQrcodeId.toString(), AppletGroupStatementDTO.class); List<AppletGroupStatementDTO> statementDTOS = JedisClusterUtils.hgetJson2List(AppletConstants.GROUP_STATEMENT_REDIS, groupQrcodeId.toString(), AppletGroupStatementDTO.class);
if (ListUtils.isEmpty(statementDTOS) || (statementDTOS.size() < 9 && !userNum.equals(statementDTOS.size()))) { if (ListUtils.isEmpty(statementDTOS) || (statementDTOS.size() < 9 && !userNum.equals(statementDTOS.size()))) {
statementDTOS = new ArrayList<>(); statementDTOS = new ArrayList<>();
userNum = userNum > 50 ? 50 : userNum;//最多50条 userNum = userNum > 50 ? 50 : userNum;//最多50条
...@@ -232,8 +230,8 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi ...@@ -232,8 +230,8 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
statementDTO.setDuration(statement.getDuration()); statementDTO.setDuration(statement.getDuration());
statementDTOS.add(statementDTO); statementDTOS.add(statementDTO);
} }
JedisClusterUtils.hset2Json(GROUP_STATEMENT_REDIS, groupQrcodeId.toString(), statementDTOS); JedisClusterUtils.hset2Json(AppletConstants.GROUP_STATEMENT_REDIS, groupQrcodeId.toString(), statementDTOS);
JedisClusterUtils.expire(GROUP_STATEMENT_REDIS, 3600); JedisClusterUtils.expire(AppletConstants.GROUP_STATEMENT_REDIS, 3600);
} }
return statementDTOS; return statementDTOS;
} }
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletNewsBiz; import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletLinkClickDao; import com.pcloud.book.applet.dao.AppletLinkClickDao;
import com.pcloud.book.applet.dao.AppletNewsClassifyDao; import com.pcloud.book.applet.dao.AppletNewsClassifyDao;
import com.pcloud.book.applet.dao.AppletNewsCommentDao; import com.pcloud.book.applet.dao.AppletNewsCommentDao;
...@@ -34,6 +35,7 @@ import com.pcloud.common.page.PageBeanNew; ...@@ -34,6 +35,7 @@ import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil; import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
...@@ -89,6 +91,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -89,6 +91,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
throw new BookBizException(BookBizException.ERROR,"id为空"); throw new BookBizException(BookBizException.ERROR,"id为空");
} }
appletNewsClassifyDao.update(appletNewsClassify); appletNewsClassifyDao.update(appletNewsClassify);
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override @Override
...@@ -98,6 +101,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -98,6 +101,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
throw new BookBizException(BookBizException.ERROR,"请先清空资讯"); throw new BookBizException(BookBizException.ERROR,"请先清空资讯");
} }
appletNewsClassifyDao.deleteById(id); appletNewsClassifyDao.deleteById(id);
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override @Override
...@@ -133,6 +137,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -133,6 +137,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
rightsSettingBiz.setClassifyAndLabel(appletNews); rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.update(appletNews); appletNewsDao.update(appletNews);
this.updateSource(beforeNews.getSource(),appletNews.getSource()); this.updateSource(beforeNews.getSource(),appletNews.getSource());
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override @Override
...@@ -143,6 +148,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -143,6 +148,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
} }
appletNewsDao.deleteById(id); appletNewsDao.deleteById(id);
this.updateSource(beforeNews.getSource(), null); this.updateSource(beforeNews.getSource(), null);
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override @Override
...@@ -274,6 +280,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -274,6 +280,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override @Override
public PageBeanNew<AppletNewsDTO> listAppletNews4Wechat(Integer currentPage, Integer numPerPage, Long newsClassifyId, Long wechatUserId) { public PageBeanNew<AppletNewsDTO> listAppletNews4Wechat(Integer currentPage, Integer numPerPage, Long newsClassifyId, Long wechatUserId) {
PageBeanNew<AppletNewsDTO> pageBeanNew = new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); ;
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
if (null == newsClassifyId) {//首页资讯 if (null == newsClassifyId) {//首页资讯
List<Long> classifyIds = appletNewsClassifyDao.getClassifyIdsByUserId(wechatUserId); List<Long> classifyIds = appletNewsClassifyDao.getClassifyIdsByUserId(wechatUserId);
...@@ -287,11 +294,22 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -287,11 +294,22 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
} }
paramMap.put("newsClassifyIdList", classifyIds); paramMap.put("newsClassifyIdList", classifyIds);
paramMap.put("order", 1); paramMap.put("order", 1);
//首页3条缓存5小时
if (currentPage==0 && numPerPage==3){
List<AppletNewsDTO> homeList = JedisClusterUtils.getJsonList(AppletConstants.HOME_NEWS_LIST, AppletNewsDTO.class);
if (!ListUtils.isEmpty(homeList)) {
pageBeanNew = new PageBeanNew<>(0, 3, homeList.size(), homeList);
} else {
pageBeanNew = appletNewsDao.listPageNew(new PageParam(0, 3), paramMap, "listAppletNews4Wechat");
JedisClusterUtils.setJsonList(AppletConstants.HOME_NEWS_LIST, pageBeanNew.getRecordList(), 5 * 3600);
}
}
} else {//栏目下的资讯 } else {//栏目下的资讯
paramMap.put("newsClassifyId", newsClassifyId); paramMap.put("newsClassifyId", newsClassifyId);
} }
PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew( if (ListUtils.isEmpty(pageBeanNew.getRecordList())) {
new PageParam(currentPage, numPerPage), paramMap, "listAppletNews4Wechat"); pageBeanNew = appletNewsDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletNews4Wechat");
}
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) { if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
...@@ -344,6 +362,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -344,6 +362,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override @Override
public void updateNewsShowState(AppletNews appletNews) { public void updateNewsShowState(AppletNews appletNews) {
appletNewsDao.updateNewsShowState(appletNews); appletNewsDao.updateNewsShowState(appletNews);
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override @Override
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz; import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO; import com.pcloud.book.applet.dto.UserLastBookReDTO;
...@@ -47,8 +48,6 @@ import java.util.stream.Collectors; ...@@ -47,8 +48,6 @@ import java.util.stream.Collectors;
@Component @Component
public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
private static final String USER_BOOK_CASE = CacheConstant.BOOK+"APPLET:listByWechatUserId";
private static final String USER_BOOK_CASE_COUNT = CacheConstant.BOOK+"APPLET:listByWechatUserId-count";
@Autowired @Autowired
private AppletUserBookcaseDao appletUserBookcaseDao; private AppletUserBookcaseDao appletUserBookcaseDao;
...@@ -68,15 +67,15 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -68,15 +67,15 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
//数据库去重 //数据库去重
appletUserBookcaseDao.insert(appletUserBookcase); appletUserBookcaseDao.insert(appletUserBookcase);
Long wechatUserId = appletUserBookcase.getWechatUserId(); Long wechatUserId = appletUserBookcase.getWechatUserId();
JedisClusterUtils.del(USER_BOOK_CASE + wechatUserId); JedisClusterUtils.del(AppletConstants.USER_BOOK_CASE + wechatUserId);
JedisClusterUtils.del(USER_BOOK_CASE_COUNT + wechatUserId); JedisClusterUtils.del(AppletConstants.USER_BOOK_CASE_COUNT + wechatUserId);
} }
@Override @Override
public PageBeanNew<AppletUserBookcaseDTO> listByWechatUserId(Long wechatUserId, Integer currentPage, Integer numPerPage) { public PageBeanNew<AppletUserBookcaseDTO> listByWechatUserId(Long wechatUserId, Integer currentPage, Integer numPerPage) {
String key = USER_BOOK_CASE+wechatUserId; String key = AppletConstants.USER_BOOK_CASE+wechatUserId;
String field = currentPage+"-"+numPerPage; String field = currentPage+"-"+numPerPage;
String countKey = USER_BOOK_CASE_COUNT+wechatUserId; String countKey = AppletConstants.USER_BOOK_CASE_COUNT+wechatUserId;
List<AppletUserBookcaseDTO> bookcaseDTOS = JedisClusterUtils.hgetJson2List(key,field,AppletUserBookcaseDTO.class); List<AppletUserBookcaseDTO> bookcaseDTOS = JedisClusterUtils.hgetJson2List(key,field,AppletUserBookcaseDTO.class);
Integer count =0; Integer count =0;
String countStr = JedisClusterUtils.get(countKey); String countStr = JedisClusterUtils.get(countKey);
...@@ -220,8 +219,8 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -220,8 +219,8 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
return; return;
} }
appletUserBookcaseDao.deleteByIds(ids); appletUserBookcaseDao.deleteByIds(ids);
JedisClusterUtils.del(USER_BOOK_CASE + wechatUserId); JedisClusterUtils.del(AppletConstants.USER_BOOK_CASE + wechatUserId);
JedisClusterUtils.del(USER_BOOK_CASE_COUNT + wechatUserId); JedisClusterUtils.del(AppletConstants.USER_BOOK_CASE_COUNT + wechatUserId);
} }
@Override @Override
......
package com.pcloud.book.applet.contants;
import com.pcloud.common.constant.CacheConstant;
/**
* @ClassName com.pcloud.book.applet.contants.AppletConstants
* @Author zhuyajie
* @Description 常量
* @Date 2020/5/25 11:23
* @Version 1.0
**/
public class AppletConstants {
/**
* 已读书刊列表
*/
public static final String USER_BOOK_CASE = CacheConstant.BOOK+"APPLET:listByWechatUserId";
public static final String USER_BOOK_CASE_COUNT = CacheConstant.BOOK+"APPLET:listByWechatUserId-count";
/**
* 书单书籍列表
*/
public static final String BOOKLIST_BOOK = CacheConstant.BOOK+"APPLET:listBooklist4Wechat_";
/**
* 共读社群头像
*/
public static final String GROUP_HEAD_URL_REDIS = CacheConstant.BOOK + "APPLET:pcloudGroupActivity_groupHeadUrl";
/**
* 共读社群对话
*/
public static final String GROUP_STATEMENT_REDIS = CacheConstant.BOOK + "APPLET:pcloudGroupActivity_statement";
/**
* 首页推荐资讯列表
*/
public static final String HOME_NEWS_LIST = CacheConstant.BOOK+"APPLET:listAppletNews4Wechat";
/**
* 首页推荐书单列表
*/
public static final String HOME_BOOKLIST = CacheConstant.BOOK+"APPLET:listBooklist4Wechat";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment