Commit d8e9b1ca by 田超

Merge branch 'fixbug/1006818' into 'master'

feat:[1006818] 斗罗

See merge request rays/pcloud-book!1528
parents b9dbcd89 0a982be3
......@@ -194,6 +194,8 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import static com.pcloud.book.group.constant.ResourcePageConstants.DL_BOOK_SERVES_CACHE;
/**
* @ClassName com.pcloud.book.group.biz.impl.ResourcePageBizImpl
* @Author zhuyajie
......@@ -1894,6 +1896,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
});
//删除缓存
JedisClusterUtils.del("FUNCTION:DOULUO_APP");
JedisClusterUtils.del(DL_BOOK_SERVES_CACHE + updateResourcePageVO.getSceneId());
return resourcePageId;
}
......@@ -3943,37 +3946,42 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
@Override
public List<ResourcePageItemVO> getServerList4Wechat(Long wechatUserId, Long sceneId) {
ResourcePage bySceneId = resourcePageDao.getBySceneId(sceneId);
if (null == bySceneId) {
return new ArrayList<>();
}
List<ResourcePageItemVO> itemVOList = resourcePageItemDao.getResourcePageItemByPageId(bySceneId.getId(), true);
if(CollUtil.isEmpty(itemVOList)) {
return new ArrayList<>();
}
if (CollUtil.isNotEmpty(itemVOList)) {
//二维码类型
fillQrcodeType(bySceneId.getId(), itemVOList);
Map<String, List<ResourcePageItemVO>> listMap = itemVOList.stream().collect(Collectors.groupingBy(ResourcePageItemVO::getServeType));
itemVOList = new ArrayList<>();
//应用和作品提出来一起查
List<ResourcePageItemVO> itemAppAndProductVOList = new ArrayList<>();
//过滤一些资源,重新排序
for (Map.Entry<String, List<ResourcePageItemVO>> entry : listMap.entrySet()) {
if (ResourcePageConstants.ServeTypeEnum.APP.getValue().equals(entry.getKey()) || ServeTypeEnum.PRODUCT.getValue().equals(entry.getKey())) {
itemAppAndProductVOList.addAll(entry.getValue());
continue;
List<ResourcePageItemVO> itemVOList = JedisClusterUtils.getJsonList(DL_BOOK_SERVES_CACHE + sceneId, ResourcePageItemVO.class);
if (CollUtil.isEmpty(itemVOList)) {
ResourcePage bySceneId = resourcePageDao.getBySceneId(sceneId);
if (null == bySceneId) {
return new ArrayList<>();
}
itemVOList = resourcePageItemDao.getResourcePageItemByPageId(bySceneId.getId(), true);
if(CollUtil.isEmpty(itemVOList)) {
return new ArrayList<>();
}
if (CollUtil.isNotEmpty(itemVOList)) {
//二维码类型
Map<String, List<ResourcePageItemVO>> listMap = itemVOList.stream().collect(Collectors.groupingBy(ResourcePageItemVO::getServeType));
itemVOList = new ArrayList<>();
//应用和作品提出来一起查
List<ResourcePageItemVO> itemAppAndProductVOList = new ArrayList<>();
//过滤一些资源,重新排序
for (Map.Entry<String, List<ResourcePageItemVO>> entry : listMap.entrySet()) {
if (ResourcePageConstants.ServeTypeEnum.APP.getValue().equals(entry.getKey()) || ServeTypeEnum.PRODUCT.getValue().equals(entry.getKey())) {
itemAppAndProductVOList.addAll(entry.getValue());
continue;
}
this.fillResourceByType(entry.getValue(), wechatUserId, entry.getKey());
itemVOList.addAll(entry.getValue());
}
if (CollUtil.isNotEmpty(itemAppAndProductVOList)) {
fillAppProductServe(itemAppAndProductVOList, wechatUserId);
//暂不返回 直接根据typecode进行判断
//fillTaskType(itemAppAndProductVOList);
itemVOList.addAll(itemAppAndProductVOList);
}
this.fillResourceByType(entry.getValue(), wechatUserId, entry.getKey());
itemVOList.addAll(entry.getValue());
itemVOList.sort(Comparator.comparing(ResourcePageItemVO::getId));
}
if (CollUtil.isNotEmpty(itemAppAndProductVOList)) {
fillAppProductServe(itemAppAndProductVOList, wechatUserId);
//暂不返回 直接根据typecode进行判断
//fillTaskType(itemAppAndProductVOList);
itemVOList.addAll(itemAppAndProductVOList);
if (CollUtil.isNotEmpty(itemVOList)) {
JedisClusterUtils.setJsonList(DL_BOOK_SERVES_CACHE + sceneId, ResourcePageItemVO.class, 3600 * 72);
}
itemVOList.sort(Comparator.comparing(ResourcePageItemVO::getId));
}
return itemVOList;
}
......
......@@ -463,4 +463,9 @@ public class ResourcePageConstants {
}
}
/**
* 斗罗首页缓存
*/
public static final String DL_BOOK_SERVES_CACHE = "BOOK:DL:SERVES:";
}
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