Commit 855b9561 authored by 刘基明's avatar 刘基明

讨论区字段

parent 1c8f353e
...@@ -38,9 +38,12 @@ public class CommentQo { ...@@ -38,9 +38,12 @@ public class CommentQo {
@ApiModelProperty(value = "当前用户是否点赞") @ApiModelProperty(value = "当前用户是否点赞")
private boolean hasLiked; private boolean hasLiked;
@ApiModelProperty(value = "2级评论") @ApiModelProperty(value = "2级评论,目前未使用")
private List<CommentLv2Qo> commentLv2Qos; private List<CommentLv2Qo> commentLv2Qos;
@ApiModelProperty(value = "是否讨论区管理员")
private boolean isManager;
// 认证标签相关 // 认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾") @ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade; private Integer levelGrade;
......
...@@ -11,8 +11,8 @@ import lombok.NoArgsConstructor; ...@@ -11,8 +11,8 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel("话题详情对象") @ApiModel("关注话题列表")
public class TopicDetailQo { public class TopicFollowQo {
@ApiModelProperty(value = "话题ID") @ApiModelProperty(value = "话题ID")
private String topicId; private String topicId;
...@@ -26,4 +26,25 @@ public class TopicDetailQo { ...@@ -26,4 +26,25 @@ public class TopicDetailQo {
@ApiModelProperty(value = "讨论量") @ApiModelProperty(value = "讨论量")
private Integer disscussCount; private Integer disscussCount;
@ApiModelProperty(value = "阅读量-格式化")
private String formatViewCount;
@ApiModelProperty(value = "讨论量-格式化")
private String formatDisscussCount;
@ApiModelProperty(value = "话题介绍")
private String topicDesc;
@ApiModelProperty(value = "封面")
private String coverImg;
@ApiModelProperty(value = "是否专属 0否,1是")
private Integer specialPermission;
@ApiModelProperty(value = "更新帖子数量")
private Integer updateCount;
@ApiModelProperty(value = "发表时间-标准格式化")
public String formatTime;
} }
...@@ -39,6 +39,15 @@ public class TopicRankQo { ...@@ -39,6 +39,15 @@ public class TopicRankQo {
@ApiModelProperty(value = "话题下的帖子权重") @ApiModelProperty(value = "话题下的帖子权重")
private Double themeWeight; private Double themeWeight;
@ApiModelProperty(value = "话题介绍")
private String topicDesc;
@ApiModelProperty(value = "封面")
private String coverImg;
@ApiModelProperty(value = "是否专属 0否,1是")
private Integer specialPermission;
private Integer minutesTillNow; private Integer minutesTillNow;
private Double score; private Double score;
......
...@@ -8,7 +8,7 @@ import lombok.Data; ...@@ -8,7 +8,7 @@ import lombok.Data;
@Data @Data
public class TopicSearchReq { public class TopicSearchReq {
@ApiModelProperty(value = "搜索关键字,可以为空") @ApiModelProperty(value = "搜索关键字,可以为空")
private String searchKeyword=""; private String searchKeyword = "";
@ApiModelProperty(value = "分页") @ApiModelProperty(value = "分页")
private Pageable page; private Pageable page;
......
package com.tanpu.community.api.enums;
public enum TopicSearchTypeEnum {
RECOMMEND(1,"推荐列表"),
FOLLOW(2,"关注列表");
private Integer code;
private String type;
TopicSearchTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.tanpu.community.api.enums;
public enum TopicSpecialPermissionEnum {
FALSE(0,"没有特殊权限"),
TRUE(1,"有特殊权限");
private Integer code;
private String type;
TopicSpecialPermissionEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
...@@ -2,7 +2,7 @@ package com.tanpu.community.controller; ...@@ -2,7 +2,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.AuthLogin; import com.tanpu.common.auth.AuthLogin;
import com.tanpu.common.auth.UserHolder; import com.tanpu.community.api.beans.qo.TopicFollowQo;
import com.tanpu.community.api.beans.qo.TopicRankQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
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;
...@@ -10,34 +10,44 @@ import com.tanpu.community.manager.TopicManager; ...@@ -10,34 +10,44 @@ import com.tanpu.community.manager.TopicManager;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@RestController @RestController
@Slf4j @Slf4j
@RequestMapping(value = "/api/topic") @RequestMapping(value = "/api/topic")
@ResponseBody
public class TopicController { public class TopicController {
@Autowired @Autowired
private TopicManager topicManager; private TopicManager topicManager;
@Autowired
private UserHolder userHolder;
@AuthLogin
@GetMapping(value = "/followList")
@ApiOperation("关注话题列表")
public CommonResp<List<TopicFollowQo>> getFollowList(){
return CommonResp.success(topicManager.getFollowTopicList());
}
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ApiOperation("APP全部话题页面,可搜索") @ApiOperation("热门话题,含搜索")
@ResponseBody
public CommonResp<Page<TopicRankQo>> getTopicList(@RequestBody TopicSearchReq req){ public CommonResp<Page<TopicRankQo>> getTopicList(@RequestBody TopicSearchReq req){
return CommonResp.success(topicManager.getAllTopicBriefInfo(req)); return CommonResp.success(topicManager.getAllTopicBriefInfo(req));
} }
@GetMapping(value = "/detailPage") @GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部") @ApiOperation("话题详情页顶部")
@ResponseBody
public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId){ public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId){
return topicManager.getDetail(topicId); return topicManager.getDetail(topicId);
} }
...@@ -45,7 +55,6 @@ public class TopicController { ...@@ -45,7 +55,6 @@ public class TopicController {
@GetMapping(value = "/titleList") @GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题标题列") @ApiOperation("首页顶部话题标题列")
@ResponseBody
public CommonResp<List<TopicRankQo>> getTop4Topic(){ public CommonResp<List<TopicRankQo>> getTop4Topic(){
return CommonResp.success(topicManager.getTop4TopicTitles()); return CommonResp.success(topicManager.getTop4TopicTitles());
......
...@@ -19,11 +19,11 @@ public class CodeAutoGenerator { ...@@ -19,11 +19,11 @@ public class CodeAutoGenerator {
String currentPath = System.getProperty("user.dir"); String currentPath = System.getProperty("user.dir");
String codeBaseHome = "/community-service/src/main/java"; String codeBaseHome = "/community-service/src/main/java";
String author = "xudong"; String author = "xudong";
String mysqlUserName = "dev"; String mysqlUserName = "tamp_admin";
String mysqlPassword = "qimeng123"; String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6lqwk9969zao53uro.mysql.rds.aliyuncs.com:3306/tamp_community"; String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community";
// String[] tables = new String[]{"theme"}; // String[] tables = new String[]{"theme"};
String[] tables = new String[]{"theme_check_duplicate"}; String[] tables = new String[]{"topic"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community"; String entityPackage = "dao.entity.community";
......
package com.tanpu.community.dao.entity.community; package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* <p> * <p>
* 话题 * 话题
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-29 * @since 2022-02-17
*/ */
@TableName("topic") @TableName("topic")
@ApiModel(value="TopicEntity对象", description="话题") @ApiModel(value="TopicEntity对象", description="话题")
...@@ -38,6 +39,18 @@ public class TopicEntity implements Serializable { ...@@ -38,6 +39,18 @@ public class TopicEntity implements Serializable {
@ApiModelProperty(value = "话题名称") @ApiModelProperty(value = "话题名称")
private String topicTitle; private String topicTitle;
@ApiModelProperty(value = "话题介绍")
private String topicDesc;
@ApiModelProperty(value = "封面")
private String coverImg;
@ApiModelProperty(value = "是否专属 0否,1是")
private Integer specialPermission;
@ApiModelProperty(value = "是否同步动态至管理员企业微信 0:否 1:是")
private Integer syncCorpWechat;
@ApiModelProperty(value = "是否置顶") @ApiModelProperty(value = "是否置顶")
private Integer isTop; private Integer isTop;
...@@ -78,6 +91,38 @@ public class TopicEntity implements Serializable { ...@@ -78,6 +91,38 @@ public class TopicEntity implements Serializable {
this.topicTitle = topicTitle; this.topicTitle = topicTitle;
} }
public String getTopicDesc() {
return topicDesc;
}
public void setTopicDesc(String topicDesc) {
this.topicDesc = topicDesc;
}
public String getCoverImg() {
return coverImg;
}
public void setCoverImg(String coverImg) {
this.coverImg = coverImg;
}
public Integer getSpecialPermission() {
return specialPermission;
}
public void setSpecialPermission(Integer specialPermission) {
this.specialPermission = specialPermission;
}
public Integer getSyncCorpWechat() {
return syncCorpWechat;
}
public void setSyncCorpWechat(Integer syncCorpWechat) {
this.syncCorpWechat = syncCorpWechat;
}
public Integer getIsTop() { public Integer getIsTop() {
return isTop; return isTop;
} }
...@@ -132,6 +177,10 @@ public class TopicEntity implements Serializable { ...@@ -132,6 +177,10 @@ public class TopicEntity implements Serializable {
"id=" + id + "id=" + id +
", topicId=" + topicId + ", topicId=" + topicId +
", topicTitle=" + topicTitle + ", topicTitle=" + topicTitle +
", topicDesc=" + topicDesc +
", coverImg=" + coverImg +
", specialPermission=" + specialPermission +
", syncCorpWechat=" + syncCorpWechat +
", isTop=" + isTop + ", isTop=" + isTop +
", isConceal=" + isConceal + ", isConceal=" + isConceal +
", viewCntAdjust=" + viewCntAdjust + ", viewCntAdjust=" + viewCntAdjust +
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-22 * @since 2022-02-17
*/ */
public interface TopicMapper extends BaseMapper<TopicEntity> { public interface TopicMapper extends BaseMapper<TopicEntity> {
@Select("select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id asc limit #{size}") @Select("select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id asc limit #{size}")
......
...@@ -132,6 +132,7 @@ public class CommentManager { ...@@ -132,6 +132,7 @@ public class CommentManager {
commentQo.setHasLiked(likeCommentList.contains(commentId)); commentQo.setHasLiked(likeCommentList.contains(commentId));
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT); Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId); commentQo.setLikeCount(countByTypeAndId);
commentQo.setManager(true);
} }
//排序:点赞降序+时间降序 //排序:点赞降序+时间降序
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.common.constant.ErrorCodeConstant; import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.community.api.beans.qo.TopicFollowQo;
import com.tanpu.community.api.beans.qo.TopicRankQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
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.enums.TopicSpecialPermissionEnum;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.service.RankService; import com.tanpu.community.service.RankService;
import com.tanpu.community.service.TopicService; import com.tanpu.community.service.TopicService;
...@@ -23,7 +26,8 @@ public class TopicManager { ...@@ -23,7 +26,8 @@ public class TopicManager {
@Autowired @Autowired
private RankService rankService; private RankService rankService;
@Autowired
private UserHolder userHolder;
// 首页-话题标签 // 首页-话题标签
public List<TopicRankQo> getTop4TopicTitles() { public List<TopicRankQo> getTop4TopicTitles() {
...@@ -33,20 +37,58 @@ public class TopicManager { ...@@ -33,20 +37,58 @@ public class TopicManager {
// 话题搜索列表 // 话题搜索列表
public Page<TopicRankQo> getAllTopicBriefInfo(TopicSearchReq req) { public Page<TopicRankQo> getAllTopicBriefInfo(TopicSearchReq req) {
// 全量排序,内存分页
List<TopicRankQo> topicList = rankService.getRankTopicList(req.getSearchKeyword()); List<TopicRankQo> topicList = rankService.getRankTopicList(req.getSearchKeyword());
return PageUtils.page(req.getPage(), topicList); return PageUtils.page(req.getPage(), topicList);
} }
// 关注话题(讨论区)列表
public List<TopicFollowQo> getFollowTopicList() {
String userId = userHolder.getUserId();
// 全量排序,内存分页
topicService.queryFollowTopic(userId);
return null;
}
// 话题详情页 // 话题详情页
public CommonResp<TopicRankQo> getDetail(String topicId) { public CommonResp<TopicRankQo> getDetail(String topicId) {
TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity==null){
TopicEntity topicEntity = topicService.queryOnlineTopicById(topicId);
if (topicEntity == null) {
return CommonResp.error(ErrorCodeConstant.TOPIC_NOT_FOUND.getCode(), "抱歉!该话题已下线。"); return CommonResp.error(ErrorCodeConstant.TOPIC_NOT_FOUND.getCode(), "抱歉!该话题已下线。");
} }
//
if (TopicSpecialPermissionEnum.TRUE.getCode().equals(topicEntity.getSpecialPermission()) && !checkPermission(topicId, userHolder.getUserId())) {
return CommonResp.error(ErrorCodeConstant.TOPIC_PERMISSION_ABORT.getCode(), getPermissionToast(topicId));
}
return CommonResp.success(rankService.getTopicDetail(topicId)); return CommonResp.success(rankService.getTopicDetail(topicId));
} }
private String getPermissionToast(String topicId) {
String permission = "专业版会员";
// return "暂无权限参与此话题~您可联系官方客服 021- 了解详情";
return "该话题仅限" + permission + "可参与哦~";
}
/**
* 判断用户是否拥有权限(1对1)
*
* @param topicId
* @param userId
*/
private boolean checkPermission(String topicId, String userId) {
return true;
}
} }
...@@ -2,6 +2,7 @@ package com.tanpu.community.service; ...@@ -2,6 +2,7 @@ package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.uuid.UuidGenHelper; import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.enums.StatusEnum; import com.tanpu.community.api.enums.StatusEnum;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.mapper.community.TopicMapper; import com.tanpu.community.dao.mapper.community.TopicMapper;
...@@ -43,7 +44,7 @@ public class TopicService { ...@@ -43,7 +44,7 @@ public class TopicService {
public TopicEntity queryById(String topicId) { public TopicEntity queryOnlineTopicById(String topicId) {
return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>() return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>()
.eq(TopicEntity::getTopicId, topicId) .eq(TopicEntity::getTopicId, topicId)
.eq(TopicEntity::getIsConceal, StatusEnum.FALSE) .eq(TopicEntity::getIsConceal, StatusEnum.FALSE)
...@@ -64,4 +65,7 @@ public class TopicService { ...@@ -64,4 +65,7 @@ public class TopicService {
return topicMapper.selectList(new LambdaQueryWrapper<TopicEntity>().in(TopicEntity::getTopicId, topicIds)); return topicMapper.selectList(new LambdaQueryWrapper<TopicEntity>().in(TopicEntity::getTopicId, topicIds));
} }
public List<TopicRankQo> queryFollowTopic(String userId) {
return null;
}
} }
...@@ -95,6 +95,8 @@ recommend: ...@@ -95,6 +95,8 @@ recommend:
tmpfile: tmpfile:
dir: /data/tmp dir: /data/tmp
logging.level.com.tanpu: debug
tanpu: tanpu:
fatools: fatools:
svc: https://testtamper.tanpuyun.com svc: https://testtamper.tanpuyun.com
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<id column="id" property="id" /> <id column="id" property="id" />
<result column="topic_id" property="topicId" /> <result column="topic_id" property="topicId" />
<result column="topic_title" property="topicTitle" /> <result column="topic_title" property="topicTitle" />
<result column="topic_desc" property="topicDesc" />
<result column="cover_img" property="coverImg" />
<result column="special_permission" property="specialPermission" />
<result column="sync_corp_wechat" property="syncCorpWechat" />
<result column="is_top" property="isTop" /> <result column="is_top" property="isTop" />
<result column="is_conceal" property="isConceal" /> <result column="is_conceal" property="isConceal" />
<result column="view_cnt_adjust" property="viewCntAdjust" /> <result column="view_cnt_adjust" property="viewCntAdjust" />
......
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