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
98874ec0
Commit
98874ec0
authored
Apr 01, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单取消支付修改为定时任务
parent
aeae67dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+1
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+23
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+6
-5
No files found.
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
98874ec0
...
...
@@ -12,6 +12,7 @@ public enum ReceiptRdeisEnum {
TIKTOK_CLIENT_TOKEN_KEY
(
8
,
"TIKTOK_CLIENT_TOKEN_KEY"
),
//房间15分钟过期
ROOM_EXPIRE_TIME
(
9
,
"ROOM_EXPIRE_TIME."
),
ORDER_CANCEL_PAY
(
10
,
"ORDER_CANCEL_PAY."
),
;
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
98874ec0
...
...
@@ -28,6 +28,7 @@ import share.system.domain.*;
import
share.system.domain.vo.MqttxVo
;
import
share.system.service.*
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -403,4 +404,26 @@ public class RedisTask {
});
}
public
void
AutoOrderCancelPay
()
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_CANCEL_PAY
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
}
keys
.
stream
().
forEach
(
key
->
{
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
key
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
SOrder
byOrderNo
=
orderService
.
getByOrderNo
(
orderNo
);
if
(
ObjectUtils
.
isEmpty
(
byOrderNo
.
getPayTime
())
&&
byOrderNo
.
getPayPrice
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orderService
.
removeById
(
byOrderNo
.
getId
());
redisUtil
.
delete
(
key
);
}
else
{
redisUtil
.
delete
(
key
);
}
}
});
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
98874ec0
...
...
@@ -1272,11 +1272,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
boolean
cancelPay
(
String
orderNo
)
{
SOrder
order
=
getByOrderNo
(
orderNo
);
if
(
Objects
.
isNull
(
order
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
removeById
(
order
.
getId
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
orderNo
);
Date
date
=
DateUtils
.
addMinutes
(
new
Date
(),
5
);
map
.
put
(
"expirationTime"
,
date
.
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_CANCEL_PAY
.
getValue
()
+
orderNo
,
jsonObject
);
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