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
fc72dcec
Commit
fc72dcec
authored
Jul 23, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改滚动清除进度定时任务
parent
4c1f519d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+21
-6
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
fc72dcec
...
...
@@ -24,7 +24,6 @@ import share.common.constant.MqttConstants;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.service.*
;
...
...
@@ -102,6 +101,9 @@ public class RedisTask {
@Autowired
private
MemberProgressLogService
memberProgressLogService
;
@Autowired
private
MemberConfigService
memberConfigService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
...
@@ -516,7 +518,7 @@ public class RedisTask {
public
void
AutoProgressLog
()
{
//查询1年之前的数据
List
<
MemberProgressLog
>
list
=
memberProgressLogService
.
list
(
new
LambdaQueryWrapper
<
MemberProgressLog
>()
.
gt
(
MemberProgressLog:
:
get
CreateTime
,
DateUtils
.
addYears
(
new
Date
(),
-
1
))
.
gt
(
MemberProgressLog:
:
get
ExpirationTime
,
new
Date
(
))
);
list
.
sort
(
Comparator
.
comparing
(
MemberProgressLog:
:
getOperationType
).
reversed
());
//获得list的consumerId
...
...
@@ -526,7 +528,7 @@ public class RedisTask {
consumerIds
.
stream
().
forEach
(
item
->
{
List
<
MemberProgressLog
>
memberProgressLogs
=
collect
.
get
(
item
);
if
(
memberProgressLogs
.
size
()
>
1
)
{
final
BigDecimal
[]
sum
=
{
new
BigDecimal
(
100
)
};
final
BigDecimal
[]
sum
=
{
BigDecimal
.
ZERO
};
memberProgressLogs
.
stream
().
forEach
(
log
->
{
if
(
log
.
getOperationType
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
sum
[
0
]
=
sum
[
0
].
subtract
(
log
.
getVariableProgress
());
...
...
@@ -534,12 +536,25 @@ public class RedisTask {
sum
[
0
]
=
sum
[
0
].
add
(
log
.
getVariableProgress
());
}
});
sum
[
0
].
subtract
(
new
BigDecimal
(
100
));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
item
));
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
>=
0
)
{
consumerMember
.
setMembershipProgress
(
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]));
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
BigDecimal
subtract
=
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]);
consumerMember
.
setMembershipProgress
(
subtract
);
if
(
subtract
.
compareTo
(
BigDecimal
.
valueOf
(
memberConfig
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
memberConfig
.
getMembershipLevel
()
-
1
);
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
);
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
}
else
{
consumerMember
.
setMembershipProgress
(
BigDecimal
.
ZERO
);
consumerMember
.
setMembershipLevel
(
0L
);
consumerMember
.
setMemberType
(
MemberTypeEnum
.
NORMAL
.
getIndex
());
}
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
});
}
...
...
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