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