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
793ec24d
Commit
793ec24d
authored
Sep 23, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化会员等级滚动降级定时任务
parent
1f1cc81f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
38 deletions
+40
-38
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+40
-38
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
793ec24d
...
...
@@ -344,6 +344,46 @@ public class RedisTask {
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
extracted
(
sOrder
);
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
// 修改房间状态
SRoom
room
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
ObjectUtil
.
isNotEmpty
(
room
))
{
room
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
room
.
setUpdateTime
(
new
Date
());
roomService
.
updateById
(
room
);
}
//判断订单是否已经添加保洁记录
SCleanRecords
cleanRecords
=
isCleanRecordsService
.
lastCleanByRoomId
(
sOrder
.
getRoomId
());
if
(
ObjectUtils
.
isEmpty
(
cleanRecords
)
||
cleanRecords
.
getStatus
().
compareTo
(
CleaningStatusEnum
.
UNCLEAN
.
getCode
())
!=
0
)
{
boolean
b
=
isCleanRecordsService
.
addSCleanRecords
(
sOrder
.
getStoreId
(),
sOrder
.
getRoomId
());
}
//删除redis中的值
redisUtil
.
delete
(
o
);
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
//延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
false
,
0L
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
//当前时间加15分钟
Date
date
=
DateUtil
.
offsetMinute
(
sOrder
.
getEndDate
(),
15
);
map
.
put
(
"expirationTime"
,
date
.
toString
());
JSONObject
json
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ROOM_EXPIRE_TIME
.
getValue
()
+
sOrder
.
getOrderNo
(),
json
.
toString
());
logger
.
debug
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
}
});
logger
.
debug
(
"AutoAddSCleanRecords:自动添加保洁记录结束"
);
}
private
void
extracted
(
SOrder
sOrder
)
{
//查询是否有上级
LambdaQueryWrapper
<
SharingActivities
>
sharingActivitiesLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities:
:
getNewUid
,
sOrder
.
getConsumerId
());
...
...
@@ -447,45 +487,7 @@ public class RedisTask {
}
}
}
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
// 修改房间状态
SRoom
room
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
ObjectUtil
.
isNotEmpty
(
room
))
{
room
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
room
.
setUpdateTime
(
new
Date
());
roomService
.
updateById
(
room
);
}
//判断订单是否已经添加保洁记录
SCleanRecords
cleanRecords
=
isCleanRecordsService
.
lastCleanByRoomId
(
sOrder
.
getRoomId
());
if
(
ObjectUtils
.
isEmpty
(
cleanRecords
)
||
cleanRecords
.
getStatus
().
compareTo
(
CleaningStatusEnum
.
UNCLEAN
.
getCode
())
!=
0
)
{
boolean
b
=
isCleanRecordsService
.
addSCleanRecords
(
sOrder
.
getStoreId
(),
sOrder
.
getRoomId
());
}
//删除redis中的值
redisUtil
.
delete
(
o
);
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
//延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
false
,
0L
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
//当前时间加15分钟
Date
date
=
DateUtil
.
offsetMinute
(
sOrder
.
getEndDate
(),
15
);
map
.
put
(
"expirationTime"
,
date
.
toString
());
JSONObject
json
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ROOM_EXPIRE_TIME
.
getValue
()
+
sOrder
.
getOrderNo
(),
json
.
toString
());
logger
.
debug
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
}
});
logger
.
debug
(
"AutoAddSCleanRecords:自动添加保洁记录结束"
);
}
@XxlJob
(
"autoRoomExpireTime"
)
public
void
autoRoomExpireTime
()
{
logger
.
debug
(
"autoRoomExpireTime:房间15分钟续单开始"
);
...
...
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