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
42afd82d
Commit
42afd82d
authored
Feb 24, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.3.1' into 'dev'
通知分页fix See merge request
!83
parents
707450f6
aafc72e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+15
-11
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-2
No files found.
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
42afd82d
...
...
@@ -31,56 +31,60 @@ import com.tanpu.community.service.NotificationService;
import
com.tanpu.community.service.ThemeService
;
import
com.tanpu.community.service.TopicService
;
import
com.tanpu.community.util.ConvertUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.text.MessageFormat
;
import
java.time.LocalDateTime
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
@Service
public
class
NotificationManager
{
@
Autowired
@
Resource
private
NotificationService
notificationService
;
@
Autowired
@
Resource
private
TopicService
topicService
;
@
Autowired
@
Resource
private
ThemeService
themeService
;
@Resource
private
BatchFeignCallService
batchFeignCallService
;
@
Autowired
@
Resource
private
FeignClientForFatools
feignClientForFatools
;
@
Autowired
@
Resource
private
CommentService
commentService
;
@
Autowired
@
Resource
private
FollowRelService
followRelService
;
@
Autowired
@
Resource
private
CollectionService
collectionService
;
@
Autowired
@
Resource
private
RedisCache
redisCache
;
public
List
<
ThemeNotifyQo
>
queryList
(
NotifyQueryReq
req
,
String
userId
)
{
List
<
NotificationEntity
>
query
=
notificationService
.
query
(
userId
,
req
.
getType
(),
req
.
getLastId
(),
req
.
getPageSize
());
if
(
CollectionUtils
.
isEmpty
(
query
)){
return
Collections
.
emptyList
();
}
List
<
ThemeNotifyQo
>
themeNotifyQos
=
ConvertUtil
.
notificationEntitiy2ThemeQos
(
query
);
UserInfoResp
currentUser
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
60
,
()
->
this
.
getUserInfo
(
userId
),
UserInfoResp
.
class
);
Set
<
String
>
followUserIds
=
followRelService
.
queryIdolsByFansId
(
userId
).
stream
().
collect
(
Collectors
.
toSet
(
));
Set
<
String
>
followUserIds
=
new
HashSet
<>(
followRelService
.
queryIdolsByFansId
(
userId
));
for
(
ThemeNotifyQo
themeNotifyQo
:
themeNotifyQos
)
{
// 用户信息
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
42afd82d
...
...
@@ -25,6 +25,7 @@ import java.util.Arrays;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -218,11 +219,11 @@ public class RankService {
.
collect
(
Collectors
.
toList
());
//落库
if
(
redisCache
.
setIfAbsent
(
"logTopicRank"
,
"1"
,
60
))
{
int
i
=
new
Random
().
nextInt
(
3
);
if
(
i
==
1
&&
redisCache
.
setIfAbsent
(
"logTopicRank"
,
"1"
,
60
))
{
rankLogService
.
logTopicRank
(
rankList
,
start
,
TimeUtils
.
calMillisTillNow
(
start
));
redisCache
.
evict
(
"logTopicRank"
);
}
return
;
}
/**
...
...
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