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
2ff9e636
Commit
2ff9e636
authored
Feb 27, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关注列表fix
parent
145cccc1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
7 deletions
+32
-7
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+2
-2
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+5
-5
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+25
-0
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
2ff9e636
...
...
@@ -519,10 +519,10 @@ public class ThemeManager {
fansList
.
add
(
userId
);
// 保证fansList不为空
// 权限控制,筛选出当前用户关注的话题
Set
<
String
>
user
PermitTopics
=
topicService
.
getUserPermit
Topics
(
userId
);
Set
<
String
>
user
FollowTopics
=
topicService
.
getUserFollow
Topics
(
userId
);
// 查库
themes
=
themeService
.
queryByUserIdsCreateDesc
(
fansList
,
pageStart
,
pageSize
,
user
Permit
Topics
);
themes
=
themeService
.
queryByUserIdsCreateDesc
(
fansList
,
pageStart
,
pageSize
,
user
Follow
Topics
);
if
(
CollectionUtils
.
isEmpty
(
excludeIds
)
&&
!
themes
.
isEmpty
())
{
// 说明是从头开始刷,则直接把最新的lastId放到redis中,保留一个月
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
2ff9e636
...
...
@@ -223,15 +223,15 @@ public class ThemeService {
* @param userIds
* @param pageStart
* @param pageSize
* @param user
Permit
Topics
* @param user
Follow
Topics
* @return
*/
public
List
<
ThemeEntity
>
queryByUserIdsCreateDesc
(
List
<
String
>
userIds
,
Integer
pageStart
,
Integer
pageSize
,
Set
<
String
>
user
Permit
Topics
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
)
&&
CollectionUtils
.
isEmpty
(
user
Permit
Topics
))
{
public
List
<
ThemeEntity
>
queryByUserIdsCreateDesc
(
List
<
String
>
userIds
,
Integer
pageStart
,
Integer
pageSize
,
Set
<
String
>
user
Follow
Topics
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
)
&&
CollectionUtils
.
isEmpty
(
user
Follow
Topics
))
{
return
Collections
.
emptyList
();
}
user
Permit
Topics
.
remove
(
""
);
return
themeMapper
.
queryFollowList
(
userIds
,
user
Permit
Topics
,
pageStart
,
pageSize
);
user
Follow
Topics
.
remove
(
""
);
return
themeMapper
.
queryFollowList
(
userIds
,
user
Follow
Topics
,
pageStart
,
pageSize
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
2ff9e636
...
...
@@ -165,6 +165,11 @@ public class TopicService {
}
}
/**
* 逐个校验是否有权限
* @param content
* @param userId
*/
public
void
batchCheckPermission
(
List
<
TopicRankQo
>
content
,
String
userId
)
{
Set
<
String
>
userPermitTopics
=
getUserPermitTopics
(
userId
);
content
.
forEach
(
o
->
{
...
...
@@ -339,6 +344,11 @@ public class TopicService {
}
/**
* 获取用户有权限的话题(专属的+所有的公开话题)
* @param userId
* @return
*/
public
Set
<
String
>
getUserPermitTopics
(
String
userId
)
{
// 公开权限的话题
List
<
TopicEntity
>
openTopics
=
topicMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicEntity
>()
...
...
@@ -360,4 +370,19 @@ public class TopicService {
res
.
addAll
(
openTopicIds
);
return
res
;
}
/**
* 获取用户关注的话题(专属的+关注的公开话题)
* @param userId
* @return
*/
public
Set
<
String
>
getUserFollowTopics
(
String
userId
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
return
new
HashSet
<>();
}
// 拥有权限的话题
List
<
String
>
followTopics
=
topicFollowRelMapper
.
selectTopicIdByUserId
(
userId
);
HashSet
<
String
>
res
=
new
HashSet
<>(
followTopics
);
return
res
;
}
}
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