Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
969228b0
Commit
969228b0
authored
Jul 20, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户信息调用feign
parent
b70e6d7c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
22 deletions
+36
-22
FeignClientForFatools.java
.../tanpu/community/feign/fatools/FeignClientForFatools.java
+4
-0
FeignbackForFatools.java
...om/tanpu/community/feign/fatools/FeignbackForFatools.java
+7
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+7
-7
BatchFeignCallService.java
...va/com/tanpu/community/service/BatchFeignCallService.java
+18
-15
No files found.
community-service/src/main/java/com/tanpu/community/feign/fatools/FeignClientForFatools.java
View file @
969228b0
...
...
@@ -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
);
...
...
community-service/src/main/java/com/tanpu/community/feign/fatools/FeignbackForFatools.java
View file @
969228b0
...
...
@@ -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
);
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
969228b0
...
...
@@ -55,7 +55,7 @@ public class ThemeManager {
private
ThemeAttachmentService
themeAttachmentService
;
@Resource
private
ProductService
product
Service
;
private
BatchFeignCallService
batchFeignCall
Service
;
@Autowired
private
VisitSummaryService
visitSummaryService
;
...
...
@@ -186,7 +186,7 @@ public class ThemeManager {
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
replyThemeIds
));
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
//组装附件
product
Service
.
getAttachDetailByBatch
(
themeQos
);
batchFeignCall
Service
.
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
);
product
Service
.
getAttachDetail
(
themeQo
);
batchFeignCall
Service
.
getAttachDetail
(
themeQo
);
buildThemeQoExtraInfo
(
userId
,
themeQo
);
return
themeQo
;
}
...
...
@@ -317,7 +317,7 @@ public class ThemeManager {
//Entity转Qo
List
<
ThemeQo
>
themeQos
=
ConvertUtil
.
themeEntitiesToDTOs
(
themeEntities
);
//批量查询附件detail
product
Service
.
getAttachDetailByBatch
(
themeQos
);
batchFeignCall
Service
.
getAttachDetailByBatch
(
themeQos
);
//其他信息
for
(
ThemeQo
themeQO
:
themeQos
)
{
buildThemeQoExtraInfo
(
userId
,
themeQO
);
...
...
@@ -367,7 +367,7 @@ public class ThemeManager {
if
(
formerTheme
!=
null
)
{
//单个查询详情
product
Service
.
getAttachDetail
(
formerTheme
);
batchFeignCall
Service
.
getAttachDetail
(
formerTheme
);
FormerThemeQo
f
=
ConvertUtil
.
themeQo2FormerThemeQo
(
formerTheme
);
themeQo
.
setFormerTheme
(
f
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/
Product
Service.java
→
community-service/src/main/java/com/tanpu/community/service/
BatchFeignCall
Service.java
View file @
969228b0
...
...
@@ -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
Product
Service
{
public
class
BatchFeignCall
Service
{
@Resource
...
...
@@ -93,7 +93,7 @@ public class ProductService {
// 话题标题
Map
<
String
,
String
>
topicMap
=
Maps
.
newHashMap
();
// 图片信息
Map
<
String
,
UserInfo
Entity
>
userMap
=
Maps
.
newHashMap
();
Map
<
String
,
UserInfo
New
>
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
,
UserInfo
Entity
>
userMap
,
Map
<
String
,
UserInfo
New
>
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
(
UserInfo
Entity:
:
get
Id
,
o
->
o
)));
userMap
.
putAll
(
queryUsersListNew
.
stream
().
collect
(
Collectors
.
toMap
(
UserInfo
New:
:
getUser
Id
,
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
,
UserInfo
Entity
>
userMap
,
Map
<
String
,
UserInfo
New
>
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment