Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
5d4d2f19
Commit
5d4d2f19
authored
Sep 20, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化会员等级滚动降级定时任务
parent
cdc82d20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+9
-3
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
5d4d2f19
...
...
@@ -694,19 +694,24 @@ public class RedisTask {
list
.
sort
(
Comparator
.
comparing
(
MemberProgressLog:
:
getOperationType
).
reversed
());
//获得list的consumerId
List
<
Long
>
consumerIds
=
list
.
stream
().
map
(
MemberProgressLog:
:
getConsumerId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
ConsumerMember
>
consumerMemberMap
=
consumerMemberService
.
list
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
in
(
ConsumerMember:
:
getConsumerId
,
consumerIds
))
.
stream
().
collect
(
Collectors
.
toMap
(
ConsumerMember:
:
getConsumerId
,
item
->
item
));
//按照consumerId进行分组
Map
<
Long
,
List
<
MemberProgressLog
>>
collect
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
MemberProgressLog:
:
getConsumerId
));
Map
<
Long
,
MemberConfig
>
memberConfigMap
=
memberConfigService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
MemberConfig:
:
getMembershipLevel
,
item
->
item
));
List
<
ConsumerMember
>
updateList
=
new
ArrayList
<>();
consumerIds
.
stream
().
forEach
(
item
->
{
List
<
MemberProgressLog
>
memberProgressLogs
=
collect
.
get
(
item
);
if
(
memberProgressLogs
.
size
()
>
0
)
{
//查询会员
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
item
));
ConsumerMember
consumerMember
=
consumerMemberMap
.
get
(
item
);
;
if
(
consumerMember
.
getMembershipProgress
().
equals
(
BigDecimal
.
ZERO
))
{
//结束此次循环
return
;
}
//查询会员配置
MemberConfig
memberConfig
=
memberConfig
Service
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()
));
MemberConfig
memberConfig
=
memberConfig
Map
.
get
(
consumerMember
.
getMembershipLevel
(
));
final
BigDecimal
[]
sum
=
{
BigDecimal
.
ZERO
};
//计算扣除进度
memberProgressLogs
.
stream
().
forEach
(
log
->
{
...
...
@@ -738,9 +743,10 @@ public class RedisTask {
}
}
}
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
updateList
.
add
(
consumerMember
);
}
});
if
(!
CollectionUtils
.
isEmpty
(
updateList
))
consumerMemberService
.
updateBatchById
(
updateList
);
logger
.
debug
(
"AutoProgressLog:会员等级滚动降级结束"
);
}
...
...
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