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
e862f373
Commit
e862f373
authored
Dec 28, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化自动添加保洁任务的自动任务
parent
7e3f31d4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
57 deletions
+23
-57
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+23
-57
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e862f373
...
...
@@ -71,10 +71,6 @@ public class RedisTask {
@Autowired
private
SConsumerService
sConsumerService
;
//30分钟的常量
final
long
THIRTY_MINUTES
=
60
*
30
;
//29分钟的常量
final
long
THIRTY_NINE_MINUTES
=
60
*
29
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
//14分钟的常量
...
...
@@ -136,7 +132,6 @@ public class RedisTask {
//查询所有待使用订单和使用中的订单
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
SOrder:
:
getStatus
,
new
ArrayList
<
Integer
>()
{{
add
(
OrderStatusEnum
.
UNUSED
.
getCode
());
add
(
OrderStatusEnum
.
INUSE
.
getCode
());
}});
List
<
SOrder
>
sOrders
=
isOrderService
.
list
();
...
...
@@ -146,11 +141,17 @@ public class RedisTask {
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
SOrder
sOrder
=
sOrders
.
stream
().
filter
(
item
->
item
.
getOrderNo
().
equals
(
jsonObject
.
getStr
(
"orderNo"
))).
findFirst
().
orElse
(
null
);
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
//判断时间是否在15分钟到14分钟
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
//语音
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER1
.
getCode
());
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER1
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
//从门店集合中判断门店id相同的门店对象
SStore
sStore
=
sStoreList
.
stream
().
filter
(
item
->
item
.
getId
().
equals
(
sOrder
.
getStoreId
())).
findFirst
().
orElse
(
null
);
//从房间集合中判断房间id相同的房间对象
...
...
@@ -167,8 +168,10 @@ public class RedisTask {
}
//判断时间是否在5分钟到4分钟
if
(
expire
<
FIVE_MINUTES
&&
expire
>
FOUR_MINUTES
)
{
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER2
.
getCode
());
return
;
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER2
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
}
//判断是否过期
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
...
...
@@ -177,21 +180,7 @@ public class RedisTask {
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
//循环判断sOrders 门店相同,房间相同,用户id相同,订单为续单,订单状态为使用中
List
<
SOrder
>
sOrders1
=
sOrders
.
stream
().
filter
(
item
->
item
.
getStoreId
().
equals
(
sOrder
.
getStoreId
())
&&
item
.
getRoomId
().
equals
(
sOrder
.
getRoomId
())
&&
item
.
getConsumerId
().
equals
(
sOrder
.
getConsumerId
())
&&
item
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
())
&&
item
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
())).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
sOrders1
))
{
//删除当前的订单
redisUtil
.
delete
(
o
);
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
return
;
}
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
...
...
@@ -220,45 +209,22 @@ public class RedisTask {
}
private
void
getResult
(
String
o
,
JSONObject
jsonObject
,
String
value
)
{
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
SOrder
sOrder
=
isOrderService
.
selectSOrderByOrderNo
(
orderNo
);
//判断订单单是否存在
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
SOrder
order
=
new
SOrder
();
order
.
setStoreId
(
sOrder
.
getStoreId
());
order
.
setRoomId
(
sOrder
.
getRoomId
());
order
.
setConsumerId
(
sOrder
.
getConsumerId
());
order
.
setOrderType
(
OrderTypeEnum
.
RENEW
.
getCode
());
order
.
setStatus
(
OrderStatusEnum
.
UNUSED
.
getCode
());
//查询当前订单下是否存在未使用的续费订单
List
<
SOrder
>
sOrders
=
isOrderService
.
selectSOrderList
(
order
);
if
(!
CollectionUtils
.
isEmpty
(
sOrders
))
{
private
boolean
extracted
(
String
o
,
List
<
SOrder
>
sOrders
,
SOrder
sOrder
)
{
List
<
SOrder
>
sOrders1
=
sOrders
.
stream
().
filter
(
item
->
item
.
getStoreId
().
equals
(
sOrder
.
getStoreId
())
&&
item
.
getRoomId
().
equals
(
sOrder
.
getRoomId
())
&&
item
.
getConsumerId
().
equals
(
sOrder
.
getConsumerId
())
&&
item
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
())
&&
item
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
())).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
sOrders1
))
{
//删除当前的订单
redisUtil
.
delete
(
o
);
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
return
;
}
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
value
,
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
return
true
;
}
private
static
class
Result
{
public
final
SOrder
sOrder
;
public
final
Device
device
;
public
Result
(
SOrder
sOrder
,
Device
device
)
{
this
.
sOrder
=
sOrder
;
this
.
device
=
device
;
}
return
false
;
}
public
void
yvying
(
Long
roomId
)
{
...
...
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