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
7bbda839
Commit
7bbda839
authored
Mar 14, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
换房接口增加复验
parent
42c80f85
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
19 deletions
+36
-19
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+6
-2
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+1
-1
ISRoomService.java
...tem/src/main/java/share/system/service/ISRoomService.java
+5
-4
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+23
-11
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+1
-1
No files found.
share-admin/src/main/java/share/web/controller/system/SOrderController.java
View file @
7bbda839
...
...
@@ -138,7 +138,7 @@ public class SOrderController extends BaseController
//查询当前门店可更换房间列表
@GetMapping
(
"/changeRoomList"
)
public
AjaxResult
changeRoomList
(
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
changeRoomList
(
Long
id
)
{
return
success
(
sOrderService
.
changeRoomList
(
id
));
}
...
...
@@ -147,7 +147,11 @@ public class SOrderController extends BaseController
*/
@PostMapping
(
"/changeRoom"
)
public
AjaxResult
changeRoom
(
@RequestBody
SOrderDto
dto
)
{
return
success
(
sOrderService
.
changeRoom
(
dto
));
if
(
sOrderService
.
changeRoom
(
dto
))
{
return
success
(
"更换房间成功"
);
}
else
{
return
error
(
"房间已被预定,更换房间失败"
);
}
}
...
...
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
7bbda839
...
...
@@ -207,5 +207,5 @@ public interface ISOrderService extends IService<SOrder>
List
<
SRoomVo
>
changeRoomList
(
Long
id
);
String
changeRoom
(
SOrderDto
dto
);
Boolean
changeRoom
(
SOrderDto
dto
);
}
share-system/src/main/java/share/system/service/ISRoomService.java
View file @
7bbda839
package
share
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Device
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.SRoomVo
;
import
java.util.List
;
import
java.util.Map
;
/**
* 房间Service接口
*
...
...
@@ -107,4 +106,6 @@ public interface ISRoomService extends IService<SRoom>
List
<
Map
>
queryRoomList
();
List
<
SRoom
>
selectByStoreIds
(
List
<
Long
>
storeIds
);
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
);
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
7bbda839
...
...
@@ -517,6 +517,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
LambdaQueryWrapper
<
SCleanRecords
>
cleanRecordsQueryWrapper
=
new
LambdaQueryWrapper
<>();
cleanRecordsQueryWrapper
.
in
(
SCleanRecords:
:
getRoomId
,
roomIds
);
cleanRecordsQueryWrapper
.
ne
(
SCleanRecords:
:
getStatus
,
CleaningStatusEnum
.
CLEANED
.
getCode
());
//七天内
cleanRecordsQueryWrapper
.
ge
(
SCleanRecords:
:
getCreateTime
,
DateUtils
.
addDays
(
new
Date
(),
-
7
));
List
<
SCleanRecords
>
sCleanRecords
=
isCleanRecordsService
.
list
(
cleanRecordsQueryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
sCleanRecords
))
{
//去掉保洁中的房间
...
...
@@ -531,11 +533,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//查询剩余房间的订单时段是否被占用
LambdaQueryWrapper
<
SOrder
>
sOrderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sOrderLambdaQueryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
sOrderLambdaQueryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
get
Valid
OrderStatus
());
sOrderLambdaQueryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
get
Unfinish
OrderStatus
());
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getStoreId
,
sOrder
.
getStoreId
());
sOrderLambdaQueryWrapper
.
in
(
SOrder:
:
getRoomId
,
list
.
stream
().
map
(
SRoom:
:
getId
).
collect
(
Collectors
.
toList
()));
q
ueryWrapper
.
apply
(
"(IFNULL(start_date,pre_start_date) BETWEEN '"
sOrderLambdaQ
ueryWrapper
.
apply
(
"(IFNULL(start_date,pre_start_date) BETWEEN '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
sOrder
.
getPreStartDate
())
+
"' AND '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
DateUtils
.
addMinutes
(
sOrder
.
getPreEndDate
(),
Constants
.
ROOM_LOCK_DELAY_MINUTE
))
+
"' "
+
"OR IFNULL(end_date,pre_end_date) BETWEEN '"
...
...
@@ -547,16 +549,28 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
List
<
Long
>
orderRoomIds
=
Optional
.
ofNullable
(
orderList
).
orElse
(
new
ArrayList
<>()).
parallelStream
().
map
(
SOrder:
:
getRoomId
).
collect
(
Collectors
.
toList
());
list
=
list
.
stream
().
filter
(
sRoom
->
!
orderRoomIds
.
contains
(
sRoom
.
getId
())).
collect
(
Collectors
.
toList
());
}
return
list
.
stream
().
map
(
sRoom
->
{
SRoomVo
sRoomVo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
sRoom
,
sRoomVo
);
return
sRoomVo
;
}).
collect
(
Collectors
.
toList
());
return
roomService
.
convertDoListToVoList
(
list
);
}
@Override
public
String
changeRoom
(
SOrderDto
dto
)
{
public
Boolean
changeRoom
(
SOrderDto
dto
)
{
SOrder
sOrder
=
getById
(
dto
.
getId
());
LambdaQueryWrapper
<
SOrder
>
sOrderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sOrderLambdaQueryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
sOrderLambdaQueryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getUnfinishOrderStatus
());
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getStoreId
,
sOrder
.
getStoreId
());
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getRoomId
,
dto
.
getRoomId
());
sOrderLambdaQueryWrapper
.
apply
(
"(IFNULL(start_date,pre_start_date) BETWEEN '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
sOrder
.
getPreStartDate
())
+
"' AND '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
DateUtils
.
addMinutes
(
sOrder
.
getPreEndDate
(),
Constants
.
ROOM_LOCK_DELAY_MINUTE
))
+
"' "
+
"OR IFNULL(end_date,pre_end_date) BETWEEN '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
DateUtils
.
addMinutes
(
sOrder
.
getPreStartDate
(),
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
))
+
"' AND '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
sOrder
.
getPreEndDate
())
+
"' )"
);
List
<
SOrder
>
orderList
=
list
(
sOrderLambdaQueryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
return
false
;
}
// 判断原房间是否生成保洁
if
(
dto
.
getIsClean
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
//判断订单是否已经添加保洁记录
...
...
@@ -577,10 +591,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sRoom
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
roomService
.
updateById
(
sRoom
);
}
//发送短信
sOrder
.
setRoomId
(
dto
.
getRoomId
());
updateById
(
sOrder
);
return
null
;
return
updateById
(
sOrder
);
}
/**
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
7bbda839
...
...
@@ -407,7 +407,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
p
rivate
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
)
{
p
ublic
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
)
{
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
roomList
.
stream
().
forEach
(
o
->
{
...
...
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