Commit 18750bc6 authored by 刘基明's avatar 刘基明

增加举报字段

parent 2298b759
......@@ -40,4 +40,16 @@ public class CommentQo {
@ApiModelProperty(value = "2级评论")
private List<CommentLv2Qo> commentLv2Qos;
//认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade;
@ApiModelProperty("认证标签用-当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType;
@ApiModelProperty("认证标签用-用户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty("认证标签用-所属机构id")
private String belongUserOrgId;
@ApiModelProperty("认证标签用-所属机构名")
private String belongUserOrgName;
}
......@@ -40,16 +40,16 @@ public class HomePageController {
@ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew")
@AuthLogin
public CommonResp<UserInfoNew> queryUsersListNew(@RequestParam(value = "userId", required = false) String userId){
public CommonResp<UserInfoNew> queryUsersListNew(@RequestParam(value = "userId", required = false) String userId) {
String userIdMyself = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself,userId));
return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself, userId));
}
// 理财师客户列表查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 理财师客户列表查询")
@GetMapping(value = "/queryUserCustomerList")
@AuthLogin
public CommonResp<List<Customer>> queryUserCustomerList(){
public CommonResp<List<Customer>> queryUserCustomerList() {
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUserCustomerList(userId));
}
......@@ -61,7 +61,7 @@ public class HomePageController {
@AuthLogin
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId));
return CommonResp.success(homePageManager.queryFollow(req, userId));
}
@PostMapping(value = "/addIdol")
......@@ -69,7 +69,7 @@ public class HomePageController {
@ResponseBody
public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId();
homePageManager.addFollowRel(req,userId);
homePageManager.addFollowRel(req, userId);
return CommonResp.success();
}
......@@ -77,9 +77,9 @@ public class HomePageController {
@ApiOperation("用户的帖子列表")
@ResponseBody
@AuthLogin
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req){
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) {
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
return CommonResp.success(themeManager.queryThemesByUser(req, userId));
}
}
......@@ -39,7 +39,7 @@ public class ThemeController {
}
@AuthLogin
@ApiOperation("圈子首页-推荐/关注/热门/最新")
@ApiOperation("主题列表-推荐/关注/热门/最新")
@PostMapping(value = "/list")
@ResponseBody
public CommonResp<List<ThemeQo>> selectInterestList(@Validated @RequestBody ThemeListReq req) {
......
package com.tanpu.community.manager;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.LikeCommentReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.CollectionService;
import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,7 +31,7 @@ public class CommentManager {
private CommentService commentService;
@Autowired
private HomePageService homePageService;
private FeignClientForFatools feignClientForFatools;
@Autowired
private CollectionService collectionService;
......@@ -63,10 +65,19 @@ public class CommentManager {
for (CommentQo commentQo : commentQos) {
//用户信息
String authorId = commentQo.getAuthorId();
UserInfoEntity userInfo = userInfoService.queryUserById(authorId);
CommonResp<UserInfoNew> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(authorId);
if (userInfoNewCommonResp.isNotSuccess()) {
throw new BizException("内部接口调用失败");
}
UserInfoNew userInfo = userInfoNewCommonResp.getData();
if (userInfo != null) {
commentQo.setUserImg(userInfo.getUiHeadimgMp());
commentQo.setNickName(userInfo.getUiUsernameMp());
commentQo.setUserImg(userInfo.getHeadImageUrl());
commentQo.setNickName(userInfo.getNickName());
commentQo.setUserType(userInfo.getUserType());
commentQo.setLevelGrade(userInfo.getLevelGrade());
commentQo.setUserInvestorType(userInfo.getUserInvestorType());
commentQo.setBelongUserOrgId(userInfo.getBelongUserOrgId());
commentQo.setBelongUserOrgName(userInfo.getBelongUserOrgName());
}
//是否点赞及点赞数
String commentId = commentQo.getCommentId();
......@@ -80,8 +91,8 @@ public class CommentManager {
// commentQo.setCommentLv2Qos(commentLv2Qos);
}
//排序:点赞降序+时间降序
return commentQos.stream().sorted(Comparator.comparing(CommentQo::getLikeCount,Comparator.reverseOrder()).
thenComparing(CommentQo::getUpdateTime,Comparator.reverseOrder()))
return commentQos.stream().sorted(Comparator.comparing(CommentQo::getLikeCount, Comparator.reverseOrder()).
thenComparing(CommentQo::getUpdateTime, Comparator.reverseOrder()))
.collect(Collectors.toList());
}
......
......@@ -4,10 +4,7 @@ import com.google.common.collect.Sets;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.ESThemeQo;
import com.tanpu.community.api.beans.qo.FormerThemeQo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.resp.CreateThemeResp;
......@@ -102,17 +99,7 @@ public class ThemeManager {
public CreateThemeResp publishTheme(CreateThemeReq req, String userId) {
//直播类型做转播检查
List<ThemeContentReq> contents = req.getContent();
for (ThemeContentReq content : contents) {
if (content != null && content.getType().equals(RelTypeEnum.LIVE.type)) {
CommonResp<Set<String>> notRelayResp = feignClientForFatools.getNotRelaySet(userId, Sets.newHashSet(content.getValue()));
if (!notRelayResp.isSuccess()) {
throw new BizException("转播失败");
}
if (CollectionUtils.isEmpty(notRelayResp.getData())) {
throw new BizException("9999", "很抱歉!您需要购买或报名成功后才可以添加这个直播哦~");
}
}
}
liveRelayCheck(userId, contents);
//保存主题表
ThemeEntity themeEntity = new ThemeEntity();
......@@ -149,6 +136,7 @@ public class ThemeManager {
}
/**
* 返回主题列表
*
......@@ -159,7 +147,7 @@ public class ThemeManager {
public List<ThemeQo> queryThemes(ThemeListReq req, String userId) {
List<ThemeEntity> themeEntities = new ArrayList<>();
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
// TODO:推荐
//推荐
// themeEntities = themeService.selectExcludeUser(userId, req.getLastId(), req.getPageSize());
List<String> recommendThemeIds = rankService.getHotAndNewThemes(100, 100);
themeEntities = themeService.queryByThemeIdsExcludeUser(recommendThemeIds, userId, req.getLastId(), req.getPageSize());
......@@ -170,11 +158,12 @@ public class ThemeManager {
themeEntities = themeService.queryByUserIds(fansList, req.getLastId(), req.getPageSize());
} else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) {
//TODO 根据话题查询热门
//根据话题查询热门
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空");
List<ThemeAnalysDO> rankThemeList = rankService.getRankThemeList(req.getTopicId());
themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
} else if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())) {
//TODO 根据话题查询最新
//根据话题查询最新
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空");
themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
}
......@@ -307,7 +296,6 @@ public class ThemeManager {
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
}
// 屏蔽(用户)
public void blockUser(String blockUser, String userId) {
BlackListEntity selectOne = blackListService.selectOne(blockUser, userId, BlockTypeEnum.USER.getCode());
......@@ -316,11 +304,6 @@ public class ThemeManager {
}
}
// 解除屏蔽(用户)
public void unblockUser(String blockUser, String userId) {
//todo
}
// 屏蔽(主题)
public void blockTheme(String themeId, String userId) {
blackListService.addBlock(themeId, userId, BlockTypeEnum.THEME);
......@@ -353,11 +336,11 @@ public class ThemeManager {
//组装主题详情
private void buildThemeQoExtraInfo(String userId, ThemeQo themeQo) {
String themeId = themeQo.getThemeId();
//封装转发对象
buildFormerTheme(themeQo);
String themeId = themeQo.getThemeId();
//是否关注作者
String authorId = themeQo.getAuthorId();
......@@ -374,7 +357,6 @@ public class ThemeManager {
themeQo.setHasCollect(collectionEntity != null);
//点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
// Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
Integer commentCount = commentService.getCommentCountByThemeId(themeId);
Integer forwardCount = themeService.getForwardCountById(themeId);
themeQo.setCommentCount(commentCount);
......@@ -405,10 +387,6 @@ public class ThemeManager {
themeService.deleteById(themeId);
}
//投诉(主题)
public void complaint(String themeId, String user) {
//TODO
}
public Integer getFollowUpdateCount(String userId) {
LocalDateTime lastViewTime = visitSummaryService.queryLatestViewFollow(userId);
......@@ -416,7 +394,10 @@ public class ThemeManager {
return themeService.queryCountFromLastTime(fansList, lastViewTime);
}
/**
* 腾讯云-内容检测
* @param content
*/
private void checkContent(String content) {
// 腾讯云接口最多支持5000文字校验,超过5000执行2次
// 检查内容是否涉黄违法
......@@ -433,4 +414,24 @@ public class ThemeManager {
return ;
}
/**
* 直播类型做转播检查
* @param userId
* @param contents
*/
private void liveRelayCheck(String userId, List<ThemeContentReq> contents) {
for (ThemeContentReq content : contents) {
if (content != null && content.getType().equals(RelTypeEnum.LIVE.type)) {
CommonResp<Set<String>> notRelayResp = feignClientForFatools.getNotRelaySet(userId, Sets.newHashSet(content.getValue()));
if (!notRelayResp.isSuccess()) {
throw new BizException("转播失败");
}
if (CollectionUtils.isEmpty(notRelayResp.getData())) {
throw new BizException("9999", "很抱歉!您需要购买或报名成功后才可以添加这个直播哦~");
}
}
}
}
}
......@@ -34,6 +34,9 @@ import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* 批量调用Feign查询接口
*/
@Service
public class BatchFeignCallService {
......@@ -373,13 +376,17 @@ public class BatchFeignCallService {
Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
//话题标题
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
}
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
//用户信息
UserInfoNew userInfo = userMap.get(themeQo.getAuthorId());
//昵称头像简介
themeQo.setNickName(userInfo.getNickName());
themeQo.setUserImg(userInfo.getHeadImageUrl());
themeQo.setUserIntroduction(userInfo.getIntroduction());
//认证标签相关
themeQo.setUserType(userInfo.getUserType());
themeQo.setLevelGrade(userInfo.getLevelGrade());
themeQo.setUserInvestorType(userInfo.getUserInvestorType());
......
......@@ -28,7 +28,7 @@ public class RankService {
private VisitSummaryService visitSummaryService;
private List<String> rankThemeList = new ArrayList<>();
private List<ThemeAnalysDO> rankThemeList = new ArrayList<>();
private List<TopicRankQo> rankTopicList = new ArrayList<>();
private List<TopicRankQo> rankTopicListTop4 = new ArrayList<>();
......@@ -56,7 +56,7 @@ public class RankService {
//打分
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getScore));
//排序
rankThemeList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey().getThemeId()).collect(Collectors.toList());
rankThemeList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey()).collect(Collectors.toList());
}
......@@ -102,7 +102,7 @@ public class RankService {
* @return
*/
public List<String> getHotAndNewThemes(Integer hotCount, Integer newCount) {
Set<String> hotThemeIds = this.rankThemeList.stream().limit(hotCount).collect(Collectors.toSet());
Set<String> hotThemeIds = this.rankThemeList.stream().limit(hotCount).map(ThemeAnalysDO::getThemeId).collect(Collectors.toSet());
Set<String> newThemeIds = themeService.selectExcludeUser(null, null, newCount)
.stream().map(ThemeEntity::getThemeId).collect(Collectors.toSet());
hotThemeIds.addAll(newThemeIds);
......@@ -124,7 +124,10 @@ public class RankService {
}
public List<String> getRankThemeList() {
public List<ThemeAnalysDO> getRankThemeList() {
if (this.rankThemeList.size()==0){
rankThemes();
}
return rankThemeList;
}
......@@ -141,4 +144,11 @@ public class RankService {
}
return rankTopicListTop4;
}
public List<ThemeAnalysDO> getRankThemeList(String topicId) {
if (this.rankThemeList.size()==0){
this.rankThemes();
}
return rankThemeList.stream().filter(o->o.getTopicId().equals(topicId)).collect(Collectors.toList());
}
}
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