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

用户信息调用feign

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