Commit 2c139d2d authored by 刘基明's avatar 刘基明

topic返回对象优化

parent 7754ef0c
......@@ -46,11 +46,12 @@ public class ThemeAnalysDO {
@ApiModelProperty(value = "距今时间")
private Long minuteTillNow;
public Double getRank(){
double p = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount);
double t = Double.valueOf(minuteTillNow);
double g =1.8;
double rank=(p)/Math.pow(t+2,g);
public Double getScore() {
double w = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount);
double i = 10;//初试权重
double t = Double.valueOf(minuteTillNow) / 60;
double g = 1.2;//时间系数
double rank = (w + i) / Math.pow(t + 2, g);
return rank;
}
......
......@@ -56,7 +56,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "当前用户是否关注该作者")
public boolean follow;
//认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade;
@ApiModelProperty("认证标签用-当levelGrade=10有值 1投资萌新 2投资达人")
......@@ -68,6 +68,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty("认证标签用-所属机构名")
private String belongUserOrgName;
@ApiModelProperty(value = "认证机构")
private String authOrg;
......@@ -105,4 +106,13 @@ public class ThemeQo implements Serializable {
public Long updateTime;
//工作室相关
@ApiModelProperty("工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)")
private Integer workshopStatus = 1;//工作室展示状态
@ApiModelProperty("工作室名")
private String workshopName;//工作室名
@ApiModelProperty("工作室简介")
private String workshopIntroduction;//工作室简介
}
......@@ -68,11 +68,12 @@ public class CommentService {
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.eq(CommentEntity::getIsBlock, StatusEnum.FALSE.getCode())
.orderByDesc(CommentEntity::getCreateTime);
if (parentId == null) {
queryWrapper.isNull(CommentEntity::getParentId);
} else {
queryWrapper.eq(CommentEntity::getParentId, parentId);
}
//二级评论,暂未开放,注意“”与null的区别
// if (parentId == null) {
// queryWrapper.isNull(CommentEntity::getParentId);
// } else {
// queryWrapper.eq(CommentEntity::getParentId, parentId);
// }
return commentMapper.selectList(queryWrapper);
}
......
......@@ -53,7 +53,9 @@ public class RankService {
theme.setCollectCount(bookCount);
theme.setViewCount(viewCount);
}
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getRank));
//打分
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());
}
......
......@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` (
INDEX `idx_visitor` (`visitor_id`),
INDEX `idx_author` (`author_id`)
) 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