Commit 65c389fc authored by 刘基明's avatar 刘基明

转发详情

parent 49f63e9c
......@@ -81,6 +81,9 @@ public class ThemeQo {
@ApiModelProperty(value = "转发的主题")
private FormerThemeQo formerTheme;
@ApiModelProperty(value = "评论Id(我的评论列表使用)")
private FormerThemeQo commentId;
private Long createTime;
private Long updateTime;
......
......@@ -19,7 +19,7 @@ public class QueryRecordThemeReq {
@ApiModelProperty(value = "操作类型 1:发布 2:回复 3:点赞 4:收藏")
private Integer recordType;
@ApiModelProperty(value = "当前浏览的最后一个themeId,可以为空")
@ApiModelProperty(value = "当前浏览的最后一个themeId/commentId,可以为空")
private String lastId;
@NotNull(message = "PageSize不能为空")
......
......@@ -216,10 +216,6 @@ public class ThemeManager {
}
//投诉(主题)
public void complaint(String themeId, String user) {
//TODO
}
// 屏蔽(用户)
public void blockUser(String blockUser, String userId) {
......@@ -296,10 +292,10 @@ public class ThemeManager {
productService.transferAttachement(themeQo);
//转发原文
buildFormerTheme(themeQo);
return;
}
//组装被转发主题
private void buildFormerTheme(ThemeQo themeQo) {
String formerThemeId = themeQo.getFormerThemeId();
if (StringUtils.isNotEmpty(formerThemeId)) {
......@@ -308,18 +304,20 @@ public class ThemeManager {
throw new BizException("转发主题Id错误,id:" + formerThemeId);
}
productService.transferAttachement(formerTheme);
FormerThemeQo f = FormerThemeQo.builder().formerThemeId(formerThemeId)
.forwardContent(formerTheme.getContent())
.userImg(formerTheme.getUserImg())
.nickName(formerTheme.getNickName())
.build();
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme);
themeQo.setFormerTheme(f);
}
}
//逻辑删除
public void delete(String themeId) {
themeService.deleteById(themeId);
}
//投诉(主题)
public void complaint(String themeId, String user) {
//TODO
}
}
......@@ -20,20 +20,21 @@ import java.util.stream.Collectors;
public class ConvertUtil {
public static ThemeQo themeEntityToQo(ThemeEntity themeEntity) {
if (themeEntity==null){
if (themeEntity == null) {
return null;
}
ThemeQo themeQO = new ThemeQo();
BeanUtils.copyProperties(themeEntity, themeQO);
themeQO.setUpdateTime(TimeUtil.getTimestampOfDateTime(themeEntity.getUpdateTime()));
themeQO.setCreateTime(TimeUtil.getTimestampOfDateTime(themeEntity.getCreateTime()));
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {});
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {
});
themeQO.setContent(themeContentQos);
return themeQO;
}
public static ThemeQo themeEntityToQo2(ThemeEntity themeEntity) {
if (themeEntity==null){
if (themeEntity == null) {
return null;
}
ThemeQo themeQO = new ThemeQo();
......@@ -41,7 +42,8 @@ public class ConvertUtil {
themeQO.setUpdateTime(TimeUtil.getTimestampOfDateTime(themeEntity.getUpdateTime()));
themeQO.setCreateTime(TimeUtil.getTimestampOfDateTime(themeEntity.getCreateTime()));
themeQO.setUpToNowTime(TimeUtil.calUpToNowTime(themeEntity.getCreateTime()));
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {});
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {
});
//首页列表使用,限制附件个数为1(1文本+1附件),-》已经改为全部返回
// if (themeContentQos != null && themeContentQos.size() > 2) {
// themeQO.setContent(themeContentQos.subList(0, 2));
......@@ -61,6 +63,7 @@ public class ConvertUtil {
/**
* 首页主题列表,限制附件个数为1(1文本+1附件)
*
* @param themeEntities
* @return
*/
......@@ -81,7 +84,7 @@ public class ConvertUtil {
return topicHotQo;
}
public static List<TopicHotQo> topicEntityToHotQos(List<TopicEntity> topicEntities){
public static List<TopicHotQo> topicEntityToHotQos(List<TopicEntity> topicEntities) {
return topicEntities.stream().map(ConvertUtil::topicEntityToHotQo).collect(Collectors.toList());
}
......@@ -90,6 +93,7 @@ public class ConvertUtil {
BeanUtils.copyProperties(topicEntity, topicTitileQo);
return topicTitileQo;
}
public static CommentQo commentEntity2Qo(CommentEntity entity) {
CommentQo qo = new CommentQo();
BeanUtils.copyProperties(entity, qo);
......@@ -97,7 +101,7 @@ public class ConvertUtil {
return qo;
}
public static List<CommentQo> commentEntity2Qos(List<CommentEntity> entities){
public static List<CommentQo> commentEntity2Qos(List<CommentEntity> entities) {
return entities.stream().map(ConvertUtil::commentEntity2Qo).collect(Collectors.toList());
}
......@@ -107,7 +111,7 @@ public class ConvertUtil {
return qo;
}
public static List<CommentLv2Qo> commentLv2Entity2Qos(List<CommentEntity> entities){
public static List<CommentLv2Qo> commentLv2Entity2Qos(List<CommentEntity> entities) {
return entities.stream().map(ConvertUtil::commentLv2Entity2Qo).collect(Collectors.toList());
}
......@@ -120,8 +124,6 @@ public class ConvertUtil {
}
public static DeleteTagEnum deleteTagShift(DeleteTagEnum deleteTagEnum) {
if (deleteTagEnum.getCode().equals(DeleteTagEnum.NOT_DELETED.getCode())) {
return DeleteTagEnum.DELETED;
......@@ -140,6 +142,7 @@ public class ConvertUtil {
/**
* 解析 List<ThemeContentReq>为Attachment列表
*
* @param req
* @param themeId
* @return
......@@ -149,9 +152,9 @@ public class ConvertUtil {
List<ThemeAttachmentEntity> list = new ArrayList<>();
for (ThemeContentReq content : contents) {
if (!RelTypeEnum.TEXT.type.equals(content.getType())){
if (!RelTypeEnum.TEXT.type.equals(content.getType())) {
//讨论-多图类型,拆开解析到attachment表中
if ((content.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type))){
if ((content.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type))) {
List<ImagesDTO> imgList = content.getImgList();
for (ImagesDTO imagesDTO : imgList) {
list.add(ThemeAttachmentEntity.builder()
......@@ -160,7 +163,7 @@ public class ConvertUtil {
.themeId(themeId)
.build());
}
}else {
} else {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
......@@ -183,5 +186,21 @@ public class ConvertUtil {
.build();
}
public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) {
if (formerTheme == null) {
return null;
}
return FormerThemeQo.builder().formerThemeId(formerTheme.getThemeId())
.forwardContent(formerTheme.getContent())
.userImg(formerTheme.getUserImg())
.nickName(formerTheme.getNickName())
.title(formerTheme.getTitle())
.topicId(formerTheme.getTopicId())
.topicTitle(formerTheme.getTopicTitle())
.authorId(formerTheme.getAuthorId())
.themeType(formerTheme.getThemeType())
.build();
}
}
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