记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
1f893217
Commit
1f893217
authored
Jul 28, 2026
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
platform 增加定时任务执行日志
parent
189a96bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
PlatformGroupBuyTaskServiceImpl.java
...m/service/impl/kylin/PlatformGroupBuyTaskServiceImpl.java
+21
-0
No files found.
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/kylin/PlatformGroupBuyTaskServiceImpl.java
View file @
1f893217
...
@@ -56,19 +56,24 @@ public class PlatformGroupBuyTaskServiceImpl {
...
@@ -56,19 +56,24 @@ public class PlatformGroupBuyTaskServiceImpl {
.
and
(
"expiresAt"
).
lt
(
now
));
.
and
(
"expiresAt"
).
lt
(
now
));
List
<
KylinGroupBuyOrderVo
>
orders
=
mongoTemplate
.
find
(
query
,
List
<
KylinGroupBuyOrderVo
>
orders
=
mongoTemplate
.
find
(
query
,
KylinGroupBuyOrderVo
.
class
,
KylinGroupBuyOrderVo
.
class
.
getSimpleName
());
KylinGroupBuyOrderVo
.
class
,
KylinGroupBuyOrderVo
.
class
.
getSimpleName
());
int
processed
=
0
;
int
skipped
=
0
;
for
(
KylinGroupBuyOrderVo
order
:
orders
)
{
for
(
KylinGroupBuyOrderVo
order
:
orders
)
{
String
groupOrderId
=
order
.
getGroupOrderId
();
String
groupOrderId
=
order
.
getGroupOrderId
();
if
(!
groupBuyPlatformHelper
.
tryLock
(
groupOrderId
))
{
if
(!
groupBuyPlatformHelper
.
tryLock
(
groupOrderId
))
{
log
.
warn
(
"拼团超时任务获取锁失败 groupOrderId={}"
,
groupOrderId
);
log
.
warn
(
"拼团超时任务获取锁失败 groupOrderId={}"
,
groupOrderId
);
skipped
++;
continue
;
continue
;
}
}
try
{
try
{
KylinGroupBuyOrderVo
fresh
=
groupBuyPlatformHelper
.
loadFromMongo
(
groupOrderId
);
KylinGroupBuyOrderVo
fresh
=
groupBuyPlatformHelper
.
loadFromMongo
(
groupOrderId
);
if
(
fresh
==
null
||
!
GroupBuyStatusConst
.
OrderStatus
.
PENDING
.
equals
(
fresh
.
getStatus
()))
{
if
(
fresh
==
null
||
!
GroupBuyStatusConst
.
OrderStatus
.
PENDING
.
equals
(
fresh
.
getStatus
()))
{
skipped
++;
continue
;
continue
;
}
}
if
(
fresh
.
getExpiresAt
()
==
null
if
(
fresh
.
getExpiresAt
()
==
null
||
!
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
fresh
.
getExpiresAt
()).
isBefore
(
LocalDateTime
.
now
()))
{
||
!
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
fresh
.
getExpiresAt
()).
isBefore
(
LocalDateTime
.
now
()))
{
skipped
++;
continue
;
continue
;
}
}
fresh
.
setStatus
(
GroupBuyStatusConst
.
OrderStatus
.
FAILED
);
fresh
.
setStatus
(
GroupBuyStatusConst
.
OrderStatus
.
FAILED
);
...
@@ -95,12 +100,15 @@ public class PlatformGroupBuyTaskServiceImpl {
...
@@ -95,12 +100,15 @@ public class PlatformGroupBuyTaskServiceImpl {
for
(
String
orderTicketsId
:
joinedOrderTicketIds
)
{
for
(
String
orderTicketsId
:
joinedOrderTicketIds
)
{
refundJoinedTicket
(
orderTicketsId
,
"拼团超时未成团,全额退款"
);
refundJoinedTicket
(
orderTicketsId
,
"拼团超时未成团,全额退款"
);
}
}
processed
++;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"拼团超时处理失败 groupOrderId={}"
,
groupOrderId
,
e
);
log
.
error
(
"拼团超时处理失败 groupOrderId={}"
,
groupOrderId
,
e
);
}
finally
{
}
finally
{
groupBuyPlatformHelper
.
unlock
(
groupOrderId
);
groupBuyPlatformHelper
.
unlock
(
groupOrderId
);
}
}
}
}
log
.
info
(
"拼团超时任务结束 now={}, hit={}, processed={}, skipped={}"
,
now
,
orders
==
null
?
0
:
orders
.
size
(),
processed
,
skipped
);
return
true
;
return
true
;
}
}
...
@@ -116,25 +124,32 @@ public class PlatformGroupBuyTaskServiceImpl {
...
@@ -116,25 +124,32 @@ public class PlatformGroupBuyTaskServiceImpl {
.
and
(
"remind1hSent"
).
ne
(
1
));
.
and
(
"remind1hSent"
).
ne
(
1
));
List
<
KylinGroupBuyOrderVo
>
orders
=
mongoTemplate
.
find
(
query
,
List
<
KylinGroupBuyOrderVo
>
orders
=
mongoTemplate
.
find
(
query
,
KylinGroupBuyOrderVo
.
class
,
KylinGroupBuyOrderVo
.
class
.
getSimpleName
());
KylinGroupBuyOrderVo
.
class
,
KylinGroupBuyOrderVo
.
class
.
getSimpleName
());
int
processed
=
0
;
int
skipped
=
0
;
for
(
KylinGroupBuyOrderVo
order
:
orders
)
{
for
(
KylinGroupBuyOrderVo
order
:
orders
)
{
String
groupOrderId
=
order
.
getGroupOrderId
();
String
groupOrderId
=
order
.
getGroupOrderId
();
if
(!
groupBuyPlatformHelper
.
tryLock
(
groupOrderId
))
{
if
(!
groupBuyPlatformHelper
.
tryLock
(
groupOrderId
))
{
log
.
warn
(
"拼团1h提醒获取锁失败 groupOrderId={}"
,
groupOrderId
);
log
.
warn
(
"拼团1h提醒获取锁失败 groupOrderId={}"
,
groupOrderId
);
skipped
++;
continue
;
continue
;
}
}
try
{
try
{
KylinGroupBuyOrderVo
fresh
=
groupBuyPlatformHelper
.
loadFromMongo
(
groupOrderId
);
KylinGroupBuyOrderVo
fresh
=
groupBuyPlatformHelper
.
loadFromMongo
(
groupOrderId
);
if
(
fresh
==
null
||
!
GroupBuyStatusConst
.
OrderStatus
.
PENDING
.
equals
(
fresh
.
getStatus
()))
{
if
(
fresh
==
null
||
!
GroupBuyStatusConst
.
OrderStatus
.
PENDING
.
equals
(
fresh
.
getStatus
()))
{
skipped
++;
continue
;
continue
;
}
}
if
(
groupBuySmsSender
.
isRemind1hAlreadySent
(
fresh
))
{
if
(
groupBuySmsSender
.
isRemind1hAlreadySent
(
fresh
))
{
skipped
++;
continue
;
continue
;
}
}
if
(
fresh
.
getExpiresAt
()
==
null
)
{
if
(
fresh
.
getExpiresAt
()
==
null
)
{
skipped
++;
continue
;
continue
;
}
}
LocalDateTime
expiresAt
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
fresh
.
getExpiresAt
());
LocalDateTime
expiresAt
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
fresh
.
getExpiresAt
());
if
(!
expiresAt
.
isAfter
(
nowLdt
)
||
expiresAt
.
isAfter
(
nowLdt
.
plusHours
(
1
)))
{
if
(!
expiresAt
.
isAfter
(
nowLdt
)
||
expiresAt
.
isAfter
(
nowLdt
.
plusHours
(
1
)))
{
skipped
++;
continue
;
continue
;
}
}
try
{
try
{
...
@@ -145,12 +160,15 @@ public class PlatformGroupBuyTaskServiceImpl {
...
@@ -145,12 +160,15 @@ public class PlatformGroupBuyTaskServiceImpl {
fresh
.
setRemind1hSent
(
1
);
fresh
.
setRemind1hSent
(
1
);
fresh
.
setUpdatedAt
(
now
);
fresh
.
setUpdatedAt
(
now
);
groupBuyPlatformHelper
.
saveGroup
(
fresh
);
groupBuyPlatformHelper
.
saveGroup
(
fresh
);
processed
++;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"拼团1h提醒处理失败 groupOrderId={}"
,
groupOrderId
,
e
);
log
.
error
(
"拼团1h提醒处理失败 groupOrderId={}"
,
groupOrderId
,
e
);
}
finally
{
}
finally
{
groupBuyPlatformHelper
.
unlock
(
groupOrderId
);
groupBuyPlatformHelper
.
unlock
(
groupOrderId
);
}
}
}
}
log
.
info
(
"拼团1h提醒任务结束 now={}, deadline={}, hit={}, processed={}, skipped={}"
,
now
,
deadline
,
orders
==
null
?
0
:
orders
.
size
(),
processed
,
skipped
);
return
true
;
return
true
;
}
}
...
@@ -189,6 +207,9 @@ public class PlatformGroupBuyTaskServiceImpl {
...
@@ -189,6 +207,9 @@ public class PlatformGroupBuyTaskServiceImpl {
GroupBuyStatusConst
.
ActivityStatus
.
ENDED
,
LocalDateTime
.
now
());
GroupBuyStatusConst
.
ActivityStatus
.
ENDED
,
LocalDateTime
.
now
());
cacheActivity
(
activity
);
cacheActivity
(
activity
);
}
}
log
.
info
(
"拼团活动调度结束 now={}, started={}, ended={}"
,
now
,
dueStartList
==
null
?
0
:
dueStartList
.
size
(),
dueEndList
==
null
?
0
:
dueEndList
.
size
());
return
true
;
return
true
;
}
}
...
...
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