Commit 3db76b3b authored by 刘基明's avatar 刘基明

主题推荐优化

parent c62301b5
package com.tanpu.community.service;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.ThemeAnalysDO;
import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
......@@ -70,19 +68,15 @@ public class RankService {
Map<String, Integer> bookCountMap = collectionService.getCountMapByType(themeIds, CollectionTypeEnum.COLLECT_THEME);
Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds);
Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds);
Map<String, Integer> visitCountMap = visitSummaryService.getCountMapByThemeIds(themeIds, VisitTypeEnum.THEME_PAGE_VIEW);
Map<String, Integer> visitCountMap = visitSummaryService.getCountMapByTargetIds(themeIds, VisitTypeEnum.THEME_PAGE_VIEW);
for (ThemeAnalysDO theme : themeAnalysDOS) {
String themeId = theme.getThemeId();
Integer likeCount = likeCountMap.getOrDefault(themeId, 0);
Integer bookCount = bookCountMap.getOrDefault(themeId,0);
Integer commentCount = commentCountMap.getOrDefault(themeId,0);
Integer forwardCount = forwardCountMap.getOrDefault(themeId,0);
Integer viewCount = visitCountMap.getOrDefault(themeId,0);
theme.setCommentCount(commentCount);
theme.setLikeCount(likeCount);
theme.setForwardCount(forwardCount);
theme.setCollectCount(bookCount);
theme.setViewCount(viewCount);
theme.setCommentCount(commentCountMap.getOrDefault(themeId,0));
theme.setLikeCount(likeCountMap.getOrDefault(themeId, 0));
theme.setForwardCount(forwardCountMap.getOrDefault(themeId,0));
theme.setCollectCount(bookCountMap.getOrDefault(themeId,0));
theme.setViewCount(visitCountMap.getOrDefault(themeId,0));
//查询用户质量
String authorId = theme.getAuthorId();
UserInfoNew authorInfo = redisCache.getObject(StringUtils.joinWith(CACHE_FEIGN_USER_INFO, authorId),
......
......@@ -36,6 +36,14 @@ public class VisitSummaryService {
.stream().map(VisitSummaryEntity::getRefId).distinct().collect(Collectors.toList());
return ListUtils.subtract(refIds, visited);
}
public List<String> queryUseVisited(String userId) {
List<String> visited = visitSummaryMapper.selectList(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getVisitorId, userId))
.stream().map(VisitSummaryEntity::getRefId).distinct().collect(Collectors.toList());
return visited;
}
@Transactional
public void insertOrUpdateDur(VisitSummaryEntity vs) {
......
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