Commit ea5dda15 authored by 刘基明's avatar 刘基明

Merge branch 'bugfix_1208' into 'dev'

Bugfix 1208

See merge request !28
parents 394274fc 98b30d73
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.util.TimeUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Slf4j @Slf4j
@Service @Service
@Configuration @Configuration
...@@ -45,7 +42,6 @@ public class ConJobManager { ...@@ -45,7 +42,6 @@ public class ConJobManager {
*/ */
@Scheduled(cron = "10 0/2 * * * ?") @Scheduled(cron = "10 0/2 * * * ?")
public void themeRank() { public void themeRank() {
log.info("圈子定时统计开始执行,"+ TimeUtils.format(LocalDateTime.now()));
rankService.rankThemes(); rankService.rankThemes();
rankService.rankTopics(); rankService.rankTopics();
} }
......
...@@ -583,13 +583,13 @@ public class ThemeManager { ...@@ -583,13 +583,13 @@ public class ThemeManager {
private void buildThemeCountInfo(ThemeQo themeQo) { private void buildThemeCountInfo(ThemeQo themeQo) {
String themeId = themeQo.getThemeId(); String themeId = themeQo.getThemeId();
// 点赞,收藏,转发 // 点赞,收藏,转发
Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60, Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60 * 60 * 24,
() -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class); () -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class);
Integer commentCount = redisCache.getObject(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId), 60, Integer commentCount = redisCache.getObject(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId), 60 * 60 * 24,
() -> commentService.getCommentCountByThemeId(themeId), Integer.class); () -> commentService.getCommentCountByThemeId(themeId), Integer.class);
Integer forwardCount = redisCache.getObject(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeId), 60, Integer forwardCount = redisCache.getObject(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeId), 60 * 60 * 24,
() -> themeService.getForwardCountById(themeId), Integer.class); () -> themeService.getForwardCountById(themeId), Integer.class);
themeQo.setCommentCount(commentCount); themeQo.setCommentCount(commentCount);
...@@ -605,10 +605,10 @@ public class ThemeManager { ...@@ -605,10 +605,10 @@ public class ThemeManager {
Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds); Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds);
Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds); Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds);
themeQos.stream().forEach(o->{ themeQos.stream().forEach(o -> {
o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(),0)); o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(), 0));
o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(),0)); o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(), 0));
o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(),0)); o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(), 0));
}); });
} }
...@@ -855,13 +855,13 @@ public class ThemeManager { ...@@ -855,13 +855,13 @@ public class ThemeManager {
while (content.length() > 5000) { while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000)); b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (StringUtils.isNotBlank(b)) { if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),"疑似违规词汇:"+b); throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(), "疑似违规词汇:" + b);
} }
content = content.substring(5000); content = content.substring(5000);
} }
b = TencentcloudUtils.textModeration(content); b = TencentcloudUtils.textModeration(content);
if (StringUtils.isNotBlank(b)) { if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),"疑似违规词汇:"+b); throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(), "疑似违规词汇:" + b);
} }
......
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