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
345b5acc
Commit
345b5acc
authored
Jul 26, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缓存修复
parent
d1466e17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
7 deletions
+11
-7
RedisKeyConstant.java
...a/com/tanpu/community/api/constants/RedisKeyConstant.java
+1
-1
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+2
-2
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+5
-1
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-3
No files found.
community-api/src/main/java/com/tanpu/community/api/constants/RedisKeyConstant.java
View file @
345b5acc
...
@@ -30,7 +30,7 @@ public class RedisKeyConstant {
...
@@ -30,7 +30,7 @@ public class RedisKeyConstant {
public
static
final
String
THEME_APPEAR_IN_SEARCH_LIST
=
"THEME_APPEAR_IN_SEARCH_LIST_"
;
public
static
final
String
THEME_APPEAR_IN_SEARCH_LIST
=
"THEME_APPEAR_IN_SEARCH_LIST_"
;
// feign 查询用户信息
// feign 查询用户信息
public
static
final
String
CAC
G
E_FEIGN_USER_INFO
=
"CACHE_FEIGN_USER_INFO_"
;
public
static
final
String
CAC
H
E_FEIGN_USER_INFO
=
"CACHE_FEIGN_USER_INFO_"
;
// 主题下的评论
// 主题下的评论
public
static
final
String
CACHE_COMMENT_THEMEID
=
"CACHE_COMMENT_THEMEID_"
;
public
static
final
String
CACHE_COMMENT_THEMEID
=
"CACHE_COMMENT_THEMEID_"
;
// 评论本身
// 评论本身
...
...
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
345b5acc
...
@@ -28,7 +28,7 @@ import java.util.List;
...
@@ -28,7 +28,7 @@ import java.util.List;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CAC
G
E_FEIGN_USER_INFO
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CAC
H
E_FEIGN_USER_INFO
;
@Service
@Service
public
class
CommentManager
{
public
class
CommentManager
{
...
@@ -74,7 +74,7 @@ public class CommentManager {
...
@@ -74,7 +74,7 @@ public class CommentManager {
for
(
CommentQo
commentQo
:
commentQos
)
{
for
(
CommentQo
commentQo
:
commentQos
)
{
//查询用户信息
//查询用户信息
String
authorId
=
commentQo
.
getAuthorId
();
String
authorId
=
commentQo
.
getAuthorId
();
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
G
E_FEIGN_USER_INFO
,
authorId
),
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
H
E_FEIGN_USER_INFO
,
authorId
),
60
*
10
,
()
->
this
.
getUserInfo
(
authorId
)
,
UserInfoNew
.
class
);
60
*
10
,
()
->
this
.
getUserInfo
(
authorId
)
,
UserInfoNew
.
class
);
if
(
userInfo
!=
null
)
{
if
(
userInfo
!=
null
)
{
commentQo
.
setUserImg
(
userInfo
.
getHeadImageUrl
());
commentQo
.
setUserImg
(
userInfo
.
getHeadImageUrl
());
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
345b5acc
...
@@ -439,7 +439,7 @@ public class ThemeManager {
...
@@ -439,7 +439,7 @@ public class ThemeManager {
//评论列表
//评论列表
List
<
CommentEntity
>
commentEntities
=
commentService
.
queryThemesByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
List
<
CommentEntity
>
commentEntities
=
commentService
.
queryThemesByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
//当前用户信息
//当前用户信息
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
G
E_FEIGN_USER_INFO
,
req
.
getUserId
()),
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
H
E_FEIGN_USER_INFO
,
req
.
getUserId
()),
60
*
10
,
()
->
this
.
getUserInfo
(
req
.
getUserId
())
,
UserInfoNew
.
class
);
60
*
10
,
()
->
this
.
getUserInfo
(
req
.
getUserId
())
,
UserInfoNew
.
class
);
Set
<
String
>
replyThemeIds
=
commentEntities
.
stream
().
map
(
CommentEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
replyThemeIds
=
commentEntities
.
stream
().
map
(
CommentEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
if
(
CollectionUtils
.
isEmpty
(
replyThemeIds
))
{
if
(
CollectionUtils
.
isEmpty
(
replyThemeIds
))
{
...
@@ -462,6 +462,10 @@ public class ThemeManager {
...
@@ -462,6 +462,10 @@ public class ThemeManager {
.
build
();
.
build
();
//原主题包装到FormerThemeQo中
//原主题包装到FormerThemeQo中
ThemeQo
themeQo
=
themeMap
.
get
(
themeId
);
ThemeQo
themeQo
=
themeMap
.
get
(
themeId
);
//如果原文被删除,跳过
if
(
themeQo
==
null
){
continue
;
}
FormerThemeQo
f
=
ConvertUtil
.
themeQo2FormerThemeQo
(
themeQo
);
FormerThemeQo
f
=
ConvertUtil
.
themeQo2FormerThemeQo
(
themeQo
);
//ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中
//ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中
ThemeQo
commentThemeQo
=
ThemeQo
.
builder
()
ThemeQo
commentThemeQo
=
ThemeQo
.
builder
()
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
345b5acc
...
@@ -21,7 +21,7 @@ import javax.annotation.Resource;
...
@@ -21,7 +21,7 @@ import javax.annotation.Resource;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CAC
G
E_FEIGN_USER_INFO
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CAC
H
E_FEIGN_USER_INFO
;
@Service
@Service
public
class
RankService
{
public
class
RankService
{
...
@@ -55,7 +55,7 @@ public class RankService {
...
@@ -55,7 +55,7 @@ public class RankService {
*/
*/
public
void
rankThemes
()
{
public
void
rankThemes
()
{
//7天内所有主题进行热度值排序
//7天内所有主题进行热度值排序
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
4
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
7
);
List
<
ThemeAnalysDO
>
themeAnalysDOS
=
ConvertUtil
.
themeEntityToAnalysDOs
(
themeEntities
);
List
<
ThemeAnalysDO
>
themeAnalysDOS
=
ConvertUtil
.
themeEntityToAnalysDOs
(
themeEntities
);
for
(
ThemeAnalysDO
theme
:
themeAnalysDOS
)
{
for
(
ThemeAnalysDO
theme
:
themeAnalysDOS
)
{
String
themeId
=
theme
.
getThemeId
();
String
themeId
=
theme
.
getThemeId
();
...
@@ -71,7 +71,7 @@ public class RankService {
...
@@ -71,7 +71,7 @@ public class RankService {
theme
.
setViewCount
(
viewCount
);
theme
.
setViewCount
(
viewCount
);
//查询用户质量
//查询用户质量
String
authorId
=
theme
.
getAuthorId
();
String
authorId
=
theme
.
getAuthorId
();
UserInfoNew
authorInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
G
E_FEIGN_USER_INFO
,
authorId
),
UserInfoNew
authorInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CAC
H
E_FEIGN_USER_INFO
,
authorId
),
60
*
10
,
()
->
this
.
getUserInfo
(
authorId
),
UserInfoNew
.
class
);
60
*
10
,
()
->
this
.
getUserInfo
(
authorId
),
UserInfoNew
.
class
);
if
(
authorInfo
==
null
||
authorInfo
.
getLevelGrade
()
==
null
)
{
if
(
authorInfo
==
null
||
authorInfo
.
getLevelGrade
()
==
null
)
{
theme
.
setUserWeight
(
0.0
);
theme
.
setUserWeight
(
0.0
);
...
...
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