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
3fdd9bb1
Commit
3fdd9bb1
authored
Jul 22, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除无用方法
parent
620dec6b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
150 deletions
+62
-150
AdminController.java
.../java/com/tanpu/community/controller/AdminController.java
+0
-77
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+61
-47
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-26
No files found.
community-service/src/main/java/com/tanpu/community/controller/AdminController.java
deleted
100644 → 0
View file @
620dec6b
package
com
.
tanpu
.
community
.
controller
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.community.api.beans.req.topic.TopicConcealReq
;
import
com.tanpu.community.api.beans.req.topic.TopicTopReq
;
import
com.tanpu.community.manager.TopicManager
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.MissingServletRequestParameterException
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@Slf4j
@RequestMapping
(
value
=
"/api/admin/topic"
)
public
class
AdminController
{
@Autowired
private
TopicManager
topicManager
;
@Autowired
private
UserHolder
userHolder
;
@GetMapping
(
value
=
"/add"
)
@ApiOperation
(
"新增话题"
)
@ResponseBody
public
CommonResp
<
Void
>
addTopic
(
@RequestParam
String
topicTitle
){
String
userId
=
userHolder
.
getUserId
();
topicManager
.
insertTopic
(
topicTitle
,
userId
);
return
CommonResp
.
success
();
}
//
// @ApiOperation("单个话题详细数据")
// @GetMapping("/detailData")
// @ResponseBody
// public CommonResp<TopicDO> selectOne(@RequestParam String topicId) throws MissingServletRequestParameterException {
// if (StringUtils.isEmpty(topicId)){
// throw new MissingServletRequestParameterException("topicId","String");
// }
// TopicDO topicDO =topicManager.getDetail(topicId);
// return CommonResp.success(topicDO);
// }
@PostMapping
(
value
=
"/setTop"
)
@ApiOperation
(
"顶置/取消顶置话题"
)
@ResponseBody
public
CommonResp
<
Void
>
setTopTopic
(
@RequestBody
TopicTopReq
req
)
throws
MissingServletRequestParameterException
{
topicManager
.
setTopTopic
(
req
.
getTopicId
(),
req
.
isTop
());
return
CommonResp
.
success
();
}
@PostMapping
(
value
=
"/setConceal"
)
@ApiOperation
(
"隐藏/显示话题"
)
@ResponseBody
public
CommonResp
<
Void
>
setConceal
(
@RequestBody
TopicConcealReq
req
)
throws
MissingServletRequestParameterException
{
topicManager
.
setTopicConceal
(
req
.
getTopicId
(),
req
.
isConceal
());
return
CommonResp
.
success
();
}
//
// @PostMapping(value = "/modifyViewNum")
// @ApiOperation("话题浏览数调整(后台管理)")
// @ResponseBody
// public CommonResp<Void> modifyViewNum(@RequestBody TopicModifyMountReq req) throws MissingServletRequestParameterException {
// topicManager.modifyViewCount(req.getTopicId(),req.getModifyMount());
// return CommonResp.success();
// }
//
// @GetMapping(value = "/dataAnalyse")
// @ApiOperation("话题数据分析")
// @ResponseBody
// public CommonResp<TopicDataAnalysDTO> dataAnalyse(@RequestParam String topicId) throws MissingServletRequestParameterException {
// TopicDataAnalysDTO result =topicManager.queryDataAnalysis(topicId);
// return CommonResp.success(result);
// }
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
3fdd9bb1
...
...
@@ -181,6 +181,19 @@ public class ThemeManager {
}
/**
* 举报主题
* @param req
* @param userId
*/
public
void
report
(
ReportThemeReq
req
,
String
userId
)
{
//更改举报状态
themeService
.
updateReportStatus
(
req
.
getThemeId
());
//写入举报日志
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
req
.
getThemeId
());
reportLogService
.
insert
(
ReportTypeEnum
.
THEME
,
userId
,
req
.
getThemeId
(),
themeEntity
.
getAuthorId
(),
req
.
getReason
());
}
// 返回用户发布、回复、收藏的主题列表
public
List
<
ThemeQo
>
queryThemesByUser
(
QueryRecordThemeReq
req
,
String
userId
)
{
...
...
@@ -190,7 +203,25 @@ public class ThemeManager {
themeEntities
=
themeService
.
queryThemesByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
break
;
case
2
:
//回复
List
<
ThemeQo
>
commentThemeList
=
getCommentThemeQos
(
req
,
userId
);
return
commentThemeList
;
case
3
:
//点赞
Set
<
String
>
likeThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
LIKE_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
likeThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
break
;
case
4
:
//收藏
Set
<
String
>
collectThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
COLLECT_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
collectThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
break
;
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
return
themeQos
;
}
private
List
<
ThemeQo
>
getCommentThemeQos
(
QueryRecordThemeReq
req
,
String
userId
)
{
List
<
ThemeQo
>
commentThemeList
=
new
ArrayList
<>();
List
<
ThemeEntity
>
themeEntities
;
//评论列表
List
<
CommentEntity
>
commentEntities
=
commentService
.
queryThemesByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
//当前用户信息
...
...
@@ -230,18 +261,7 @@ public class ThemeManager {
commentThemeList
.
add
(
commentThemeQo
);
}
return
commentThemeList
;
case
3
:
//点赞
Set
<
String
>
likeThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
LIKE_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
likeThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
break
;
case
4
:
//收藏
Set
<
String
>
collectThemeIds
=
collectionService
.
getListByUser
(
req
.
getUserId
(),
CollectionTypeEnum
.
COLLECT_THEME
);
themeEntities
=
themeService
.
queryByThemeIds
(
new
ArrayList
<>(
collectThemeIds
),
req
.
getLastId
(),
req
.
getPageSize
());
break
;
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
return
themeQos
;
return
null
;
}
...
...
@@ -437,11 +457,5 @@ public class ThemeManager {
}
}
public
void
report
(
ReportThemeReq
req
,
String
userId
)
{
//更改举报状态
themeService
.
updateReportStatus
(
req
.
getThemeId
());
//写入举报日志
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
req
.
getThemeId
());
reportLogService
.
insert
(
ReportTypeEnum
.
THEME
,
userId
,
req
.
getThemeId
(),
themeEntity
.
getAuthorId
(),
req
.
getReason
());
}
}
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
3fdd9bb1
...
...
@@ -66,31 +66,6 @@ public class TopicManager {
}
public
void
setTopTopic
(
String
topicId
,
boolean
setTop
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
)
{
throw
new
BizException
(
"找不到话题,id:"
+
topicId
);
}
if
(
setTop
)
{
topicService
.
updateTopicToTop
(
topicId
);
}
else
{
topicService
.
updateTopicNotTop
(
topicId
);
}
}
public
void
setTopicConceal
(
String
topicId
,
boolean
setConceal
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
)
{
throw
new
BizException
(
"找不到话题,id:"
+
topicId
);
}
if
(
setConceal
)
{
topicService
.
updateTopicToConceal
(
topicId
);
}
else
{
topicService
.
updateTopicNotConceal
(
topicId
);
}
}
public
void
refreshRedisCache
()
{
List
<
TopicEntity
>
topicEntities
=
topicService
.
queryAll
();
...
...
@@ -122,7 +97,7 @@ public class TopicManager {
}
//
后台管理:
返回数据分析
//返回数据分析
public
TopicDataAnalysDTO
queryDataAnalysis
(
String
topicId
)
{
TopicDataAnalysDTO
topicDataAnalysDTO
=
new
TopicDataAnalysDTO
();
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
...
...
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