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

转发详情

parent 65c389fc
...@@ -23,7 +23,7 @@ public class FormerThemeQo { ...@@ -23,7 +23,7 @@ public class FormerThemeQo {
private String userImg; private String userImg;
@ApiModelProperty(value = "被转发的主题Id") @ApiModelProperty(value = "被转发的主题Id")
private String formerThemeId; private String themeId;
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发 ") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发 ")
private Integer themeType; private Integer themeType;
...@@ -41,6 +41,6 @@ public class FormerThemeQo { ...@@ -41,6 +41,6 @@ public class FormerThemeQo {
private String authorId; private String authorId;
@ApiModelProperty(value = "转发内容") @ApiModelProperty(value = "转发内容")
private List<ThemeContentQo> forwardContent; private List<ThemeContentQo> content;
} }
...@@ -82,7 +82,7 @@ public class ThemeQo { ...@@ -82,7 +82,7 @@ public class ThemeQo {
private FormerThemeQo formerTheme; private FormerThemeQo formerTheme;
@ApiModelProperty(value = "评论Id(我的评论列表使用)") @ApiModelProperty(value = "评论Id(我的评论列表使用)")
private FormerThemeQo commentId; private String commentId;
private Long createTime; private Long createTime;
......
...@@ -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;
......
...@@ -11,7 +11,7 @@ import com.tanpu.community.api.enums.*; ...@@ -11,7 +11,7 @@ import com.tanpu.community.api.enums.*;
import com.tanpu.community.dao.entity.community.*; import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.user.UserInfoEntity; import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.service.other.BlackListService; import com.tanpu.community.service.BlackListService;
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.apache.commons.lang3.StringUtils;
...@@ -111,51 +111,54 @@ public class ThemeManager { ...@@ -111,51 +111,54 @@ public class ThemeManager {
List<ThemeEntity> themeEntities = Collections.emptyList(); List<ThemeEntity> themeEntities = Collections.emptyList();
switch (req.getRecordType()) { switch (req.getRecordType()) {
case 1://发布 case 1://发布
themeEntities = themeService.queryThemeIdsByUserId(req.getUserId(),req.getLastId(),req.getPageSize()); themeEntities = themeService.queryThemeIdsByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
break; break;
case 2://回复 case 2://回复
List<ThemeQo> commentThemeList = new ArrayList<>(); List<ThemeQo> commentThemeList = new ArrayList<>();
//评论列表 //评论列表
List<CommentEntity> commentEntities = commentService.queryThemesByUserId(req.getUserId(),req.getLastId(),req.getPageSize()); List<CommentEntity> commentEntities = commentService.queryThemesByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
//当前用户信息 //当前用户信息
UserInfoEntity userInfoEntity = userInfoService.selectById(req.getUserId()); UserInfoEntity userInfoEntity = userInfoService.selectById(req.getUserId());
Set<String> replyThemeIds = commentEntities.stream().map(CommentEntity::getThemeId).collect(Collectors.toSet()); Set<String> replyThemeIds = commentEntities.stream().map(CommentEntity::getThemeId).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(replyThemeIds)){ if (CollectionUtils.isEmpty(replyThemeIds)) {
return commentThemeList; return commentThemeList;
} }
Map<String, CommentEntity> commentMap = commentEntities.stream()
.collect(Collectors.toMap(CommentEntity::getThemeId, o -> o));
themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds)); themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds));
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId); List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
productService.transferAttachments(themeQos);
for (ThemeQo themeQo : themeQos) { //主题列表
String themeId = themeQo.getThemeId(); Map<String, ThemeQo> themeMap = themeQos.stream()
.collect(Collectors.toMap(ThemeQo::getThemeId, o -> o));
//主题+评论封装转发对象
for (CommentEntity commentEntity : commentEntities) {
String themeId = commentEntity.getThemeId();
//评论内容包装到ThemeContentQo里
ThemeContentQo commentContent = ThemeContentQo.builder() ThemeContentQo commentContent = ThemeContentQo.builder()
.type(RelTypeEnum.TEXT.type) .type(RelTypeEnum.TEXT.type)
.value(commentMap.get(themeId) .value(commentEntity.getContent())
.getContent())
.build(); .build();
ThemeQo commentThemeQo = ThemeQo.builder().userImg(themeQo.getUserImg()) //原主题包装到FormerThemeQo中
ThemeQo themeQo = themeMap.get(themeId);
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(themeQo);
//ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中
ThemeQo commentThemeQo = ThemeQo.builder()
.nickName(userInfoEntity.getUiNickname()) .nickName(userInfoEntity.getUiNickname())
.userImg(userInfoEntity.getUiHeadimg()) .userImg(userInfoEntity.getUiHeadimg())
.content(Arrays.asList(commentContent)) .content(Arrays.asList(commentContent))
.formerTheme(f)
.commentId(commentEntity.getCommentId())
.build(); .build();
FormerThemeQo f = FormerThemeQo.builder().formerThemeId(themeId)
.forwardContent(themeQo.getContent())
.userImg(themeQo.getUserImg())
.nickName(themeQo.getNickName())
.build();
commentThemeQo.setFormerTheme(f);
commentThemeList.add(commentThemeQo); commentThemeList.add(commentThemeQo);
} }
return commentThemeList; return commentThemeList;
case 3://点赞 case 3://点赞
Set<String> likeThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.LIKE_THEME); Set<String> likeThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.LIKE_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(likeThemeIds),req.getLastId(),req.getPageSize()); themeEntities = themeService.queryByThemeIds(new ArrayList<>(likeThemeIds), req.getLastId(), req.getPageSize());
break; break;
case 4://收藏 case 4://收藏
Set<String> collectThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.COLLECT_THEME); Set<String> collectThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.COLLECT_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(collectThemeIds),req.getLastId(),req.getPageSize()); themeEntities = themeService.queryByThemeIds(new ArrayList<>(collectThemeIds), req.getLastId(), req.getPageSize());
break; break;
} }
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId); List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
...@@ -163,7 +166,6 @@ public class ThemeManager { ...@@ -163,7 +166,6 @@ public class ThemeManager {
} }
//查询正文 //查询正文
public ThemeQo getDetail(String themeId, String userId) { public ThemeQo getDetail(String themeId, String userId) {
...@@ -216,7 +218,6 @@ public class ThemeManager { ...@@ -216,7 +218,6 @@ public class ThemeManager {
} }
// 屏蔽(用户) // 屏蔽(用户)
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());
......
package com.tanpu.community.service.other; 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.exception.BizException; import com.tanpu.common.exception.BizException;
......
...@@ -84,7 +84,8 @@ public class CommentService { ...@@ -84,7 +84,8 @@ public class CommentService {
.eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode()) .eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode())
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()); .eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
if (StringUtils.isNotEmpty(lastId)) { if (StringUtils.isNotEmpty(lastId)) {
CommentEntity commentEntity = commentMapper.selectById(lastId); CommentEntity commentEntity = commentMapper.selectOne(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getCommentId,lastId));
if (commentEntity==null) throw new BizException("主题未找到,id:"+lastId); if (commentEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime()); queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime());
} }
......
...@@ -180,7 +180,8 @@ public class ThemeService { ...@@ -180,7 +180,8 @@ public class ThemeService {
@Transactional @Transactional
public void deleteById(String themeId) { public void deleteById(String themeId) {
ThemeEntity themeEntity = themeMapper.selectById(themeId); ThemeEntity themeEntity = themeMapper.selectOne(new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getThemeId, themeId));
if (themeEntity==null){ if (themeEntity==null){
throw new BizException("主题未找到,id:"+themeId); throw new BizException("主题未找到,id:"+themeId);
} }
......
package com.tanpu.community.service.other; package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.dao.entity.user.UserRistRzEntity; import com.tanpu.community.dao.entity.user.UserRistRzEntity;
......
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.user.CurriculumPriceEntity;
import com.tanpu.community.dao.mapper.user.CurriculumPriceMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class CurriculumPriceService {
@Resource
private CurriculumPriceMapper curriculumPriceMapper;
public CurriculumPriceEntity selectById(String id){
return curriculumPriceMapper.selectById(id);
}
public List<CurriculumPriceEntity> selectByIds(List<String> ids){
if (CollectionUtils.isEmpty(ids)){
return Collections.emptyList();
}
return curriculumPriceMapper.selectBatchIds(ids);
}
}
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.api.enums.CurriculumEnum;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.user.CurriculumResEntity;
import com.tanpu.community.dao.mapper.user.CurriculumResMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 短视频详情
*/
@Service
public class CurriculumResService {
@Resource
private CurriculumResMapper curriculumResMapper;
public CurriculumResEntity selectById(String id) {
return curriculumResMapper.selectById(id);
}
public CurriculumResEntity selectShortVideo(String id){
return curriculumResMapper.selectOne(new LambdaQueryWrapper<CurriculumResEntity>()
.eq(CurriculumResEntity::getId,id)
.eq(CurriculumResEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.eq(CurriculumResEntity::getStatus, CurriculumEnum.CcStatus.up));
}
}
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.tanpu.community.dao.mapper.user.FinProResMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 产品详情
*/
@Service
public class FinProResService {
@Resource
private FinProResMapper finProResMapper;
public FinProResEntity selectById(String id){
return finProResMapper.selectById(id);
}
}
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.user.OrderFlowEntity;
import com.tanpu.community.dao.mapper.user.OrderFlowMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class OrderFlowService {
@Resource
private OrderFlowMapper orderFlowMapper;
public OrderFlowEntity selectById(String id){
return orderFlowMapper.selectById(id);
}
public List<OrderFlowEntity> selectByIds(List<String> ids){
if (CollectionUtils.isEmpty(ids)){
return Collections.emptyList();
}
return orderFlowMapper.selectBatchIds(ids);
}
public OrderFlowEntity queryByUserAndProId(String proId,String userId){
return orderFlowMapper.selectOne(new LambdaQueryWrapper<OrderFlowEntity>()
.eq(OrderFlowEntity::getCreateby,userId)
.eq(OrderFlowEntity::getAbProid,proId)
.eq(OrderFlowEntity::getDeletetag, DeleteTagEnum.NOT_DELETED.getCode())
.eq(OrderFlowEntity::getAbStatus,"SUCCESS"));
}
}
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.tanpu.community.dao.mapper.zhibo.ZhiboThemeMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 直播详情
*/
@Service
public class ZhiboService {
@Resource
private ZhiboThemeMapper zhiboThemeMapper;
public ZhiboThemeEntity selectByid(String id) {
return zhiboThemeMapper.selectById(id);
}
}
...@@ -190,8 +190,8 @@ public class ConvertUtil { ...@@ -190,8 +190,8 @@ public class ConvertUtil {
if (formerTheme == null) { if (formerTheme == null) {
return null; return null;
} }
return FormerThemeQo.builder().formerThemeId(formerTheme.getThemeId()) return FormerThemeQo.builder().themeId(formerTheme.getThemeId())
.forwardContent(formerTheme.getContent()) .content(formerTheme.getContent())
.userImg(formerTheme.getUserImg()) .userImg(formerTheme.getUserImg())
.nickName(formerTheme.getNickName()) .nickName(formerTheme.getNickName())
.title(formerTheme.getTitle()) .title(formerTheme.getTitle())
......
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