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
58b1d7c6
Commit
58b1d7c6
authored
Jul 12, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题接口修改
parent
753eaead
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+2
-2
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+18
-19
No files found.
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
58b1d7c6
...
...
@@ -49,9 +49,9 @@ public class ThemeController {
@ApiOperation
(
"主题正文"
)
@GetMapping
(
value
=
"/detail"
)
@ResponseBody
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
t
opic
Id
)
{
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
t
heme
Id
)
{
String
userId
=
"liujm"
;
ThemeQo
themeQo
=
themeManager
.
getDetail
(
t
opic
Id
,
userId
);
ThemeQo
themeQo
=
themeManager
.
getDetail
(
t
heme
Id
,
userId
);
return
CommonResp
.
success
(
themeQo
);
}
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
58b1d7c6
...
...
@@ -106,21 +106,21 @@ public class ThemeManager {
// 返回推荐主题文章
public
List
<
ThemeQo
>
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
List
<
ThemeEntity
>
themeEntities
=
new
ArrayList
<>();
List
<
ThemeEntity
>
themeEntities
=
new
ArrayList
<>();
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
// TODO:推荐
themeEntities
=
themeService
.
selectAll
(
req
.
getLastId
(),
req
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
())){
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//根据关注列表查询
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
themeEntities
=
themeService
.
queryByFans
(
fansList
,
req
.
getLastId
(),
req
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
//TODO 根据话题查询热门
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
}
else
if
(
ThemeListTypeEnum
.
TOPIC_LATEST
.
getCode
().
equals
(
req
.
getType
()))
{
}
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
());
...
...
@@ -129,7 +129,7 @@ public class ThemeManager {
}
// 返回用户发布、回复、收藏的主题列表
public
List
<
ThemeQo
>
queryThemesByUser
(
QueryRecordThemeReq
req
,
String
userId
)
{
public
List
<
ThemeQo
>
queryThemesByUser
(
QueryRecordThemeReq
req
,
String
userId
)
{
// List<ThemeEntity> themeEntities = themeService.queryByUser(req.getUserId(), req.getPageSize(),req.getLastId());
List
<
ThemeEntity
>
themeEntities
=
themeService
.
selectAll
(
req
.
getLastId
(),
req
.
getPageSize
());
...
...
@@ -231,12 +231,12 @@ public class ThemeManager {
String
themeId
=
themeQO
.
getThemeId
();
List
<
ThemeContentQo
>
content
=
themeQO
.
getContent
();
if
(
content
!=
null
&&
content
.
size
()>
2
)
{
themeQO
.
setContent
(
content
.
subList
(
0
,
2
));
if
(
content
!=
null
&&
content
.
size
()
>
2
)
{
themeQO
.
setContent
(
content
.
subList
(
0
,
2
));
}
content
=
themeQO
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
transferAttachment
(
themeContentQo
,
userId
);
transferAttachment
(
themeContentQo
,
userId
);
}
//迄今时间
...
...
@@ -264,7 +264,7 @@ public class ThemeManager {
String
themeId
=
themeQo
.
getThemeId
();
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
transferAttachment
(
themeContentQo
,
userId
);
transferAttachment
(
themeContentQo
,
userId
);
}
//迄今时间
themeQo
.
setUpToNowTime
(
calUpToNowTime
(
themeQo
.
getCreateTime
()));
...
...
@@ -279,19 +279,19 @@ public class ThemeManager {
public
void
transferAttachment
(
ThemeContentQo
themeContentQo
,
String
userId
)
{
String
type
=
themeContentQo
.
getType
();
if
(
RelTypeEnum
.
FUND
.
type
.
equals
(
type
)){
if
(
RelTypeEnum
.
FUND
.
type
.
equals
(
type
))
{
//产品
String
productId
=
themeContentQo
.
getValue
();
CommonResp
<
ProductInfoVO
>
productDetailInfo
=
feignClientForProducts
.
getProductDetailInfo
(
productId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
productInfoVO
(
productDetailInfo
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
LIVE
.
type
.
equals
(
type
))
{
}
else
if
(
RelTypeEnum
.
LIVE
.
type
.
equals
(
type
))
{
//直播
String
zhiboId
=
themeContentQo
.
getValue
();
CommonResp
<
ZhiboDetailVO
>
zhiboDetailVOCommonResp
=
feignClientForZhibo
.
queryZhiboDetail
(
zhiboId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
zhiboDetailVO
(
zhiboDetailVOCommonResp
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
SHORT_VIDEO
.
type
.
equals
(
type
))
{
}
else
if
(
RelTypeEnum
.
SHORT_VIDEO
.
type
.
equals
(
type
))
{
//短视频
String
videoId
=
themeContentQo
.
getValue
();
String
[]
attachmentIds
=
new
String
[]{
videoId
};
...
...
@@ -299,23 +299,23 @@ public class ThemeManager {
feignClientForTanpuroom
.
getShortVideoBaseInfo
(
Arrays
.
asList
(
attachmentIds
));
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
shortVideoBaseInfoResp
(
shortVideoBaseInfo
.
getData
().
get
(
0
)).
build
());
}
else
if
(
RelTypeEnum
.
PACKAGE
.
type
.
equals
(
type
))
{
}
else
if
(
RelTypeEnum
.
PACKAGE
.
type
.
equals
(
type
))
{
//课程
String
packageId
=
themeContentQo
.
getValue
();
CommonResp
<
CoursePackageDetail
>
courseIdDetailInfo
=
feignClientForCourse
.
getCoursePackageDetailInfo
(
packageId
);
themeContentQo
.
setDetail
(
AttachmentDetailVo
.
builder
().
coursePackageDetail
(
courseIdDetailInfo
.
getData
()).
build
());
}
else
if
(
RelTypeEnum
.
SINGLE_IMG
.
type
.
equals
(
type
))
{
}
else
if
(
RelTypeEnum
.
SINGLE_IMG
.
type
.
equals
(
type
))
{
//单图,根据id传入url
String
imgId
=
themeContentQo
.
getValue
();
FileRecordEntity
fileEntity
=
ossFileService
.
queryById
(
imgId
);
if
(
fileEntity
==
null
)
{
throw
new
BizException
(
"图片未找到,id:"
+
imgId
);
if
(
fileEntity
==
null
)
{
throw
new
BizException
(
"图片未找到,id:"
+
imgId
);
}
themeContentQo
.
setValue
(
CommunityConstant
.
OSS_PREFIX_URL
+
fileEntity
.
getFileOssKey
());
themeContentQo
.
setValue
(
CommunityConstant
.
OSS_PREFIX_URL
+
fileEntity
.
getFileOssKey
());
}
}
}
//计算迄今时间
...
...
@@ -335,5 +335,4 @@ public class ThemeManager {
}
}
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