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
e1d54d59
Commit
e1d54d59
authored
Jul 13, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题返回添加话题名称
parent
ef955a9a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
10 deletions
+55
-10
ThemeQo.java
...c/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
+4
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+3
-0
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+6
-0
ProductService.java
...main/java/com/tanpu/community/service/ProductService.java
+38
-10
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+4
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
View file @
e1d54d59
...
...
@@ -18,6 +18,7 @@ public class ThemeQo {
@ApiModelProperty
(
value
=
"主题ID"
)
private
String
themeId
;
@ApiModelProperty
(
value
=
"被转发的主题"
)
private
String
formerThemeId
;
...
...
@@ -36,6 +37,9 @@ public class ThemeQo {
@ApiModelProperty
(
value
=
"所属的话题"
)
private
String
topicId
;
@ApiModelProperty
(
value
=
"话题名称"
)
private
String
topicTitle
;
@ApiModelProperty
(
value
=
"昵称"
)
private
String
nickName
;
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
e1d54d59
...
...
@@ -109,6 +109,7 @@ public class ThemeManager {
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
}
//组装详情
return
convertEntityToQo
(
themeEntities
,
userId
);
}
...
...
@@ -207,7 +208,9 @@ public class ThemeManager {
//主题Entity转QO
private
List
<
ThemeQo
>
convertEntityToQo
(
List
<
ThemeEntity
>
themeEntities
,
String
userId
)
{
//Entity转Qo
List
<
ThemeQo
>
themeQos
=
ConvertUtil
.
themeEntitiesToDTOs
(
themeEntities
);
//批量查询附件detail
productService
.
transferAttachment
(
themeQos
,
userId
);
for
(
ThemeQo
themeQO
:
themeQos
)
{
buildThemeQoExtraInfo
(
userId
,
themeQO
);
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
e1d54d59
...
...
@@ -14,6 +14,7 @@ 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
;
...
...
@@ -77,6 +78,11 @@ public class TopicManager {
TopicDetailQo
topicDetailQo
=
new
TopicDetailQo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicDetailQo
);
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topicId
);
if
(
CollectionUtils
.
isEmpty
(
themeIds
)){
topicDetailQo
.
setViewCount
(
1000
);
topicDetailQo
.
setDisscussCount
(
0
);
return
topicDetailQo
;
}
//TODO 浏览量
topicDetailQo
.
setViewCount
(
1000
);
...
...
community-service/src/main/java/com/tanpu/community/service/ProductService.java
View file @
e1d54d59
...
...
@@ -13,6 +13,7 @@ import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import
com.tanpu.community.api.beans.vo.feign.ZhiboListResp
;
import
com.tanpu.community.api.enums.RelTypeEnum
;
import
com.tanpu.community.dao.entity.community.FileRecordEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.feign.product.FeignClientForProducts
;
import
com.tanpu.community.feign.product.FeignForFund
;
...
...
@@ -20,9 +21,9 @@ import com.tanpu.community.feign.product.FeignForPublicFund;
import
com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom
;
import
com.tanpu.community.feign.zhibo.FeignClientForZhibo
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.util.List
;
...
...
@@ -52,9 +53,12 @@ public class ProductService {
@Resource
private
FeignClientForFatools
feignClientForFatools
;
@
Autowired
@
Resource
private
OSSFileService
ossFileService
;
@Resource
private
TopicService
topicService
;
public
void
transferAttachment
(
List
<
ThemeQo
>
themeQos
,
String
userId
)
{
// 短视频信息
...
...
@@ -67,10 +71,12 @@ public class ProductService {
Map
<
String
,
FundInfoBaseResp
>
fundMap
=
Maps
.
newHashMap
();
// 图片信息
Map
<
String
,
String
>
imgMap
=
Maps
.
newHashMap
();
// 话题标题
Map
<
String
,
String
>
topicMap
=
Maps
.
newHashMap
();
// 批量查询资源信息
this
.
getResInfo
(
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
imgMap
,
themeQos
);
this
.
getResInfo
(
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
imgMap
,
t
opicMap
,
t
hemeQos
);
//逐个装入
setResInfo
(
themeQos
,
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
img
Map
);
setResInfo
(
themeQos
,
shortVideoMap
,
curriculumMap
,
zhiboMap
,
fundMap
,
imgMap
,
topic
Map
);
}
...
...
@@ -88,6 +94,7 @@ public class ProductService {
Map
<
String
,
ZhiboListResp
>
zhiboMap
,
Map
<
String
,
FundInfoBaseResp
>
fundMap
,
Map
<
String
,
String
>
imgMap
,
Map
<
String
,
String
>
topicMap
,
List
<
ThemeQo
>
themeQos
)
{
// 白名单基金id
...
...
@@ -108,8 +115,11 @@ public class ProductService {
List
<
String
>
curriculumIds
=
Lists
.
newArrayList
();
// 图片id
List
<
String
>
imageIds
=
Lists
.
newArrayList
();
// 话题id
List
<
String
>
topicIds
=
Lists
.
newArrayList
();
// 获取关联资源id
if
(
themeQos
!=
null
)
{
themeQos
.
stream
().
forEach
(
o
->
o
.
getContent
().
stream
().
forEach
(
c
->
{
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
zhiboIds
.
add
(
c
.
getValue
());
...
...
@@ -133,10 +143,12 @@ public class ProductService {
}
else
if
(
c
.
getType
().
equals
(
RelTypeEnum
.
SINGLE_IMG
.
type
))
{
imageIds
.
add
(
c
.
getValue
());
}
}));
themeQos
.
stream
().
forEach
(
o
->
{
if
(
o
.
getTopicId
()
!=
null
)
{
topicIds
.
add
(
o
.
getTopicId
());
}
});
}
if
(!
CollectionUtils
.
isEmpty
(
shortVideoIds
))
{
// 短视频列表
...
...
@@ -160,13 +172,21 @@ public class ProductService {
}
}
if
(!
CollectionUtils
.
isEmpty
(
imageIds
))
{
//
直播列表
//
查询文件
List
<
FileRecordEntity
>
fileRecordEntities
=
ossFileService
.
queryByIds
(
imageIds
);
if
(!
CollectionUtils
.
isEmpty
(
fileRecordEntities
))
{
imgMap
.
putAll
(
fileRecordEntities
.
stream
().
collect
(
Collectors
.
toMap
(
FileRecordEntity:
:
getFileId
,
FileRecordEntity:
:
getUrl
)));
}
}
if
(!
CollectionUtils
.
isEmpty
(
topicIds
))
{
// 查询话题标题
List
<
TopicEntity
>
topicEntities
=
topicService
.
queryByIds
(
topicIds
);
if
(!
CollectionUtils
.
isEmpty
(
topicEntities
))
{
topicMap
.
putAll
(
topicEntities
.
stream
().
collect
(
Collectors
.
toMap
(
TopicEntity:
:
getTopicId
,
TopicEntity:
:
getTopicTitle
)));
}
}
this
.
getFundInfo
(
tanpuFundIds
,
fundIds
,
publicFundIds
,
ifaFundIds
,
notNetFundIds
,
fundMap
);
}
...
...
@@ -284,8 +304,12 @@ public class ProductService {
Map
<
String
,
ShortVideoBaseInfoResp
>
curriculumMap
,
Map
<
String
,
ZhiboListResp
>
zhiboMap
,
Map
<
String
,
FundInfoBaseResp
>
fundMap
,
Map
<
String
,
String
>
imgUrlMap
)
{
Map
<
String
,
String
>
imgUrlMap
,
Map
<
String
,
String
>
topicMap
)
{
for
(
ThemeQo
themeQo
:
themeQos
)
{
if
(!
StringUtils
.
isEmpty
(
themeQo
.
getTopicId
())
&&
topicMap
.
containsKey
(
themeQo
.
getTopicId
())){
themeQo
.
setTopicTitle
(
topicMap
.
get
(
themeQo
.
getTopicId
()));
}
for
(
ThemeContentQo
themeContent
:
themeQo
.
getContent
())
{
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
LIVE
.
type
))
{
if
(
zhiboMap
.
containsKey
(
themeContent
.
getValue
()))
{
...
...
@@ -313,6 +337,10 @@ public class ProductService {
themeContent
.
setDetail
(
AttachmentDetailVo
.
builder
()
.
product
(
product
).
build
());
}
}
else
if
(
themeContent
.
getType
().
equals
(
RelTypeEnum
.
SINGLE_IMG
.
type
))
{
if
(
imgUrlMap
.
containsKey
(
themeContent
.
getValue
()))
{
themeContent
.
setValue
(
imgUrlMap
.
get
(
themeContent
.
getValue
()));
}
}
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
e1d54d59
...
...
@@ -81,6 +81,10 @@ public class TopicService {
return
topicMapper
.
selectOne
(
new
LambdaQueryWrapper
<
TopicEntity
>().
eq
(
TopicEntity:
:
getTopicId
,
topicId
));
}
public
List
<
TopicEntity
>
queryByIds
(
List
<
String
>
topicIds
)
{
return
topicMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicEntity
>().
in
(
TopicEntity:
:
getTopicId
,
topicIds
));
}
public
void
modifyViewCount
(
String
topicId
,
long
Count
)
{
TopicEntity
topicEntity
=
topicMapper
.
selectById
(
topicId
);
Long
oldCount
=
topicEntity
.
getviewCntAdjust
();
...
...
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