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
cb457094
Commit
cb457094
authored
Aug 02, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
个人信息缓存 fix
parent
6bb304f9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
15 deletions
+41
-15
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+37
-9
RecommendService.java
...in/java/com/tanpu/community/service/RecommendService.java
+4
-6
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
cb457094
...
...
@@ -183,15 +183,16 @@ public class ThemeManager {
/**
* 参数校验
*
* @param themeAttachments
*/
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
for
(
ThemeContentReq
content
:
themeAttachments
)
{
if
(
content
.
getType
()
==
null
)
{
if
(
content
.
getType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq缺少类型"
);
}
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
)){
if
(
content
.
getProductType
()
==
null
)
{
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
if
(
content
.
getProductType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"附件产品FUND缺少类型"
);
}
}
...
...
@@ -258,7 +259,6 @@ public class ThemeManager {
themes
=
RankUtils
.
sortThemeEntityByIds
(
themes
,
recmdIds
).
stream
().
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
// 根据关注列表查询,按时间倒序
List
<
String
>
fansList
=
followRelService
.
queryIdolsByFollowerId
(
userId
);
...
...
@@ -314,7 +314,7 @@ public class ThemeManager {
}
// 和用户相关信息
buildThemeExtraInfoByUser
(
userId
,
themeQos
);
buildThemeExtraInfoByUser
(
userId
,
themeQos
);
return
themeQos
;
}
...
...
@@ -391,6 +391,18 @@ public class ThemeManager {
break
;
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
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
));
redisCache
.
put
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
user
,
60
);
}
return
themeQos
;
}
...
...
@@ -485,8 +497,8 @@ public class ThemeManager {
// 逻辑删除主题,校验用户
public
void
delete
(
String
themeId
,
String
userId
)
{
themeService
.
deleteById
(
themeId
,
userId
);
public
void
delete
(
String
themeId
,
String
userId
)
{
themeService
.
deleteById
(
themeId
,
userId
);
}
...
...
@@ -498,7 +510,7 @@ public class ThemeManager {
private
void
checkContent
(
CreateThemeReq
req
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
ThemeContentReq
themeContentReq
:
req
.
getContent
())
{
if
(
RelTypeEnum
.
TEXT
.
type
.
equals
(
themeContentReq
.
getType
())){
if
(
RelTypeEnum
.
TEXT
.
type
.
equals
(
themeContentReq
.
getType
()))
{
sb
.
append
(
themeContentReq
.
getValue
());
}
}
...
...
@@ -610,4 +622,20 @@ public class ThemeManager {
return
userInfoNewCommonResp
.
getData
();
}
private
void
reBuildAuthorInfo
(
ThemeQo
themeQo
,
UserInfoResp
userInfo
){
themeQo
.
setNickName
(
userInfo
.
getNickName
());
themeQo
.
setUserImg
(
userInfo
.
getHeadImageUrl
());
themeQo
.
setUserIntroduction
(
userInfo
.
getIntroduction
());
//认证标签相关
themeQo
.
setUserType
(
userInfo
.
getUserType
());
themeQo
.
setLevelGrade
(
userInfo
.
getLevelGrade
());
themeQo
.
setUserInvestorType
(
userInfo
.
getUserInvestorType
());
themeQo
.
setBelongUserOrgId
(
userInfo
.
getBelongUserOrgId
());
themeQo
.
setBelongUserOrgName
(
userInfo
.
getBelongUserOrgName
());
//工作室相关
themeQo
.
setWorkshopName
(
userInfo
.
getWorkshopName
());
themeQo
.
setWorkshopStatus
(
userInfo
.
getWorkshopStatus
());
themeQo
.
setWorkshopIntroduction
(
userInfo
.
getWorkshopIntroduction
());
}
}
community-service/src/main/java/com/tanpu/community/service/RecommendService.java
View file @
cb457094
...
...
@@ -39,8 +39,6 @@ public class RecommendService {
@Autowired
private
ThemeService
themeService
;
@Autowired
private
VisitLogService
visitLogService
;
// 最新
private
List
<
ThemeAnalysDO
>
recentThemeList
=
new
ArrayList
<>();
...
...
@@ -133,7 +131,7 @@ public class RecommendService {
String
id
;
while
(
hotTimes
>
0
&&
hotThemeIds
.
size
()
>
hotIdx
)
{
id
=
hotThemeIds
.
get
(
hotIdx
);
if
(!
set
.
contains
(
id
)){
if
(!
set
.
contains
(
id
))
{
result
.
add
(
id
);
set
.
add
(
id
);
}
...
...
@@ -143,7 +141,7 @@ public class RecommendService {
}
while
(
newTimes
>
0
&&
newThemeIds
.
size
()
>
newIdx
)
{
id
=
newThemeIds
.
get
(
newIdx
);
if
(!
set
.
contains
(
id
)){
if
(!
set
.
contains
(
id
))
{
result
.
add
(
id
);
set
.
add
(
id
);
}
...
...
@@ -153,7 +151,7 @@ public class RecommendService {
}
while
(
recTimes
>
0
&&
recThemeIds
.
size
()
>
recIdx
)
{
id
=
recThemeIds
.
get
(
recIdx
);
if
(!
set
.
contains
(
id
)){
if
(!
set
.
contains
(
id
))
{
result
.
add
(
id
);
set
.
add
(
id
);
}
...
...
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