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
84dd371d
Commit
84dd371d
authored
Jul 24, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/dev' into test
parents
93246edb
eb645956
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
11 deletions
+43
-11
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+36
-10
ComputedOrderPriceResponse.java
...ava/share/system/response/ComputedOrderPriceResponse.java
+7
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+0
-0
No files found.
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
84dd371d
package
share
.
quartz
.
task
;
import
cn.hutool.core.date.DateField
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.*
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
...
...
@@ -15,6 +12,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.constant.Constants
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
...
...
@@ -72,6 +70,9 @@ public class OrderTask {
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
ISCleanRecordsService
isCleanRecordsService
;
final
int
ZERO
=
0
;
//10分钟的常量
...
...
@@ -324,16 +325,41 @@ public class OrderTask {
public
void
orderCompensate
()
{
// 订单状态处理
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
le
(
SOrder:
:
getEndDate
,
DateUtil
.
offset
(
DateUtil
.
date
(),
DateField
.
MINUTE
,
-
5
));
queryWrapper
.
le
(
SOrder:
:
getEndDate
,
DateUtil
.
offset
(
DateUtil
.
date
(),
DateField
.
MINUTE
,
-
2
));
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
UNUSED
.
getCode
(),
OrderStatusEnum
.
INUSE
.
getCode
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
1
);
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
()
);
List
<
SOrder
>
orders
=
orderService
.
list
(
queryWrapper
);
if
(
orders
!=
null
&&
orders
.
size
()
>
0
)
{
orders
.
forEach
(
order
->
{
order
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
order
.
setUpdateTime
(
new
Date
());
orders
.
stream
().
forEach
(
sOrder
->
{
logger
.
debug
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单异常"
);
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
sOrder
.
setUpdateTime
(
new
Date
());
orderService
.
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
());
}
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
());
logger
.
debug
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
// order.setStatus(OrderStatusEnum.USED.getCode());
// order.setUpdateTime(new Date());
});
orderService
.
updateBatchById
(
orders
,
orders
.
size
());
//
orderService.updateBatchById(orders,orders.size());
}
// 房间状态处理
LambdaQueryWrapper
<
SRoom
>
queryRoomWrapper
=
new
LambdaQueryWrapper
();
...
...
share-system/src/main/java/share/system/response/ComputedOrderPriceResponse.java
View file @
84dd371d
...
...
@@ -27,8 +27,14 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty
(
value
=
"实际支付金额"
)
private
BigDecimal
payFee
;
@ApiModelProperty
(
value
=
"总金额"
)
@ApiModelProperty
(
value
=
"
原
总金额"
)
private
BigDecimal
totalFee
;
//现总金额
@ApiModelProperty
(
value
=
"现总金额"
)
private
BigDecimal
totalFeeNow
;
//优惠折扣
@ApiModelProperty
(
value
=
"优惠折扣"
)
private
BigDecimal
discount
;
@ApiModelProperty
(
value
=
"优惠金额"
)
private
BigDecimal
discountFee
;
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
84dd371d
This diff is collapsed.
Click to expand it.
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