Commit 576738bf authored by 吴泽佳's avatar 吴泽佳
parents c3c427f8 c0360c0a
package com.tanpu.community.api.enums;
import org.apache.commons.collections4.SetUtils;
import java.util.HashSet;
public enum ThemeRecordTypeEnum {
PUBLISH_LIST(1,"发布列表"),
COMMENT_LIST(2,"评论列表"),
LIKE_LIST(3,"点赞"),
COLLECT_LIST(4,"收藏");
public static final HashSet<String> imageTypeSet = SetUtils.hashSet("jpg", "jpeg", "png");
private Integer code;
private String type;
ThemeRecordTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
......@@ -178,7 +178,12 @@ public class HomePageManager {
}
//获取用户关注、粉丝列表
/**
* 用户关注列表
* @param req 目标用户
* @param userId 当前用户
* @return
*/
public Page<FollowQo> queryFollow(QueryFollowReq req, String userId) {
//TODO 数据库分页
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
......
......@@ -14,7 +14,13 @@ import com.tanpu.community.api.beans.qo.FormerThemeQo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.req.theme.CollectThemeReq;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
import com.tanpu.community.api.beans.req.theme.LikeThemeReq;
import com.tanpu.community.api.beans.req.theme.ReportThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.api.beans.resp.ThemeFullSearchResp;
import com.tanpu.community.api.beans.resp.ThemeListResp;
......@@ -22,9 +28,14 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.enums.BlockTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.api.enums.ThemeListTypeEnum;
import com.tanpu.community.api.enums.ThemeRecordTypeEnum;
import com.tanpu.community.api.enums.ThemeTypeEnum;
import com.tanpu.community.cache.RedisCache;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.*;
import com.tanpu.community.service.base.ESService;
......@@ -43,7 +54,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.tanpu.community.api.constants.RedisKeyConstant.*;
......@@ -367,7 +384,12 @@ public class ThemeManager {
}
}
// 返回用户发布、回复、点赞、收藏的主题列表
/**
* 返回用户发布、回复、点赞、收藏的主题列表
* @param req 查询用户
* @param userId 当前用户
* @return
*/
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) {
List<ThemeEntity> themeEntities = Collections.emptyList();
......@@ -392,8 +414,8 @@ public class ThemeManager {
}
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
if (userId.equals(req.getUserId())) {
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致
if (userId.equals(req.getUserId()) && !ThemeRecordTypeEnum.COLLECT_LIST.getCode().equals(req.getRecordType())) {
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
CommonResp<UserInfoResp> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(userId);
if (userInfoNewCommonResp.isNotSuccess()) {
throw new BizException("内部接口调用失败");
......
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