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
883b02be
Commit
883b02be
authored
Aug 06, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞列表fix
parent
6b5fe214
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+10
-10
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
883b02be
...
...
@@ -173,7 +173,6 @@ public class ThemeManager {
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
if
(
StringUtils
.
isBlank
(
req
.
getEditThemeId
()))
{
// 新建
themeService
.
insertTheme
(
themeEntity
);
...
...
@@ -209,11 +208,11 @@ public class ThemeManager {
*/
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
for
(
ThemeContentReq
content
:
themeAttachments
)
{
if
(
content
.
getType
()
==
null
)
{
if
(
content
.
getType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq缺少类型"
);
}
Set
<
String
>
types
=
Arrays
.
stream
(
RelTypeEnum
.
values
()).
map
(
o
->
o
.
type
).
collect
(
Collectors
.
toSet
());
if
(!
types
.
contains
(
content
.
getType
())){
Set
<
String
>
types
=
Arrays
.
stream
(
RelTypeEnum
.
values
()).
map
(
o
->
o
.
type
).
collect
(
Collectors
.
toSet
());
if
(!
types
.
contains
(
content
.
getType
()))
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq类型错误"
);
}
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
...
...
@@ -258,7 +257,6 @@ public class ThemeManager {
/**
* 查询主题列表:推荐/关注/热门/最新
*
*/
// 查询主题列表:推荐/关注/热门/最新
public
ThemeListResp
queryList
(
ThemeListReq
req
,
String
userId
)
{
...
...
@@ -358,7 +356,6 @@ public class ThemeManager {
themeQo
.
setFormerTheme
(
former
);
// 点赞,收藏,转发
Integer
likeCount
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
THEME_LIKE_COUNT
,
themeId
),
60
,
()
->
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
),
Integer
.
class
);
...
...
@@ -436,15 +433,18 @@ public class ThemeManager {
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
if
(
userId
.
equals
(
req
.
getUserId
())
&&
!
ThemeRecordTypeEnum
.
COLLECT_LIST
.
getCode
().
equals
(
req
.
getRecordType
())
&&
!
ThemeRecordTypeEnum
.
LIKE_LIST
.
getCode
().
equals
(
req
.
getRecordType
()))
{
if
(
userId
.
equals
(
req
.
getUserId
()))
{
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
CommonResp
<
UserInfoResp
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
userId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
throw
new
BizException
(
"内部接口调用失败"
);
}
UserInfoResp
user
=
userInfoNewCommonResp
.
getData
();
themeQos
.
stream
().
forEach
(
o
->
reBuildAuthorInfo
(
o
,
user
));
themeQos
.
forEach
(
o
->
{
if
(
o
.
getAuthorId
().
equals
(
userId
))
{
reBuildAuthorInfo
(
o
,
user
);
}
});
redisCache
.
put
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
user
,
60
);
}
...
...
@@ -693,7 +693,7 @@ public class ThemeManager {
themeQo
.
setWorkshopIntroduction
(
userInfo
.
getWorkshopIntroduction
());
}
private
void
evictThemeCache
(
String
themeId
){
private
void
evictThemeCache
(
String
themeId
)
{
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FORWARD_THEME_ID
,
themeId
));
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_THEME_ID
,
themeId
));
}
...
...
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