Commit 883b02be authored by 刘基明's avatar 刘基明

点赞列表fix

parent 6b5fe214
...@@ -173,7 +173,6 @@ public class ThemeManager { ...@@ -173,7 +173,6 @@ public class ThemeManager {
themeEntity.setContent(JsonUtil.toJson(req.getContent())); themeEntity.setContent(JsonUtil.toJson(req.getContent()));
if (StringUtils.isBlank(req.getEditThemeId())) { if (StringUtils.isBlank(req.getEditThemeId())) {
// 新建 // 新建
themeService.insertTheme(themeEntity); themeService.insertTheme(themeEntity);
...@@ -209,11 +208,11 @@ public class ThemeManager { ...@@ -209,11 +208,11 @@ public class ThemeManager {
*/ */
private void checkAttachment(List<ThemeContentReq> themeAttachments) { private void checkAttachment(List<ThemeContentReq> themeAttachments) {
for (ThemeContentReq content : themeAttachments) { for (ThemeContentReq content : themeAttachments) {
if (content.getType() == null ) { if (content.getType() == null) {
throw new IllegalArgumentException("主题内容ThemeContentReq缺少类型"); throw new IllegalArgumentException("主题内容ThemeContentReq缺少类型");
} }
Set<String> types = Arrays.stream(RelTypeEnum.values()).map(o->o.type).collect(Collectors.toSet()); Set<String> types = Arrays.stream(RelTypeEnum.values()).map(o -> o.type).collect(Collectors.toSet());
if (!types.contains(content.getType())){ if (!types.contains(content.getType())) {
throw new IllegalArgumentException("主题内容ThemeContentReq类型错误"); throw new IllegalArgumentException("主题内容ThemeContentReq类型错误");
} }
if (content.getType().equals(RelTypeEnum.FUND.type)) { if (content.getType().equals(RelTypeEnum.FUND.type)) {
...@@ -258,7 +257,6 @@ public class ThemeManager { ...@@ -258,7 +257,6 @@ public class ThemeManager {
/** /**
* 查询主题列表:推荐/关注/热门/最新 * 查询主题列表:推荐/关注/热门/最新
*
*/ */
// 查询主题列表:推荐/关注/热门/最新 // 查询主题列表:推荐/关注/热门/最新
public ThemeListResp queryList(ThemeListReq req, String userId) { public ThemeListResp queryList(ThemeListReq req, String userId) {
...@@ -358,7 +356,6 @@ public class ThemeManager { ...@@ -358,7 +356,6 @@ public class ThemeManager {
themeQo.setFormerTheme(former); themeQo.setFormerTheme(former);
// 点赞,收藏,转发 // 点赞,收藏,转发
Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60, Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60,
() -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class); () -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class);
...@@ -436,15 +433,18 @@ public class ThemeManager { ...@@ -436,15 +433,18 @@ public class ThemeManager {
} }
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId); List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
if (userId.equals(req.getUserId()) && !ThemeRecordTypeEnum.COLLECT_LIST.getCode().equals(req.getRecordType()) if (userId.equals(req.getUserId())) {
&& !ThemeRecordTypeEnum.LIKE_LIST.getCode().equals(req.getRecordType())) {
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型) //如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
CommonResp<UserInfoResp> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(userId); CommonResp<UserInfoResp> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(userId);
if (userInfoNewCommonResp.isNotSuccess()) { if (userInfoNewCommonResp.isNotSuccess()) {
throw new BizException("内部接口调用失败"); throw new BizException("内部接口调用失败");
} }
UserInfoResp user = userInfoNewCommonResp.getData(); UserInfoResp user = userInfoNewCommonResp.getData();
themeQos.stream().forEach(o -> reBuildAuthorInfo(o, user)); themeQos.forEach(o -> {
if (o.getAuthorId().equals(userId)) {
reBuildAuthorInfo(o, user);
}
});
redisCache.put(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, userId), user, 60); redisCache.put(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, userId), user, 60);
} }
...@@ -693,7 +693,7 @@ public class ThemeManager { ...@@ -693,7 +693,7 @@ public class ThemeManager {
themeQo.setWorkshopIntroduction(userInfo.getWorkshopIntroduction()); themeQo.setWorkshopIntroduction(userInfo.getWorkshopIntroduction());
} }
private void evictThemeCache(String themeId){ private void evictThemeCache(String themeId) {
redisCache.evict(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeId)); redisCache.evict(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeId));
redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeId)); redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeId));
} }
......
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