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
04ef023d
Commit
04ef023d
authored
Oct 29, 2021
by
胡定国
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.2.10' into dev
parents
4983541e
9be8680d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
HotRecommendService.java
...java/com/tanpu/community/service/HotRecommendService.java
+30
-5
No files found.
community-service/src/main/java/com/tanpu/community/service/HotRecommendService.java
View file @
04ef023d
...
...
@@ -22,12 +22,17 @@ import com.tanpu.community.dao.mapper.community.HotRecommendMapper;
import
com.tanpu.community.dao.mapper.community.HotRecommendUserMapper
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.HttpServletHelper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -44,6 +49,12 @@ public class HotRecommendService {
@Resource
private
FeignClientForFatools
feignClientForFatools
;
@Resource
private
FollowRelService
followRelService
;
@Resource
private
HttpServletHelper
httpServletHelper
;
/**
* 首页热门推荐列表
...
...
@@ -84,15 +95,29 @@ public class HotRecommendService {
LambdaQueryWrapper
<
HotRecommend
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
HotRecommend:
:
getHotRecommendId
,
req
.
getHotRecommendId
());
HotRecommend
hotRecommend
=
hotRecommendMapper
.
selectOne
(
queryWrapper
);
List
<
FollowQo
>
list
=
null
;
Page
<
FollowQo
>
page
=
null
;
if
(
hotRecommend
.
getType
()
==
1
)
{
return
this
.
getChiefInvAdv
(
req
);
page
=
this
.
getChiefInvAdv
(
req
);
}
else
if
(
hotRecommend
.
getType
()
==
2
)
{
return
this
.
getCorpInfo
(
req
);
page
=
this
.
getCorpInfo
(
req
);
}
else
if
(
hotRecommend
.
getType
()
==
3
)
{
return
this
.
getUserInfo
(
req
);
page
=
this
.
getUserInfo
(
req
);
}
if
(
StringUtils
.
isNotEmpty
(
httpServletHelper
.
getCurrentUserId
()))
{
page
.
setContent
(
judgeFollowed
(
page
.
getContent
(),
httpServletHelper
.
getCurrentUserId
()));
}
return
null
;
return
page
;
}
//判断返回列表中的用户是否被当前用户关注
public
List
<
FollowQo
>
judgeFollowed
(
List
<
FollowQo
>
followQos
,
@NotEmpty
String
followerId
)
{
Set
<
String
>
idolSet
=
new
HashSet
<>(
followRelService
.
queryIdolsByFansId
(
followerId
));
return
followQos
.
stream
().
map
(
o
->
{
if
(
idolSet
.
contains
(
o
.
getUserId
()))
{
o
.
setFollowed
(
true
);
}
return
o
;
}).
collect
(
Collectors
.
toList
());
}
private
Page
<
FollowQo
>
getCorpInfo
(
UserInfoCorpReq
req
)
{
...
...
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