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
b2911793
Commit
b2911793
authored
3 years ago
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.3.1' into 'dev'
话题权限 See merge request
!61
parents
d4549168
0252f076
dev
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
25 deletions
+31
-25
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+2
-2
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-1
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+28
-22
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
b2911793
...
...
@@ -129,7 +129,7 @@ public class CommentManager {
}
// 查询管理员
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
themeId
);
S
tring
managerId
=
topicService
.
getManagerId
(
themeEntity
.
getTopicId
());
S
et
<
String
>
managerId
=
topicService
.
getManagerId
(
themeEntity
.
getTopicId
());
for
(
CommentQo
commentQo
:
commentQos
)
{
// 封装用户信息
...
...
@@ -140,7 +140,7 @@ public class CommentManager {
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
// 是否管理员
if
(
commentQo
.
getAuthorId
().
equals
(
managerId
))
{
if
(
managerId
.
contains
(
commentQo
.
getAuthorId
()
))
{
commentQo
.
setManager
(
true
);
}
else
{
commentQo
.
setManager
(
false
);
...
...
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
b2911793
...
...
@@ -143,7 +143,7 @@ public class TopicManager {
BeanUtils
.
copyProperties
(
topicDetail
,
result
);
// 查询管理员
result
.
setManagers
(
topicService
.
queryManagers
(
result
.
getTopicId
()));
result
.
setManagers
(
topicService
.
queryManager
Name
s
(
result
.
getTopicId
()));
// 查询关联产品
topicService
.
queryAttachments
(
result
);
// 是否关注
...
...
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
b2911793
...
...
@@ -141,9 +141,15 @@ public class TopicService {
}
public
void
batchCheckPermission
(
List
<
TopicRankQo
>
content
,
String
userId
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
return
;
}
Set
<
String
>
userPermitTopics
=
getUserPermitTopics
(
userId
);
content
.
forEach
(
o
->
{
if
(
userPermitTopics
.
contains
(
o
.
getTopicId
()))
{
o
.
setHasPermission
(
true
);
}
else
{
o
.
setHasPermission
(
false
);
}
});
}
...
...
@@ -176,8 +182,20 @@ public class TopicService {
// return "该话题仅限" + permission + "可参与哦~";
}
public
String
queryManagers
(
String
topicId
)
{
return
"小王、小李、小刘"
;
public
String
queryManagerNames
(
String
topicId
)
{
List
<
TopicManagerEntity
>
topicManagerEntities
=
topicManagerMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicManagerEntity
>().
eq
(
TopicManagerEntity:
:
getTopicId
,
topicId
));
List
<
String
>
managerIds
=
topicManagerEntities
.
stream
().
map
(
TopicManagerEntity:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
UserInfoResp
>
userList
=
feignService
.
getUserList
(
managerIds
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
""
;
}
List
<
String
>
userNames
=
userList
.
stream
().
map
(
UserInfoResp:
:
getNickName
).
collect
(
Collectors
.
toList
());
return
StringUtils
.
join
(
userNames
,
"、"
);
}
public
void
queryAttachments
(
TopicPageDetailQo
topic
)
{
...
...
@@ -243,30 +261,18 @@ public class TopicService {
public
void
checkManager
(
String
topicId
,
List
<
ThemeQo
>
themes
)
{
S
tring
managerId
=
getManagerId
(
topicId
);
S
et
<
String
>
managerId
=
getManagerId
(
topicId
);
for
(
ThemeQo
theme
:
themes
)
{
theme
.
setManager
(
theme
.
getAuthorId
().
equals
(
managerId
));
theme
.
setManager
(
managerId
.
contains
(
theme
.
getAuthorId
()
));
}
}
public
S
tring
getManagerId
(
String
topicId
)
{
public
S
et
<
String
>
getManagerId
(
String
topicId
)
{
if
(
StringUtils
.
isBlank
(
topicId
))
{
return
""
;
return
new
HashSet
<>()
;
}
List
<
TopicManagerEntity
>
topicManagerEntities
=
topicManagerMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicManagerEntity
>().
eq
(
TopicManagerEntity:
:
getTopicId
,
topicId
));
List
<
String
>
managerIds
=
topicManagerEntities
.
stream
().
map
(
TopicManagerEntity:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
UserInfoResp
>
userList
=
feignService
.
getUserList
(
managerIds
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
""
;
}
List
<
String
>
userNames
=
userList
.
stream
().
map
(
UserInfoResp:
:
getNickName
).
collect
(
Collectors
.
toList
());
return
StringUtils
.
join
(
userNames
,
"、"
);
return
topicManagerEntities
.
stream
().
map
(
TopicManagerEntity:
:
getUserId
).
collect
(
Collectors
.
toSet
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
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