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
aafc72e2
Commit
aafc72e2
authored
Feb 24, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通知分页fix
parent
b95d8a7a
Hide 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 @
aafc72e2
...
@@ -31,56 +31,60 @@ import com.tanpu.community.service.NotificationService;
...
@@ -31,56 +31,60 @@ import com.tanpu.community.service.NotificationService;
import
com.tanpu.community.service.ThemeService
;
import
com.tanpu.community.service.ThemeService
;
import
com.tanpu.community.service.TopicService
;
import
com.tanpu.community.service.TopicService
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.ConvertUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
@Service
@Service
public
class
NotificationManager
{
public
class
NotificationManager
{
@
Autowired
@
Resource
private
NotificationService
notificationService
;
private
NotificationService
notificationService
;
@
Autowired
@
Resource
private
TopicService
topicService
;
private
TopicService
topicService
;
@
Autowired
@
Resource
private
ThemeService
themeService
;
private
ThemeService
themeService
;
@Resource
@Resource
private
BatchFeignCallService
batchFeignCallService
;
private
BatchFeignCallService
batchFeignCallService
;
@
Autowired
@
Resource
private
FeignClientForFatools
feignClientForFatools
;
private
FeignClientForFatools
feignClientForFatools
;
@
Autowired
@
Resource
private
CommentService
commentService
;
private
CommentService
commentService
;
@
Autowired
@
Resource
private
FollowRelService
followRelService
;
private
FollowRelService
followRelService
;
@
Autowired
@
Resource
private
CollectionService
collectionService
;
private
CollectionService
collectionService
;
@
Autowired
@
Resource
private
RedisCache
redisCache
;
private
RedisCache
redisCache
;
public
List
<
ThemeNotifyQo
>
queryList
(
NotifyQueryReq
req
,
String
userId
)
{
public
List
<
ThemeNotifyQo
>
queryList
(
NotifyQueryReq
req
,
String
userId
)
{
List
<
NotificationEntity
>
query
=
notificationService
.
query
(
userId
,
req
.
getType
(),
req
.
getLastId
(),
req
.
getPageSize
());
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
);
List
<
ThemeNotifyQo
>
themeNotifyQos
=
ConvertUtil
.
notificationEntitiy2ThemeQos
(
query
);
UserInfoResp
currentUser
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
UserInfoResp
currentUser
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
60
,
()
->
this
.
getUserInfo
(
userId
),
UserInfoResp
.
class
);
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
)
{
for
(
ThemeNotifyQo
themeNotifyQo
:
themeNotifyQos
)
{
// 用户信息
// 用户信息
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
aafc72e2
...
@@ -25,6 +25,7 @@ import java.util.Arrays;
...
@@ -25,6 +25,7 @@ import java.util.Arrays;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -218,11 +219,11 @@ public class RankService {
...
@@ -218,11 +219,11 @@ public class RankService {
.
collect
(
Collectors
.
toList
());
.
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
));
rankLogService
.
logTopicRank
(
rankList
,
start
,
TimeUtils
.
calMillisTillNow
(
start
));
redisCache
.
evict
(
"logTopicRank"
);
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