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
412e8cf5
Commit
412e8cf5
authored
Mar 28, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单开门增加订单状态判断,续单换房生成保洁增加原房间订单判断,退款生成保洁增加预定单的查询条件
parent
b1e633ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
19 deletions
+35
-19
OpenInterfaceServiceImpl.java
...a/share/system/service/impl/OpenInterfaceServiceImpl.java
+4
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+31
-19
No files found.
share-system/src/main/java/share/system/service/impl/OpenInterfaceServiceImpl.java
View file @
412e8cf5
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.Constants
;
...
...
@@ -88,6 +89,9 @@ public class OpenInterfaceServiceImpl implements OpenInterfaceService {
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
if
(!
ArrayUtils
.
contains
(
OrderStatusEnum
.
getUnfinishOrderStatus
(),
sOrder
.
getStatus
()))
{
throw
new
BaseException
(
"订单状态已更新,请刷新后重试!"
);
}
SRoomVo
sRoomVo
=
roomService
.
selectSRoomById
(
sOrder
.
getRoomId
());
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
412e8cf5
...
...
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -451,26 +452,31 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//查询预定的结束时间是否在续单的开始时间之后和开始时间加一分钟前
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getRoomId
,
oldSOrder
.
getRoomId
());
queryWrapper
.
eq
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
UNREFUND
.
getCode
());
//修改preStartDate的秒为59
preStartDate
=
DateUtil
.
addSecond
(
preStartDate
,
59
);
queryWrapper
.
between
(
SOrder:
:
getEndDate
,
DateUtil
.
addMin
(
preStartDate
,
-
15
),
preStartDate
);
SOrder
one
=
getOne
(
queryWrapper
);
if
(
one
.
getStatus
().
equals
(
OrderStatusEnum
.
USED
.
getCode
()))
{
if
(
one
.
getEndDate
().
getTime
()
>
new
Date
().
getTime
())
{
if
(!
ObjectUtils
.
isEmpty
(
one
))
{
if
(
one
.
getStatus
().
equals
(
OrderStatusEnum
.
USED
.
getCode
()))
{
if
(
one
.
getEndDate
().
getTime
()
>
new
Date
().
getTime
())
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
one
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
one
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
one
.
getOrderNo
(),
jsonObject
.
toString
());
}
else
{
// 使用中订单断电, 延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
false
,
0
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
}
else
if
(
one
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
one
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
one
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
one
.
getOrderNo
(),
jsonObject
.
toString
());
}
else
{
// 使用中订单断电, 延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
false
,
0
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
}
else
if
(
one
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
one
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
one
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
one
.
getOrderNo
(),
jsonObject
.
toString
());
}
}
// 如果订单使用中,房间修改状态
...
...
@@ -602,14 +608,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
return
false
;
}
List
<
SOrder
>
orders
=
list
(
new
LambdaQueryWrapper
<
SOrder
>()
.
eq
(
SOrder:
:
getRoomId
,
oldSOrder
.
getRoomId
())
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
INUSE
.
getCode
())
.
ne
(
SOrder:
:
getOrderNo
,
oldSOrder
.
getOrderNo
()));
// 判断原房间是否生成保洁
if
(
dto
.
getIsClean
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
//判断订单是否已经添加保洁记录
SCleanRecords
cleanRecords
=
isCleanRecordsService
.
lastCleanByRoomId
(
oldSOrder
.
getRoomId
());
if
(
CollectionUtils
.
isEmpty
(
list
(
new
LambdaQueryWrapper
<
SOrder
>()
.
eq
(
SOrder:
:
getRoomId
,
oldSOrder
.
getRoomId
())
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
INUSE
.
getCode
())
.
ne
(
SOrder:
:
getOrderNo
,
oldSOrder
.
getOrderNo
())))
&&
if
(
CollectionUtils
.
isEmpty
(
orders
)
&&
(
ObjectUtil
.
isEmpty
(
cleanRecords
)
||
cleanRecords
.
getStatus
().
equals
(
CleaningStatusEnum
.
CLEANED
.
getCode
())))
{
//房间添加保洁记录
isCleanRecordsService
.
addSCleanRecords
(
oldSOrder
.
getStoreId
(),
oldSOrder
.
getRoomId
());
...
...
@@ -625,9 +632,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
false
,
0
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
//修改原房间状态
SRoom
sRoom
=
new
SRoom
();
sRoom
.
setId
(
oldSOrder
.
getRoomId
());
sRoom
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
roomService
.
updateById
(
sRoom
);
if
(
CollectionUtils
.
isEmpty
(
orders
))
{
sRoom
.
setId
(
oldSOrder
.
getRoomId
());
sRoom
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
roomService
.
updateById
(
sRoom
);
}
//修改新房间状态
sRoom
.
setId
(
dto
.
getRoomId
());
sRoom
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
...
...
@@ -1582,6 +1591,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
if
(!
ArrayUtils
.
contains
(
OrderStatusEnum
.
getUnfinishOrderStatus
(),
sOrder
.
getStatus
()))
{
throw
new
BaseException
(
"订单状态已更新,请刷新后重试!"
);
}
SRoomVo
sRoomVo
=
roomService
.
selectSRoomById
(
sOrder
.
getRoomId
());
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
...
...
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