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
882a4927
Commit
882a4927
authored
Jul 22, 2021
by
吴泽佳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://47.100.44.39:10001/tp-backend/tanpu-community
into dev
parents
681c2558
18750bc6
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
531 additions
and
194 deletions
+531
-194
CommentQo.java
...main/java/com/tanpu/community/api/beans/qo/CommentQo.java
+12
-0
FollowQo.java
.../main/java/com/tanpu/community/api/beans/qo/FollowQo.java
+12
-0
ThemeAnalysDO.java
.../java/com/tanpu/community/api/beans/qo/ThemeAnalysDO.java
+6
-5
ThemeContentQo.java
...java/com/tanpu/community/api/beans/qo/ThemeContentQo.java
+1
-1
ThemeQo.java
...c/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
+21
-10
TopicRankQo.java
...in/java/com/tanpu/community/api/beans/qo/TopicRankQo.java
+1
-1
CreateThemeReq.java
...m/tanpu/community/api/beans/req/theme/CreateThemeReq.java
+1
-1
RelTypeEnum.java
.../main/java/com/tanpu/community/api/enums/RelTypeEnum.java
+1
-1
CommentController.java
...ava/com/tanpu/community/controller/CommentController.java
+1
-1
HomePageController.java
...va/com/tanpu/community/controller/HomePageController.java
+7
-7
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+1
-1
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+7
-11
CodeAutoGenerator.java
.../main/java/com/tanpu/community/dao/CodeAutoGenerator.java
+1
-1
CommentEntity.java
...m/tanpu/community/dao/entity/community/CommentEntity.java
+22
-10
ReportLogEntity.java
...tanpu/community/dao/entity/community/ReportLogEntity.java
+174
-0
ThemeEntity.java
...com/tanpu/community/dao/entity/community/ThemeEntity.java
+30
-5
CommentMapper.java
...m/tanpu/community/dao/mapper/community/CommentMapper.java
+1
-1
ReportLogMapper.java
...tanpu/community/dao/mapper/community/ReportLogMapper.java
+16
-0
ThemeMapper.java
...com/tanpu/community/dao/mapper/community/ThemeMapper.java
+1
-5
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+19
-8
HomePageManager.java
...ain/java/com/tanpu/community/manager/HomePageManager.java
+2
-6
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+37
-33
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+11
-59
BatchFeignCallService.java
...va/com/tanpu/community/service/BatchFeignCallService.java
+7
-0
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+6
-7
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+67
-12
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+23
-7
CommentEntityMapper.xml
...c/main/resources/mapper/community/CommentEntityMapper.xml
+2
-1
ReportLogEntityMapper.xml
...main/resources/mapper/community/ReportLogEntityMapper.xml
+21
-0
ThemeEntityMapper.xml
...src/main/resources/mapper/community/ThemeEntityMapper.xml
+2
-0
create.sql
docs/create.sql
+18
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/CommentQo.java
View file @
882a4927
...
...
@@ -40,4 +40,16 @@ public class CommentQo {
@ApiModelProperty
(
value
=
"2级评论"
)
private
List
<
CommentLv2Qo
>
commentLv2Qos
;
//认证标签相关
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
@ApiModelProperty
(
"认证标签用-当levelGrade=10有值 1投资萌新 2投资达人"
)
private
String
userInvestorType
;
@ApiModelProperty
(
"认证标签用-用户类型 1普通账号 2机构账号 3机构人员"
)
private
Integer
userType
;
@ApiModelProperty
(
"认证标签用-所属机构id"
)
private
String
belongUserOrgId
;
@ApiModelProperty
(
"认证标签用-所属机构名"
)
private
String
belongUserOrgName
;
}
community-api/src/main/java/com/tanpu/community/api/beans/qo/FollowQo.java
View file @
882a4927
...
...
@@ -29,4 +29,16 @@ public class FollowQo {
@ApiModelProperty
(
value
=
"是否关注"
)
private
boolean
followed
;
//认证标签相关
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
@ApiModelProperty
(
"认证标签用-当levelGrade=10有值 1投资萌新 2投资达人"
)
private
String
userInvestorType
;
@ApiModelProperty
(
"认证标签用-用户类型 1普通账号 2机构账号 3机构人员"
)
private
Integer
userType
;
@ApiModelProperty
(
"认证标签用-所属机构id"
)
private
String
belongUserOrgId
;
@ApiModelProperty
(
"认证标签用-所属机构名"
)
private
String
belongUserOrgName
;
}
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeAnalysDO.java
View file @
882a4927
...
...
@@ -46,11 +46,12 @@ public class ThemeAnalysDO {
@ApiModelProperty
(
value
=
"距今时间"
)
private
Long
minuteTillNow
;
public
Double
getRank
(){
double
p
=
(
double
)
(
viewCount
+
forwardCount
+
commentCount
+
likeCount
+
collectCount
);
double
t
=
Double
.
valueOf
(
minuteTillNow
);
double
g
=
1.8
;
double
rank
=(
p
)/
Math
.
pow
(
t
+
2
,
g
);
public
Double
getScore
()
{
double
w
=
(
double
)
(
viewCount
+
forwardCount
+
commentCount
+
likeCount
+
collectCount
);
double
i
=
10
;
//初试权重
double
t
=
Double
.
valueOf
(
minuteTillNow
)
/
60
;
double
g
=
1.2
;
//时间系数
double
rank
=
(
w
+
i
)
/
Math
.
pow
(
t
+
2
,
g
);
return
rank
;
}
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeContentQo.java
View file @
882a4927
...
...
@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor
public
class
ThemeContentQo
{
@ApiModelProperty
(
value
=
"RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 110:多图(讨论)"
)
@ApiModelProperty
(
value
=
"RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,
304:
新版课程-音频,109:单图(长文) 110:多图(讨论)"
)
private
String
type
;
@ApiModelProperty
(
value
=
"文本的值是内容,附件的值为id"
)
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
View file @
882a4927
...
...
@@ -57,16 +57,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty
(
value
=
"当前用户是否关注该作者"
)
public
boolean
follow
;
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
@ApiModelProperty
(
"认证标签用-当levelGrade=10有值 1投资萌新 2投资达人"
)
private
String
userInvestorType
;
@ApiModelProperty
(
"认证标签用-用户类型 1普通账号 2机构账号 3机构人员"
)
private
Integer
userType
;
@ApiModelProperty
(
"认证标签用-所属机构id"
)
private
String
belongUserOrgId
;
@ApiModelProperty
(
"认证标签用-所属机构名"
)
private
String
belongUserOrgName
;
@ApiModelProperty
(
value
=
"认证机构"
)
private
String
authOrg
;
...
...
@@ -105,4 +96,24 @@ public class ThemeQo implements Serializable {
public
Long
updateTime
;
//认证标签相关
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
@ApiModelProperty
(
"认证标签用-当levelGrade=10有值 1投资萌新 2投资达人"
)
private
String
userInvestorType
;
@ApiModelProperty
(
"认证标签用-用户类型 1普通账号 2机构账号 3机构人员"
)
private
Integer
userType
;
@ApiModelProperty
(
"认证标签用-所属机构id"
)
private
String
belongUserOrgId
;
@ApiModelProperty
(
"认证标签用-所属机构名"
)
private
String
belongUserOrgName
;
//工作室相关
@ApiModelProperty
(
"工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)"
)
private
Integer
workshopStatus
=
1
;
//工作室展示状态
@ApiModelProperty
(
"工作室名"
)
private
String
workshopName
;
//工作室名
@ApiModelProperty
(
"工作室简介"
)
private
String
workshopIntroduction
;
//工作室简介
}
community-api/src/main/java/com/tanpu/community/api/beans/qo/Topic
Hot
Qo.java
→
community-api/src/main/java/com/tanpu/community/api/beans/qo/Topic
Rank
Qo.java
View file @
882a4927
...
...
@@ -6,7 +6,7 @@ import lombok.Data;
@Data
@ApiModel
(
"热点话题对象"
)
public
class
Topic
Hot
Qo
{
public
class
Topic
Rank
Qo
{
@ApiModelProperty
(
value
=
"话题ID"
)
private
String
topicId
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/CreateThemeReq.java
View file @
882a4927
...
...
@@ -14,7 +14,7 @@ public class CreateThemeReq {
@NotNull
(
message
=
"类型不能为空"
)
@ApiModelProperty
(
value
=
"类型 1:讨论无标题 2:长文有标题
3:转发
"
)
@ApiModelProperty
(
value
=
"类型 1:讨论无标题 2:长文有标题"
)
private
Integer
themeType
;
...
...
community-api/src/main/java/com/tanpu/community/api/enums/RelTypeEnum.java
View file @
882a4927
...
...
@@ -76,7 +76,7 @@ public enum RelTypeEnum {
/**
* 新版课程
*/
NEW_COURSE_SECTION_VIDEO
(
304
,
"新版课程 - 小节 - 视频"
,
30
3
),
NEW_COURSE_SECTION_VIDEO
(
304
,
"新版课程 - 小节 - 视频"
,
30
4
),
/**
* 新版课程附件
...
...
community-service/src/main/java/com/tanpu/community/controller/CommentController.java
View file @
882a4927
...
...
@@ -45,7 +45,7 @@ public class CommentController {
@AuthLogin
@PostMapping
(
value
=
"/queryComment"
)
@ResponseBody
public
CommonResp
<
Page
<
CommentQo
>>
queryComment
(
@Validated
@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
));
...
...
community-service/src/main/java/com/tanpu/community/controller/HomePageController.java
View file @
882a4927
...
...
@@ -40,16 +40,16 @@ public class HomePageController {
@ApiOperation
(
value
=
"个人中心 查询"
)
@GetMapping
(
value
=
"/queryUserInfoNew"
)
@AuthLogin
public
CommonResp
<
UserInfoNew
>
queryUsersListNew
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
){
public
CommonResp
<
UserInfoNew
>
queryUsersListNew
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
)
{
String
userIdMyself
=
userHolder
.
getUserId
();
return
CommonResp
.
success
(
homePageManager
.
queryUsersListNew
(
userIdMyself
,
userId
));
return
CommonResp
.
success
(
homePageManager
.
queryUsersListNew
(
userIdMyself
,
userId
));
}
// 理财师客户列表查询 (供圈子服务调用)
@ApiOperation
(
value
=
"个人中心 理财师客户列表查询"
)
@GetMapping
(
value
=
"/queryUserCustomerList"
)
@AuthLogin
public
CommonResp
<
List
<
Customer
>>
queryUserCustomerList
(){
public
CommonResp
<
List
<
Customer
>>
queryUserCustomerList
()
{
String
userId
=
userHolder
.
getUserId
();
return
CommonResp
.
success
(
homePageManager
.
queryUserCustomerList
(
userId
));
}
...
...
@@ -61,7 +61,7 @@ public class HomePageController {
@AuthLogin
public
CommonResp
<
Page
<
FollowQo
>>
queryFollowList
(
@RequestBody
QueryFollowReq
req
)
{
String
userId
=
userHolder
.
getUserId
();
return
CommonResp
.
success
(
homePageManager
.
queryFollow
(
req
,
userId
));
return
CommonResp
.
success
(
homePageManager
.
queryFollow
(
req
,
userId
));
}
@PostMapping
(
value
=
"/addIdol"
)
...
...
@@ -69,7 +69,7 @@ public class HomePageController {
@ResponseBody
public
CommonResp
addIdol
(
@RequestBody
FollowRelReq
req
)
{
String
userId
=
userHolder
.
getUserId
();
homePageManager
.
addFollowRel
(
req
,
userId
);
homePageManager
.
addFollowRel
(
req
,
userId
);
return
CommonResp
.
success
();
}
...
...
@@ -77,9 +77,9 @@ public class HomePageController {
@ApiOperation
(
"用户的帖子列表"
)
@ResponseBody
@AuthLogin
public
CommonResp
<
List
<
ThemeQo
>>
likeList
(
@Validated
@RequestBody
QueryRecordThemeReq
req
){
public
CommonResp
<
List
<
ThemeQo
>>
likeList
(
@Validated
@RequestBody
QueryRecordThemeReq
req
)
{
String
userId
=
userHolder
.
getUserId
();
return
CommonResp
.
success
(
themeManager
.
queryThemesByUser
(
req
,
userId
));
return
CommonResp
.
success
(
themeManager
.
queryThemesByUser
(
req
,
userId
));
}
}
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
882a4927
...
...
@@ -39,7 +39,7 @@ public class ThemeController {
}
@AuthLogin
@ApiOperation
(
"
圈子首页
-推荐/关注/热门/最新"
)
@ApiOperation
(
"
主题列表
-推荐/关注/热门/最新"
)
@PostMapping
(
value
=
"/list"
)
@ResponseBody
public
CommonResp
<
List
<
ThemeQo
>>
selectInterestList
(
@Validated
@RequestBody
ThemeListReq
req
)
{
...
...
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
882a4927
...
...
@@ -2,9 +2,7 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.community.api.beans.qo.TopicDetailQo
;
import
com.tanpu.community.api.beans.qo.TopicHotQo
;
import
com.tanpu.community.api.beans.qo.TopicTitileQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.manager.TopicManager
;
...
...
@@ -30,25 +28,23 @@ public class TopicController {
@PostMapping
(
value
=
"/list"
)
@ApiOperation
(
"APP全部话题页面,可搜索"
)
@ResponseBody
public
CommonResp
<
Page
<
TopicTitileQo
>>
getTopicBriefInfoList
(
@RequestBody
TopicSearchReq
req
){
Page
<
TopicTitileQo
>
allTopic
=
topicManager
.
getAllTopicBriefInfo
(
req
);
return
CommonResp
.
success
(
allTopic
);
public
CommonResp
<
Page
<
TopicRankQo
>>
getTopicBriefInfoList
(
@RequestBody
TopicSearchReq
req
){
return
CommonResp
.
success
(
topicManager
.
getAllTopicBriefInfo
(
req
));
}
@GetMapping
(
value
=
"/detailPage"
)
@ApiOperation
(
"话题详情页顶部"
)
@ResponseBody
public
CommonResp
<
TopicDetailQo
>
gethotThemes
(
@RequestParam
String
topicId
){
TopicDetailQo
detail
=
topicManager
.
getDetail
(
topicId
);
return
CommonResp
.
success
(
detail
);
public
CommonResp
<
TopicRankQo
>
gethotThemes
(
@RequestParam
String
topicId
){
return
CommonResp
.
success
(
topicManager
.
getDetail
(
topicId
));
}
@GetMapping
(
value
=
"/titleList"
)
@ApiOperation
(
"首页顶部话题标题列"
)
@ResponseBody
public
CommonResp
<
List
<
Topic
Hot
Qo
>>
getTitleList
(){
return
CommonResp
.
success
(
topicManager
.
get
Hot
TopicTitles
());
public
CommonResp
<
List
<
Topic
Rank
Qo
>>
getTitleList
(){
return
CommonResp
.
success
(
topicManager
.
get
Top4
TopicTitles
());
}
...
...
community-service/src/main/java/com/tanpu/community/dao/CodeAutoGenerator.java
View file @
882a4927
...
...
@@ -22,7 +22,7 @@ public class CodeAutoGenerator {
String
mysqlUserName
=
"dev"
;
String
mysqlPassword
=
"qimeng123"
;
String
jdbcUrl
=
"jdbc:mysql://47.101.189.151:31931/tamp_community"
;
String
[]
tables
=
new
String
[]{
"
visit_summary
"
};
String
[]
tables
=
new
String
[]{
"
comment
"
};
// String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String
basePackage
=
"com.tanpu.community"
;
String
mapperPackage
=
"dao.mapper.community"
;
...
...
community-service/src/main/java/com/tanpu/community/dao/entity/community/CommentEntity.java
View file @
882a4927
...
...
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-
07
* @since 2021-07-
21
*/
@TableName
(
"comment"
)
@Builder
...
...
@@ -33,10 +33,10 @@ public class CommentEntity implements Serializable {
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"
uui
d"
)
@ApiModelProperty
(
value
=
"
评论主键I
d"
)
private
String
commentId
;
@ApiModelProperty
(
value
=
"类型"
)
@ApiModelProperty
(
value
=
"类型
1:评论
"
)
private
Integer
commentType
;
@ApiModelProperty
(
value
=
"文本内容"
)
...
...
@@ -54,8 +54,11 @@ public class CommentEntity implements Serializable {
@ApiModelProperty
(
value
=
"回复评论id"
)
private
String
replyId
;
@ApiModelProperty
(
value
=
"是否屏蔽"
)
private
Integer
isBlock
;
@ApiModelProperty
(
value
=
"是否通过 0:初始值 1:已通过(管理后台使用)"
)
private
Integer
isPass
;
@ApiModelProperty
(
value
=
"举报状态 0:未被举报 1:被举报 2:已处理"
)
private
Integer
reportStatus
;
private
LocalDateTime
createTime
;
...
...
@@ -128,12 +131,20 @@ public class CommentEntity implements Serializable {
this
.
replyId
=
replyId
;
}
public
Integer
getIsBlock
()
{
return
isBlock
;
public
Integer
getIsPass
()
{
return
isPass
;
}
public
void
setIsPass
(
Integer
isPass
)
{
this
.
isPass
=
isPass
;
}
public
Integer
getReportStatus
()
{
return
reportStatus
;
}
public
void
set
IsBlock
(
Integer
isBlock
)
{
this
.
isBlock
=
isBlock
;
public
void
set
ReportStatus
(
Integer
reportStatus
)
{
this
.
reportStatus
=
reportStatus
;
}
public
LocalDateTime
getCreateTime
()
{
...
...
@@ -171,7 +182,8 @@ public class CommentEntity implements Serializable {
", themeId="
+
themeId
+
", parentId="
+
parentId
+
", replyId="
+
replyId
+
", isBlock="
+
isBlock
+
", isPass="
+
isPass
+
", reportStatus="
+
reportStatus
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", deleteTag="
+
deleteTag
+
...
...
community-service/src/main/java/com/tanpu/community/dao/entity/community/ReportLogEntity.java
0 → 100644
View file @
882a4927
package
com
.
tanpu
.
community
.
dao
.
entity
.
community
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* <p>
* 举报记录
* </p>
*
* @author xudong
* @since 2021-07-21
*/
@TableName
(
"report_log"
)
@ApiModel
(
value
=
"ReportLogEntity对象"
,
description
=
"举报记录"
)
public
class
ReportLogEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"id"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"举报发起人"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"举报类型,1:主题,2:评论 3、用户"
)
private
Integer
reportType
;
@ApiModelProperty
(
value
=
"举报对象id"
)
private
String
targetId
;
@ApiModelProperty
(
value
=
"举报对象作者id"
)
private
String
targetUserId
;
@ApiModelProperty
(
value
=
"上报时间"
)
private
LocalDateTime
reportTime
;
@ApiModelProperty
(
value
=
"处理结果 0:无操作 1:屏蔽 2:删除 "
)
private
Integer
dealResult
;
@ApiModelProperty
(
value
=
"处理管理员"
)
private
Integer
dealUserId
;
@ApiModelProperty
(
value
=
"处理时间"
)
private
LocalDateTime
dealTime
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
private
Integer
deleteTag
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
Integer
getReportType
()
{
return
reportType
;
}
public
void
setReportType
(
Integer
reportType
)
{
this
.
reportType
=
reportType
;
}
public
String
getTargetId
()
{
return
targetId
;
}
public
void
setTargetId
(
String
targetId
)
{
this
.
targetId
=
targetId
;
}
public
String
getTargetUserId
()
{
return
targetUserId
;
}
public
void
setTargetUserId
(
String
targetUserId
)
{
this
.
targetUserId
=
targetUserId
;
}
public
LocalDateTime
getReportTime
()
{
return
reportTime
;
}
public
void
setReportTime
(
LocalDateTime
reportTime
)
{
this
.
reportTime
=
reportTime
;
}
public
Integer
getDealResult
()
{
return
dealResult
;
}
public
void
setDealResult
(
Integer
dealResult
)
{
this
.
dealResult
=
dealResult
;
}
public
Integer
getDealUserId
()
{
return
dealUserId
;
}
public
void
setDealUserId
(
Integer
dealUserId
)
{
this
.
dealUserId
=
dealUserId
;
}
public
LocalDateTime
getDealTime
()
{
return
dealTime
;
}
public
void
setDealTime
(
LocalDateTime
dealTime
)
{
this
.
dealTime
=
dealTime
;
}
public
LocalDateTime
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
LocalDateTime
createTime
)
{
this
.
createTime
=
createTime
;
}
public
LocalDateTime
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
LocalDateTime
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getDeleteTag
()
{
return
deleteTag
;
}
public
void
setDeleteTag
(
Integer
deleteTag
)
{
this
.
deleteTag
=
deleteTag
;
}
@Override
public
String
toString
()
{
return
"ReportLogEntity{"
+
"id="
+
id
+
", userId="
+
userId
+
", reportType="
+
reportType
+
", targetId="
+
targetId
+
", targetUserId="
+
targetUserId
+
", reportTime="
+
reportTime
+
", dealResult="
+
dealResult
+
", dealUserId="
+
dealUserId
+
", dealTime="
+
dealTime
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", deleteTag="
+
deleteTag
+
"}"
;
}
}
community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java
View file @
882a4927
...
...
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-
07
* @since 2021-07-
21
*/
@TableName
(
"theme"
)
@Builder
...
...
@@ -33,31 +33,38 @@ public class ThemeEntity implements Serializable {
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"
UUID
"
)
@ApiModelProperty
(
value
=
"
主题主键Id
"
)
private
String
themeId
;
@ApiModelProperty
(
value
=
"标题"
)
private
String
title
;
@ApiModelProperty
(
value
=
"类型"
)
@ApiModelProperty
(
value
=
"类型
1:讨论无标题 2:长文有标题 3:转发
"
)
private
Integer
themeType
;
@ApiModelProperty
(
value
=
"文本内容"
)
@ApiModelProperty
(
value
=
"文本内容
(json),type:附件类型(8:文本,88:产品 3:直播 6:短视频 300:课程,9:图片 10:多图),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)
"
)
private
String
content
;
@ApiModelProperty
(
value
=
"作者id"
)
private
String
authorId
;
@ApiModelProperty
(
value
=
"
被
转发的主题"
)
@ApiModelProperty
(
value
=
"转发的主题"
)
private
String
formerThemeId
;
@ApiModelProperty
(
value
=
"所属的话题"
)
private
String
topicId
;
@ApiModelProperty
(
value
=
"是否通过 0:初始值 1:已通过(管理后台使用)"
)
private
Integer
isPass
;
@ApiModelProperty
(
value
=
"举报状态 0:未被举报 1:被举报 2:已处理"
)
private
Integer
reportStatus
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
@ApiModelProperty
(
value
=
"1:删除"
)
private
Integer
deleteTag
;
...
...
@@ -125,6 +132,22 @@ public class ThemeEntity implements Serializable {
this
.
topicId
=
topicId
;
}
public
Integer
getIsPass
()
{
return
isPass
;
}
public
void
setIsPass
(
Integer
isPass
)
{
this
.
isPass
=
isPass
;
}
public
Integer
getReportStatus
()
{
return
reportStatus
;
}
public
void
setReportStatus
(
Integer
reportStatus
)
{
this
.
reportStatus
=
reportStatus
;
}
public
LocalDateTime
getCreateTime
()
{
return
createTime
;
}
...
...
@@ -160,6 +183,8 @@ public class ThemeEntity implements Serializable {
", authorId="
+
authorId
+
", formerThemeId="
+
formerThemeId
+
", topicId="
+
topicId
+
", isPass="
+
isPass
+
", reportStatus="
+
reportStatus
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", deleteTag="
+
deleteTag
+
...
...
community-service/src/main/java/com/tanpu/community/dao/mapper/community/CommentMapper.java
View file @
882a4927
...
...
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-
07
* @since 2021-07-
21
*/
public
interface
CommentMapper
extends
BaseMapper
<
CommentEntity
>
{
...
...
community-service/src/main/java/com/tanpu/community/dao/mapper/community/ReportLogMapper.java
0 → 100644
View file @
882a4927
package
com
.
tanpu
.
community
.
dao
.
mapper
.
community
;
import
com.tanpu.community.dao.entity.community.ReportLogEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* 举报记录 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-07-21
*/
public
interface
ReportLogMapper
extends
BaseMapper
<
ReportLogEntity
>
{
}
community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java
View file @
882a4927
...
...
@@ -2,10 +2,6 @@ package com.tanpu.community.dao.mapper.community;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
/**
* <p>
...
...
@@ -13,7 +9,7 @@ import java.util.List;
* </p>
*
* @author xudong
* @since 2021-07-
07
* @since 2021-07-
21
*/
public
interface
ThemeMapper
extends
BaseMapper
<
ThemeEntity
>
{
...
...
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
882a4927
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.qo.CommentQo
;
import
com.tanpu.community.api.beans.req.comment.CreateCommentReq
;
import
com.tanpu.community.api.beans.req.comment.LikeCommentReq
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
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.
feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.service.CollectionService
;
import
com.tanpu.community.service.CommentService
;
import
com.tanpu.community.service.HomePageService
;
import
com.tanpu.community.service.UserInfoService
;
import
com.tanpu.community.util.ConvertUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -29,7 +31,7 @@ public class CommentManager {
private
CommentService
commentService
;
@Autowired
private
HomePageService
homePageService
;
private
FeignClientForFatools
feignClientForFatools
;
@Autowired
private
CollectionService
collectionService
;
...
...
@@ -63,10 +65,19 @@ public class CommentManager {
for
(
CommentQo
commentQo
:
commentQos
)
{
//用户信息
String
authorId
=
commentQo
.
getAuthorId
();
UserInfoEntity
userInfo
=
userInfoService
.
queryUserById
(
authorId
);
CommonResp
<
UserInfoNew
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
authorId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
throw
new
BizException
(
"内部接口调用失败"
);
}
UserInfoNew
userInfo
=
userInfoNewCommonResp
.
getData
();
if
(
userInfo
!=
null
)
{
commentQo
.
setUserImg
(
userInfo
.
getUiHeadimgMp
());
commentQo
.
setNickName
(
userInfo
.
getUiUsernameMp
());
commentQo
.
setUserImg
(
userInfo
.
getHeadImageUrl
());
commentQo
.
setNickName
(
userInfo
.
getNickName
());
commentQo
.
setUserType
(
userInfo
.
getUserType
());
commentQo
.
setLevelGrade
(
userInfo
.
getLevelGrade
());
commentQo
.
setUserInvestorType
(
userInfo
.
getUserInvestorType
());
commentQo
.
setBelongUserOrgId
(
userInfo
.
getBelongUserOrgId
());
commentQo
.
setBelongUserOrgName
(
userInfo
.
getBelongUserOrgName
());
}
//是否点赞及点赞数
String
commentId
=
commentQo
.
getCommentId
();
...
...
@@ -80,8 +91,8 @@ public class CommentManager {
// commentQo.setCommentLv2Qos(commentLv2Qos);
}
//排序:点赞降序+时间降序
return
commentQos
.
stream
().
sorted
(
Comparator
.
comparing
(
CommentQo:
:
getLikeCount
,
Comparator
.
reverseOrder
()).
thenComparing
(
CommentQo:
:
getUpdateTime
,
Comparator
.
reverseOrder
()))
return
commentQos
.
stream
().
sorted
(
Comparator
.
comparing
(
CommentQo:
:
getLikeCount
,
Comparator
.
reverseOrder
()).
thenComparing
(
CommentQo:
:
getUpdateTime
,
Comparator
.
reverseOrder
()))
.
collect
(
Collectors
.
toList
());
}
...
...
community-service/src/main/java/com/tanpu/community/manager/HomePageManager.java
View file @
882a4927
...
...
@@ -18,7 +18,6 @@ import com.tanpu.community.dao.entity.fund.CompanyInfo;
import
com.tanpu.community.dao.entity.fund.FundInfo
;
import
com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank
;
import
com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline
;
import
com.tanpu.community.dao.entity.user.UserInfoEntity
;
import
com.tanpu.community.dao.mapper.community.FollowRelMapper
;
import
com.tanpu.community.dao.mapper.fund.CompanyInfoMapper
;
import
com.tanpu.community.dao.mapper.fund.FundInfoMapper
;
...
...
@@ -35,9 +34,7 @@ import com.tanpu.community.util.PageUtils;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
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.*
;
...
...
@@ -182,10 +179,9 @@ public class HomePageManager {
followRelService
.
queryFansByIdolId
(
req
.
getUserId
())
:
followRelService
.
queryFansByFollowerId
(
req
.
getUserId
());
List
<
FollowQo
>
followQos
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
List
<
UserInfo
Entity
>
userInfos
=
userInfoService
.
queryUserByIds
(
userIds
);
List
<
FollowQo
>
collect
=
userInfo
s
.
stream
().
map
(
ConvertUtil:
:
userInfoEntity
2FollowQo
).
collect
(
Collectors
.
toList
());
List
<
UserInfo
New
>
userInfoNews
=
feignClientForFatools
.
queryUserListNew
(
userIds
);
List
<
FollowQo
>
collect
=
userInfo
News
.
stream
().
map
(
ConvertUtil:
:
userInfoNew
2FollowQo
).
collect
(
Collectors
.
toList
());
followQos
=
judgeFollowed
(
collect
,
userId
);
}
//分页
return
PageUtils
.
page
(
req
.
getPage
(),
followQos
);
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
882a4927
...
...
@@ -4,10 +4,7 @@ import com.google.common.collect.Sets;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.qo.ESThemeQo
;
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.qo.*
;
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
;
...
...
@@ -96,20 +93,13 @@ public class ThemeManager {
}
@Transactional
/**
* 发表主题(可修改)
*/
public
CreateThemeResp
publishTheme
(
CreateThemeReq
req
,
String
userId
)
{
//直播类型做转播检查
List
<
ThemeContentReq
>
contents
=
req
.
getContent
();
for
(
ThemeContentReq
content
:
contents
)
{
if
(
content
!=
null
&&
content
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
CommonResp
<
Set
<
String
>>
notRelayResp
=
feignClientForFatools
.
getNotRelaySet
(
userId
,
Sets
.
newHashSet
(
content
.
getValue
()));
if
(!
notRelayResp
.
isSuccess
())
{
throw
new
BizException
(
"转播失败"
);
}
if
(
CollectionUtils
.
isEmpty
(
notRelayResp
.
getData
()))
{
throw
new
BizException
(
"9999"
,
"很抱歉!您需要购买或报名成功后才可以添加这个直播哦~"
);
}
}
}
liveRelayCheck
(
userId
,
contents
);
//保存主题表
ThemeEntity
themeEntity
=
new
ThemeEntity
();
...
...
@@ -117,7 +107,7 @@ public class ThemeManager {
themeEntity
.
setAuthorId
(
userId
);
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
//
TODO 敏感词过滤
//
腾讯云敏感词校验
checkContent
(
themeEntity
.
getContent
());
if
(
StringUtils
.
isEmpty
(
req
.
getEditThemeId
()))
{
...
...
@@ -146,6 +136,7 @@ public class ThemeManager {
}
/**
* 返回主题列表
*
...
...
@@ -156,7 +147,7 @@ public class ThemeManager {
public
List
<
ThemeQo
>
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
List
<
ThemeEntity
>
themeEntities
=
new
ArrayList
<>();
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
//
TODO:
推荐
//推荐
// themeEntities = themeService.selectExcludeUser(userId, req.getLastId(), req.getPageSize());
List
<
String
>
recommendThemeIds
=
rankService
.
getHotAndNewThemes
(
100
,
100
);
themeEntities
=
themeService
.
queryByThemeIdsExcludeUser
(
recommendThemeIds
,
userId
,
req
.
getLastId
(),
req
.
getPageSize
());
...
...
@@ -167,11 +158,12 @@ public class ThemeManager {
themeEntities
=
themeService
.
queryByUserIds
(
fansList
,
req
.
getLastId
(),
req
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
//
TODO
根据话题查询热门
//根据话题查询热门
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
List
<
ThemeAnalysDO
>
rankThemeList
=
rankService
.
getRankThemeList
(
req
.
getTopicId
());
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
TOPIC_LATEST
.
getCode
().
equals
(
req
.
getType
()))
{
//
TODO
根据话题查询最新
//根据话题查询最新
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
}
...
...
@@ -304,7 +296,6 @@ public class ThemeManager {
return
CreateThemeResp
.
builder
().
themeId
(
themeEntity
.
getThemeId
()).
build
();
}
// 屏蔽(用户)
public
void
blockUser
(
String
blockUser
,
String
userId
)
{
BlackListEntity
selectOne
=
blackListService
.
selectOne
(
blockUser
,
userId
,
BlockTypeEnum
.
USER
.
getCode
());
...
...
@@ -313,11 +304,6 @@ public class ThemeManager {
}
}
// 解除屏蔽(用户)
public
void
unblockUser
(
String
blockUser
,
String
userId
)
{
//todo
}
// 屏蔽(主题)
public
void
blockTheme
(
String
themeId
,
String
userId
)
{
blackListService
.
addBlock
(
themeId
,
userId
,
BlockTypeEnum
.
THEME
);
...
...
@@ -350,11 +336,11 @@ public class ThemeManager {
//组装主题详情
private
void
buildThemeQoExtraInfo
(
String
userId
,
ThemeQo
themeQo
)
{
String
themeId
=
themeQo
.
getThemeId
();
//封装转发对象
buildFormerTheme
(
themeQo
);
String
themeId
=
themeQo
.
getThemeId
();
//是否关注作者
String
authorId
=
themeQo
.
getAuthorId
();
...
...
@@ -371,7 +357,6 @@ public class ThemeManager {
themeQo
.
setHasCollect
(
collectionEntity
!=
null
);
//点赞,收藏,转发
Integer
likeCount
=
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
);
// Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
Integer
commentCount
=
commentService
.
getCommentCountByThemeId
(
themeId
);
Integer
forwardCount
=
themeService
.
getForwardCountById
(
themeId
);
themeQo
.
setCommentCount
(
commentCount
);
...
...
@@ -402,10 +387,6 @@ public class ThemeManager {
themeService
.
deleteById
(
themeId
);
}
//投诉(主题)
public
void
complaint
(
String
themeId
,
String
user
)
{
//TODO
}
public
Integer
getFollowUpdateCount
(
String
userId
)
{
LocalDateTime
lastViewTime
=
visitSummaryService
.
queryLatestViewFollow
(
userId
);
...
...
@@ -413,7 +394,10 @@ public class ThemeManager {
return
themeService
.
queryCountFromLastTime
(
fansList
,
lastViewTime
);
}
/**
* 腾讯云-内容检测
* @param content
*/
private
void
checkContent
(
String
content
)
{
// 腾讯云接口最多支持5000文字校验,超过5000执行2次
// 检查内容是否涉黄违法
...
...
@@ -430,4 +414,24 @@ public class ThemeManager {
return
;
}
/**
* 直播类型做转播检查
* @param userId
* @param contents
*/
private
void
liveRelayCheck
(
String
userId
,
List
<
ThemeContentReq
>
contents
)
{
for
(
ThemeContentReq
content
:
contents
)
{
if
(
content
!=
null
&&
content
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
CommonResp
<
Set
<
String
>>
notRelayResp
=
feignClientForFatools
.
getNotRelaySet
(
userId
,
Sets
.
newHashSet
(
content
.
getValue
()));
if
(!
notRelayResp
.
isSuccess
())
{
throw
new
BizException
(
"转播失败"
);
}
if
(
CollectionUtils
.
isEmpty
(
notRelayResp
.
getData
()))
{
throw
new
BizException
(
"9999"
,
"很抱歉!您需要购买或报名成功后才可以添加这个直播哦~"
);
}
}
}
}
}
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
882a4927
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.qo.TopicDetailQo
;
import
com.tanpu.community.api.beans.qo.TopicHotQo
;
import
com.tanpu.community.api.beans.qo.TopicTitileQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.beans.vo.TopicDTO
;
import
com.tanpu.community.api.beans.vo.TopicDataAnalysDTO
;
import
com.tanpu.community.api.constants.RedisKeyConstant
;
import
com.tanpu.community.api.enums.CollectionTypeEnum
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.PageUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -49,71 +43,29 @@ public class TopicManager {
//新增话题
public
void
insertTopic
(
String
topicTitle
,
String
userId
)
{
if
(
topicService
.
queryByTitile
(
topicTitle
)
==
null
)
{
t
opicService
.
addTopic
(
topicTitle
,
userId
);
t
hrow
new
BizException
(
"话题名称已存在:"
+
topicTitle
);
}
return
;
topicService
.
addTopic
(
topicTitle
,
userId
)
;
}
//
话题详情列表
public
List
<
Topic
DTO
>
getAllTopicDetail
()
{
return
ConvertUtil
.
topicEntitiesToDTOs
(
topicService
.
queryAll
()
);
//
首页-话题标签
public
List
<
Topic
RankQo
>
getTop4TopicTitles
()
{
return
rankService
.
getRankTopicListTop4
(
);
}
//话题简介列表
public
Page
<
TopicTitileQo
>
getAllTopicBriefInfo
(
TopicSearchReq
req
)
{
List
<
TopicEntity
>
allTopic
=
topicService
.
queryByKeyword
(
req
.
getSearchKeyword
());
List
<
TopicTitileQo
>
topicTitileQos
=
ConvertUtil
.
topicEntitiesToBriefDTOs
(
allTopic
);
for
(
TopicTitileQo
topicQo
:
topicTitileQos
)
{
//讨论数=发布主题贴数+回复总数
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topicQo
.
getTopicId
());
Integer
commentCount
=
commentService
.
getCommentCountByThemeIds
(
themeIds
);
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
);
//话题搜索列表
public
Page
<
TopicRankQo
>
getAllTopicBriefInfo
(
TopicSearchReq
req
)
{
return
PageUtils
.
page
(
req
.
getPage
(),
rankService
.
getRankTopicList
());
}
//话题详情页
public
TopicDetailQo
getDetail
(
String
topicId
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
)
{
throw
new
BizException
(
"找不到话题,id:"
+
topicId
);
}
TopicDetailQo
topicDetailQo
=
new
TopicDetailQo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicDetailQo
);
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topicId
);
if
(
CollectionUtils
.
isEmpty
(
themeIds
))
{
topicDetailQo
.
setViewCount
(
visitSummaryService
.
queryTopicDetailVisit
(
topicId
));
topicDetailQo
.
setDisscussCount
(
0
);
return
topicDetailQo
;
}
//浏览量
Integer
topicPV
=
visitSummaryService
.
queryTopicDetailVisit
(
topicId
);
Integer
themePV
=
visitSummaryService
.
queryThemeVisit
(
themeIds
);
topicDetailQo
.
setViewCount
(
topicPV
+
themePV
);
//讨论数=发布主题贴数+回复总数
Integer
commentCount
=
commentService
.
getCommentCountByThemeIds
(
themeIds
);
topicDetailQo
.
setDisscussCount
(
themeIds
.
size
()
+
commentCount
);
return
topicDetailQo
;
public
TopicRankQo
getDetail
(
String
topicId
)
{
return
rankService
.
getTopicDetail
(
topicId
);
}
public
List
<
TopicHotQo
>
getHotTopicTitles
()
{
List
<
TopicHotQo
>
rankTopicList
=
rankService
.
rankTopicList
;
if
(
rankTopicList
.
size
()==
0
){
rankService
.
rankTopics
();
}
return
rankService
.
rankTopicList
;
}
public
void
setTopTopic
(
String
topicId
,
boolean
setTop
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
)
{
...
...
community-service/src/main/java/com/tanpu/community/service/BatchFeignCallService.java
View file @
882a4927
...
...
@@ -34,6 +34,9 @@ import javax.annotation.Resource;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 批量调用Feign查询接口
*/
@Service
public
class
BatchFeignCallService
{
...
...
@@ -373,13 +376,17 @@ public class BatchFeignCallService {
Map
<
String
,
String
>
topicMap
)
{
for
(
ThemeQo
themeQo
:
themeQos
)
{
if
(!
StringUtils
.
isEmpty
(
themeQo
.
getTopicId
())
&&
topicMap
.
containsKey
(
themeQo
.
getTopicId
()))
{
//话题标题
themeQo
.
setTopicTitle
(
topicMap
.
get
(
themeQo
.
getTopicId
()));
}
if
(!
StringUtils
.
isEmpty
(
themeQo
.
getAuthorId
())
&&
userMap
.
containsKey
(
themeQo
.
getAuthorId
()))
{
//用户信息
UserInfoNew
userInfo
=
userMap
.
get
(
themeQo
.
getAuthorId
());
//昵称头像简介
themeQo
.
setNickName
(
userInfo
.
getNickName
());
themeQo
.
setUserImg
(
userInfo
.
getHeadImageUrl
());
themeQo
.
setUserIntroduction
(
userInfo
.
getIntroduction
());
//认证标签相关
themeQo
.
setUserType
(
userInfo
.
getUserType
());
themeQo
.
setLevelGrade
(
userInfo
.
getLevelGrade
());
themeQo
.
setUserInvestorType
(
userInfo
.
getUserInvestorType
());
...
...
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
882a4927
...
...
@@ -5,7 +5,6 @@ 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
;
import
com.tanpu.community.api.enums.StatusEnum
;
import
com.tanpu.community.dao.entity.community.CommentEntity
;
import
com.tanpu.community.dao.mapper.community.CommentMapper
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -66,13 +65,13 @@ public class CommentService {
LambdaQueryWrapper
<
CommentEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
CommentEntity
>()
.
eq
(
CommentEntity:
:
getThemeId
,
themeId
)
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
eq
(
CommentEntity:
:
getIsBlock
,
StatusEnum
.
FALSE
.
getCode
())
.
orderByDesc
(
CommentEntity:
:
getCreateTime
);
if
(
parentId
==
null
)
{
queryWrapper
.
isNull
(
CommentEntity:
:
getParentId
);
}
else
{
queryWrapper
.
eq
(
CommentEntity:
:
getParentId
,
parentId
);
}
//二级评论,暂未开放,注意“”与null的区别
// if (parentId == null) {
// queryWrapper.isNull(CommentEntity::getParentId);
// } else {
// queryWrapper.eq(CommentEntity::getParentId, parentId);
// }
return
commentMapper
.
selectList
(
queryWrapper
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
882a4927
package
com
.
tanpu
.
community
.
service
;
import
com.tanpu.community.api.beans.qo.ThemeAnalysDO
;
import
com.tanpu.community.api.beans.qo.Topic
Hot
Qo
;
import
com.tanpu.community.api.beans.qo.Topic
Rank
Qo
;
import
com.tanpu.community.api.enums.CollectionTypeEnum
;
import
com.tanpu.community.api.enums.TopicStatusEnum
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
...
...
@@ -28,11 +28,15 @@ public class RankService {
private
VisitSummaryService
visitSummaryService
;
p
ublic
List
<
String
>
rankThemeList
=
new
ArrayList
<>();
p
rivate
List
<
ThemeAnalysDO
>
rankThemeList
=
new
ArrayList
<>();
public
List
<
TopicHotQo
>
rankTopicList
=
new
ArrayList
<>();
private
List
<
TopicRankQo
>
rankTopicList
=
new
ArrayList
<>();
private
List
<
TopicRankQo
>
rankTopicListTop4
=
new
ArrayList
<>();
/**
* 计算主题热度排行
*/
public
void
rankThemes
()
{
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryAll
();
List
<
ThemeAnalysDO
>
themeAnalysDOS
=
ConvertUtil
.
themeEntityToAnalysDOs
(
themeEntities
);
...
...
@@ -49,8 +53,10 @@ public class RankService {
theme
.
setCollectCount
(
bookCount
);
theme
.
setViewCount
(
viewCount
);
}
Map
<
ThemeAnalysDO
,
Double
>
map
=
themeAnalysDOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
ThemeAnalysDO:
:
getRank
));
rankThemeList
=
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
map
(
e
->
e
.
getKey
().
getThemeId
()).
collect
(
Collectors
.
toList
());
//打分
Map
<
ThemeAnalysDO
,
Double
>
map
=
themeAnalysDOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
ThemeAnalysDO:
:
getScore
));
//排序
rankThemeList
=
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
map
(
e
->
e
.
getKey
()).
collect
(
Collectors
.
toList
());
}
...
...
@@ -61,11 +67,11 @@ public class RankService {
*/
public
void
rankTopics
()
{
List
<
TopicEntity
>
topicEntities
=
topicService
.
queryAll
();
List
<
Topic
HotQo
>
topicHot
Qos
=
ConvertUtil
.
topicEntityToHotQos
(
topicEntities
);
if
(
topic
Hot
Qos
.
size
()
==
0
)
{
List
<
Topic
RankQo
>
topicRank
Qos
=
ConvertUtil
.
topicEntityToHotQos
(
topicEntities
);
if
(
topic
Rank
Qos
.
size
()
==
0
)
{
return
;
}
for
(
Topic
HotQo
topic
:
topicHot
Qos
)
{
for
(
Topic
RankQo
topic
:
topicRank
Qos
)
{
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topic
.
getTopicId
());
if
(
CollectionUtils
.
isEmpty
(
themeIds
)){
topic
.
setViewCount
(
0
);
...
...
@@ -80,20 +86,69 @@ public class RankService {
Integer
commentCount
=
commentService
.
getCommentCountByThemeIds
(
themeIds
);
topic
.
setDisscussCount
(
themeIds
.
size
()
+
commentCount
);
}
Map
<
Topic
HotQo
,
Integer
>
map
=
topicHotQos
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
TopicHot
Qo:
:
getRank
));
List
<
Topic
HotQo
>
rankList
=
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
map
(
e
->
e
.
getKey
()).
limit
(
4
).
collect
(
Collectors
.
toList
());
Map
<
Topic
RankQo
,
Integer
>
map
=
topicRankQos
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
TopicRank
Qo:
:
getRank
));
List
<
Topic
RankQo
>
rankList
=
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
map
(
Map
.
Entry
::
getKey
).
collect
(
Collectors
.
toList
());
rankList
.
get
(
0
).
setType
(
TopicStatusEnum
.
HOTTEST
.
getCode
());
rankTopicList
=
rankList
;
this
.
rankTopicList
=
rankList
;
this
.
rankTopicListTop4
=
rankList
.
stream
().
limit
(
4
).
collect
(
Collectors
.
toList
());
return
;
}
/**
* 最新和热门主题集合
* @param hotCount
* @param newCount
* @return
*/
public
List
<
String
>
getHotAndNewThemes
(
Integer
hotCount
,
Integer
newCount
)
{
Set
<
String
>
hotThemeIds
=
this
.
rankThemeList
.
stream
().
limit
(
hotCount
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
hotThemeIds
=
this
.
rankThemeList
.
stream
().
limit
(
hotCount
).
map
(
ThemeAnalysDO:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
newThemeIds
=
themeService
.
selectExcludeUser
(
null
,
null
,
newCount
)
.
stream
().
map
(
ThemeEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
hotThemeIds
.
addAll
(
newThemeIds
);
return
new
ArrayList
<>(
hotThemeIds
);
}
/**
* 话题详情
* @param topicId 话题Id
* @return
*/
public
TopicRankQo
getTopicDetail
(
String
topicId
){
if
(
this
.
rankTopicList
.
size
()==
0
){
rankTopics
();
}
List
<
TopicRankQo
>
matchTopic
=
this
.
rankTopicList
.
stream
().
filter
(
o
->
o
.
getTopicId
().
equals
(
topicId
)).
limit
(
1
).
collect
(
Collectors
.
toList
());
matchTopic
.
add
(
new
TopicRankQo
());
return
matchTopic
.
get
(
0
);
}
public
List
<
ThemeAnalysDO
>
getRankThemeList
()
{
if
(
this
.
rankThemeList
.
size
()==
0
){
rankThemes
();
}
return
rankThemeList
;
}
public
List
<
TopicRankQo
>
getRankTopicList
()
{
if
(
this
.
rankTopicList
.
size
()==
0
){
this
.
rankTopics
();
}
return
rankTopicList
;
}
public
List
<
TopicRankQo
>
getRankTopicListTop4
()
{
if
(
this
.
rankTopicList
.
size
()==
0
){
this
.
rankTopics
();
}
return
rankTopicListTop4
;
}
public
List
<
ThemeAnalysDO
>
getRankThemeList
(
String
topicId
)
{
if
(
this
.
rankThemeList
.
size
()==
0
){
this
.
rankThemes
();
}
return
rankThemeList
.
stream
().
filter
(
o
->
o
.
getTopicId
().
equals
(
topicId
)).
collect
(
Collectors
.
toList
());
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
882a4927
...
...
@@ -8,6 +8,7 @@ import com.tanpu.community.api.beans.vo.TopicDTO;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.api.enums.RelTypeEnum
;
import
com.tanpu.community.api.enums.TopicStatusEnum
;
...
...
@@ -18,7 +19,6 @@ import org.springframework.util.StringUtils;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.time.temporal.TemporalField
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -94,17 +94,17 @@ public class ConvertUtil {
return
topicDTO
;
}
public
static
Topic
Hot
Qo
topicEntityToHotQo
(
TopicEntity
topicEntity
)
{
Topic
HotQo
topicHotQo
=
new
TopicHot
Qo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topic
Hot
Qo
);
public
static
Topic
Rank
Qo
topicEntityToHotQo
(
TopicEntity
topicEntity
)
{
Topic
RankQo
topicRankQo
=
new
TopicRank
Qo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topic
Rank
Qo
);
//2小时内发帖,添加新话题标签
if
(
TimeUtil
.
calMinuteTillNow
(
topicEntity
.
getCreateTime
())<
120
){
topic
Hot
Qo
.
setType
(
TopicStatusEnum
.
NEWEST
.
getCode
());
topic
Rank
Qo
.
setType
(
TopicStatusEnum
.
NEWEST
.
getCode
());
}
return
topic
Hot
Qo
;
return
topic
Rank
Qo
;
}
public
static
List
<
Topic
Hot
Qo
>
topicEntityToHotQos
(
List
<
TopicEntity
>
topicEntities
)
{
public
static
List
<
Topic
Rank
Qo
>
topicEntityToHotQos
(
List
<
TopicEntity
>
topicEntities
)
{
if
(
topicEntities
==
null
){
return
Collections
.
emptyList
();
}
...
...
@@ -223,6 +223,22 @@ public class ConvertUtil {
.
build
();
}
public
static
FollowQo
userInfoNew2FollowQo
(
UserInfoNew
entity
)
{
if
(
entity
==
null
)
{
return
null
;
}
return
FollowQo
.
builder
().
userId
(
entity
.
getUserId
())
.
nickName
(
entity
.
getNickName
())
.
headImg
(
entity
.
getHeadImageUrl
())
.
introduction
(
entity
.
getIntroduction
())
.
userType
(
entity
.
getUserType
())
.
levelGrade
(
entity
.
getLevelGrade
())
.
userInvestorType
(
entity
.
getUserInvestorType
())
.
belongUserOrgId
(
entity
.
getBelongUserOrgId
())
.
belongUserOrgName
(
entity
.
getBelongUserOrgName
())
.
build
();
}
public
static
FormerThemeQo
themeQo2FormerThemeQo
(
ThemeQo
formerTheme
)
{
if
(
formerTheme
==
null
)
{
return
null
;
...
...
community-service/src/main/resources/mapper/community/CommentEntityMapper.xml
View file @
882a4927
...
...
@@ -12,7 +12,8 @@
<result
column=
"theme_id"
property=
"themeId"
/>
<result
column=
"parent_id"
property=
"parentId"
/>
<result
column=
"reply_id"
property=
"replyId"
/>
<result
column=
"is_block"
property=
"isBlock"
/>
<result
column=
"is_pass"
property=
"isPass"
/>
<result
column=
"report_status"
property=
"reportStatus"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"delete_tag"
property=
"deleteTag"
/>
...
...
community-service/src/main/resources/mapper/community/ReportLogEntityMapper.xml
0 → 100644
View file @
882a4927
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tanpu.community.dao.mapper.community.ReportLogMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.tanpu.community.dao.entity.community.ReportLogEntity"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"report_type"
property=
"reportType"
/>
<result
column=
"target_id"
property=
"targetId"
/>
<result
column=
"target_user_id"
property=
"targetUserId"
/>
<result
column=
"report_time"
property=
"reportTime"
/>
<result
column=
"deal_result"
property=
"dealResult"
/>
<result
column=
"deal_user_id"
property=
"dealUserId"
/>
<result
column=
"deal_time"
property=
"dealTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"delete_tag"
property=
"deleteTag"
/>
</resultMap>
</mapper>
community-service/src/main/resources/mapper/community/ThemeEntityMapper.xml
View file @
882a4927
...
...
@@ -12,6 +12,8 @@
<result
column=
"author_id"
property=
"authorId"
/>
<result
column=
"former_theme_id"
property=
"formerThemeId"
/>
<result
column=
"topic_id"
property=
"topicId"
/>
<result
column=
"is_pass"
property=
"isPass"
/>
<result
column=
"report_status"
property=
"reportStatus"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"delete_tag"
property=
"deleteTag"
/>
...
...
docs/create.sql
View file @
882a4927
...
...
@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` (
INDEX
`idx_visitor`
(
`visitor_id`
),
INDEX
`idx_author`
(
`author_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'浏览记录'
;
CREATE
TABLE
`report_log`
(
`id`
int
(
32
)
auto_increment
PRIMARY
KEY
COMMENT
'id'
,
`user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报发起人'
,
`report_type`
int
(
4
)
NOT
NULL
COMMENT
'举报类型,1:主题,2:评论 3、用户'
,
`target_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报对象id'
,
`target_user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报对象作者id'
,
`report_time`
datetime
NOT
NULL
COMMENT
'上报时间'
,
`deal_result`
int
(
4
)
COMMENT
'处理结果 0:无操作 1:屏蔽 2:删除 '
,
`deal_user_id`
int
(
4
)
COMMENT
'处理管理员'
,
`deal_time`
datetime
COMMENT
'处理时间'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`delete_tag`
int
(
3
)
NOT
NULL
DEFAULT
'0'
,
INDEX
`uk_user`
(
`user_id`
),
INDEX
`uk_report_target_id`
(
`target_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'举报记录'
;
\ No newline at end of file
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