Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
154269ef
Commit
154269ef
authored
Jul 12, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口修改
parent
faced86f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
154 additions
and
61 deletions
+154
-61
FormerThemeQo.java
.../java/com/tanpu/community/api/beans/qo/FormerThemeQo.java
+7
-1
ThemeQo.java
...c/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
+10
-4
CollectThemeReq.java
.../tanpu/community/api/beans/req/theme/CollectThemeReq.java
+16
-0
ForwardThemeReq.java
.../tanpu/community/api/beans/req/theme/ForwardThemeReq.java
+10
-2
LikeThemeReq.java
...com/tanpu/community/api/beans/req/theme/LikeThemeReq.java
+1
-1
ReportThemeReq.java
...m/tanpu/community/api/beans/req/theme/ReportThemeReq.java
+18
-0
CollectionTypeEnum.java
...ava/com/tanpu/community/api/enums/CollectionTypeEnum.java
+1
-1
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+16
-21
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+62
-28
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-1
CollectionService.java
...n/java/com/tanpu/community/service/CollectionService.java
+2
-2
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+7
-0
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+3
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/
ThemeFormer
Qo.java
→
community-api/src/main/java/com/tanpu/community/api/beans/qo/
FormerTheme
Qo.java
View file @
154269ef
...
@@ -2,13 +2,19 @@ package com.tanpu.community.api.beans.qo;
...
@@ -2,13 +2,19 @@ package com.tanpu.community.api.beans.qo;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"转发的主题"
)
@ApiModel
(
value
=
"转发的主题"
)
public
class
ThemeFormer
Qo
{
public
class
FormerTheme
Qo
{
@ApiModelProperty
(
value
=
"被转发的昵称"
)
@ApiModelProperty
(
value
=
"被转发的昵称"
)
private
String
nickName
;
private
String
nickName
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
View file @
154269ef
...
@@ -18,6 +18,9 @@ public class ThemeQo {
...
@@ -18,6 +18,9 @@ public class ThemeQo {
@ApiModelProperty
(
value
=
"主题ID"
)
@ApiModelProperty
(
value
=
"主题ID"
)
private
String
themeId
;
private
String
themeId
;
@ApiModelProperty
(
value
=
"被转发的主题"
)
private
String
formerThemeId
;
@ApiModelProperty
(
value
=
"标题"
)
@ApiModelProperty
(
value
=
"标题"
)
private
String
title
;
private
String
title
;
...
@@ -39,7 +42,7 @@ public class ThemeQo {
...
@@ -39,7 +42,7 @@ public class ThemeQo {
@ApiModelProperty
(
value
=
"用户头像"
)
@ApiModelProperty
(
value
=
"用户头像"
)
private
String
userImg
;
private
String
userImg
;
@ApiModelProperty
(
value
=
"
是否关注
"
)
@ApiModelProperty
(
value
=
"
当前用户是否关注该作者
"
)
private
boolean
follow
;
private
boolean
follow
;
@ApiModelProperty
(
value
=
"作者认证"
)
@ApiModelProperty
(
value
=
"作者认证"
)
...
@@ -57,14 +60,17 @@ public class ThemeQo {
...
@@ -57,14 +60,17 @@ public class ThemeQo {
@ApiModelProperty
(
value
=
"点赞量"
)
@ApiModelProperty
(
value
=
"点赞量"
)
private
Integer
likeCount
;
private
Integer
likeCount
;
@ApiModelProperty
(
value
=
"当前用户是否点赞"
)
@ApiModelProperty
(
value
=
"当前用户是否点赞该主题"
)
private
boolean
isLiked
;
private
boolean
hasLiked
;
@ApiModelProperty
(
value
=
"当前用户是否转发该主题"
)
private
boolean
hasForward
;
@ApiModelProperty
(
value
=
"图片九宫格"
)
@ApiModelProperty
(
value
=
"图片九宫格"
)
private
List
<
ImagesDTO
>
imgList
;
private
List
<
ImagesDTO
>
imgList
;
@ApiModelProperty
(
value
=
"转发的主题"
)
@ApiModelProperty
(
value
=
"转发的主题"
)
private
ThemeFormer
Qo
formerTheme
;
private
FormerTheme
Qo
formerTheme
;
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/CollectThemeReq.java
0 → 100644
View file @
154269ef
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"收藏/取消收藏主题"
)
@Data
public
class
CollectThemeReq
{
@ApiModelProperty
(
value
=
"主题Id"
)
private
String
themeId
;
@ApiModelProperty
(
value
=
"类型,1:收藏 2:取消收藏"
)
private
Integer
type
;
}
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ForwardThemeReq.java
View file @
154269ef
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
@Data
@Data
@ApiModel
(
value
=
"转发主题"
)
public
class
ForwardThemeReq
{
public
class
ForwardThemeReq
{
@NotEmpty
(
message
=
"转发对象id不能为空"
)
@NotEmpty
(
message
=
"转发对象id不能为空"
)
@ApiModelProperty
(
value
=
"转发的主题Id"
)
private
String
formerThemeId
;
private
String
formerThemeId
;
@NotEmpty
(
message
=
"内容不能为空"
)
@NotNull
(
message
=
"内容不能为空"
)
private
String
content
;
@ApiModelProperty
(
value
=
"转发的讨论内容"
)
private
List
<
ThemeContentReq
>
content
;
@ApiModelProperty
(
value
=
"话题Id"
)
private
String
topicId
;
private
String
topicId
;
}
}
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/LikeThemeReq.java
View file @
154269ef
...
@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
...
@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
@ApiModel
(
value
=
"
请求
"
)
@ApiModel
(
value
=
"
点赞/取消点赞主题
"
)
@Data
@Data
public
class
LikeThemeReq
{
public
class
LikeThemeReq
{
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ReportThemeReq.java
0 → 100644
View file @
154269ef
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"举报主题"
)
@Data
public
class
ReportThemeReq
{
@ApiModelProperty
(
value
=
"主题Id"
)
private
String
themeId
;
@ApiModelProperty
(
value
=
"举报理由"
)
private
String
reason
;
}
community-api/src/main/java/com/tanpu/community/api/enums/CollectionTypeEnum.java
View file @
154269ef
...
@@ -3,7 +3,7 @@ package com.tanpu.community.api.enums;
...
@@ -3,7 +3,7 @@ package com.tanpu.community.api.enums;
public
enum
CollectionTypeEnum
{
public
enum
CollectionTypeEnum
{
LIKE_THEME
(
1
,
"点赞主题"
),
LIKE_THEME
(
1
,
"点赞主题"
),
BOOK
_THEME
(
2
,
"收藏主题"
),
COLLECT
_THEME
(
2
,
"收藏主题"
),
LIKE_COMMENT
(
3
,
"点赞评论"
);
LIKE_COMMENT
(
3
,
"点赞评论"
);
private
Integer
code
;
private
Integer
code
;
...
...
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
154269ef
...
@@ -3,10 +3,7 @@ package com.tanpu.community.controller;
...
@@ -3,10 +3,7 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.api.beans.req.theme.ForwardThemeReq
;
import
com.tanpu.community.api.beans.req.theme.LikeThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeListReq
;
import
com.tanpu.community.manager.ThemeManager
;
import
com.tanpu.community.manager.ThemeManager
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -35,24 +32,22 @@ public class ThemeController {
...
@@ -35,24 +32,22 @@ public class ThemeController {
}
}
@ApiOperation
(
"圈子首页-推荐/关注/热门/最新"
)
@ApiOperation
(
"圈子首页-推荐/关注/热门/最新"
)
@PostMapping
(
value
=
"/list"
)
@PostMapping
(
value
=
"/list"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
List
<
ThemeQo
>>
selectInterestList
(
@Validated
@RequestBody
ThemeListReq
req
)
{
public
CommonResp
<
List
<
ThemeQo
>>
selectInterestList
(
@Validated
@RequestBody
ThemeListReq
req
)
{
String
userId
=
"liujm"
;
String
userId
=
"liujm"
;
List
<
ThemeQo
>
result
=
themeManager
.
queryThemes
(
req
,
userId
);
List
<
ThemeQo
>
result
=
themeManager
.
queryThemes
(
req
,
userId
);
return
CommonResp
.
success
(
result
);
return
CommonResp
.
success
(
result
);
}
}
@ApiOperation
(
"主题正文"
)
@ApiOperation
(
"主题正文"
)
@GetMapping
(
value
=
"/detail"
)
@GetMapping
(
value
=
"/detail"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
themeId
)
{
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
themeId
)
{
String
userId
=
"liujm"
;
String
userId
=
"liujm"
;
ThemeQo
themeQo
=
themeManager
.
getDetail
(
themeId
,
userId
);
ThemeQo
themeQo
=
themeManager
.
getDetail
(
themeId
,
userId
);
return
CommonResp
.
success
(
themeQo
);
return
CommonResp
.
success
(
themeQo
);
}
}
...
@@ -65,40 +60,40 @@ public class ThemeController {
...
@@ -65,40 +60,40 @@ public class ThemeController {
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
@ApiOperation
(
"点赞/取消点赞主题"
)
@ApiOperation
(
"点赞主题"
)
@PostMapping
(
value
=
"/like"
)
@PostMapping
(
value
=
"/like"
)
@ResponseBody
@ResponseBody
public
CommonResp
likeOnTheme
(
@RequestBody
LikeThemeReq
req
)
{
public
CommonResp
<
Void
>
likeOnTheme
(
@RequestBody
LikeThemeReq
req
)
{
String
user
=
"liujm"
;
String
user
=
"liujm"
;
themeManager
.
like
(
req
,
user
);
themeManager
.
like
(
req
,
user
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
@ApiOperation
(
"分享主题"
)
@GetMapping
(
value
=
"/share"
)
@ResponseBody
public
CommonResp
shareTheme
(
String
themeId
)
{
return
CommonResp
.
success
();
}
@ApiOperation
(
"收藏主题"
)
@ApiOperation
(
"收藏
/取消收藏
主题"
)
@GetMapping
(
value
=
"/collect"
)
@GetMapping
(
value
=
"/collect"
)
@ResponseBody
@ResponseBody
public
CommonResp
bookTheme
(
String
themeId
)
{
public
CommonResp
<
Void
>
bookTheme
(
@RequestBody
CollectThemeReq
req
)
{
String
user
=
"liujm"
;
String
user
=
"liujm"
;
// themeManager.book(themeId,
user);
themeManager
.
collect
(
req
,
user
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
@ApiOperation
(
"举报主题"
)
@ApiOperation
(
"举报主题"
)
@GetMapping
(
value
=
"/report"
)
@GetMapping
(
value
=
"/report"
)
@ResponseBody
@ResponseBody
public
CommonResp
complaintTheme
(
@Request
Param
String
themeId
)
{
public
CommonResp
complaintTheme
(
@Request
Body
ReportThemeReq
req
)
{
return
CommonResp
.
failed
(
"功能暂未开放"
);
return
CommonResp
.
failed
(
"功能暂未开放"
);
}
}
@ApiOperation
(
"分享主题"
)
@GetMapping
(
value
=
"/share"
)
@ResponseBody
public
CommonResp
<
Void
>
shareTheme
(
String
themeId
)
{
return
CommonResp
.
success
();
}
@ApiOperation
(
"屏蔽"
)
@ApiOperation
(
"屏蔽"
)
@GetMapping
(
value
=
"/block"
)
@GetMapping
(
value
=
"/block"
)
@ResponseBody
@ResponseBody
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
154269ef
...
@@ -4,13 +4,11 @@ import com.tanpu.common.api.CommonResp;
...
@@ -4,13 +4,11 @@ import com.tanpu.common.api.CommonResp;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.qo.AttachmentDetailVo
;
import
com.tanpu.community.api.beans.qo.AttachmentDetailVo
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq
;
import
com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.api.beans.req.theme.ForwardThemeReq
;
import
com.tanpu.community.api.beans.req.theme.LikeThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeListReq
;
import
com.tanpu.community.api.beans.vo.feign.CoursePackageDetail
;
import
com.tanpu.community.api.beans.vo.feign.CoursePackageDetail
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
com.tanpu.community.api.beans.vo.feign.ProductInfoVO
;
import
com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp
;
...
@@ -161,15 +159,21 @@ public class ThemeManager {
...
@@ -161,15 +159,21 @@ public class ThemeManager {
}
}
public
void
unlike
(
String
themeId
,
String
userId
)
{
//收藏/取消收藏
public
void
collect
(
CollectThemeReq
req
,
String
userId
)
{
//todo 枚举值
if
(
1
==
req
.
getType
()){
collectionService
.
addIfNotExist
(
req
.
getThemeId
(),
userId
,
CollectionTypeEnum
.
COLLECT_THEME
);
}
else
if
(
2
==
req
.
getType
())
{
collectionService
.
delete
(
req
.
getThemeId
(),
userId
,
CollectionTypeEnum
.
COLLECT_THEME
);
}
}
}
//转发
//转发
public
void
forward
(
ForwardThemeReq
req
,
String
userId
)
{
public
void
forward
(
ForwardThemeReq
req
,
String
userId
)
{
ThemeEntity
targetTheme
=
themeService
.
queryByThemeId
(
req
.
getFormerThemeId
());
ThemeEntity
targetTheme
=
themeService
.
queryByThemeId
(
req
.
getFormerThemeId
());
ThemeEntity
newTheme
=
ThemeEntity
.
builder
()
ThemeEntity
newTheme
=
ThemeEntity
.
builder
()
.
content
(
req
.
getContent
(
))
.
content
(
JsonUtil
.
toJson
(
req
.
getContent
()
))
.
topicId
(
req
.
getTopicId
())
.
topicId
(
req
.
getTopicId
())
.
formerThemeId
(
req
.
getFormerThemeId
())
.
formerThemeId
(
req
.
getFormerThemeId
())
.
authorId
(
userId
)
.
authorId
(
userId
)
...
@@ -180,14 +184,8 @@ public class ThemeManager {
...
@@ -180,14 +184,8 @@ public class ThemeManager {
}
}
//收藏
public
void
favorite
(
String
themeId
,
String
userId
)
{
collectionService
.
addIfNotExist
(
themeId
,
userId
,
CollectionTypeEnum
.
BOOK_THEME
);
}
public
void
unFavorite
(
String
themeId
,
String
userId
)
{
collectionService
.
delete
(
themeId
,
userId
,
CollectionTypeEnum
.
BOOK_THEME
);
}
//投诉(主题)
//投诉(主题)
public
void
complaint
(
String
themeId
,
String
user
)
{
public
void
complaint
(
String
themeId
,
String
user
)
{
...
@@ -233,36 +231,57 @@ public class ThemeManager {
...
@@ -233,36 +231,57 @@ public class ThemeManager {
//组装主题列表
//组装主题列表
private
void
buildThemeQoExtraInfo
(
String
userId
,
ThemeQo
themeQ
O
)
{
private
void
buildThemeQoExtraInfo
(
String
userId
,
ThemeQo
themeQ
o
)
{
//附件列表
//附件列表
String
themeId
=
themeQ
O
.
getThemeId
();
String
themeId
=
themeQ
o
.
getThemeId
();
List
<
ThemeContentQo
>
content
=
themeQ
O
.
getContent
();
List
<
ThemeContentQo
>
content
=
themeQ
o
.
getContent
();
if
(
content
!=
null
&&
content
.
size
()
>
2
)
{
if
(
content
!=
null
&&
content
.
size
()
>
2
)
{
themeQ
O
.
setContent
(
content
.
subList
(
0
,
2
));
themeQ
o
.
setContent
(
content
.
subList
(
0
,
2
));
}
}
content
=
themeQ
O
.
getContent
();
content
=
themeQ
o
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
for
(
ThemeContentQo
themeContentQo
:
content
)
{
transferAttachment
(
themeContentQo
,
userId
);
transferAttachment
(
themeContentQo
,
userId
);
}
}
//迄今时间
//迄今时间
themeQ
O
.
setUpToNowTime
(
calUpToNowTime
(
themeQO
.
getCreateTime
()));
themeQ
o
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
//是否关注作者
//是否关注作者
String
authorId
=
themeQ
O
.
getAuthorId
();
String
authorId
=
themeQ
o
.
getAuthorId
();
Set
<
String
>
fansSet
=
new
HashSet
<>(
followRelService
.
queryFansByFollowerId
(
userId
));
Set
<
String
>
fansSet
=
new
HashSet
<>(
followRelService
.
queryFansByFollowerId
(
userId
));
themeQO
.
setFollow
(
fansSet
.
contains
(
authorId
));
themeQo
.
setFollow
(
fansSet
.
contains
(
authorId
));
//是否点赞
CollectionEntity
likeEntity
=
collectionService
.
getTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
//是否转发
Integer
forwardCountByUser
=
themeService
.
getForwardCountByUser
(
themeId
,
userId
);
themeQo
.
setHasForward
(
forwardCountByUser
>
0
);
//转发原文
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
if
(
formerThemeId
!=
null
){
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
(
themeService
.
queryByThemeId
(
formerThemeId
));
if
(
formerTheme
==
null
){
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
}
HomePageEntity
formerUser
=
homePageService
.
selectByUserId
(
formerTheme
.
getAuthorId
());
FormerThemeQo
f
=
FormerThemeQo
.
builder
().
formerThemeId
(
formerThemeId
)
.
forwardContent
(
formerTheme
.
getContent
())
.
userImg
(
formerUser
.
getHeadImg
())
.
nickName
(
formerUser
.
getNickName
())
.
build
();
themeQo
.
setFormerTheme
(
f
);
}
//用户信息:头像、昵称
//用户信息:头像、昵称
HomePageEntity
userEntity
=
homePageService
.
selectByUserId
(
userId
);
HomePageEntity
userEntity
=
homePageService
.
selectByUserId
(
userId
);
themeQ
O
.
setUserImg
(
userEntity
.
getHeadImg
());
themeQ
o
.
setUserImg
(
userEntity
.
getHeadImg
());
themeQ
O
.
setNickName
(
userEntity
.
getNickName
());
themeQ
o
.
setNickName
(
userEntity
.
getNickName
());
//热点数据:点赞,收藏,转发
//热点数据:点赞,收藏,转发
Integer
likeCount
=
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
);
Integer
likeCount
=
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
);
Integer
bookCount
=
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
BOOK
_THEME
);
Integer
bookCount
=
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
COLLECT
_THEME
);
Integer
forwardCount
=
themeService
.
getForwardCountById
(
themeId
);
Integer
forwardCount
=
themeService
.
getForwardCountById
(
themeId
);
themeQ
O
.
setCommentCount
(
bookCount
);
themeQ
o
.
setCommentCount
(
bookCount
);
themeQ
O
.
setLikeCount
(
likeCount
);
themeQ
o
.
setLikeCount
(
likeCount
);
themeQ
O
.
setForwardCount
(
forwardCount
);
themeQ
o
.
setForwardCount
(
forwardCount
);
}
}
//组装正文详情
//组装正文详情
...
@@ -279,6 +298,21 @@ public class ThemeManager {
...
@@ -279,6 +298,21 @@ public class ThemeManager {
HomePageEntity
author
=
homePageService
.
selectByUserId
(
userId
);
HomePageEntity
author
=
homePageService
.
selectByUserId
(
userId
);
themeQo
.
setUserImg
(
author
.
getHeadImg
());
themeQo
.
setUserImg
(
author
.
getHeadImg
());
themeQo
.
setNickName
(
author
.
getNickName
());
themeQo
.
setNickName
(
author
.
getNickName
());
//转发原文
String
formerThemeId
=
themeQo
.
getFormerThemeId
();
if
(
formerThemeId
!=
null
){
ThemeQo
formerTheme
=
ConvertUtil
.
themeEntityToQo
(
themeService
.
queryByThemeId
(
formerThemeId
));
if
(
formerTheme
==
null
){
throw
new
BizException
(
"转发主题Id错误,id:"
+
formerThemeId
);
}
HomePageEntity
formerUser
=
homePageService
.
selectByUserId
(
formerTheme
.
getAuthorId
());
FormerThemeQo
f
=
FormerThemeQo
.
builder
().
formerThemeId
(
formerThemeId
)
.
forwardContent
(
formerTheme
.
getContent
())
.
userImg
(
formerUser
.
getHeadImg
())
.
nickName
(
formerUser
.
getNickName
())
.
build
();
themeQo
.
setFormerTheme
(
f
);
}
return
;
return
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
154269ef
...
@@ -145,7 +145,7 @@ public class TopicManager {
...
@@ -145,7 +145,7 @@ public class TopicManager {
Long
viewCountModify
=
topic
.
getviewCntAdjust
();
Long
viewCountModify
=
topic
.
getviewCntAdjust
();
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topicId
);
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topicId
);
Integer
likeCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
LIKE_THEME
);
Integer
likeCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
LIKE_THEME
);
Integer
bookCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
BOOK
_THEME
);
Integer
bookCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
COLLECT
_THEME
);
Long
commentCountByThemeIds
=
(
long
)
commentService
.
getCommentCountByThemeIds
(
themeIds
);
Long
commentCountByThemeIds
=
(
long
)
commentService
.
getCommentCountByThemeIds
(
themeIds
);
Set
<
String
>
postUsers
=
themeService
.
getPostUserCount
(
themeIds
);
Set
<
String
>
postUsers
=
themeService
.
getPostUserCount
(
themeIds
);
Set
<
String
>
commentUsers
=
commentService
.
getCommentUserCount
(
themeIds
);
Set
<
String
>
commentUsers
=
commentService
.
getCommentUserCount
(
themeIds
);
...
...
community-service/src/main/java/com/tanpu/community/service/CollectionService.java
View file @
154269ef
...
@@ -42,11 +42,11 @@ public class CollectionService {
...
@@ -42,11 +42,11 @@ public class CollectionService {
//根据用户、主题、类型查询未删除对象
//根据用户、主题、类型查询未删除对象
public
CollectionEntity
getTargetCollection
(
String
t
heme
Id
,
String
userId
,
CollectionTypeEnum
type
)
{
public
CollectionEntity
getTargetCollection
(
String
t
arget
Id
,
String
userId
,
CollectionTypeEnum
type
)
{
return
collectionMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
return
collectionMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CollectionEntity
>()
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
.
eq
(
CollectionEntity:
:
getCollectionType
,
type
.
getCode
())
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
.
eq
(
CollectionEntity:
:
getUserId
,
userId
)
.
eq
(
CollectionEntity:
:
getTargetId
,
t
heme
Id
)
.
eq
(
CollectionEntity:
:
getTargetId
,
t
arget
Id
)
.
eq
(
CollectionEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
()));
.
eq
(
CollectionEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
()));
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
154269ef
...
@@ -108,4 +108,11 @@ public class ThemeService {
...
@@ -108,4 +108,11 @@ public class ThemeService {
.
eq
(
ThemeEntity:
:
getThemeId
,
themeId
)
.
eq
(
ThemeEntity:
:
getThemeId
,
themeId
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
}
}
public
Integer
getForwardCountByUser
(
String
themeId
,
String
userId
)
{
return
themeMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getFormerThemeId
,
themeId
)
.
eq
(
ThemeEntity:
:
getAuthorId
,
userId
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
}
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
154269ef
...
@@ -19,6 +19,9 @@ import java.util.stream.Collectors;
...
@@ -19,6 +19,9 @@ 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
){
return
null
;
}
ThemeQo
themeQO
=
new
ThemeQo
();
ThemeQo
themeQO
=
new
ThemeQo
();
BeanUtils
.
copyProperties
(
themeEntity
,
themeQO
);
BeanUtils
.
copyProperties
(
themeEntity
,
themeQO
);
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{});
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment