Commit 3fdd9bb1 authored by 刘基明's avatar 刘基明

删除无用方法

parent 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);
// }
}
......@@ -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());
}
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment