Commit 882a4927 authored by 吴泽佳's avatar 吴泽佳
parents 681c2558 18750bc6
...@@ -40,4 +40,16 @@ public class CommentQo { ...@@ -40,4 +40,16 @@ public class CommentQo {
@ApiModelProperty(value = "2级评论") @ApiModelProperty(value = "2级评论")
private List<CommentLv2Qo> commentLv2Qos; 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;
} }
...@@ -29,4 +29,16 @@ public class FollowQo { ...@@ -29,4 +29,16 @@ public class FollowQo {
@ApiModelProperty(value = "是否关注") @ApiModelProperty(value = "是否关注")
private boolean followed; private boolean followed;
//认证标签相关
@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;
} }
...@@ -46,11 +46,12 @@ public class ThemeAnalysDO { ...@@ -46,11 +46,12 @@ public class ThemeAnalysDO {
@ApiModelProperty(value = "距今时间") @ApiModelProperty(value = "距今时间")
private Long minuteTillNow; private Long minuteTillNow;
public Double getRank(){ public Double getScore() {
double p = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount); double w = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount);
double t = Double.valueOf(minuteTillNow); double i = 10;//初试权重
double g =1.8; double t = Double.valueOf(minuteTillNow) / 60;
double rank=(p)/Math.pow(t+2,g); double g = 1.2;//时间系数
double rank = (w + i) / Math.pow(t + 2, g);
return rank; return rank;
} }
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class ThemeContentQo { public class ThemeContentQo {
@ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 110:多图(讨论)") @ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)")
private String type; private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
......
...@@ -57,16 +57,7 @@ public class ThemeQo implements Serializable { ...@@ -57,16 +57,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "当前用户是否关注该作者") @ApiModelProperty(value = "当前用户是否关注该作者")
public boolean follow; public boolean follow;
@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;
@ApiModelProperty(value = "认证机构") @ApiModelProperty(value = "认证机构")
private String authOrg; private String authOrg;
...@@ -105,4 +96,24 @@ public class ThemeQo implements Serializable { ...@@ -105,4 +96,24 @@ public class ThemeQo implements Serializable {
public Long updateTime; public Long updateTime;
//认证标签相关
@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;
//工作室相关
@ApiModelProperty("工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)")
private Integer workshopStatus = 1;//工作室展示状态
@ApiModelProperty("工作室名")
private String workshopName;//工作室名
@ApiModelProperty("工作室简介")
private String workshopIntroduction;//工作室简介
} }
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
@ApiModel("热点话题对象") @ApiModel("热点话题对象")
public class TopicHotQo { public class TopicRankQo {
@ApiModelProperty(value = "话题ID") @ApiModelProperty(value = "话题ID")
private String topicId; private String topicId;
......
...@@ -14,7 +14,7 @@ public class CreateThemeReq { ...@@ -14,7 +14,7 @@ public class CreateThemeReq {
@NotNull(message = "类型不能为空") @NotNull(message = "类型不能为空")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题")
private Integer themeType; private Integer themeType;
......
...@@ -76,7 +76,7 @@ public enum RelTypeEnum { ...@@ -76,7 +76,7 @@ public enum RelTypeEnum {
/** /**
* 新版课程 * 新版课程
*/ */
NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频", 303), NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频", 304),
/** /**
* 新版课程附件 * 新版课程附件
......
...@@ -40,16 +40,16 @@ public class HomePageController { ...@@ -40,16 +40,16 @@ public class HomePageController {
@ApiOperation(value = "个人中心 查询") @ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew") @GetMapping(value = "/queryUserInfoNew")
@AuthLogin @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(); String userIdMyself = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself,userId)); return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself, userId));
} }
// 理财师客户列表查询 (供圈子服务调用) // 理财师客户列表查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 理财师客户列表查询") @ApiOperation(value = "个人中心 理财师客户列表查询")
@GetMapping(value = "/queryUserCustomerList") @GetMapping(value = "/queryUserCustomerList")
@AuthLogin @AuthLogin
public CommonResp<List<Customer>> queryUserCustomerList(){ public CommonResp<List<Customer>> queryUserCustomerList() {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUserCustomerList(userId)); return CommonResp.success(homePageManager.queryUserCustomerList(userId));
} }
...@@ -61,7 +61,7 @@ public class HomePageController { ...@@ -61,7 +61,7 @@ public class HomePageController {
@AuthLogin @AuthLogin
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) { public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId)); return CommonResp.success(homePageManager.queryFollow(req, userId));
} }
@PostMapping(value = "/addIdol") @PostMapping(value = "/addIdol")
...@@ -69,7 +69,7 @@ public class HomePageController { ...@@ -69,7 +69,7 @@ public class HomePageController {
@ResponseBody @ResponseBody
public CommonResp addIdol(@RequestBody FollowRelReq req) { public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
homePageManager.addFollowRel(req,userId); homePageManager.addFollowRel(req, userId);
return CommonResp.success(); return CommonResp.success();
} }
...@@ -77,9 +77,9 @@ public class HomePageController { ...@@ -77,9 +77,9 @@ public class HomePageController {
@ApiOperation("用户的帖子列表") @ApiOperation("用户的帖子列表")
@ResponseBody @ResponseBody
@AuthLogin @AuthLogin
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req){ public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) {
String userId = userHolder.getUserId(); 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 { ...@@ -39,7 +39,7 @@ public class ThemeController {
} }
@AuthLogin @AuthLogin
@ApiOperation("圈子首页-推荐/关注/热门/最新") @ApiOperation("主题列表-推荐/关注/热门/最新")
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ResponseBody @ResponseBody
public CommonResp<List<ThemeQo>> selectInterestList(@Validated @RequestBody ThemeListReq req) { public CommonResp<List<ThemeQo>> selectInterestList(@Validated @RequestBody ThemeListReq req) {
......
...@@ -2,9 +2,7 @@ package com.tanpu.community.controller; ...@@ -2,9 +2,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder; import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.TopicDetailQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.manager.TopicManager; import com.tanpu.community.manager.TopicManager;
...@@ -30,25 +28,23 @@ public class TopicController { ...@@ -30,25 +28,23 @@ public class TopicController {
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ApiOperation("APP全部话题页面,可搜索") @ApiOperation("APP全部话题页面,可搜索")
@ResponseBody @ResponseBody
public CommonResp<Page<TopicTitileQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){ public CommonResp<Page<TopicRankQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){
Page<TopicTitileQo> allTopic = topicManager.getAllTopicBriefInfo(req); return CommonResp.success(topicManager.getAllTopicBriefInfo(req));
return CommonResp.success(allTopic);
} }
@GetMapping(value = "/detailPage") @GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部") @ApiOperation("话题详情页顶部")
@ResponseBody @ResponseBody
public CommonResp<TopicDetailQo> gethotThemes(@RequestParam String topicId){ public CommonResp<TopicRankQo> gethotThemes(@RequestParam String topicId){
TopicDetailQo detail = topicManager.getDetail(topicId); return CommonResp.success(topicManager.getDetail(topicId));
return CommonResp.success(detail);
} }
@GetMapping(value = "/titleList") @GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题标题列") @ApiOperation("首页顶部话题标题列")
@ResponseBody @ResponseBody
public CommonResp<List<TopicHotQo>> getTitleList(){ public CommonResp<List<TopicRankQo>> getTitleList(){
return CommonResp.success(topicManager.getHotTopicTitles()); return CommonResp.success(topicManager.getTop4TopicTitles());
} }
......
...@@ -22,7 +22,7 @@ public class CodeAutoGenerator { ...@@ -22,7 +22,7 @@ public class CodeAutoGenerator {
String mysqlUserName = "dev"; String mysqlUserName = "dev";
String mysqlPassword = "qimeng123"; String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community"; String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community";
String[] tables = new String[]{"visit_summary"}; String[] tables = new String[]{"comment"};
// String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"}; // String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.community";
......
...@@ -18,7 +18,7 @@ import java.time.LocalDateTime; ...@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-07 * @since 2021-07-21
*/ */
@TableName("comment") @TableName("comment")
@Builder @Builder
...@@ -33,10 +33,10 @@ public class CommentEntity implements Serializable { ...@@ -33,10 +33,10 @@ public class CommentEntity implements Serializable {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty(value = "uuid") @ApiModelProperty(value = "评论主键Id")
private String commentId; private String commentId;
@ApiModelProperty(value = "类型") @ApiModelProperty(value = "类型 1:评论")
private Integer commentType; private Integer commentType;
@ApiModelProperty(value = "文本内容") @ApiModelProperty(value = "文本内容")
...@@ -54,8 +54,11 @@ public class CommentEntity implements Serializable { ...@@ -54,8 +54,11 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "回复评论id") @ApiModelProperty(value = "回复评论id")
private String replyId; private String replyId;
@ApiModelProperty(value = "是否屏蔽") @ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isBlock; private Integer isPass;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
private LocalDateTime createTime; private LocalDateTime createTime;
...@@ -128,12 +131,20 @@ public class CommentEntity implements Serializable { ...@@ -128,12 +131,20 @@ public class CommentEntity implements Serializable {
this.replyId = replyId; this.replyId = replyId;
} }
public Integer getIsBlock() { public Integer getIsPass() {
return isBlock; return isPass;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
}
public Integer getReportStatus() {
return reportStatus;
} }
public void setIsBlock(Integer isBlock) { public void setReportStatus(Integer reportStatus) {
this.isBlock = isBlock; this.reportStatus = reportStatus;
} }
public LocalDateTime getCreateTime() { public LocalDateTime getCreateTime() {
...@@ -171,7 +182,8 @@ public class CommentEntity implements Serializable { ...@@ -171,7 +182,8 @@ public class CommentEntity implements Serializable {
", themeId=" + themeId + ", themeId=" + themeId +
", parentId=" + parentId + ", parentId=" + parentId +
", replyId=" + replyId + ", replyId=" + replyId +
", isBlock=" + isBlock + ", isPass=" + isPass +
", reportStatus=" + reportStatus +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", deleteTag=" + deleteTag + ", deleteTag=" + deleteTag +
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 举报记录
* </p>
*
* @author xudong
* @since 2021-07-21
*/
@TableName("report_log")
@ApiModel(value="ReportLogEntity对象", description="举报记录")
public class ReportLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "举报发起人")
private String userId;
@ApiModelProperty(value = "举报类型,1:主题,2:评论 3、用户")
private Integer reportType;
@ApiModelProperty(value = "举报对象id")
private String targetId;
@ApiModelProperty(value = "举报对象作者id")
private String targetUserId;
@ApiModelProperty(value = "上报时间")
private LocalDateTime reportTime;
@ApiModelProperty(value = "处理结果 0:无操作 1:屏蔽 2:删除 ")
private Integer dealResult;
@ApiModelProperty(value = "处理管理员")
private Integer dealUserId;
@ApiModelProperty(value = "处理时间")
private LocalDateTime dealTime;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer deleteTag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getReportType() {
return reportType;
}
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
public String getTargetId() {
return targetId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public String getTargetUserId() {
return targetUserId;
}
public void setTargetUserId(String targetUserId) {
this.targetUserId = targetUserId;
}
public LocalDateTime getReportTime() {
return reportTime;
}
public void setReportTime(LocalDateTime reportTime) {
this.reportTime = reportTime;
}
public Integer getDealResult() {
return dealResult;
}
public void setDealResult(Integer dealResult) {
this.dealResult = dealResult;
}
public Integer getDealUserId() {
return dealUserId;
}
public void setDealUserId(Integer dealUserId) {
this.dealUserId = dealUserId;
}
public LocalDateTime getDealTime() {
return dealTime;
}
public void setDealTime(LocalDateTime dealTime) {
this.dealTime = dealTime;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
@Override
public String toString() {
return "ReportLogEntity{" +
"id=" + id +
", userId=" + userId +
", reportType=" + reportType +
", targetId=" + targetId +
", targetUserId=" + targetUserId +
", reportTime=" + reportTime +
", dealResult=" + dealResult +
", dealUserId=" + dealUserId +
", dealTime=" + dealTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
}
}
...@@ -18,7 +18,7 @@ import java.time.LocalDateTime; ...@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-07 * @since 2021-07-21
*/ */
@TableName("theme") @TableName("theme")
@Builder @Builder
...@@ -33,31 +33,38 @@ public class ThemeEntity implements Serializable { ...@@ -33,31 +33,38 @@ public class ThemeEntity implements Serializable {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty(value = "UUID") @ApiModelProperty(value = "主题主键Id")
private String themeId; private String themeId;
@ApiModelProperty(value = "标题") @ApiModelProperty(value = "标题")
private String title; private String title;
@ApiModelProperty(value = "类型") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType; private Integer themeType;
@ApiModelProperty(value = "文本内容") @ApiModelProperty(value = "文本内容(json),type:附件类型(8:文本,88:产品 3:直播 6:短视频 300:课程,9:图片 10:多图),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)")
private String content; private String content;
@ApiModelProperty(value = "作者id") @ApiModelProperty(value = "作者id")
private String authorId; private String authorId;
@ApiModelProperty(value = "转发的主题") @ApiModelProperty(value = "转发的主题")
private String formerThemeId; private String formerThemeId;
@ApiModelProperty(value = "所属的话题") @ApiModelProperty(value = "所属的话题")
private String topicId; private String topicId;
@ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isPass;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
private LocalDateTime createTime; private LocalDateTime createTime;
private LocalDateTime updateTime; private LocalDateTime updateTime;
@ApiModelProperty(value = "1:删除")
private Integer deleteTag; private Integer deleteTag;
...@@ -125,6 +132,22 @@ public class ThemeEntity implements Serializable { ...@@ -125,6 +132,22 @@ public class ThemeEntity implements Serializable {
this.topicId = topicId; this.topicId = topicId;
} }
public Integer getIsPass() {
return isPass;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
}
public Integer getReportStatus() {
return reportStatus;
}
public void setReportStatus(Integer reportStatus) {
this.reportStatus = reportStatus;
}
public LocalDateTime getCreateTime() { public LocalDateTime getCreateTime() {
return createTime; return createTime;
} }
...@@ -160,6 +183,8 @@ public class ThemeEntity implements Serializable { ...@@ -160,6 +183,8 @@ public class ThemeEntity implements Serializable {
", authorId=" + authorId + ", authorId=" + authorId +
", formerThemeId=" + formerThemeId + ", formerThemeId=" + formerThemeId +
", topicId=" + topicId + ", topicId=" + topicId +
", isPass=" + isPass +
", reportStatus=" + reportStatus +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", deleteTag=" + deleteTag + ", deleteTag=" + deleteTag +
......
...@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-07 * @since 2021-07-21
*/ */
public interface CommentMapper extends BaseMapper<CommentEntity> { public interface CommentMapper extends BaseMapper<CommentEntity> {
......
package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.ReportLogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 举报记录 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-07-21
*/
public interface ReportLogMapper extends BaseMapper<ReportLogEntity> {
}
...@@ -2,10 +2,6 @@ package com.tanpu.community.dao.mapper.community; ...@@ -2,10 +2,6 @@ package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.ThemeEntity; import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* <p> * <p>
...@@ -13,7 +9,7 @@ import java.util.List; ...@@ -13,7 +9,7 @@ import java.util.List;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-07 * @since 2021-07-21
*/ */
public interface ThemeMapper extends BaseMapper<ThemeEntity> { public interface ThemeMapper extends BaseMapper<ThemeEntity> {
......
package com.tanpu.community.manager; 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.qo.CommentQo;
import com.tanpu.community.api.beans.req.comment.CreateCommentReq; import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.LikeCommentReq; 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.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum; import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; 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.CollectionService;
import com.tanpu.community.service.CommentService; import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.service.UserInfoService; import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,7 +31,7 @@ public class CommentManager { ...@@ -29,7 +31,7 @@ public class CommentManager {
private CommentService commentService; private CommentService commentService;
@Autowired @Autowired
private HomePageService homePageService; private FeignClientForFatools feignClientForFatools;
@Autowired @Autowired
private CollectionService collectionService; private CollectionService collectionService;
...@@ -63,10 +65,19 @@ public class CommentManager { ...@@ -63,10 +65,19 @@ public class CommentManager {
for (CommentQo commentQo : commentQos) { for (CommentQo commentQo : commentQos) {
//用户信息 //用户信息
String authorId = commentQo.getAuthorId(); 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) { if (userInfo != null) {
commentQo.setUserImg(userInfo.getUiHeadimgMp()); commentQo.setUserImg(userInfo.getHeadImageUrl());
commentQo.setNickName(userInfo.getUiUsernameMp()); 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(); String commentId = commentQo.getCommentId();
...@@ -80,8 +91,8 @@ public class CommentManager { ...@@ -80,8 +91,8 @@ public class CommentManager {
// commentQo.setCommentLv2Qos(commentLv2Qos); // commentQo.setCommentLv2Qos(commentLv2Qos);
} }
//排序:点赞降序+时间降序 //排序:点赞降序+时间降序
return commentQos.stream().sorted(Comparator.comparing(CommentQo::getLikeCount,Comparator.reverseOrder()). return commentQos.stream().sorted(Comparator.comparing(CommentQo::getLikeCount, Comparator.reverseOrder()).
thenComparing(CommentQo::getUpdateTime,Comparator.reverseOrder())) thenComparing(CommentQo::getUpdateTime, Comparator.reverseOrder()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
......
...@@ -18,7 +18,6 @@ import com.tanpu.community.dao.entity.fund.CompanyInfo; ...@@ -18,7 +18,6 @@ import com.tanpu.community.dao.entity.fund.CompanyInfo;
import com.tanpu.community.dao.entity.fund.FundInfo; import com.tanpu.community.dao.entity.fund.FundInfo;
import com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank; import com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank;
import com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline; import com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.dao.mapper.community.FollowRelMapper; import com.tanpu.community.dao.mapper.community.FollowRelMapper;
import com.tanpu.community.dao.mapper.fund.CompanyInfoMapper; import com.tanpu.community.dao.mapper.fund.CompanyInfoMapper;
import com.tanpu.community.dao.mapper.fund.FundInfoMapper; import com.tanpu.community.dao.mapper.fund.FundInfoMapper;
...@@ -35,9 +34,7 @@ import com.tanpu.community.util.PageUtils; ...@@ -35,9 +34,7 @@ import com.tanpu.community.util.PageUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
...@@ -182,10 +179,9 @@ public class HomePageManager { ...@@ -182,10 +179,9 @@ public class HomePageManager {
followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId()); followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId());
List<FollowQo> followQos = new ArrayList<>(); List<FollowQo> followQos = new ArrayList<>();
if (!CollectionUtils.isEmpty(userIds)) { if (!CollectionUtils.isEmpty(userIds)) {
List<UserInfoEntity> userInfos = userInfoService.queryUserByIds(userIds); List<UserInfoNew> userInfoNews = feignClientForFatools.queryUserListNew(userIds);
List<FollowQo> collect = userInfos.stream().map(ConvertUtil::userInfoEntity2FollowQo).collect(Collectors.toList()); List<FollowQo> collect = userInfoNews.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList());
followQos = judgeFollowed(collect, userId); followQos = judgeFollowed(collect, userId);
} }
//分页 //分页
return PageUtils.page(req.getPage(), followQos); return PageUtils.page(req.getPage(), followQos);
......
...@@ -4,10 +4,7 @@ import com.google.common.collect.Sets; ...@@ -4,10 +4,7 @@ import com.google.common.collect.Sets;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.JsonUtil; import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.ESThemeQo; import com.tanpu.community.api.beans.qo.*;
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.req.homepage.QueryRecordThemeReq; import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*; import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.resp.CreateThemeResp; import com.tanpu.community.api.beans.resp.CreateThemeResp;
...@@ -96,20 +93,13 @@ public class ThemeManager { ...@@ -96,20 +93,13 @@ public class ThemeManager {
} }
@Transactional @Transactional
/**
* 发表主题(可修改)
*/
public CreateThemeResp publishTheme(CreateThemeReq req, String userId) { public CreateThemeResp publishTheme(CreateThemeReq req, String userId) {
//直播类型做转播检查 //直播类型做转播检查
List<ThemeContentReq> contents = req.getContent(); List<ThemeContentReq> contents = req.getContent();
for (ThemeContentReq content : contents) { liveRelayCheck(userId, 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", "很抱歉!您需要购买或报名成功后才可以添加这个直播哦~");
}
}
}
//保存主题表 //保存主题表
ThemeEntity themeEntity = new ThemeEntity(); ThemeEntity themeEntity = new ThemeEntity();
...@@ -117,7 +107,7 @@ public class ThemeManager { ...@@ -117,7 +107,7 @@ public class ThemeManager {
themeEntity.setAuthorId(userId); themeEntity.setAuthorId(userId);
themeEntity.setContent(JsonUtil.toJson(req.getContent())); themeEntity.setContent(JsonUtil.toJson(req.getContent()));
//TODO 敏感词过滤 //腾讯云敏感词校验
checkContent(themeEntity.getContent()); checkContent(themeEntity.getContent());
if (StringUtils.isEmpty(req.getEditThemeId())) { if (StringUtils.isEmpty(req.getEditThemeId())) {
...@@ -146,6 +136,7 @@ public class ThemeManager { ...@@ -146,6 +136,7 @@ public class ThemeManager {
} }
/** /**
* 返回主题列表 * 返回主题列表
* *
...@@ -156,7 +147,7 @@ public class ThemeManager { ...@@ -156,7 +147,7 @@ public class ThemeManager {
public List<ThemeQo> queryThemes(ThemeListReq req, String userId) { public List<ThemeQo> queryThemes(ThemeListReq req, String userId) {
List<ThemeEntity> themeEntities = new ArrayList<>(); List<ThemeEntity> themeEntities = new ArrayList<>();
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) { if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
// TODO:推荐 //推荐
// themeEntities = themeService.selectExcludeUser(userId, req.getLastId(), req.getPageSize()); // themeEntities = themeService.selectExcludeUser(userId, req.getLastId(), req.getPageSize());
List<String> recommendThemeIds = rankService.getHotAndNewThemes(100, 100); List<String> recommendThemeIds = rankService.getHotAndNewThemes(100, 100);
themeEntities = themeService.queryByThemeIdsExcludeUser(recommendThemeIds, userId, req.getLastId(), req.getPageSize()); themeEntities = themeService.queryByThemeIdsExcludeUser(recommendThemeIds, userId, req.getLastId(), req.getPageSize());
...@@ -167,11 +158,12 @@ public class ThemeManager { ...@@ -167,11 +158,12 @@ public class ThemeManager {
themeEntities = themeService.queryByUserIds(fansList, req.getLastId(), req.getPageSize()); themeEntities = themeService.queryByUserIds(fansList, req.getLastId(), req.getPageSize());
} else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) { } else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) {
//TODO 根据话题查询热门 //根据话题查询热门
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空"); 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()); themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
} else if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())) { } else if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())) {
//TODO 根据话题查询最新 //根据话题查询最新
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空"); if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空");
themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize()); themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
} }
...@@ -304,7 +296,6 @@ public class ThemeManager { ...@@ -304,7 +296,6 @@ public class ThemeManager {
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build(); return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
} }
// 屏蔽(用户) // 屏蔽(用户)
public void blockUser(String blockUser, String userId) { public void blockUser(String blockUser, String userId) {
BlackListEntity selectOne = blackListService.selectOne(blockUser, userId, BlockTypeEnum.USER.getCode()); BlackListEntity selectOne = blackListService.selectOne(blockUser, userId, BlockTypeEnum.USER.getCode());
...@@ -313,11 +304,6 @@ public class ThemeManager { ...@@ -313,11 +304,6 @@ public class ThemeManager {
} }
} }
// 解除屏蔽(用户)
public void unblockUser(String blockUser, String userId) {
//todo
}
// 屏蔽(主题) // 屏蔽(主题)
public void blockTheme(String themeId, String userId) { public void blockTheme(String themeId, String userId) {
blackListService.addBlock(themeId, userId, BlockTypeEnum.THEME); blackListService.addBlock(themeId, userId, BlockTypeEnum.THEME);
...@@ -350,11 +336,11 @@ public class ThemeManager { ...@@ -350,11 +336,11 @@ public class ThemeManager {
//组装主题详情 //组装主题详情
private void buildThemeQoExtraInfo(String userId, ThemeQo themeQo) { private void buildThemeQoExtraInfo(String userId, ThemeQo themeQo) {
String themeId = themeQo.getThemeId();
//封装转发对象 //封装转发对象
buildFormerTheme(themeQo); buildFormerTheme(themeQo);
String themeId = themeQo.getThemeId();
//是否关注作者 //是否关注作者
String authorId = themeQo.getAuthorId(); String authorId = themeQo.getAuthorId();
...@@ -371,7 +357,6 @@ public class ThemeManager { ...@@ -371,7 +357,6 @@ public class ThemeManager {
themeQo.setHasCollect(collectionEntity != null); themeQo.setHasCollect(collectionEntity != null);
//点赞,收藏,转发 //点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME); Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
// Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
Integer commentCount = commentService.getCommentCountByThemeId(themeId); Integer commentCount = commentService.getCommentCountByThemeId(themeId);
Integer forwardCount = themeService.getForwardCountById(themeId); Integer forwardCount = themeService.getForwardCountById(themeId);
themeQo.setCommentCount(commentCount); themeQo.setCommentCount(commentCount);
...@@ -402,10 +387,6 @@ public class ThemeManager { ...@@ -402,10 +387,6 @@ public class ThemeManager {
themeService.deleteById(themeId); themeService.deleteById(themeId);
} }
//投诉(主题)
public void complaint(String themeId, String user) {
//TODO
}
public Integer getFollowUpdateCount(String userId) { public Integer getFollowUpdateCount(String userId) {
LocalDateTime lastViewTime = visitSummaryService.queryLatestViewFollow(userId); LocalDateTime lastViewTime = visitSummaryService.queryLatestViewFollow(userId);
...@@ -413,7 +394,10 @@ public class ThemeManager { ...@@ -413,7 +394,10 @@ public class ThemeManager {
return themeService.queryCountFromLastTime(fansList, lastViewTime); return themeService.queryCountFromLastTime(fansList, lastViewTime);
} }
/**
* 腾讯云-内容检测
* @param content
*/
private void checkContent(String content) { private void checkContent(String content) {
// 腾讯云接口最多支持5000文字校验,超过5000执行2次 // 腾讯云接口最多支持5000文字校验,超过5000执行2次
// 检查内容是否涉黄违法 // 检查内容是否涉黄违法
...@@ -430,4 +414,24 @@ public class ThemeManager { ...@@ -430,4 +414,24 @@ public class ThemeManager {
return ; 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", "很抱歉!您需要购买或报名成功后才可以添加这个直播哦~");
}
}
}
}
} }
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.TopicDetailQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.vo.TopicDataAnalysDTO; import com.tanpu.community.api.beans.vo.TopicDataAnalysDTO;
import com.tanpu.community.api.constants.RedisKeyConstant; import com.tanpu.community.api.constants.RedisKeyConstant;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils; import com.tanpu.community.util.PageUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -49,71 +43,29 @@ public class TopicManager { ...@@ -49,71 +43,29 @@ public class TopicManager {
//新增话题 //新增话题
public void insertTopic(String topicTitle, String userId) { public void insertTopic(String topicTitle, String userId) {
if (topicService.queryByTitile(topicTitle) == null) { if (topicService.queryByTitile(topicTitle) == null) {
topicService.addTopic(topicTitle, userId); throw new BizException("话题名称已存在:"+topicTitle);
} }
return; topicService.addTopic(topicTitle, userId);
} }
//话题详情列表 //首页-话题标签
public List<TopicDTO> getAllTopicDetail() { public List<TopicRankQo> getTop4TopicTitles() {
return ConvertUtil.topicEntitiesToDTOs(topicService.queryAll()); return rankService.getRankTopicListTop4();
} }
//话题简介列表 //话题搜索列表
public Page<TopicTitileQo> getAllTopicBriefInfo(TopicSearchReq req) { public Page<TopicRankQo> getAllTopicBriefInfo(TopicSearchReq req) {
List<TopicEntity> allTopic = topicService.queryByKeyword(req.getSearchKeyword()); return PageUtils.page(req.getPage(), rankService.getRankTopicList());
List<TopicTitileQo> topicTitileQos = ConvertUtil.topicEntitiesToBriefDTOs(allTopic);
for (TopicTitileQo topicQo : topicTitileQos) {
//讨论数=发布主题贴数+回复总数
List<String> themeIds = themeService.queryThemeIdsByTopic(topicQo.getTopicId());
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topicQo.setDiscussionCount(String.valueOf(themeIds.size() + commentCount));
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topicQo.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topicQo.setViewCount(String.valueOf(topicPV + themePV));
}
//TODO 判断顶置
return PageUtils.page(req.getPage(), topicTitileQos);
} }
//话题详情页 //话题详情页
public TopicDetailQo getDetail(String topicId) { public TopicRankQo getDetail(String topicId) {
TopicEntity topicEntity = topicService.queryById(topicId); return rankService.getTopicDetail(topicId);
if (topicEntity == null) {
throw new BizException("找不到话题,id:" + topicId);
}
TopicDetailQo topicDetailQo = new TopicDetailQo();
BeanUtils.copyProperties(topicEntity, topicDetailQo);
List<String> themeIds = themeService.queryThemeIdsByTopic(topicId);
if (CollectionUtils.isEmpty(themeIds)) {
topicDetailQo.setViewCount(visitSummaryService.queryTopicDetailVisit(topicId));
topicDetailQo.setDisscussCount(0);
return topicDetailQo;
}
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topicId);
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topicDetailQo.setViewCount(topicPV + themePV);
//讨论数=发布主题贴数+回复总数
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topicDetailQo.setDisscussCount(themeIds.size() + commentCount);
return topicDetailQo;
} }
public List<TopicHotQo> getHotTopicTitles() {
List<TopicHotQo> rankTopicList = rankService.rankTopicList;
if (rankTopicList.size()==0){
rankService.rankTopics();
}
return rankService.rankTopicList;
}
public void setTopTopic(String topicId, boolean setTop) { public void setTopTopic(String topicId, boolean setTop) {
TopicEntity topicEntity = topicService.queryById(topicId); TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity == null) { if (topicEntity == null) {
......
...@@ -34,6 +34,9 @@ import javax.annotation.Resource; ...@@ -34,6 +34,9 @@ import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 批量调用Feign查询接口
*/
@Service @Service
public class BatchFeignCallService { public class BatchFeignCallService {
...@@ -373,13 +376,17 @@ public class BatchFeignCallService { ...@@ -373,13 +376,17 @@ public class BatchFeignCallService {
Map<String, String> topicMap) { Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) { for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) { if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
//话题标题
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId())); themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
} }
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) { if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
//用户信息
UserInfoNew userInfo = userMap.get(themeQo.getAuthorId()); UserInfoNew userInfo = userMap.get(themeQo.getAuthorId());
//昵称头像简介
themeQo.setNickName(userInfo.getNickName()); themeQo.setNickName(userInfo.getNickName());
themeQo.setUserImg(userInfo.getHeadImageUrl()); themeQo.setUserImg(userInfo.getHeadImageUrl());
themeQo.setUserIntroduction(userInfo.getIntroduction()); themeQo.setUserIntroduction(userInfo.getIntroduction());
//认证标签相关
themeQo.setUserType(userInfo.getUserType()); themeQo.setUserType(userInfo.getUserType());
themeQo.setLevelGrade(userInfo.getLevelGrade()); themeQo.setLevelGrade(userInfo.getLevelGrade());
themeQo.setUserInvestorType(userInfo.getUserInvestorType()); themeQo.setUserInvestorType(userInfo.getUserInvestorType());
......
...@@ -5,7 +5,6 @@ import com.tanpu.common.exception.BizException; ...@@ -5,7 +5,6 @@ import com.tanpu.common.exception.BizException;
import com.tanpu.common.uuid.UuidGenHelper; import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.StatusEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper; import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -66,13 +65,13 @@ public class CommentService { ...@@ -66,13 +65,13 @@ public class CommentService {
LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>() LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getThemeId, themeId) .eq(CommentEntity::getThemeId, themeId)
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()) .eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.eq(CommentEntity::getIsBlock, StatusEnum.FALSE.getCode())
.orderByDesc(CommentEntity::getCreateTime); .orderByDesc(CommentEntity::getCreateTime);
if (parentId == null) { //二级评论,暂未开放,注意“”与null的区别
queryWrapper.isNull(CommentEntity::getParentId); // if (parentId == null) {
} else { // queryWrapper.isNull(CommentEntity::getParentId);
queryWrapper.eq(CommentEntity::getParentId, parentId); // } else {
} // queryWrapper.eq(CommentEntity::getParentId, parentId);
// }
return commentMapper.selectList(queryWrapper); return commentMapper.selectList(queryWrapper);
} }
......
package com.tanpu.community.service; package com.tanpu.community.service;
import com.tanpu.community.api.beans.qo.ThemeAnalysDO; import com.tanpu.community.api.beans.qo.ThemeAnalysDO;
import com.tanpu.community.api.beans.qo.TopicHotQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.TopicStatusEnum; import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.ThemeEntity; import com.tanpu.community.dao.entity.community.ThemeEntity;
...@@ -28,11 +28,15 @@ public class RankService { ...@@ -28,11 +28,15 @@ public class RankService {
private VisitSummaryService visitSummaryService; private VisitSummaryService visitSummaryService;
public List<String> rankThemeList = new ArrayList<>(); private List<ThemeAnalysDO> rankThemeList = new ArrayList<>();
public List<TopicHotQo> rankTopicList = new ArrayList<>(); private List<TopicRankQo> rankTopicList = new ArrayList<>();
private List<TopicRankQo> rankTopicListTop4 = new ArrayList<>();
/**
* 计算主题热度排行
*/
public void rankThemes() { public void rankThemes() {
List<ThemeEntity> themeEntities = themeService.queryAll(); List<ThemeEntity> themeEntities = themeService.queryAll();
List<ThemeAnalysDO> themeAnalysDOS = ConvertUtil.themeEntityToAnalysDOs(themeEntities); List<ThemeAnalysDO> themeAnalysDOS = ConvertUtil.themeEntityToAnalysDOs(themeEntities);
...@@ -49,8 +53,10 @@ public class RankService { ...@@ -49,8 +53,10 @@ public class RankService {
theme.setCollectCount(bookCount); theme.setCollectCount(bookCount);
theme.setViewCount(viewCount); theme.setViewCount(viewCount);
} }
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getRank)); //打分
rankThemeList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey().getThemeId()).collect(Collectors.toList()); 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()).collect(Collectors.toList());
} }
...@@ -61,11 +67,11 @@ public class RankService { ...@@ -61,11 +67,11 @@ public class RankService {
*/ */
public void rankTopics() { public void rankTopics() {
List<TopicEntity> topicEntities = topicService.queryAll(); List<TopicEntity> topicEntities = topicService.queryAll();
List<TopicHotQo> topicHotQos = ConvertUtil.topicEntityToHotQos(topicEntities); List<TopicRankQo> topicRankQos = ConvertUtil.topicEntityToHotQos(topicEntities);
if (topicHotQos.size() == 0) { if (topicRankQos.size() == 0) {
return; return;
} }
for (TopicHotQo topic : topicHotQos) { for (TopicRankQo topic : topicRankQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId()); List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
if (CollectionUtils.isEmpty(themeIds)){ if (CollectionUtils.isEmpty(themeIds)){
topic.setViewCount(0); topic.setViewCount(0);
...@@ -80,20 +86,69 @@ public class RankService { ...@@ -80,20 +86,69 @@ public class RankService {
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds); Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topic.setDisscussCount(themeIds.size() + commentCount); topic.setDisscussCount(themeIds.size() + commentCount);
} }
Map<TopicHotQo, Integer> map = topicHotQos.stream().collect(Collectors.toMap(o -> o, TopicHotQo::getRank)); Map<TopicRankQo, Integer> map = topicRankQos.stream().collect(Collectors.toMap(o -> o, TopicRankQo::getRank));
List<TopicHotQo> rankList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey()).limit(4).collect(Collectors.toList()); List<TopicRankQo> rankList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(Map.Entry::getKey).collect(Collectors.toList());
rankList.get(0).setType(TopicStatusEnum.HOTTEST.getCode()); rankList.get(0).setType(TopicStatusEnum.HOTTEST.getCode());
rankTopicList = rankList; this.rankTopicList = rankList;
this.rankTopicListTop4 = rankList.stream().limit(4).collect(Collectors.toList());
return; return;
} }
/**
* 最新和热门主题集合
* @param hotCount
* @param newCount
* @return
*/
public List<String> getHotAndNewThemes(Integer hotCount, Integer newCount) { 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) Set<String> newThemeIds = themeService.selectExcludeUser(null, null, newCount)
.stream().map(ThemeEntity::getThemeId).collect(Collectors.toSet()); .stream().map(ThemeEntity::getThemeId).collect(Collectors.toSet());
hotThemeIds.addAll(newThemeIds); hotThemeIds.addAll(newThemeIds);
return new ArrayList<>(hotThemeIds); return new ArrayList<>(hotThemeIds);
} }
/**
* 话题详情
* @param topicId 话题Id
* @return
*/
public TopicRankQo getTopicDetail(String topicId){
if (this.rankTopicList.size()==0){
rankTopics();
}
List<TopicRankQo> matchTopic = this.rankTopicList.stream().filter(o -> o.getTopicId().equals(topicId)).limit(1).collect(Collectors.toList());
matchTopic.add(new TopicRankQo());
return matchTopic.get(0);
}
public List<ThemeAnalysDO> getRankThemeList() {
if (this.rankThemeList.size()==0){
rankThemes();
}
return rankThemeList;
}
public List<TopicRankQo> getRankTopicList() {
if (this.rankTopicList.size()==0){
this.rankTopics();
}
return rankTopicList;
}
public List<TopicRankQo> getRankTopicListTop4() {
if (this.rankTopicList.size()==0){
this.rankTopics();
}
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());
}
} }
...@@ -8,6 +8,7 @@ import com.tanpu.community.api.beans.vo.TopicDTO; ...@@ -8,6 +8,7 @@ import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.qo.*; import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq; import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.RelTypeEnum; import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.api.enums.TopicStatusEnum; import com.tanpu.community.api.enums.TopicStatusEnum;
...@@ -18,7 +19,6 @@ import org.springframework.util.StringUtils; ...@@ -18,7 +19,6 @@ import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.temporal.TemporalField;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -94,17 +94,17 @@ public class ConvertUtil { ...@@ -94,17 +94,17 @@ public class ConvertUtil {
return topicDTO; return topicDTO;
} }
public static TopicHotQo topicEntityToHotQo(TopicEntity topicEntity) { public static TopicRankQo topicEntityToHotQo(TopicEntity topicEntity) {
TopicHotQo topicHotQo = new TopicHotQo(); TopicRankQo topicRankQo = new TopicRankQo();
BeanUtils.copyProperties(topicEntity, topicHotQo); BeanUtils.copyProperties(topicEntity, topicRankQo);
//2小时内发帖,添加新话题标签 //2小时内发帖,添加新话题标签
if(TimeUtil.calMinuteTillNow(topicEntity.getCreateTime())<120){ if(TimeUtil.calMinuteTillNow(topicEntity.getCreateTime())<120){
topicHotQo.setType(TopicStatusEnum.NEWEST.getCode()); topicRankQo.setType(TopicStatusEnum.NEWEST.getCode());
} }
return topicHotQo; return topicRankQo;
} }
public static List<TopicHotQo> topicEntityToHotQos(List<TopicEntity> topicEntities) { public static List<TopicRankQo> topicEntityToHotQos(List<TopicEntity> topicEntities) {
if (topicEntities==null){ if (topicEntities==null){
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -223,6 +223,22 @@ public class ConvertUtil { ...@@ -223,6 +223,22 @@ public class ConvertUtil {
.build(); .build();
} }
public static FollowQo userInfoNew2FollowQo(UserInfoNew entity) {
if (entity == null) {
return null;
}
return FollowQo.builder().userId(entity.getUserId())
.nickName(entity.getNickName())
.headImg(entity.getHeadImageUrl())
.introduction(entity.getIntroduction())
.userType(entity.getUserType())
.levelGrade(entity.getLevelGrade())
.userInvestorType(entity.getUserInvestorType())
.belongUserOrgId(entity.getBelongUserOrgId())
.belongUserOrgName(entity.getBelongUserOrgName())
.build();
}
public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) { public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) {
if (formerTheme == null) { if (formerTheme == null) {
return null; return null;
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
<result column="theme_id" property="themeId" /> <result column="theme_id" property="themeId" />
<result column="parent_id" property="parentId" /> <result column="parent_id" property="parentId" />
<result column="reply_id" property="replyId" /> <result column="reply_id" property="replyId" />
<result column="is_block" property="isBlock" /> <result column="is_pass" property="isPass" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" /> <result column="delete_tag" property="deleteTag" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tanpu.community.dao.mapper.community.ReportLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ReportLogEntity">
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="report_type" property="reportType" />
<result column="target_id" property="targetId" />
<result column="target_user_id" property="targetUserId" />
<result column="report_time" property="reportTime" />
<result column="deal_result" property="dealResult" />
<result column="deal_user_id" property="dealUserId" />
<result column="deal_time" property="dealTime" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
</mapper>
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<result column="author_id" property="authorId" /> <result column="author_id" property="authorId" />
<result column="former_theme_id" property="formerThemeId" /> <result column="former_theme_id" property="formerThemeId" />
<result column="topic_id" property="topicId" /> <result column="topic_id" property="topicId" />
<result column="is_pass" property="isPass" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" /> <result column="delete_tag" property="deleteTag" />
......
...@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` ( ...@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` (
INDEX `idx_visitor` (`visitor_id`), INDEX `idx_visitor` (`visitor_id`),
INDEX `idx_author` (`author_id`) INDEX `idx_author` (`author_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录';
CREATE TABLE `report_log` (
`id` int(32) auto_increment PRIMARY KEY COMMENT 'id',
`user_id` varchar(64) NOT NULL COMMENT '举报发起人',
`report_type` int(4) NOT NULL COMMENT '举报类型,1:主题,2:评论 3、用户',
`target_id` varchar(64) NOT NULL COMMENT '举报对象id',
`target_user_id` varchar(64) NOT NULL COMMENT '举报对象作者id',
`report_time` datetime NOT NULL COMMENT '上报时间',
`deal_result` int(4) COMMENT '处理结果 0:无操作 1:屏蔽 2:删除 ',
`deal_user_id` int(4) COMMENT '处理管理员',
`deal_time` datetime COMMENT '处理时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
INDEX `uk_user` (`user_id`),
INDEX `uk_report_target_id` (`target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='举报记录';
\ No newline at end of file
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