Commit 969228b0 authored by 刘基明's avatar 刘基明

用户信息调用feign

parent b70e6d7c
......@@ -42,6 +42,10 @@ public interface FeignClientForFatools {
@GetMapping(value = "/queryUserInfoNew")
CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId);
@ApiOperation(value = "批量查询查询基本信息")
@GetMapping(value = "/queryUserBaseInfoList")
List<UserInfoNew> queryUserListNew(@RequestParam("userIds") List<String> userIds);
@ApiOperation(value = "根据机构用户id 查询旗下机构用户信息")
@GetMapping(value = "/getUsetInfoByOrgUserId")
CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(@RequestParam("orgUserId") String orgUserId);
......
......@@ -10,6 +10,7 @@ import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -51,6 +52,12 @@ public class FeignbackForFatools implements FallbackFactory<FeignClientForFatool
return CommonResp.error();
}
@Override
public List<UserInfoNew> queryUserListNew(List<String> userIds) {
log.info("FeignbackForFatools.queryUserListNew", throwable);
return Collections.emptyList();
}
@Override
public CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(String orgUserId) {
log.info("FeignbackForFatools.getUsetInfoByOrgUserId", throwable);
......
......@@ -55,7 +55,7 @@ public class ThemeManager {
private ThemeAttachmentService themeAttachmentService;
@Resource
private ProductService productService;
private BatchFeignCallService batchFeignCallService;
@Autowired
private VisitSummaryService visitSummaryService;
......@@ -186,7 +186,7 @@ public class ThemeManager {
themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds));
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
//组装附件
productService.getAttachDetailByBatch(themeQos);
batchFeignCallService.getAttachDetailByBatch(themeQos);
//主题列表
Map<String, ThemeQo> themeMap = themeQos.stream()
.collect(Collectors.toMap(ThemeQo::getThemeId, o -> o));
......@@ -216,11 +216,11 @@ public class ThemeManager {
}
return commentThemeList;
case 3://点赞
Set<String> likeThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.LIKE_THEME);
Set<String> likeThemeIds = collectionService.getListByUser(req.getLastId(), CollectionTypeEnum.LIKE_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(likeThemeIds), req.getLastId(), req.getPageSize());
break;
case 4://收藏
Set<String> collectThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.COLLECT_THEME);
Set<String> collectThemeIds = collectionService.getListByUser(req.getLastId(), CollectionTypeEnum.COLLECT_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(collectThemeIds), req.getLastId(), req.getPageSize());
break;
}
......@@ -236,7 +236,7 @@ public class ThemeManager {
throw new BizException("找不到帖子id:" + themeId);
}
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
productService.getAttachDetail(themeQo);
batchFeignCallService.getAttachDetail(themeQo);
buildThemeQoExtraInfo(userId, themeQo);
return themeQo;
}
......@@ -317,7 +317,7 @@ public class ThemeManager {
//Entity转Qo
List<ThemeQo> themeQos = ConvertUtil.themeEntitiesToDTOs(themeEntities);
//批量查询附件detail
productService.getAttachDetailByBatch(themeQos);
batchFeignCallService.getAttachDetailByBatch(themeQos);
//其他信息
for (ThemeQo themeQO : themeQos) {
buildThemeQoExtraInfo(userId, themeQO);
......@@ -367,7 +367,7 @@ public class ThemeManager {
if (formerTheme != null) {
//单个查询详情
productService.getAttachDetail(formerTheme);
batchFeignCallService.getAttachDetail(formerTheme);
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme);
themeQo.setFormerTheme(f);
}
......
......@@ -11,13 +11,13 @@ import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.feign.product.FeignClientForProducts;
......@@ -35,7 +35,7 @@ import java.util.*;
import java.util.stream.Collectors;
@Service
public class ProductService {
public class BatchFeignCallService {
@Resource
......@@ -93,7 +93,7 @@ public class ProductService {
// 话题标题
Map<String, String> topicMap = Maps.newHashMap();
// 图片信息
Map<String, UserInfoEntity> userMap = Maps.newHashMap();
Map<String, UserInfoNew> userMap = Maps.newHashMap();
// 批量查询资源信息
this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap, userMap, themeQos);
//逐个装入
......@@ -117,7 +117,7 @@ public class ProductService {
Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgMap,
Map<String, String> topicMap,
Map<String, UserInfoEntity> userMap,
Map<String, UserInfoNew> userMap,
List<ThemeQo> themeQos
) {
// 白名单基金id
......@@ -238,12 +238,12 @@ public class ProductService {
}
if (!CollectionUtils.isEmpty(userIds)) {
// 查询用户信息
List<UserInfoEntity> userInfos =
userInfoService.queryUserByIds(setToList(userIds));
List<UserInfoNew> queryUsersListNew = feignClientForFatools.queryUserListNew(setToList(userIds));
if (!CollectionUtils.isEmpty(userIds)) {
userMap.putAll(userInfos.stream().collect(Collectors
.toMap(UserInfoEntity::getId, o -> o)));
userMap.putAll(queryUsersListNew.stream().collect(Collectors
.toMap(UserInfoNew::getUserId, o -> o)));
}
}
this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap);
}
......@@ -369,19 +369,22 @@ public class ProductService {
Map<String, ZhiboListResp> zhiboMap,
Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgUrlMap,
Map<String, UserInfoEntity> userMap,
Map<String, UserInfoNew> userMap,
Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
}
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
UserInfoEntity userInfoEntity = userMap.get(themeQo.getAuthorId());
themeQo.setNickName(userInfoEntity.getUiUsernameMp());
themeQo.setUserImg(userInfoEntity.getUiHeadimgMp());
themeQo.setUserIntroduction(userInfoEntity.getUiIntroductionMp());
themeQo.setUserType(userInfoEntity.getUserType());
themeQo.setLevelGrade(userInfoEntity.getLevelGrade());
UserInfoNew userInfo = userMap.get(themeQo.getAuthorId());
themeQo.setNickName(userInfo.getNickName());
themeQo.setUserImg(userInfo.getHeadImageUrl());
themeQo.setUserIntroduction(userInfo.getIntroduction());
themeQo.setUserType(userInfo.getUserType());
themeQo.setLevelGrade(userInfo.getLevelGrade());
themeQo.setUserInvestorType(userInfo.getUserInvestorType());
themeQo.setBelongUserOrgId(userInfo.getBelongUserOrgId());
themeQo.setBelongUserOrgName(userInfo.getBelongUserOrgName());
}
if (themeQo.getContent() == null) {
continue;
......
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