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
3b651c63
Commit
3b651c63
authored
Aug 09, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加线程池延时Redis操作
parent
a31a2a95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
22 deletions
+46
-22
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+46
-22
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
3b651c63
...
...
@@ -976,16 +976,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
});
}
}
try
{
Thread
.
sleep
(
1000L
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
new
Thread
(()
->
{
try
{
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
unLockOrder
(
request
.
getRoomId
());
}
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
...
...
@@ -1003,7 +1005,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
new
Thread
(()
->
{
try
{
// 这里设置你的延迟时间,例如5秒
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
unLockOrder
(
request
.
getRoomId
());
}
// 订单预定成功, 发送短信通知运维客服
...
...
@@ -1884,27 +1894,33 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
baseMapper
.
updateSOrder
(
sOrder
);
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
try
{
Thread
.
sleep
(
1000L
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
new
Thread
(()
->
{
try
{
// 这里设置你的延迟时间,例如5秒
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
try
{
Thread
.
sleep
(
1000L
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
new
Thread
(()
->
{
try
{
// 这里设置你的延迟时间,例如5秒
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
}
Long
couponId
=
sOrder
.
getCouponId
();
SStore
sStore
=
storeService
.
getById
(
sOrder
.
getStoreId
());
...
...
@@ -2246,13 +2262,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder
.
setEndDate
(
sOrder
.
getPreEndDate
());
}
}
sOrder
.
setArrivalTime
(
new
Date
());
baseMapper
.
updateById
(
sOrder
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
sOrder
.
setArrivalTime
(
new
Date
());
baseMapper
.
updateById
(
sOrder
);
new
Thread
(()
->
{
try
{
// 这里设置你的延迟时间,例如5秒
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
//更改房间状态
SRoom
sRoom
=
new
SRoom
();
sRoom
.
setId
(
sOrder
.
getRoomId
());
...
...
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