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

转发详情

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