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
81bbee19
Commit
81bbee19
authored
Oct 26, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/main'
parents
da43ca7d
b0a0b6ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
31 deletions
+37
-31
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+35
-0
RyTask.java
share-quartz/src/main/java/share/quartz/task/RyTask.java
+2
-31
No files found.
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
81bbee19
...
...
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
org.springframework.util.CollectionUtils
;
import
share.common.constant.Constants
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.CouponStatusEnum
;
...
...
@@ -20,11 +21,14 @@ import share.common.exception.base.BaseException;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SOrder
;
import
share.system.domain.SRoom
;
import
share.system.mapper.SRoomMapper
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISOrderService
;
import
share.system.service.ISysConfigService
;
import
share.system.service.SConsumerService
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
...
...
@@ -56,6 +60,9 @@ public class OrderTask {
@Autowired
private
TransactionTemplate
transactionTemplate
;
@Autowired
private
SRoomMapper
roomMapper
;
public
void
autoCancel
()
{
String
redisKey
=
Constants
.
ORDER_AUTO_CANCEL_KEY
;
Long
size
=
redisUtil
.
getListSize
(
redisKey
);
...
...
@@ -198,4 +205,32 @@ public class OrderTask {
return
execute
;
}
//预约订单到期自动更新订单状态,更新房间状态
public
void
autoToStore
()
{
//查询所有已支付的订单
SOrder
order
=
new
SOrder
();
order
.
setPayStatus
(
1
);
order
.
setStatus
(
0
);
order
.
setRefundStatus
(
0
);
List
<
SOrder
>
sOrders
=
orderService
.
selectSOrderList
(
order
);
if
(
CollectionUtils
.
isEmpty
(
sOrders
))
{
return
;
}
sOrders
.
forEach
(
item
->
{
//判断预约开始时间是否已到期
if
((
Math
.
abs
(
item
.
getPreStartDate
().
getTime
()
-
new
Date
().
getTime
()))
/
(
60
*
1000
)
==
0
)
{
//更改订单状态,房间状态,开始时间,结束时间
item
.
setStatus
(
1
);
item
.
setUpdateTime
(
new
Date
());
item
.
setStartDate
(
item
.
getPreStartDate
());
item
.
setEndDate
(
item
.
getPreEndDate
());
orderService
.
updateSOrder
(
item
);
SRoom
sRoom
=
roomMapper
.
selectById
(
item
.
getRoomId
());
sRoom
.
setStatus
(
"2"
);
sRoom
.
setUpdateTime
(
new
Date
());
roomMapper
.
updateById
(
sRoom
);
}
});
}
}
share-quartz/src/main/java/share/quartz/task/RyTask.java
View file @
81bbee19
...
...
@@ -25,10 +25,7 @@ import java.util.List;
@Component
(
"ryTask"
)
public
class
RyTask
{
@Autowired
private
ISOrderService
orderService
;
@Autowired
private
SRoomMapper
roomMapper
;
public
void
ryMultipleParams
(
String
s
,
Boolean
b
,
Long
l
,
Double
d
,
Integer
i
)
{
System
.
out
.
println
(
StringUtils
.
format
(
"执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}"
,
s
,
b
,
l
,
d
,
i
));
...
...
@@ -44,31 +41,5 @@ public class RyTask
System
.
out
.
println
(
"执行无参方法"
);
}
//预约订单到期自动更新订单状态,更新房间状态
public
void
autoToStore
()
{
//查询所有已支付的订单
SOrder
order
=
new
SOrder
();
order
.
setPayStatus
(
1
);
order
.
setStatus
(
0
);
order
.
setRefundStatus
(
0
);
List
<
SOrder
>
sOrders
=
orderService
.
selectSOrderList
(
order
);
if
(
CollectionUtils
.
isEmpty
(
sOrders
))
{
return
;
}
sOrders
.
forEach
(
item
->
{
//判断预约开始时间是否已到期
if
((
Math
.
abs
(
item
.
getPreStartDate
().
getTime
()
-
new
Date
().
getTime
()))
/
(
60
*
1000
)
==
0
)
{
//更改订单状态,房间状态,开始时间,结束时间
item
.
setStatus
(
1
);
item
.
setUpdateTime
(
new
Date
());
item
.
setStartDate
(
item
.
getPreStartDate
());
item
.
setEndDate
(
item
.
getPreEndDate
());
orderService
.
updateSOrder
(
item
);
SRoom
sRoom
=
roomMapper
.
selectById
(
item
.
getRoomId
());
sRoom
.
setStatus
(
"2"
);
sRoom
.
setUpdateTime
(
new
Date
());
roomMapper
.
updateById
(
sRoom
);
}
});
}
}
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