Commit f43ac197 authored by 张辰's avatar 张辰

Merge branch 'dev' of http://47.100.44.39:10001/tp-backend/tanpu-community into dev

# Conflicts:
#	community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeContentQo.java
#	community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
parents 7132ad8e 1ddb2104
......@@ -2,17 +2,19 @@ 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
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("关注列表")
public class FollowQo {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "用户id")
private String userId;
......
......@@ -26,9 +26,24 @@ public class FormerThemeQo implements Serializable {
private String userImg;
@ApiModelProperty(value = "被转发的主题Id")
private String formerThemeId;
private String themeId;
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发 ")
private Integer themeType;
@ApiModelProperty(value = "被转发的主题标题")
private String title;
@ApiModelProperty(value = "被转发的主题的话题名称")
private String topicTitle;
@ApiModelProperty(value = "被转发的主题所属的话题")
private String topicId;
@ApiModelProperty(value = "被转发的主题的作者id")
private String authorId;
@ApiModelProperty(value = "转发内容")
private List<ThemeContentQo> forwardContent;
private List<ThemeContentQo> content;
}
......@@ -3,16 +3,19 @@ package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel(value = "主题内容")
public class ThemeContentQo implements Serializable {
private static final long serialVersionUID = 100042751824238477L;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThemeContentQo {
@ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片 10:多图(讨论)")
private String type;
......
......@@ -3,12 +3,18 @@ package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("主题信息流对象")
public class ThemeQo implements Serializable {
......@@ -24,7 +30,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发 4:评论")
private Integer themeType;
@ApiModelProperty(value = "内容")
......@@ -75,6 +81,9 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "转发的主题")
private FormerThemeQo formerTheme;
@ApiModelProperty(value = "评论Id(我的评论列表使用)")
private String commentId;
private Long createTime;
private Long updateTime;
......
......@@ -18,5 +18,8 @@ public class TopicTitileQo {
private String topicTitle;
@ApiModelProperty("讨论数")
private Integer discussionCount;
private String discussionCount;
@ApiModelProperty("浏览量")
private String viewCount;
}
......@@ -5,13 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@ApiModel
@Data
public class CreateCommentReq {
@NotEmpty(message = "主题id不能为空")
@NotBlank(message = "主题id不能为空")
@ApiModelProperty(value = "主题Id")
private String themeId;
......
......@@ -4,10 +4,13 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "点赞/取消点赞评论")
import javax.validation.constraints.NotBlank;
@Data
@ApiModel(value = "点赞/取消点赞评论")
public class LikeCommentReq {
@NotBlank
@ApiModelProperty(value = "评论Id")
private String commentId;
......
......@@ -4,11 +4,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AddIdolReq {
public class FollowRelReq {
@ApiModelProperty(value = "关注对象Id")
private String followUserId;
@ApiModelProperty(value = "粉丝Id")
private String followerId;
@ApiModelProperty(value = "关注类型,1:关注 2:取消关注")
private Integer type;
}
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
......@@ -11,12 +12,14 @@ import javax.validation.constraints.NotNull;
public class QueryRecordThemeReq {
@ApiModelProperty("用户Id")
@NotBlank
private String userId;
@ApiModelProperty(value = "操作类型 1:发布 2:点赞 3:收藏")
@NotNull
@ApiModelProperty(value = "操作类型 1:发布 2:回复 3:点赞 4:收藏")
private Integer recordType;
@ApiModelProperty(value = "当前浏览的最后一个themeId,可以为空")
@ApiModelProperty(value = "当前浏览的最后一个themeId/commentId,可以为空")
private String lastId;
@NotNull(message = "PageSize不能为空")
......
......@@ -26,11 +26,11 @@ public class CreateThemeReq {
private List<ThemeContentReq> content;
@ApiModelProperty(value = "所属的话题id")
private String topicId;
private String topicId="";
@ApiModelProperty(value = "修改,则传入正在编辑的ThemeId")
private String editThemeId;
private String editThemeId="";
}
......@@ -4,25 +4,25 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "转发主题")
public class ForwardThemeReq {
@NotEmpty(message = "转发对象id不能为空")
@NotBlank(message = "转发对象id不能为空")
@ApiModelProperty(value = "转发的主题Id")
private String formerThemeId;
@NotNull(message = "内容不能为空")
@NotEmpty(message = "内容不能为空")
@ApiModelProperty(value = "转发的讨论内容")
private List<ThemeContentReq> content;
@ApiModelProperty(value = "话题Id")
private String topicId;
private String topicId="";
@ApiModelProperty(value = "修改,则传入正在编辑的ThemeId")
private String editThemeId;
private String editThemeId="";
}
......@@ -4,14 +4,22 @@ package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class ThemeListByTopicReq {
@ApiModelProperty(value = "当前浏览的最后一个themeId")
private String lastId;
private String lastId="";
@NotNull
@ApiModelProperty(value = "页面大小")
private Integer PageSize;
@NotNull
@ApiModelProperty(value = "类型,1:最热 2:最新")
private Integer type;
@NotNull
@ApiModelProperty(value = "话题Id")
private String topicId;
......
......@@ -18,7 +18,7 @@ public class ThemeListReq {
private String topicId;
@ApiModelProperty(value = "当前浏览的最后一个themeId,可以为空")
private String lastId;
private String lastId="";
@NotNull(message = "PageSize不能为空")
@ApiModelProperty(value = "页面大小")
......
......@@ -8,7 +8,7 @@ import lombok.Data;
@Data
public class TopicSearchReq {
@ApiModelProperty(value = "搜索关键字,可以为空")
private String searchKeyword;
private String searchKeyword="";
@ApiModelProperty(value = "分页")
private Pageable page;
......
package com.tanpu.community.api.beans.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "创建主题")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateThemeResp {
@ApiModelProperty(value = "主题id")
private String themeId;
}
package com.tanpu.community.api.enums;
/**
* 通用操作类型枚举,包括点赞/取消点赞,收藏/取消收藏,关注/取消关注
*/
public enum OperationTypeEnum {
CONFIRM(1,"确认操作"),
CANCEL(2,"取消操作");
private Integer code;
private String 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;
}
OperationTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
}
......@@ -14,6 +14,7 @@ import com.tanpu.community.util.PageUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -34,7 +35,7 @@ public class CommentController {
@AuthLogin
@PostMapping(value = "/publishComment")
@ResponseBody
public CommonResp<Void> publishCommet(@RequestBody CreateCommentReq req) {
public CommonResp<Void> publishCommet(@Validated @RequestBody CreateCommentReq req) {
String userId = userHolder.getUserId();
commentManager.comment(req, userId);
return CommonResp.success();
......@@ -44,7 +45,7 @@ public class CommentController {
@AuthLogin
@PostMapping(value = "/queryComment")
@ResponseBody
public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req) {
public CommonResp<Page<CommentQo>> queryComment(@Validated @RequestBody QueryCommentReq req) {
String userId = userHolder.getUserId();
List<CommentQo> result = commentManager.queryComments(req.getThemeId(), userId);
return CommonResp.success(PageUtils.page(req.getPage(), result));
......@@ -54,7 +55,7 @@ public class CommentController {
@PostMapping(value = "/likeComment")
@AuthLogin
@ResponseBody
public CommonResp<Void> likeComment(@RequestBody LikeCommentReq req) {
public CommonResp<Void> likeComment(@Validated @RequestBody LikeCommentReq req) {
String userId = userHolder.getUserId();
commentManager.likeComment(req, userId);
return CommonResp.success();
......
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.AuthLogin;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.AddIdolReq;
import com.tanpu.community.api.beans.req.homepage.FollowRelReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.page.Page;
......@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
......@@ -29,6 +32,9 @@ public class HomePageController {
@Autowired
private ThemeManager themeManager;
@Resource
private UserHolder userHolder;
@PostMapping(value = "/editInfo")
@ApiOperation("编辑圈子个人资料")
@ResponseBody
......@@ -41,27 +47,37 @@ public class HomePageController {
@PostMapping(value = "/followList")
@ApiOperation("查询关注/粉丝列表")
@ResponseBody
@AuthLogin
public CommonResp<Page<FollowQo>> queryMyFans(@RequestBody QueryFollowReq req) {
String userId = "123";
return CommonResp.success(homePageManager.queryFollow(req));
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId));
}
@PostMapping(value = "/addIdol")
@ApiOperation("关注他人")
@ApiOperation("关注/取消关注他人")
@ResponseBody
public CommonResp addIdol(@RequestBody AddIdolReq req) {
String userId = "123";
homePageManager.addIdol(req.getFollowUserId(), req.getFollowUserId());
public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId();
homePageManager.addFollowRel(req,userId);
return CommonResp.success();
}
@PostMapping(value = "/themeList")
@ApiOperation("用户的帖子列表")
@ResponseBody
public CommonResp<List<ThemeQo>> likeList(@RequestBody QueryRecordThemeReq req){
String userId="123";
@AuthLogin
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req){
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
}
// @PostMapping(value = "/commentThemeList")
// @ApiOperation("用户评论过的帖子列表")
// @ResponseBody
// public CommonResp<List<ThemeQo>> commentThemeList(@RequestBody QueryRecordThemeReq req){
// String userId="123";
//
// return CommonResp.success(themeManager.queryThemesByUser(req,userId));
// }
}
......@@ -25,6 +25,6 @@ public class TestController {
@GetMapping(value = "/1")
@ResponseBody
public Object sendKafka() {
return userInfoService.selectById("USER_INFO15912897523789");
return userInfoService.queryUserById("USER_INFO15912897523789");
}
}
......@@ -7,6 +7,7 @@ import com.tanpu.common.auth.UserHolder;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.manager.ThemeManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -32,13 +33,12 @@ public class ThemeController {
@ApiOperation("发表主题")
@PostMapping(value = "/publish")
@ResponseBody
public CommonResp<Void> publishTheme(@Validated @RequestBody CreateThemeReq req) {
public CommonResp<CreateThemeResp> publishTheme(@Validated @RequestBody CreateThemeReq req) {
String userId = userHolder.getUserId();
if(StringUtils.isEmpty(userId)){
throw new BizException("用户为空");
}
themeManager.publishTheme(req, userId);
return CommonResp.success();
return CommonResp.success(themeManager.publishTheme(req, userId));
}
@AuthLogin
......
......@@ -5,6 +5,7 @@ import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.LikeCommentReq;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.service.CollectionService;
......@@ -50,7 +51,7 @@ public class CommentManager {
}
//查询
public List<CommentQo> queryComments(String themeId,String userId) {
public List<CommentQo> queryComments(String themeId, String userId) {
List<CommentEntity> commentEntities = commentService.selectByThemeIdAndParentId(themeId, null);
List<CommentQo> commentQos = ConvertUtil.commentEntity2Qos(commentEntities);
......@@ -60,19 +61,19 @@ public class CommentManager {
for (CommentQo commentQo : commentQos) {
//用户信息
String authorId = commentQo.getAuthorId();
UserInfoEntity userInfo = userInfoService.selectById(authorId);
if (userInfo!=null){
UserInfoEntity userInfo = userInfoService.queryUserById(authorId);
if (userInfo != null) {
commentQo.setUserImg(userInfo.getUiHeadimg());
commentQo.setNickName(userInfo.getUiNickname());
}
//是否点赞及点赞数
String commentId = commentQo.getCommentId();
if (likeCommentList.contains(commentId)){
if (likeCommentList.contains(commentId)) {
commentQo.setHasLiked(true);
}else {
} else {
commentQo.setHasLiked(false);
}
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId,CollectionTypeEnum.LIKE_COMMENT);
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId);
//二级评论,本期不上线
......@@ -86,10 +87,9 @@ public class CommentManager {
//点赞评论/取消点赞
public void likeComment(LikeCommentReq req, String userId) {
//todo 枚举值
if (1==req.getType()){
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
collectionService.addIfNotExist(req.getCommentId(), userId, CollectionTypeEnum.LIKE_COMMENT);
}else if (2==req.getType()) {
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
collectionService.delete(req.getCommentId(), userId, CollectionTypeEnum.LIKE_COMMENT);
}
......
package com.tanpu.community.manager;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.FollowRelReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.api.enums.QueryFollowTypeEnum;
import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.service.FollowRelService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -25,42 +25,26 @@ public class HomePageManager {
@Autowired
private FollowRelService followRelService;
@Resource
private HomePageService homePageService;
// public void editUserInfo(HomePageReq req,String userId) {
// HomePageEntity entity = HomePageEntity.builder()
// .userId(userId)
// .nickName(req.getNickName())
// .headImg(req.getHeadImg())
// .introduction(req.getIntroduction())
// .sex(req.getSex())
// .location(req.getLocation())
// .build();
// if(homePageService.selectByUserId(userId) == null){
// homePageService.insert(entity);
// }else {
// homePageService.update(entity);
// }
// return;
// }
@Autowired
private UserInfoService userInfoService;
//获取用户关注、粉丝列表
public Page<FollowQo> queryFollow(QueryFollowReq req) {
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType())?
followRelService.queryFansByIdolId(req.getUserId()):followRelService.queryFansByFollowerId(req.getUserId());
List<HomePageEntity> list = homePageService.selectListByUserIds(userIds);
List<FollowQo> collect = list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
List<FollowQo> followQos = judgeFollowed(collect, req.getUserId());
return PageUtils.page(req.getPage(),followQos);
public Page<FollowQo> queryFollow(QueryFollowReq req, String userId) {
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId());
List<UserInfoEntity> userInfos = userInfoService.queryUserByIds(userIds);
List<FollowQo> collect = userInfos.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
List<FollowQo> followQos = judgeFollowed(collect, userId);
return PageUtils.page(req.getPage(), followQos);
}
//判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos,String followerId){
public List<FollowQo> judgeFollowed(List<FollowQo> followQos, String followerId) {
Set<String> idolSet = new HashSet<>(followRelService.queryFansByFollowerId(followerId));
return followQos.stream().map(o->{
if (idolSet.contains(o.getUserId())){
return followQos.stream().map(o -> {
if (idolSet.contains(o.getUserId())) {
o.setFollowed(true);
}
return o;
......@@ -68,7 +52,11 @@ public class HomePageManager {
}
public void addIdol(String idolId, String followerId) {
followRelService.addFans(idolId, followerId);
public void addFollowRel(FollowRelReq req, String followerId) {
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
followRelService.addFollowRel(req.getFollowUserId(), followerId);
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
followRelService.deleteFollowRel(req.getFollowUserId(), followerId);
}
}
}
......@@ -3,22 +3,28 @@ package com.tanpu.community.manager;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.FormerThemeQo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.api.enums.*;
import com.tanpu.community.api.enums.BlockTypeEnum;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.ThemeListTypeEnum;
import com.tanpu.community.api.enums.ThemeTypeEnum;
import com.tanpu.community.cache.CacheGet;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
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 org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
......@@ -57,7 +63,8 @@ public class ThemeManager {
private OSSFileService ossFileService;
public void publishTheme(CreateThemeReq req, String userId) {
@Transactional
public CreateThemeResp publishTheme(CreateThemeReq req, String userId) {
//TODO 敏感词过滤
......@@ -66,17 +73,18 @@ public class ThemeManager {
BeanUtils.copyProperties(req, themeEntity);
themeEntity.setAuthorId(userId);
themeEntity.setContent(JsonUtil.toJson(req.getContent()));
if (StringUtils.isEmpty(req.getEditThemeId())){
if (StringUtils.isEmpty(req.getEditThemeId())) {
//新建
themeService.insertTheme(themeEntity);
}else {
} else {
//修改
themeService.update(themeEntity,req.getEditThemeId());
themeService.update(themeEntity, req.getEditThemeId());
}
//保存附件表
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getThemeId());
themeAttachmentService.insertList(themeAttachments);
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
}
// 返回推荐主题文章
......@@ -110,28 +118,60 @@ public class ThemeManager {
List<ThemeEntity> themeEntities = Collections.emptyList();
switch (req.getRecordType()) {
case 1://发布
themeEntities = themeService.queryThemeIdsByUserId(req.getUserId());
themeEntities = themeService.queryThemesByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
break;
case 2://点赞
case 2://回复
List<ThemeQo> commentThemeList = new ArrayList<>();
//评论列表
List<CommentEntity> commentEntities = commentService.queryThemesByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
//当前用户信息
UserInfoEntity userInfoEntity = userInfoService.queryUserById(req.getUserId());
Set<String> replyThemeIds = commentEntities.stream().map(CommentEntity::getThemeId).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(replyThemeIds)) {
return commentThemeList;
}
themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds));
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
productService.transferAttachments(themeQos);
//主题列表
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()
.type(RelTypeEnum.TEXT.type)
.value(commentEntity.getContent())
.build();
//原主题包装到FormerThemeQo中
ThemeQo themeQo = themeMap.get(themeId);
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(themeQo);
//ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中
ThemeQo commentThemeQo = ThemeQo.builder()
.nickName(userInfoEntity.getUiNickname())
.userImg(userInfoEntity.getUiHeadimg())
.content(Arrays.asList(commentContent))
.formerTheme(f)
.commentId(commentEntity.getCommentId())
.build();
commentThemeList.add(commentThemeQo);
}
return commentThemeList;
case 3://点赞
Set<String> likeThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.LIKE_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(likeThemeIds));
themeEntities = themeService.queryByThemeIds(new ArrayList<>(likeThemeIds), req.getLastId(), req.getPageSize());
break;
case 3://收藏
case 4://收藏
Set<String> collectThemeIds = collectionService.getListByUser(userId, CollectionTypeEnum.COLLECT_THEME);
themeEntities = themeService.queryByThemeIds(new ArrayList<>(collectThemeIds));
themeEntities = themeService.queryByThemeIds(new ArrayList<>(collectThemeIds), req.getLastId(), req.getPageSize());
break;
}
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
return themeQos;
}
public List<ThemeQo> queryThemesByUserComment(QueryRecordThemeReq req, String userId) {
List<CommentEntity> commentEntities = commentService.queryThemesByUserId(req.getUserId());
Set<String> replyThemeIds = commentEntities.stream().map(CommentEntity::getThemeId).collect(Collectors.toSet());
List<ThemeEntity> themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds));
return null;
}
//查询正文
@CacheGet(prefix = "getThemeDetail", expireSeconds = 600)
......@@ -147,10 +187,9 @@ public class ThemeManager {
// 点赞/取消点赞
public void like(LikeThemeReq req, String userId) {
//todo 枚举值
if (1 == req.getType()) {
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
collectionService.addIfNotExist(req.getThemeId(), userId, CollectionTypeEnum.LIKE_THEME);
} else if (2 == req.getType()) {
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
collectionService.delete(req.getThemeId(), userId, CollectionTypeEnum.LIKE_THEME);
}
......@@ -158,10 +197,9 @@ public class ThemeManager {
//收藏/取消收藏
public void collect(CollectThemeReq req, String userId) {
//todo 枚举值
if (1 == req.getType()) {
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
collectionService.addIfNotExist(req.getThemeId(), userId, CollectionTypeEnum.COLLECT_THEME);
} else if (2 == req.getType()) {
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
collectionService.delete(req.getThemeId(), userId, CollectionTypeEnum.COLLECT_THEME);
}
}
......@@ -177,21 +215,16 @@ public class ThemeManager {
.themeType(ThemeTypeEnum.FORWARD.getCode())
.build();
if (StringUtils.isEmpty(req.getEditThemeId())){
if (StringUtils.isEmpty(req.getEditThemeId()) || req.getEditThemeId() == req.getFormerThemeId()) {
//新建
themeService.insertTheme(newTheme);
}else {
} else {
//修改
themeService.update(newTheme,req.getEditThemeId());
themeService.update(newTheme, req.getEditThemeId());
}
}
//投诉(主题)
public void complaint(String themeId, String user) {
//TODO
}
// 屏蔽(用户)
public void blockUser(String blockUser, String userId) {
BlackListEntity selectOne = blackListService.selectOne(blockUser, userId, BlockTypeEnum.USER.getCode());
......@@ -230,6 +263,7 @@ public class ThemeManager {
for (ThemeQo themeQO : themeQos) {
buildThemeQoExtraInfo(userId, themeQO);
}
return themeQos;
}
......@@ -263,15 +297,13 @@ public class ThemeManager {
//组装正文详情
private void buildMainTestExtraInfo(ThemeQo themeQo, String userId) {
//附件列表
String themeId = themeQo.getThemeId();
productService.transferAttachement(themeQo);
//转发原文
buildFormerTheme(themeQo);
return;
}
//组装被转发主题
private void buildFormerTheme(ThemeQo themeQo) {
String formerThemeId = themeQo.getFormerThemeId();
if (StringUtils.isNotEmpty(formerThemeId)) {
......@@ -280,18 +312,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
}
}
......@@ -68,7 +68,11 @@ public class TopicManager {
//讨论数=发布主题贴数+回复总数
List<String> themeIds = themeService.queryThemeIdsByTopic(topicQo.getTopicId());
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topicQo.setDiscussionCount(themeIds.size() + commentCount);
topicQo.setDiscussionCount(String.valueOf(themeIds.size() + commentCount));
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topicQo.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topicQo.setViewCount(String.valueOf(topicPV + themePV));
}
//TODO 判断顶置
return PageUtils.page(req.getPage(), topicTitileQos);
......
package com.tanpu.community.service.other;
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.exception.BizException;
......
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.DeleteTagEnum;
......@@ -8,6 +9,7 @@ import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -74,4 +76,22 @@ public class CommentService {
.eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode())
.eq(CommentEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()));
}
public List<CommentEntity> queryThemesByUserId(String userId, String lastId,Integer pageSize) {
LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getAuthorId, userId)
.eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode())
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
if (StringUtils.isNotEmpty(lastId)) {
CommentEntity commentEntity = commentMapper.selectOne(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getCommentId,lastId));
if (commentEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime());
}
if (pageSize!=null){
queryWrapper.last("limit "+pageSize);
}
return commentMapper.selectList(queryWrapper);
}
}
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.community.FollowRelEntity;
import com.tanpu.community.dao.mapper.community.FollowRelMapper;
import org.springframework.cache.annotation.EnableCaching;
......@@ -8,6 +10,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
......@@ -20,24 +23,61 @@ public class FollowRelService {
public List<String> queryFansByFollowerId(String followerId) {
return followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowerId, followerId))
.stream().map(FollowRelEntity::getFollowUserId).collect(Collectors.toList());
.eq(FollowRelEntity::getFollowerId, followerId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()))
.stream().map(FollowRelEntity::getFollowUserId)
.collect(Collectors.toList());
}
// @Cacheable(value = "tempCache", keyGenerator = "communityKeyGenerator")
public List<String> queryFansByIdolId(String idolId) {
LambdaQueryWrapper<FollowRelEntity> queryWrapper = new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowUserId, idolId);
.eq(FollowRelEntity::getFollowUserId, idolId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return followRelMapper.selectList(queryWrapper)
.stream().map(FollowRelEntity::getFollowerId).collect(Collectors.toList());
}
@Transactional
public void addFans(String idolId, String followerId) {
FollowRelEntity rel = new FollowRelEntity();
rel.setFollowUserId(idolId);
rel.setFollowerId(followerId);
public void addFollowRel(String idolId, String followerId) {
FollowRelEntity searchResult = queryRecord(idolId, followerId);
if (searchResult==null){
FollowRelEntity entity = FollowRelEntity.builder()
.followUserId(idolId)
.followerId(followerId)
.followTime(LocalDateTime.now())
.build();
followRelMapper.insert(rel);
followRelMapper.insert(entity);
}else {
searchResult.setFollowTime(LocalDateTime.now());
searchResult.setDeleteTag(DeleteTagEnum.NOT_DELETED.getCode());
followRelMapper.updateById(searchResult);
}
}
/**
* 逻辑删除关注关系
* @param idolId
* @param followerId
*/
@Transactional
public void deleteFollowRel(String idolId, String followerId) {
FollowRelEntity searchResult = queryRecord(idolId, followerId);
if (searchResult==null){
throw new BizException("未找到关注关系");
}
searchResult.setUnfollowTime(LocalDateTime.now());
searchResult.setDeleteTag(DeleteTagEnum.DELETED.getCode());
followRelMapper.updateById(searchResult);
}
public FollowRelEntity queryRecord(String idolId, String followerId){
return followRelMapper.selectOne(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowUserId,idolId)
.eq(FollowRelEntity::getFollowerId,followerId));
}
}
......@@ -116,7 +116,8 @@ public class OSSFileService {
}
public FileRecordEntity queryById(String fileId) {
return fileRecordMapper.selectById(fileId);
return fileRecordMapper.selectOne(new LambdaQueryWrapper<FileRecordEntity>()
.eq(FileRecordEntity::getFileId,fileId));
}
public List<FileRecordEntity> queryByIds(List<String> fileIds) {
......
package com.tanpu.community.service;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.enums.fund.ProductTypeEnum;
import com.tanpu.common.util.JsonUtil;
......@@ -31,10 +31,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -98,9 +95,9 @@ public class ProductService {
// 图片信息
Map<String, UserInfoEntity> userMap = Maps.newHashMap();
// 批量查询资源信息
this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap,userMap, themeQos);
this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap, userMap, themeQos);
//逐个装入
setResInfo(themeQos, shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap,userMap, topicMap);
setResInfo(themeQos, shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, userMap, topicMap);
}
......@@ -121,32 +118,32 @@ public class ProductService {
Map<String, FileRecordEntity> imgMap,
Map<String, String> topicMap,
Map<String, UserInfoEntity> userMap,
List<ThemeQo> themeQos
List<ThemeQo> themeQos
) {
// 白名单基金id
List<String> tanpuFundIds = Lists.newArrayList();
HashSet<String> tanpuFundIds = Sets.newHashSet();
// 私募基金id
List<String> fundIds = Lists.newArrayList();
HashSet<String> fundIds = Sets.newHashSet();
// 理财师导入
List<String> ifaFundIds = Lists.newArrayList();
HashSet<String> ifaFundIds = Sets.newHashSet();
// 公募基金id
List<String> publicFundIds = Lists.newArrayList();
HashSet<String> publicFundIds = Sets.newHashSet();
// 无净值产品id
List<String> notNetFundIds = Lists.newArrayList();
HashSet<String> notNetFundIds = Sets.newHashSet();
// 短视频id
List<String> shortVideoIds = Lists.newArrayList();
HashSet<String> shortVideoIds = Sets.newHashSet();
// 直播id
List<String> zhiboIds = Lists.newArrayList();
HashSet<String> zhiboIds = Sets.newHashSet();
// 课程id
List<String> curriculumIds = Lists.newArrayList();
HashSet<String> curriculumIds = Sets.newHashSet();
// 新课程id
List<String> courseIds = Lists.newArrayList();
HashSet<String> courseIds = Sets.newHashSet();
// 图片id
List<String> imageIds = Lists.newArrayList();
HashSet<String> imageIds = Sets.newHashSet();
// 话题id
List<String> topicIds = Lists.newArrayList();
HashSet<String> topicIds = Sets.newHashSet();
// 用户id
List<String> userIds = Lists.newArrayList();
HashSet<String> userIds = Sets.newHashSet();
// 获取关联资源id
if (themeQos != null) {
themeQos.forEach(o -> {
......@@ -157,75 +154,83 @@ public class ProductService {
});
themeQos.forEach(o -> o.getContent().forEach(c -> {
if (c.getType().equals(RelTypeEnum.LIVE.type)) {
zhiboIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SHORT_VIDEO.type)) {
shortVideoIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.FUND.type)) {
if (c.getProductType() == ProductTypeEnum.PUBLIC.type) {
publicFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.PRIVATE.type) {
fundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.TAMP.type) {
tanpuFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.CUSTOMER_IMPORT.type) {
ifaFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.NOT_NET_PRODUCT.type) {
notNetFundIds.add(c.getValue());
if (c.getType().equals(RelTypeEnum.LIVE.type)) {
zhiboIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SHORT_VIDEO.type)) {
shortVideoIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.FUND.type)) {
if (c.getProductType() == ProductTypeEnum.PUBLIC.type) {
publicFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.PRIVATE.type) {
fundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.TAMP.type) {
tanpuFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.CUSTOMER_IMPORT.type) {
ifaFundIds.add(c.getValue());
} else if (c.getProductType() == ProductTypeEnum.NOT_NET_PRODUCT.type) {
notNetFundIds.add(c.getValue());
}
} else if (c.getType().equals(RelTypeEnum.VIDEO.type) || c.getType().equals(RelTypeEnum.AUDIO.type)) {
curriculumIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
imageIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_AUDIO.type) ||
c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_VIDEO.type)) {
courseIds.add(c.getValue());
}
} else if (c.getType().equals(RelTypeEnum.VIDEO.type) || c.getType().equals(RelTypeEnum.AUDIO.type)) {
curriculumIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
imageIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_AUDIO.type) ||
c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_VIDEO.type)) {
courseIds.add(c.getValue());
}
})
})
);
}
if (!CollectionUtils.isEmpty(shortVideoIds)) {
// 短视频列表
CommonResp<List<ShortVideoBaseInfoResp>> commonResp = feignClientForTanpuroom.getShortVideoBaseInfo(shortVideoIds);
CommonResp<List<ShortVideoBaseInfoResp>> commonResp =
feignClientForTanpuroom.getShortVideoBaseInfo(setToList(shortVideoIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
shortVideoMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(ShortVideoBaseInfoResp::getSourceId, item -> item)));
shortVideoMap.putAll(commonResp.getData().stream()
.collect(Collectors.toMap(ShortVideoBaseInfoResp::getSourceId, item -> item)));
}
}
if (!CollectionUtils.isEmpty(curriculumIds)) {
// 课程列表
List<ShortVideoBaseInfoResp> commonResp = feignClientForFatools.getCurriculumByColumnRelId(curriculumIds);
List<ShortVideoBaseInfoResp> commonResp =
feignClientForFatools.getCurriculumByColumnRelId(setToList(curriculumIds));
if (commonResp != null && !CollectionUtils.isEmpty(commonResp)) {
curriculumMap.putAll(commonResp.stream().collect(Collectors.toMap(ShortVideoBaseInfoResp::getColumnRelId, item -> item)));
curriculumMap.putAll(commonResp.stream()
.collect(Collectors.toMap(ShortVideoBaseInfoResp::getColumnRelId, item -> item)));
}
}
if (!CollectionUtils.isEmpty(courseIds)) {
// 新版课程列表
CommonResp<List<CourseSimpleResp>> commonResp = feignForCourse.getCourseSimpleList(courseIds);
CommonResp<List<CourseSimpleResp>> commonResp =
feignForCourse.getCourseSimpleList(setToList(courseIds));
if (commonResp.isSuccess() & !CollectionUtils.isEmpty(commonResp.getData())) {
courseMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(CourseSimpleResp::getCourseId, item -> item)));
}
}
if (!CollectionUtils.isEmpty(zhiboIds)) {
// 直播列表
CommonResp<List<ZhiboListResp>> commonResp = feignClientForZhibo.simpleList(zhiboIds);
CommonResp<List<ZhiboListResp>> commonResp =
feignClientForZhibo.simpleList(setToList(zhiboIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
zhiboMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(ZhiboListResp::getId, item -> item)));
}
}
if (!CollectionUtils.isEmpty(imageIds)) {
// 查询图片
List<FileRecordEntity> fileRecordEntities = ossFileService.queryByIds(imageIds);
List<FileRecordEntity> fileRecordEntities =
ossFileService.queryByIds(setToList(imageIds));
if (!CollectionUtils.isEmpty(fileRecordEntities)) {
imgMap.putAll(fileRecordEntities.stream().collect(Collectors
.toMap(FileRecordEntity::getFileId, o->o)));
.toMap(FileRecordEntity::getFileId, o -> o)));
}
}
if (!CollectionUtils.isEmpty(topicIds)) {
// 查询话题标题
List<TopicEntity> topicEntities = topicService.queryByIds(topicIds);
List<TopicEntity> topicEntities =
topicService.queryByIds(setToList(topicIds));
if (!CollectionUtils.isEmpty(topicEntities)) {
topicMap.putAll(topicEntities.stream().collect(Collectors
.toMap(TopicEntity::getTopicId, TopicEntity::getTopicTitle)));
......@@ -233,10 +238,11 @@ public class ProductService {
}
if (!CollectionUtils.isEmpty(userIds)) {
// 查询用户信息
List<UserInfoEntity> userInfos = userInfoService.selectByIds(userIds);
List<UserInfoEntity> userInfos =
userInfoService.queryUserByIds(setToList(userIds));
if (!CollectionUtils.isEmpty(userIds)) {
userMap.putAll(userInfos.stream().collect(Collectors
.toMap(UserInfoEntity::getId, o->o)));
.toMap(UserInfoEntity::getId, o -> o)));
}
}
this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap);
......@@ -250,11 +256,11 @@ public class ProductService {
* @param publicFundIds
* @param fundMap
*/
private void getFundInfo(List<String> tanpuFundIds,
List<String> fundIds,
List<String> publicFundIds,
List<String> ifaFundIds,
List<String> notNetFundIds,
private void getFundInfo(Set<String> tanpuFundIds,
Set<String> fundIds,
Set<String> publicFundIds,
Set<String> ifaFundIds,
Set<String> notNetFundIds,
Map<String, FundInfoBaseResp> fundMap) {
Map<String, FundInfoBaseResp> tampFundMap = null;
Map<String, FundInfoBaseResp> privateFundMap = null;
......@@ -266,7 +272,8 @@ public class ProductService {
// .fundIds(Lists.newArrayList(tanpuFundIds))
// .build();
// 探普产品
CommonResp<List<ProductInfoVO>> commonResp = feignForProduct.getProductInfoByIds(tanpuFundIds);
CommonResp<List<ProductInfoVO>> commonResp =
feignForProduct.getProductInfoByIds(setToList(tanpuFundIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = commonResp.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
......@@ -283,7 +290,8 @@ public class ProductService {
// 私募产品
if (!CollectionUtils.isEmpty(fundIds)) {
// 私募产品
CommonResp<List<ProductInfoVO>> fundResult = feignForFund.getProductList(fundIds);
CommonResp<List<ProductInfoVO>> fundResult =
feignForFund.getProductList(setToList(fundIds));
if (fundResult.isSuccess() && !CollectionUtils.isEmpty(fundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = fundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
......@@ -300,7 +308,8 @@ public class ProductService {
// 理财师导入产品
if (!CollectionUtils.isEmpty(ifaFundIds)) {
CommonResp<List<ProductInfoVO>> ifaFundResult = feignForFund.getPrivateFundList(ifaFundIds);
CommonResp<List<ProductInfoVO>> ifaFundResult =
feignForFund.getPrivateFundList(setToList(ifaFundIds));
if (ifaFundResult.isSuccess() && !CollectionUtils.isEmpty(ifaFundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = ifaFundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
......@@ -317,7 +326,8 @@ public class ProductService {
if (!CollectionUtils.isEmpty(publicFundIds)) {
// 公募产品
CommonResp<List<ProductInfoVO>> publicFundResult = feignForPublicFund.getProductList(publicFundIds);
CommonResp<List<ProductInfoVO>> publicFundResult =
feignForPublicFund.getProductList(setToList(publicFundIds));
if (publicFundResult.isSuccess() && !CollectionUtils.isEmpty(publicFundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = publicFundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
......@@ -333,7 +343,8 @@ public class ProductService {
if (!CollectionUtils.isEmpty(notNetFundIds)) {
// 无净值产品
CommonResp<List<ProductInfoVO>> notNetInfoResult = feignForFund.getProductListNotNetInfo(notNetFundIds);
CommonResp<List<ProductInfoVO>> notNetInfoResult =
feignForFund.getProductListNotNetInfo(setToList(notNetFundIds));
if (notNetInfoResult.isSuccess() && !CollectionUtils.isEmpty(notNetInfoResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = notNetInfoResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
......@@ -359,7 +370,7 @@ public class ProductService {
Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgUrlMap,
Map<String, UserInfoEntity> userMap,
Map<String, String> topicMap) {
Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
......@@ -408,7 +419,7 @@ public class ProductService {
if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)){
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
ImagesDTO imagesDTO = ImagesDTO.builder().imgHeight((Integer) extMap.get("height"))
.imgWidth((Integer) extMap.get("width"))
......@@ -419,11 +430,16 @@ public class ProductService {
}
}
}
}
}
}
private List<String> setToList(Set<String> set) {
List<String> l = new ArrayList<>();
l.addAll(set);
return l;
}
}
......@@ -44,30 +44,69 @@ public class ThemeService {
.eq(ThemeEntity::getThemeId,themeId));
}
public List<ThemeEntity> queryThemeIdsByUserId(String userId) {
public List<ThemeEntity> queryThemesByUserId(String userId) {
return themeMapper.selectList(new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getAuthorId,userId)
.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()));
.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode())
.orderByDesc(ThemeEntity::getId));
}
public List<ThemeEntity> queryThemesByUserId(String userId, String lastId, Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getAuthorId, userId)
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.orderByDesc(ThemeEntity::getId);
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
if (pageSize!=null){
queryWrapper.last("limit "+pageSize);
}
return themeMapper.selectList(queryWrapper);
}
//根据ids返回主题详情
public List<ThemeEntity> queryByThemeIds(List<String> themeIds, String lastId,Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getThemeId, themeIds)
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
if (pageSize!=null){
queryWrapper.last("limit "+pageSize);
}
return themeMapper.selectList(queryWrapper);
}
//根据ids返回主题详情
public List<ThemeEntity> queryByThemeIds(List<String> themeIds) {
return themeMapper.selectList(new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getThemeId,themeIds)
.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()));
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getThemeId, themeIds)
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
//分页倒叙lastId之前的主题
public List<ThemeEntity> selectAll(String lastId,Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.orderByDesc(ThemeEntity::getUpdateTime);
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>();
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getUpdateTime());
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
queryWrapper.last("limit "+pageSize);
queryWrapper.orderByDesc(ThemeEntity::getId);
queryWrapper.orderByDesc(ThemeEntity::getCreateTime);
queryWrapper.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
......@@ -79,18 +118,19 @@ public class ThemeService {
* @param pageSize 查询数量
* @return
*/
public List<ThemeEntity> queryByTopic(String topidId, String lastId,Integer pageSize) {
public List<ThemeEntity> queryByTopic(String topidId, String lastId, Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getTopicId, topidId);
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getUpdateTime());
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
if (pageSize!=null){
queryWrapper.last("limit "+pageSize);
}
queryWrapper.orderByDesc(ThemeEntity::getId);
queryWrapper.orderByDesc(ThemeEntity::getCreateTime);
queryWrapper.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
......@@ -109,15 +149,15 @@ public class ThemeService {
//关注的主题列表
public List<ThemeEntity> queryByUserIds(List<String> userIds, String lastId, Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getAuthorId, userIds)
.orderByDesc(ThemeEntity::getUpdateTime);
.in(ThemeEntity::getAuthorId, userIds);
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity==null) throw new BizException("主题未找到,id:"+lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getUpdateTime());
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
queryWrapper.last("limit "+pageSize);
queryWrapper.orderByDesc(ThemeEntity::getCreateTime);
queryWrapper.eq(ThemeEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
......@@ -145,7 +185,8 @@ public class ThemeService {
@Transactional
public void deleteById(String themeId) {
ThemeEntity themeEntity = themeMapper.selectById(themeId);
ThemeEntity themeEntity = themeMapper.selectOne(new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getThemeId, themeId));
if (themeEntity==null){
throw new BizException("主题未找到,id:"+themeId);
}
......
......@@ -7,12 +7,14 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.mapper.community.TopicMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
......@@ -83,11 +85,14 @@ public class TopicService {
}
public List<TopicEntity> queryByIds(List<String> topicIds) {
if (CollectionUtils.isEmpty(topicIds)){
return Collections.emptyList();
}
return topicMapper.selectList(new LambdaQueryWrapper<TopicEntity>().in(TopicEntity::getTopicId,topicIds));
}
public void modifyViewCount(String topicId, long Count) {
TopicEntity topicEntity = topicMapper.selectById(topicId);
TopicEntity topicEntity = queryById(topicId);
Long oldCount = topicEntity.getviewCntAdjust();
topicEntity.setViewAmountModify(topicEntity.getviewCntAdjust() + Count);
topicMapper.update(topicEntity, new LambdaUpdateWrapper<TopicEntity>()
......
......@@ -14,11 +14,11 @@ public class UserInfoService {
private UserInfoMapper userInfoMapper;
public UserInfoEntity selectById(String userId) {
public UserInfoEntity queryUserById(String userId) {
return userInfoMapper.selectById(userId);
}
public List<UserInfoEntity> selectByIds(List<String> ids) {
public List<UserInfoEntity> queryUserByIds(List<String> ids) {
return userInfoMapper.selectBatchIds(ids);
}
}
package com.tanpu.community.service.other;
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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);
}
}
......@@ -10,6 +10,7 @@ import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
......@@ -19,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();
......@@ -40,12 +42,13 @@ 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));
// }else{
themeQO.setContent(themeContentQos);
themeQO.setContent(themeContentQos);
// }
return themeQO;
......@@ -60,6 +63,7 @@ public class ConvertUtil {
/**
* 首页主题列表,限制附件个数为1(1文本+1附件)
*
* @param themeEntities
* @return
*/
......@@ -80,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());
}
......@@ -89,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);
......@@ -96,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());
}
......@@ -106,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());
}
......@@ -119,8 +124,6 @@ public class ConvertUtil {
}
public static DeleteTagEnum deleteTagShift(DeleteTagEnum deleteTagEnum) {
if (deleteTagEnum.getCode().equals(DeleteTagEnum.NOT_DELETED.getCode())) {
return DeleteTagEnum.DELETED;
......@@ -139,6 +142,7 @@ public class ConvertUtil {
/**
* 解析 List<ThemeContentReq>为Attachment列表
*
* @param req
* @param themeId
* @return
......@@ -148,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()
......@@ -159,7 +163,7 @@ public class ConvertUtil {
.themeId(themeId)
.build());
}
}else {
} else {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
......@@ -171,14 +175,33 @@ public class ConvertUtil {
return list;
}
public static FollowQo homePageEntity2FollowQo(HomePageEntity entity) {
public static FollowQo homePageEntity2FollowQo(UserInfoEntity entity) {
if (entity == null) {
return null;
}
FollowQo followQo = new FollowQo();
BeanUtils.copyProperties(entity, followQo);
return followQo;
return FollowQo.builder().userId(entity.getId())
.nickName(entity.getUiNickname())
.headImg(entity.getUiHeadimg())
.introduction(entity.getUiIntroduction())
.build();
}
public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) {
if (formerTheme == null) {
return null;
}
return FormerThemeQo.builder().themeId(formerTheme.getThemeId())
.content(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