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
0252f076
Commit
0252f076
authored
Feb 22, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
话题权限
parent
4d3514d1
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 @
0252f076
...
@@ -129,7 +129,7 @@ public class CommentManager {
...
@@ -129,7 +129,7 @@ public class CommentManager {
}
}
// 查询管理员
// 查询管理员
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
themeId
);
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
themeId
);
S
tring
managerId
=
topicService
.
getManagerId
(
themeEntity
.
getTopicId
());
S
et
<
String
>
managerId
=
topicService
.
getManagerId
(
themeEntity
.
getTopicId
());
for
(
CommentQo
commentQo
:
commentQos
)
{
for
(
CommentQo
commentQo
:
commentQos
)
{
// 封装用户信息
// 封装用户信息
...
@@ -140,7 +140,7 @@ public class CommentManager {
...
@@ -140,7 +140,7 @@ public class CommentManager {
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
// 是否管理员
// 是否管理员
if
(
commentQo
.
getAuthorId
().
equals
(
managerId
))
{
if
(
managerId
.
contains
(
commentQo
.
getAuthorId
()
))
{
commentQo
.
setManager
(
true
);
commentQo
.
setManager
(
true
);
}
else
{
}
else
{
commentQo
.
setManager
(
false
);
commentQo
.
setManager
(
false
);
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
0252f076
...
@@ -143,7 +143,7 @@ public class TopicManager {
...
@@ -143,7 +143,7 @@ public class TopicManager {
BeanUtils
.
copyProperties
(
topicDetail
,
result
);
BeanUtils
.
copyProperties
(
topicDetail
,
result
);
// 查询管理员
// 查询管理员
result
.
setManagers
(
topicService
.
queryManagers
(
result
.
getTopicId
()));
result
.
setManagers
(
topicService
.
queryManager
Name
s
(
result
.
getTopicId
()));
// 查询关联产品
// 查询关联产品
topicService
.
queryAttachments
(
result
);
topicService
.
queryAttachments
(
result
);
// 是否关注
// 是否关注
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
0252f076
...
@@ -141,9 +141,15 @@ public class TopicService {
...
@@ -141,9 +141,15 @@ public class TopicService {
}
}
public
void
batchCheckPermission
(
List
<
TopicRankQo
>
content
,
String
userId
)
{
public
void
batchCheckPermission
(
List
<
TopicRankQo
>
content
,
String
userId
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
Set
<
String
>
userPermitTopics
=
getUserPermitTopics
(
userId
);
return
;
content
.
forEach
(
o
->
{
}
if
(
userPermitTopics
.
contains
(
o
.
getTopicId
()))
{
o
.
setHasPermission
(
true
);
}
else
{
o
.
setHasPermission
(
false
);
}
});
}
}
...
@@ -176,8 +182,20 @@ public class TopicService {
...
@@ -176,8 +182,20 @@ public class TopicService {
// return "该话题仅限" + permission + "可参与哦~";
// return "该话题仅限" + permission + "可参与哦~";
}
}
public
String
queryManagers
(
String
topicId
)
{
public
String
queryManagerNames
(
String
topicId
)
{
return
"小王、小李、小刘"
;
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
)
{
public
void
queryAttachments
(
TopicPageDetailQo
topic
)
{
...
@@ -243,30 +261,18 @@ public class TopicService {
...
@@ -243,30 +261,18 @@ public class TopicService {
public
void
checkManager
(
String
topicId
,
List
<
ThemeQo
>
themes
)
{
public
void
checkManager
(
String
topicId
,
List
<
ThemeQo
>
themes
)
{
S
tring
managerId
=
getManagerId
(
topicId
);
S
et
<
String
>
managerId
=
getManagerId
(
topicId
);
for
(
ThemeQo
theme
:
themes
)
{
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
))
{
if
(
StringUtils
.
isBlank
(
topicId
))
{
return
""
;
return
new
HashSet
<>()
;
}
}
List
<
TopicManagerEntity
>
topicManagerEntities
=
topicManagerMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicManagerEntity
>().
eq
(
TopicManagerEntity:
:
getTopicId
,
topicId
));
List
<
TopicManagerEntity
>
topicManagerEntities
=
topicManagerMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicManagerEntity
>().
eq
(
TopicManagerEntity:
:
getTopicId
,
topicId
));
return
topicManagerEntities
.
stream
().
map
(
TopicManagerEntity:
:
getUserId
).
collect
(
Collectors
.
toSet
());
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
,
"、"
);
}
}
/**
/**
...
...
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