Commit 56768478 authored by 刘基明's avatar 刘基明

Merge branch 'v2.3.1' into 'dev'

V2.3.1

See merge request !45
parents ce909d9e 3617c248
...@@ -23,6 +23,12 @@ public class CommentQo { ...@@ -23,6 +23,12 @@ public class CommentQo {
@ApiModelProperty(value = "作者id") @ApiModelProperty(value = "作者id")
private String authorId; private String authorId;
@ApiModelProperty(value = "回复对象的用户id,根据这个来判断是否有回复对象")
private String replyUserId;
@ApiModelProperty(value = "回复对象的用户名")
private String replyUserName;
@ApiModelProperty(value = "点赞次数") @ApiModelProperty(value = "点赞次数")
private Integer likeCount; private Integer likeCount;
...@@ -44,6 +50,7 @@ public class CommentQo { ...@@ -44,6 +50,7 @@ public class CommentQo {
@ApiModelProperty(value = "是否讨论区管理员") @ApiModelProperty(value = "是否讨论区管理员")
private boolean isManager; 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;
......
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@ApiModel(value = "主题关联产品")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TopicAttachement {
@ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-音频,304: 新版课程-视频,109:单图(长文) 110:多图(讨论)")
private String type;
@ApiModelProperty(value = "对象详情")
private AttachmentDetailVo detail;
}
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("热点话题对象")
public class TopicPageDetailQo {
@ApiModelProperty(value = "话题ID")
private String topicId;
@ApiModelProperty(value = "话题名称")
private String topicTitle;
@ApiModelProperty(value = "阅读量")
private Integer viewCount;
@ApiModelProperty(value = "讨论量")
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 boolean hasPermission;
@ApiModelProperty(value = "关联产品")
private List<TopicAttachement> attachments;
}
...@@ -48,6 +48,9 @@ public class TopicRankQo { ...@@ -48,6 +48,9 @@ public class TopicRankQo {
@ApiModelProperty(value = "是否专属 0否,1是") @ApiModelProperty(value = "是否专属 0否,1是")
private Integer specialPermission; private Integer specialPermission;
@ApiModelProperty(value = "是否有权限")
private boolean hasPermission;
private Integer minutesTillNow; private Integer minutesTillNow;
private Double score; private Double score;
......
...@@ -14,11 +14,6 @@ public class CreateCommentReq { ...@@ -14,11 +14,6 @@ public class CreateCommentReq {
@ApiModelProperty(value = "主题Id") @ApiModelProperty(value = "主题Id")
private String themeId; private String themeId;
@ApiModelProperty(value = "一级评论id(对主题的一级评论,此项为空)")
private String parentId;
@ApiModelProperty(value = "回复对象的id(非对评论回复时,此项为空)")
private String replyId;
@NotBlank(message = "评论内容不能为空") @NotBlank(message = "评论内容不能为空")
@ApiModelProperty(value = "评论内容") @ApiModelProperty(value = "评论内容")
...@@ -27,4 +22,14 @@ public class CreateCommentReq { ...@@ -27,4 +22,14 @@ public class CreateCommentReq {
@ApiModelProperty(value = "同步转发,1 同步 ,0 不同步(默认)") @ApiModelProperty(value = "同步转发,1 同步 ,0 不同步(默认)")
private int syncForward = 0; private int syncForward = 0;
@ApiModelProperty(value = "回复对象的commentId(非对评论回复时,此项为空)")
private String replyId;
@ApiModelProperty(value = "回复对象的userid")
private String replyUserId;
@ApiModelProperty(value = "一级评论id(对主题的一级评论,此项为空,目前未使用)")
private String parentId;
} }
...@@ -51,7 +51,7 @@ public class TopicController { ...@@ -51,7 +51,7 @@ public class TopicController {
} }
@GetMapping(value = "/detailPage") @GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部") @ApiOperation("话题详情页")
public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId) { public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId) {
return topicManager.getDetail(topicId); return topicManager.getDetail(topicId);
} }
...@@ -66,9 +66,9 @@ public class TopicController { ...@@ -66,9 +66,9 @@ public class TopicController {
@AuthLogin @AuthLogin
@PostMapping(value = "/follow") @PostMapping(value = "/follow")
@ApiOperation("首页顶部话题标题列") @ApiOperation("关注话题(讨论区)")
public CommonResp<Void> follow(@RequestBody FollowTopicReq req) { public CommonResp<Void> follow(@RequestBody FollowTopicReq req) {
topicManager.follow(req, userHolder.getUserId()); topicManager.followTopic(req, userHolder.getUserId());
return CommonResp.success(); return CommonResp.success();
} }
......
...@@ -23,7 +23,7 @@ public class CodeAutoGenerator { ...@@ -23,7 +23,7 @@ public class CodeAutoGenerator {
String mysqlPassword = "@imeng123"; String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.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[]{"topic_follow_rel"}; String[] tables = new String[]{"comment"};
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";
......
...@@ -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-28 * @since 2022-02-18
*/ */
@TableName("comment") @TableName("comment")
@ApiModel(value="CommentEntity对象", description="评论") @ApiModel(value="CommentEntity对象", description="评论")
...@@ -54,6 +54,9 @@ public class CommentEntity implements Serializable { ...@@ -54,6 +54,9 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "回复评论id") @ApiModelProperty(value = "回复评论id")
private String replyId; private String replyId;
@ApiModelProperty(value = "回复对象的用户id")
private String replyUserId;
@ApiModelProperty(value = "审核状态 0:初始值 1:已通过(管理后台使用)") @ApiModelProperty(value = "审核状态 0:初始值 1:已通过(管理后台使用)")
private Integer reviewStatus; private Integer reviewStatus;
...@@ -131,6 +134,14 @@ public class CommentEntity implements Serializable { ...@@ -131,6 +134,14 @@ public class CommentEntity implements Serializable {
this.replyId = replyId; this.replyId = replyId;
} }
public String getReplyUserId() {
return replyUserId;
}
public void setReplyUserId(String replyUserId) {
this.replyUserId = replyUserId;
}
public Integer getReviewStatus() { public Integer getReviewStatus() {
return reviewStatus; return reviewStatus;
} }
...@@ -182,6 +193,7 @@ public class CommentEntity implements Serializable { ...@@ -182,6 +193,7 @@ public class CommentEntity implements Serializable {
", themeId=" + themeId + ", themeId=" + themeId +
", parentId=" + parentId + ", parentId=" + parentId +
", replyId=" + replyId + ", replyId=" + replyId +
", replyUserId=" + replyUserId +
", reviewStatus=" + reviewStatus + ", reviewStatus=" + reviewStatus +
", reportStatus=" + reportStatus + ", reportStatus=" + reportStatus +
", createTime=" + createTime + ", createTime=" + createTime +
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-22 * @since 2022-02-18
*/ */
public interface CommentMapper extends BaseMapper<CommentEntity> { public interface CommentMapper extends BaseMapper<CommentEntity> {
......
...@@ -11,6 +11,7 @@ import com.tanpu.community.api.beans.req.topic.TopicSearchReq; ...@@ -11,6 +11,7 @@ import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.api.enums.OperationTypeEnum; import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.api.enums.TopicSpecialPermissionEnum; 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.dao.entity.community.TopicFollowRelEntity;
import com.tanpu.community.dao.mapper.community.TopicFollowRelMapper; import com.tanpu.community.dao.mapper.community.TopicFollowRelMapper;
import com.tanpu.community.service.RankService; import com.tanpu.community.service.RankService;
import com.tanpu.community.service.ThemeService; import com.tanpu.community.service.ThemeService;
...@@ -52,7 +53,10 @@ public class TopicManager { ...@@ -52,7 +53,10 @@ 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); Page<TopicRankQo> result = PageUtils.page(req.getPage(), topicList);
// 添加权限
topicService.batchCheckPermission(result.getContent(),userHolder.getUserId());
return result;
} }
/** /**
...@@ -64,12 +68,12 @@ public class TopicManager { ...@@ -64,12 +68,12 @@ public class TopicManager {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
// 查库 // 查库
List<TopicFollowQo> topicFollowQos = topicService.queryFollowTopic(userId); List<TopicFollowQo> topicFollowQos = topicService.queryFollowTopic(userId);
// 从缓存中获取浏览量 // 从缓存中获取浏览量
Map<String, TopicRankQo> topicMap = rankService.getRankTopicList(null).stream().collect(Collectors.toMap(TopicRankQo::getTopicId, o -> o, (a, b) -> a)); Map<String, TopicRankQo> topicMap = rankService.getRankTopicList(null).stream().collect(Collectors.toMap(TopicRankQo::getTopicId, o -> o, (a, b) -> a));
topicFollowQos.stream().forEach(o->{ topicFollowQos.stream().forEach(o -> {
TopicRankQo topicRankQo = topicMap.get(o.getTopicId()); TopicRankQo topicRankQo = topicMap.get(o.getTopicId());
BeanUtils.copyProperties(topicRankQo,o); BeanUtils.copyProperties(topicRankQo, o);
}); });
...@@ -86,6 +90,7 @@ public class TopicManager { ...@@ -86,6 +90,7 @@ public class TopicManager {
/** /**
* 话题详情页 * 话题详情页
*
* @param topicId * @param topicId
* @return * @return
*/ */
...@@ -109,8 +114,8 @@ public class TopicManager { ...@@ -109,8 +114,8 @@ public class TopicManager {
String permission = "专业版会员"; String permission = "专业版会员";
// return "暂无权限参与此话题~您可联系官方客服 021- 了解详情"; return "暂无权限参与此话题~您可联系官方客服 021- 了解详情";
return "该话题仅限" + permission + "可参与哦~"; // return "该话题仅限" + permission + "可参与哦~";
} }
/** /**
...@@ -121,17 +126,40 @@ public class TopicManager { ...@@ -121,17 +126,40 @@ public class TopicManager {
*/ */
private boolean checkPermission(String topicId, String userId) { private boolean checkPermission(String topicId, String userId) {
return true; TopicEntity topicEntity = topicService.queryOnlineTopicById(topicId);
if (TopicSpecialPermissionEnum.FALSE.equals(topicEntity.getSpecialPermission())) {
return true;
}
TopicFollowRelEntity topicFollowRelEntity = topicFollowRelMapper.queryOneByTopicIdAndUserId(topicId, userId);
if (topicFollowRelEntity != null) {
return true;
} else {
return false;
}
} }
public void follow(FollowTopicReq req, String userId) { /**
* 关注/取关 话题
*
* @param req
* @param userId
* @return
*/
public CommonResp<Void> followTopic(FollowTopicReq req, String userId) {
// 检验话题权限是否专属
TopicEntity topicEntity = topicService.queryOnlineTopicById(req.getTopicId());
if (TopicSpecialPermissionEnum.TRUE.equals(topicEntity.getSpecialPermission())) {
return CommonResp.error(ErrorCodeConstant.ILLEGAL_ARGEMENT.getCode(), "专属话题不支持关注");
}
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) { if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
topicService.addFollowTopic(req.getTopicId(), userId); topicService.addFollowTopic(req.getTopicId(), userId);
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) { } else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
topicService.deleteFollowTopic(req.getTopicId(), userId); topicService.deleteFollowTopic(req.getTopicId(), userId);
} }
return CommonResp.success();
} }
} }
...@@ -312,7 +312,7 @@ public class ThemeService { ...@@ -312,7 +312,7 @@ public class ThemeService {
ThemeEntity themeEntity = themeMapper.queryOneByTopicIdOrderByUpdateTimeDesc(topicId); ThemeEntity themeEntity = themeMapper.queryOneByTopicIdOrderByUpdateTimeDesc(topicId);
if (themeEntity != null) { if (themeEntity != null) {
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity); ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
topic.setLastTheme(themeQo.getAuthorId() + themeQo.content.get(0).getValue()); topic.setLastTheme(getUserName(themeQo.getAuthorId()) + ":" + themeQo.content.get(0).getValue());
topic.setLastThemeTime(TimeUtils.format(themeEntity.getUpdateTime())); topic.setLastThemeTime(TimeUtils.format(themeEntity.getUpdateTime()));
} }
...@@ -330,4 +330,9 @@ public class ThemeService { ...@@ -330,4 +330,9 @@ public class ThemeService {
} }
} }
private String getUserName(String authorId) {
return "理财师Jack";
}
} }
...@@ -3,6 +3,7 @@ package com.tanpu.community.service; ...@@ -3,6 +3,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.TopicFollowQo; import com.tanpu.community.api.beans.qo.TopicFollowQo;
import com.tanpu.community.api.beans.qo.TopicRankQo;
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.api.enums.StatusEnum;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
...@@ -11,6 +12,7 @@ import com.tanpu.community.dao.mapper.community.TopicFollowRelMapper; ...@@ -11,6 +12,7 @@ import com.tanpu.community.dao.mapper.community.TopicFollowRelMapper;
import com.tanpu.community.dao.mapper.community.TopicMapper; import com.tanpu.community.dao.mapper.community.TopicMapper;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -121,4 +123,10 @@ public class TopicService { ...@@ -121,4 +123,10 @@ public class TopicService {
topicFollowRelMapper.updateById(searchResult); topicFollowRelMapper.updateById(searchResult);
} }
} }
public void batchCheckPermission(List<TopicRankQo> content, String userId) {
if (StringUtils.isBlank(userId)){
}
}
} }
...@@ -14,8 +14,9 @@ import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg; ...@@ -14,8 +14,9 @@ import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp; import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.NotificationTypeEnum; import com.tanpu.community.api.enums.NotificationTypeEnum;
import com.tanpu.community.dao.entity.NotificationLikeDO; import com.tanpu.community.api.enums.TopicSpecialPermissionEnum;
import com.tanpu.community.dao.entity.NotificationForwardDO; import com.tanpu.community.dao.entity.NotificationForwardDO;
import com.tanpu.community.dao.entity.NotificationLikeDO;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.FileRecordEntity; import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.NotificationEntity; import com.tanpu.community.dao.entity.community.NotificationEntity;
...@@ -23,8 +24,8 @@ import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity; ...@@ -23,8 +24,8 @@ import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity; import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.entity.community.VisitLogEntity; import com.tanpu.community.dao.entity.community.VisitLogEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
...@@ -122,6 +123,12 @@ public class ConvertUtil { ...@@ -122,6 +123,12 @@ public class ConvertUtil {
if (TimeUtils.calMinuteTillNow(topicEntity.getCreateTime()) < 60 * 24) { if (TimeUtils.calMinuteTillNow(topicEntity.getCreateTime()) < 60 * 24) {
topicRankQo.setType(TopicStatusEnum.NEWEST.getCode()); topicRankQo.setType(TopicStatusEnum.NEWEST.getCode());
} }
// 根据是否专属设置默认权限
if (TopicSpecialPermissionEnum.FALSE.getCode().equals(topicEntity.getSpecialPermission())){
topicRankQo.setHasPermission(true);
}else {
topicRankQo.setHasPermission(false);
}
topicRankQo.setMinutesTillNow((int) TimeUtils.calMinuteTillNow(topicEntity.getCreateTime())); topicRankQo.setMinutesTillNow((int) TimeUtils.calMinuteTillNow(topicEntity.getCreateTime()));
return topicRankQo; return topicRankQo;
} }
...@@ -152,6 +159,9 @@ public class ConvertUtil { ...@@ -152,6 +159,9 @@ public class ConvertUtil {
BeanUtils.copyProperties(entity, qo); BeanUtils.copyProperties(entity, qo);
qo.setContent(OtherUtil.blockPhoneAndEmail(entity.getContent())); qo.setContent(OtherUtil.blockPhoneAndEmail(entity.getContent()));
qo.setUpdateTime(TimeUtils.getTimestampOfDateTime(entity.getUpdateTime())); qo.setUpdateTime(TimeUtils.getTimestampOfDateTime(entity.getUpdateTime()));
if (StringUtils.isBlank(entity.getReplyUserId())){
qo.setReplyUserId(null);
}
return qo; return qo;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<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="reply_user_id" property="replyUserId" />
<result column="review_status" property="reviewStatus" /> <result column="review_status" property="reviewStatus" />
<result column="report_status" property="reportStatus" /> <result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
......
...@@ -37,6 +37,6 @@ ...@@ -37,6 +37,6 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from topic_follow_rel from topic_follow_rel
where topic_id=#{topicId} and user_id=#{userId} where topic_id=#{topicId} and user_id=#{userId} and delete_tag = 0
</select> </select>
</mapper> </mapper>
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