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
2de37d0e
Commit
2de37d0e
authored
Jun 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
屏蔽fix
parent
fd84c963
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
24 deletions
+39
-24
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+6
-1
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+14
-15
BlackListService.java
...in/java/com/tanpu/community/service/BlackListService.java
+13
-0
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+6
-8
No files found.
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
2de37d0e
...
@@ -65,6 +65,8 @@ public class ThemeController {
...
@@ -65,6 +65,8 @@ public class ThemeController {
@RequestMapping
(
value
=
"/forward"
)
@RequestMapping
(
value
=
"/forward"
)
@ResponseBody
@ResponseBody
public
String
forwardTheme
(
String
themeId
){
public
String
forwardTheme
(
String
themeId
){
String
userId
=
"liujm"
;
themeManager
.
forward
(
themeId
,
userId
);
return
"success"
;
return
"success"
;
}
}
...
@@ -98,13 +100,16 @@ public class ThemeController {
...
@@ -98,13 +100,16 @@ public class ThemeController {
@RequestMapping
(
value
=
"/complaint"
)
@RequestMapping
(
value
=
"/complaint"
)
@ResponseBody
@ResponseBody
public
String
complaintTheme
(
String
themeId
){
public
String
complaintTheme
(
String
themeId
){
return
"success"
;
return
"功能暂未开放"
;
}
}
@ApiOperation
(
"屏蔽"
)
@ApiOperation
(
"屏蔽"
)
@RequestMapping
(
value
=
"/conceal"
)
@RequestMapping
(
value
=
"/conceal"
)
@ResponseBody
@ResponseBody
public
String
concealTheme
(
String
themeId
){
public
String
concealTheme
(
String
themeId
){
String
user
=
"liujm"
;
themeManager
.
blockContent
(
themeId
,
user
);
return
"success"
;
return
"success"
;
}
}
}
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
2de37d0e
...
@@ -32,13 +32,14 @@ public class ThemeManager {
...
@@ -32,13 +32,14 @@ public class ThemeManager {
//返回推荐主题文章
//返回推荐主题文章
public
List
<
ThemeEntity
>
selectHotThemes
(){
public
List
<
ThemeEntity
>
selectHotThemes
(){
//TO
T
O:根据算法计算推荐主题
//TO
D
O:根据算法计算推荐主题
return
null
;
return
null
;
}
}
//返回关注主题
//返回关注主题
public
List
<
ThemeEntity
>
selectInterestThemes
(
String
userId
){
public
List
<
ThemeEntity
>
selectInterestThemes
(
String
userId
){
List
<
String
>
fansRelEntities
=
fansRelService
.
queryFansByFollowerId
(
userId
).
stream
().
map
(
FansRelEntity:
:
getIdolId
).
collect
(
Collectors
.
toList
());
List
<
String
>
fansList
=
fansRelService
.
queryFansByFollowerId
(
userId
).
stream
().
map
(
FansRelEntity:
:
getIdolId
).
collect
(
Collectors
.
toList
());
List
<
ThemeEntity
>
result
=
themeService
.
selectByFans
(
fansList
);
return
null
;
return
null
;
}
}
...
@@ -65,12 +66,12 @@ public class ThemeManager {
...
@@ -65,12 +66,12 @@ public class ThemeManager {
//转发
//转发
public
void
forward
(
String
themeId
,
String
user
)
{
public
void
forward
(
String
themeId
,
String
user
)
{
//TODO
}
}
//分享
//分享
public
void
share
(
String
themeId
,
String
user
)
{
public
void
share
(
String
themeId
,
String
user
)
{
//TODO
}
}
//收藏
//收藏
...
@@ -85,24 +86,22 @@ public class ThemeManager {
...
@@ -85,24 +86,22 @@ public class ThemeManager {
}
}
//投诉(主题)
//投诉(主题)
public
void
complaint
(
String
themeId
,
String
user
)
{
public
void
complaint
(
String
themeId
,
String
user
)
{
//TODO
}
}
//屏蔽(用户)
//屏蔽(用户)
public
void
blockUser
(
String
themeId
,
String
userId
)
{
public
void
blockUser
(
String
themeId
,
String
userId
)
{
BlackListEntity
blackListEntity
=
new
BlackListEntity
();
BlackListEntity
selectOne
=
blackListService
.
selectOne
(
userId
,
BlockTypeEnum
.
USER
.
getCode
(),
themeService
.
selectTheme
(
themeId
).
getAuthorId
());
blackListEntity
.
setBlockedId
(
themeService
.
selectTheme
(
themeId
).
getAuthorId
());
if
(
selectOne
==
null
){
blackListEntity
.
setBlocker
(
userId
);
blackListService
.
insertBlackList
(
userId
,
BlockTypeEnum
.
USER
.
getCode
(),
themeService
.
selectTheme
(
themeId
).
getAuthorId
());
blackListEntity
.
setBlockedType
(
BlockTypeEnum
.
USER
.
getCode
());
}
blackListService
.
insertBlackList
(
blackListEntity
);
}
}
//屏蔽(内容)
//屏蔽(内容)
public
void
blockContent
(
String
themeId
,
String
userId
)
{
public
void
blockContent
(
String
themeId
,
String
userId
)
{
BlackListEntity
blackListEntity
=
new
BlackListEntity
();
BlackListEntity
selectOne
=
blackListService
.
selectOne
(
userId
,
BlockTypeEnum
.
USER
.
getCode
(),
themeId
);
blackListEntity
.
setBlockedId
(
themeId
);
if
(
selectOne
==
null
){
blackListEntity
.
setBlocker
(
userId
);
blackListService
.
insertBlackList
(
userId
,
BlockTypeEnum
.
USER
.
getCode
(),
themeId
);
blackListEntity
.
setBlockedType
(
BlockTypeEnum
.
CONTENT
.
getCode
());
}
blackListService
.
insertBlackList
(
blackListEntity
);
}
}
public
void
insert
(
ThemeEntity
themeEntity
)
{
public
void
insert
(
ThemeEntity
themeEntity
)
{
...
...
community-service/src/main/java/com/tanpu/community/service/BlackListService.java
View file @
2de37d0e
...
@@ -16,6 +16,19 @@ public class BlackListService {
...
@@ -16,6 +16,19 @@ public class BlackListService {
blackListMapper
.
insert
(
blackListEntity
);
blackListMapper
.
insert
(
blackListEntity
);
}
}
public
BlackListEntity
selectOne
(
String
blocker
,
Integer
blockType
,
String
blockId
)
{
return
blackListMapper
.
selectOne
(
new
LambdaQueryWrapper
<
BlackListEntity
>().
eq
(
BlackListEntity:
:
getBlocker
,
blocker
).
eq
(
BlackListEntity:
:
getBlockedId
,
blockId
).
eq
(
BlackListEntity:
:
getBlockedType
,
blockType
));
}
public
void
insertBlackList
(
String
blocker
,
Integer
blockType
,
String
blockId
){
BlackListEntity
blackListEntity
=
new
BlackListEntity
();
blackListEntity
.
setBlockedType
(
blockType
);
blackListEntity
.
setBlocker
(
blocker
);
blackListEntity
.
setBlockedId
(
blockId
);
blackListMapper
.
insert
(
blackListEntity
);
}
public
void
deleteBlackList
(
String
blocker
,
String
blockId
,
String
blockType
){
public
void
deleteBlackList
(
String
blocker
,
String
blockId
,
String
blockType
){
blackListMapper
.
delete
(
new
LambdaQueryWrapper
<
BlackListEntity
>().
eq
(
BlackListEntity:
:
getBlocker
,
blocker
).
blackListMapper
.
delete
(
new
LambdaQueryWrapper
<
BlackListEntity
>().
eq
(
BlackListEntity:
:
getBlocker
,
blocker
).
eq
(
BlackListEntity:
:
getBlockedId
,
blockId
).
eq
(
BlackListEntity:
:
getBlockedType
,
blockType
));
eq
(
BlackListEntity:
:
getBlockedId
,
blockId
).
eq
(
BlackListEntity:
:
getBlockedType
,
blockType
));
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
2de37d0e
package
com
.
tanpu
.
community
.
service
;
package
com
.
tanpu
.
community
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.
Lambda
QueryWrapper
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.mapper.community.ThemeMapper
;
import
com.tanpu.community.dao.mapper.community.ThemeMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -26,11 +25,10 @@ public class ThemeService {
...
@@ -26,11 +25,10 @@ public class ThemeService {
//根据话题查询主题
//根据话题查询主题
public
List
<
ThemeEntity
>
selectByTopic
(
String
topidId
){
public
List
<
ThemeEntity
>
selectByTopic
(
String
topidId
){
QueryWrapper
<
ThemeEntity
>
themeEntityQueryWrapper
=
new
QueryWrapper
<>();
return
themeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ThemeEntity
>().
eq
(
ThemeEntity:
:
getTopicId
,
topidId
));
themeEntityQueryWrapper
.
eq
(
"topic_id"
,
topidId
);
}
return
themeMapper
.
selectList
(
themeEntityQueryWrapper
);
//查询列表中用户的主题
public
List
<
ThemeEntity
>
selectByFans
(
List
<
String
>
fansList
)
{
return
themeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ThemeEntity
>().
in
(
ThemeEntity:
:
getAuthorId
,
fansList
));
}
}
}
}
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