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
4d4a16b8
Commit
4d4a16b8
authored
Jul 22, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除直播转播校验
parent
c438acd8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
170 deletions
+29
-170
TopicTitileQo.java
.../java/com/tanpu/community/api/beans/qo/TopicTitileQo.java
+0
-25
TopicDTO.java
.../main/java/com/tanpu/community/api/beans/vo/TopicDTO.java
+0
-61
HomePageManager.java
...ain/java/com/tanpu/community/manager/HomePageManager.java
+1
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+7
-8
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+10
-5
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+3
-66
RankUtils.java
...ice/src/main/java/com/tanpu/community/util/RankUtils.java
+8
-5
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/TopicTitileQo.java
deleted
100644 → 0
View file @
c438acd8
package
com
.
tanpu
.
community
.
api
.
beans
.
qo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 话题列表页
*/
@Data
@ApiModel
(
"话题列表对象"
)
public
class
TopicTitileQo
{
@ApiModelProperty
(
"话题ID"
)
private
String
topicId
;
@ApiModelProperty
(
"话题名称"
)
private
String
topicTitle
;
@ApiModelProperty
(
"讨论数"
)
private
String
discussionCount
;
@ApiModelProperty
(
"浏览量"
)
private
String
viewCount
;
}
community-api/src/main/java/com/tanpu/community/api/beans/vo/TopicDTO.java
deleted
100644 → 0
View file @
c438acd8
package
com
.
tanpu
.
community
.
api
.
beans
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
@Data
@ApiModel
(
value
=
"TopicDTO对象"
,
description
=
"话题"
)
public
class
TopicDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"id"
)
private
String
id
;
@ApiModelProperty
(
value
=
"话题名称"
)
private
String
topicTitle
;
@ApiModelProperty
(
value
=
"是否置顶"
)
private
Integer
isTop
;
@ApiModelProperty
(
value
=
"是否隐藏"
)
private
Integer
isConceal
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
private
Integer
deleteTag
;
@ApiModelProperty
(
value
=
"帖子量"
)
private
Integer
themeCount
;
@ApiModelProperty
(
value
=
"浏览量"
)
private
Integer
viewCount
;
@ApiModelProperty
(
value
=
"点赞量"
)
private
Integer
likeCount
;
@ApiModelProperty
(
value
=
"总用户数"
)
private
Integer
UserCount
;
@ApiModelProperty
@Override
public
String
toString
()
{
return
"TopicEntity{"
+
"id="
+
id
+
", topicTitle="
+
topicTitle
+
", isTop="
+
isTop
+
", isConceal="
+
isConceal
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", deleteTag="
+
deleteTag
+
"}"
;
}
}
community-service/src/main/java/com/tanpu/community/manager/HomePageManager.java
View file @
4d4a16b8
...
@@ -102,6 +102,7 @@ public class HomePageManager {
...
@@ -102,6 +102,7 @@ public class HomePageManager {
}
else
{
}
else
{
userInfoNew
.
getUserInfoNewChief
().
setClientId
(
null
);
userInfoNew
.
getUserInfoNewChief
().
setClientId
(
null
);
}
}
}
}
}
else
if
(
UserTypeEnum
.
USER_ORG
.
getCode
()
==
userInfoNew
.
getUserType
())
{
}
else
if
(
UserTypeEnum
.
USER_ORG
.
getCode
()
==
userInfoNew
.
getUserType
())
{
// 机构账号
// 机构账号
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
4d4a16b8
...
@@ -16,6 +16,7 @@ import com.tanpu.community.feign.fatools.FeignClientForFatools;
...
@@ -16,6 +16,7 @@ import com.tanpu.community.feign.fatools.FeignClientForFatools;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.service.base.ESService
;
import
com.tanpu.community.service.base.ESService
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.RankUtils
;
import
com.tanpu.community.util.TencentcloudUtils
;
import
com.tanpu.community.util.TencentcloudUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -100,9 +101,6 @@ public class ThemeManager {
...
@@ -100,9 +101,6 @@ public class ThemeManager {
* 发表主题(可修改)
* 发表主题(可修改)
*/
*/
public
CreateThemeResp
publishTheme
(
CreateThemeReq
req
,
String
userId
)
{
public
CreateThemeResp
publishTheme
(
CreateThemeReq
req
,
String
userId
)
{
//直播类型做转播检查
List
<
ThemeContentReq
>
contents
=
req
.
getContent
();
liveRelayCheck
(
userId
,
contents
);
//保存主题表
//保存主题表
ThemeEntity
themeEntity
=
new
ThemeEntity
();
ThemeEntity
themeEntity
=
new
ThemeEntity
();
...
@@ -167,9 +165,9 @@ public class ThemeManager {
...
@@ -167,9 +165,9 @@ public class ThemeManager {
List
<
ThemeEntity
>
themeEntities
=
new
ArrayList
<>();
List
<
ThemeEntity
>
themeEntities
=
new
ArrayList
<>();
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
//推荐
//推荐
List
<
String
>
recommendThemeIds
=
rankService
.
getHotAndNewThemes
(
100
,
100
);
List
<
String
>
recommendThemeIds
=
rankService
.
getHotAndNewThemes
(
100
,
100
,
userId
);
themeEntities
=
themeService
.
queryByThemeIdsExcludeUser
(
recommendThemeIds
,
userId
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
themeService
.
queryByThemeIdsExcludeUser
(
recommendThemeIds
,
null
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
recommendThemeIds
);
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//根据关注列表查询
//根据关注列表查询
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
...
@@ -178,8 +176,9 @@ public class ThemeManager {
...
@@ -178,8 +176,9 @@ public class ThemeManager {
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
//根据话题查询热门
//根据话题查询热门
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
List
<
ThemeAnalysDO
>
rankThemeListByTopic
=
rankService
.
getRankThemeList
(
req
.
getTopicId
());
List
<
String
>
rankThemeIds
=
rankService
.
getRankThemeListByTopic
(
req
.
getTopicId
());
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
themeService
.
queryByThemeIdsExcludeUser
(
rankThemeIds
,
null
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
rankThemeIds
);
}
else
if
(
ThemeListTypeEnum
.
TOPIC_LATEST
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
TOPIC_LATEST
.
getCode
().
equals
(
req
.
getType
()))
{
//根据话题查询最新
//根据话题查询最新
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
4d4a16b8
...
@@ -101,8 +101,11 @@ public class RankService {
...
@@ -101,8 +101,11 @@ public class RankService {
* @param newCount
* @param newCount
* @return
* @return
*/
*/
public
List
<
String
>
getHotAndNewThemes
(
Integer
hotCount
,
Integer
newCount
)
{
public
List
<
String
>
getHotAndNewThemes
(
Integer
hotCount
,
Integer
newCount
,
String
userId
)
{
Set
<
String
>
hotThemeIds
=
this
.
rankThemeList
.
stream
().
limit
(
hotCount
).
map
(
ThemeAnalysDO:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
hotThemeIds
=
this
.
rankThemeList
.
stream
().
limit
(
hotCount
)
.
filter
(
o
->!
userId
.
equals
(
o
.
getAuthorId
()))
.
map
(
ThemeAnalysDO:
:
getThemeId
)
.
collect
(
Collectors
.
toSet
());
Set
<
String
>
newThemeIds
=
themeService
.
selectExcludeUser
(
null
,
null
,
newCount
)
Set
<
String
>
newThemeIds
=
themeService
.
selectExcludeUser
(
null
,
null
,
newCount
)
.
stream
().
map
(
ThemeEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
.
stream
().
map
(
ThemeEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
hotThemeIds
.
addAll
(
newThemeIds
);
hotThemeIds
.
addAll
(
newThemeIds
);
...
@@ -124,7 +127,7 @@ public class RankService {
...
@@ -124,7 +127,7 @@ public class RankService {
}
}
public
List
<
ThemeAnalysDO
>
getRankThemeList
()
{
public
List
<
ThemeAnalysDO
>
getRankThemeList
ByTopic
()
{
if
(
this
.
rankThemeList
.
size
()==
0
){
if
(
this
.
rankThemeList
.
size
()==
0
){
rankThemes
();
rankThemes
();
}
}
...
@@ -145,10 +148,12 @@ public class RankService {
...
@@ -145,10 +148,12 @@ public class RankService {
return
rankTopicListTop4
;
return
rankTopicListTop4
;
}
}
public
List
<
ThemeAnalysDO
>
getRankThemeList
(
String
topicId
)
{
public
List
<
String
>
getRankThemeListByTopic
(
String
topicId
)
{
if
(
this
.
rankThemeList
.
size
()==
0
){
if
(
this
.
rankThemeList
.
size
()==
0
){
this
.
rankThemes
();
this
.
rankThemes
();
}
}
return
rankThemeList
.
stream
().
filter
(
o
->
topicId
.
equals
(
o
.
getTopicId
())).
collect
(
Collectors
.
toList
());
return
rankThemeList
.
stream
().
filter
(
o
->
topicId
.
equals
(
o
.
getTopicId
()))
.
map
(
ThemeAnalysDO:
:
getThemeId
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
4d4a16b8
...
@@ -2,19 +2,17 @@ package com.tanpu.community.util;
...
@@ -2,19 +2,17 @@ package com.tanpu.community.util;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.resp.FileUploadResp
;
import
com.tanpu.community.api.beans.vo.ImagesDTO
;
import
com.tanpu.community.api.beans.vo.KafkaDurationUptMsg
;
import
com.tanpu.community.api.beans.vo.TopicDTO
;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.resp.FileUploadResp
;
import
com.tanpu.community.api.beans.vo.ImagesDTO
;
import
com.tanpu.community.api.beans.vo.KafkaDurationUptMsg
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.api.enums.RelTypeEnum
;
import
com.tanpu.community.api.enums.RelTypeEnum
;
import
com.tanpu.community.api.enums.TopicStatusEnum
;
import
com.tanpu.community.api.enums.TopicStatusEnum
;
import
com.tanpu.community.dao.entity.community.*
;
import
com.tanpu.community.dao.entity.community.*
;
import
com.tanpu.community.dao.entity.user.UserInfoEntity
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -28,9 +26,6 @@ import java.util.stream.Collectors;
...
@@ -28,9 +26,6 @@ import java.util.stream.Collectors;
public
class
ConvertUtil
{
public
class
ConvertUtil
{
/**
* THEME
*/
public
static
ThemeQo
themeEntityToQo
(
ThemeEntity
themeEntity
)
{
public
static
ThemeQo
themeEntityToQo
(
ThemeEntity
themeEntity
)
{
if
(
themeEntity
==
null
)
{
if
(
themeEntity
==
null
)
{
return
null
;
return
null
;
...
@@ -92,15 +87,6 @@ public class ConvertUtil {
...
@@ -92,15 +87,6 @@ public class ConvertUtil {
}
}
/**
* TOPIC
*/
public
static
TopicDTO
topicEntityToDTO
(
TopicEntity
topicEntity
)
{
TopicDTO
topicDTO
=
new
TopicDTO
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicDTO
);
return
topicDTO
;
}
public
static
TopicRankQo
topicEntityToHotQo
(
TopicEntity
topicEntity
)
{
public
static
TopicRankQo
topicEntityToHotQo
(
TopicEntity
topicEntity
)
{
TopicRankQo
topicRankQo
=
new
TopicRankQo
();
TopicRankQo
topicRankQo
=
new
TopicRankQo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicRankQo
);
BeanUtils
.
copyProperties
(
topicEntity
,
topicRankQo
);
...
@@ -118,11 +104,6 @@ public class ConvertUtil {
...
@@ -118,11 +104,6 @@ public class ConvertUtil {
return
topicEntities
.
stream
().
map
(
ConvertUtil:
:
topicEntityToHotQo
).
collect
(
Collectors
.
toList
());
return
topicEntities
.
stream
().
map
(
ConvertUtil:
:
topicEntityToHotQo
).
collect
(
Collectors
.
toList
());
}
}
public
static
TopicTitileQo
topicToBriefInfoDTO
(
TopicEntity
topicEntity
)
{
TopicTitileQo
topicTitileQo
=
new
TopicTitileQo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicTitileQo
);
return
topicTitileQo
;
}
public
static
CommentQo
commentEntity2Qo
(
CommentEntity
entity
)
{
public
static
CommentQo
commentEntity2Qo
(
CommentEntity
entity
)
{
CommentQo
qo
=
new
CommentQo
();
CommentQo
qo
=
new
CommentQo
();
...
@@ -135,40 +116,6 @@ public class ConvertUtil {
...
@@ -135,40 +116,6 @@ public class ConvertUtil {
return
entities
.
stream
().
map
(
ConvertUtil:
:
commentEntity2Qo
).
collect
(
Collectors
.
toList
());
return
entities
.
stream
().
map
(
ConvertUtil:
:
commentEntity2Qo
).
collect
(
Collectors
.
toList
());
}
}
public
static
CommentLv2Qo
commentLv2Entity2Qo
(
CommentEntity
entity
)
{
CommentLv2Qo
qo
=
new
CommentLv2Qo
();
BeanUtils
.
copyProperties
(
entity
,
qo
);
return
qo
;
}
public
static
List
<
CommentLv2Qo
>
commentLv2Entity2Qos
(
List
<
CommentEntity
>
entities
)
{
return
entities
.
stream
().
map
(
ConvertUtil:
:
commentLv2Entity2Qo
).
collect
(
Collectors
.
toList
());
}
public
static
List
<
TopicDTO
>
topicEntitiesToDTOs
(
List
<
TopicEntity
>
topicEntities
)
{
return
topicEntities
.
stream
().
map
(
ConvertUtil:
:
topicEntityToDTO
).
collect
(
Collectors
.
toList
());
}
public
static
List
<
TopicTitileQo
>
topicEntitiesToBriefDTOs
(
List
<
TopicEntity
>
topicEntities
)
{
return
topicEntities
.
stream
().
map
(
ConvertUtil:
:
topicToBriefInfoDTO
).
collect
(
Collectors
.
toList
());
}
public
static
DeleteTagEnum
deleteTagShift
(
DeleteTagEnum
deleteTagEnum
)
{
if
(
deleteTagEnum
.
getCode
().
equals
(
DeleteTagEnum
.
NOT_DELETED
.
getCode
()))
{
return
DeleteTagEnum
.
DELETED
;
}
else
{
return
DeleteTagEnum
.
NOT_DELETED
;
}
}
public
static
Integer
deleteTagShift
(
Integer
deleteTag
)
{
if
(
deleteTag
.
equals
(
DeleteTagEnum
.
NOT_DELETED
.
getCode
()))
{
return
DeleteTagEnum
.
DELETED
.
getCode
();
}
else
{
return
DeleteTagEnum
.
NOT_DELETED
.
getCode
();
}
}
/**
/**
* VISIT_SUMMARY
* VISIT_SUMMARY
...
@@ -235,16 +182,6 @@ public class ConvertUtil {
...
@@ -235,16 +182,6 @@ public class ConvertUtil {
return
list
;
return
list
;
}
}
public
static
FollowQo
userInfoEntity2FollowQo
(
UserInfoEntity
entity
)
{
if
(
entity
==
null
)
{
return
null
;
}
return
FollowQo
.
builder
().
userId
(
entity
.
getId
())
.
nickName
(
entity
.
getUiUsernameMp
())
.
headImg
(
entity
.
getUiHeadimgMp
())
.
introduction
(
entity
.
getUiIntroductionMp
())
.
build
();
}
public
static
FollowQo
userInfoNew2FollowQo
(
UserInfoNew
entity
)
{
public
static
FollowQo
userInfoNew2FollowQo
(
UserInfoNew
entity
)
{
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
...
...
community-service/src/main/java/com/tanpu/community/util/RankUtils.java
View file @
4d4a16b8
package
com
.
tanpu
.
community
.
util
;
package
com
.
tanpu
.
community
.
util
;
import
com.tanpu.community.
api.beans.qo.ThemeQo
;
import
com.tanpu.community.
dao.entity.community.ThemeEntity
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
RankUtils
{
public
class
RankUtils
{
public
static
List
<
Theme
Qo
>
rankByIds
(
List
<
ThemeQo
>
list
,
List
<
String
>
ids
){
public
static
List
<
Theme
Entity
>
sortThemeEntityByIds
(
List
<
ThemeEntity
>
list
,
List
<
String
>
ids
){
int
count
=
0
;
int
count
=
0
;
HashMap
<
String
,
Integer
>
indexMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
indexMap
=
new
HashMap
<>();
for
(
String
id
:
ids
)
{
for
(
String
id
:
ids
)
{
indexMap
.
put
(
id
,
count
++);
indexMap
.
put
(
id
,
count
++);
}
}
List
<
ThemeEntity
>
collect
=
list
.
stream
().
filter
(
o
->
indexMap
.
containsKey
(
o
.
getThemeId
()))
.
sorted
(
Comparator
.
comparingInt
(
o
->
indexMap
.
get
(
o
.
getThemeId
())))
return
list
;
.
collect
(
Collectors
.
toList
());
return
collect
;
}
}
}
}
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