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
d7e9de3a
Commit
d7e9de3a
authored
Jan 15, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单结束且保洁结束解除房间锁定可预约
parent
9a681d57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
19 deletions
+53
-19
ISCleanRecordsService.java
...main/java/share/system/service/ISCleanRecordsService.java
+2
-0
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+24
-12
SCleanRecordsServiceImpl.java
...a/share/system/service/impl/SCleanRecordsServiceImpl.java
+14
-5
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+13
-2
No files found.
share-system/src/main/java/share/system/service/ISCleanRecordsService.java
View file @
d7e9de3a
...
@@ -87,6 +87,8 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
...
@@ -87,6 +87,8 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
List
<
SCleanRecords
>
unCleanedListByRoomIds
(
List
<
Long
>
roomIds
);
List
<
SCleanRecords
>
unCleanedListByRoomIds
(
List
<
Long
>
roomIds
);
SCleanRecords
lastCleanByRoomId
(
Long
roomId
);
/**
/**
* 结束保洁
* 结束保洁
* @param sCleanRecords
* @param sCleanRecords
...
...
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
d7e9de3a
...
@@ -4,19 +4,19 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -4,19 +4,19 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.Constants
;
import
share.common.constant.Constants
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.OrderStatusEnum
;
import
share.common.enums.OrderTypeEnum
;
import
share.common.enums.OrderTypeEnum
;
import
share.common.enums.RoomStatusEnum
;
import
share.common.enums.RoomStatusEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
share.common.utils.StringUtils
;
import
share.common.utils.StringUtils
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SOrder
;
import
share.system.domain.SOrder
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.service.ISOrderService
;
import
share.system.service.*
;
import
share.system.service.ISStoreService
;
import
share.system.service.RoomStatusService
;
import
share.system.service.SConsumerService
;
import
java.util.*
;
import
java.util.*
;
...
@@ -39,6 +39,9 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -39,6 +39,9 @@ public class RoomStatusServiceImpl implements RoomStatusService {
@Autowired
@Autowired
private
SConsumerService
consumerService
;
private
SConsumerService
consumerService
;
@Autowired
private
ISCleanRecordsService
cleanRecordsService
;
@Override
@Override
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
,
Integer
orderType
)
{
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
,
Integer
orderType
)
{
SConsumer
user
=
consumerService
.
getInfo
();
SConsumer
user
=
consumerService
.
getInfo
();
...
@@ -49,12 +52,13 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -49,12 +52,13 @@ public class RoomStatusServiceImpl implements RoomStatusService {
SStore
store
=
storeService
.
getById
(
storeId
);
SStore
store
=
storeService
.
getById
(
storeId
);
// 通过门店及房间查询指定日期T+1的订单
// 通过门店及房间查询指定日期T+1的订单
List
<
SOrder
>
orderList
=
orderService
.
listByRoomInfo
(
storeId
,
roomId
,
day
);
List
<
SOrder
>
orderList
=
orderService
.
listByRoomInfo
(
storeId
,
roomId
,
day
);
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
day
,
orderType
);
SCleanRecords
cleanRecords
=
cleanRecordsService
.
lastCleanByRoomId
(
roomId
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
DateUtils
.
addDays
(
day
,
1
),
orderType
));
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
cleanRecords
,
day
,
orderType
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
cleanRecords
,
DateUtils
.
addDays
(
day
,
1
),
orderType
));
return
voList
;
return
voList
;
}
}
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
Date
day
,
Integer
orderType
){
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
Date
day
,
Integer
orderType
){
String
nowTime
=
"00:00"
;
String
nowTime
=
"00:00"
;
String
dayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
);
String
dayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
);
Boolean
isToday
=
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
Boolean
isToday
=
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
...
@@ -78,19 +82,19 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -78,19 +82,19 @@ public class RoomStatusServiceImpl implements RoomStatusService {
vo
.
setRoomId
(
roomId
);
vo
.
setRoomId
(
roomId
);
vo
.
setTimeHour
(
timeHour
);
vo
.
setTimeHour
(
timeHour
);
Date
timeHourDate
=
DateUtils
.
parseDate
(
timeHour
);
Date
timeHourDate
=
DateUtils
.
parseDate
(
timeHour
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
orderList
,
dayStr
,
finalNowTime
,
isToday
,
orderType
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
orderList
,
cleanRecords
,
dayStr
,
finalNowTime
,
isToday
,
orderType
);
voList
.
add
(
vo
);
voList
.
add
(
vo
);
});
});
return
voList
;
return
voList
;
}
}
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
){
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
S
CleanRecords
cleanRecords
,
S
tring
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
){
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
cleanRecords
,
orderType
);
}
}
private
void
changeEndHoldTime
(
RoomStatusVo
vo
,
Date
date
){
private
void
changeEndHoldTime
(
RoomStatusVo
vo
,
Date
date
){
...
@@ -151,7 +155,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -151,7 +155,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
}
}
}
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
Integer
orderType
){
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
Integer
orderType
){
SConsumer
user
=
consumerService
.
getInfo
();
SConsumer
user
=
consumerService
.
getInfo
();
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
orderList
.
stream
().
forEach
(
order
->
{
orderList
.
stream
().
forEach
(
order
->
{
...
@@ -161,7 +165,15 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -161,7 +165,15 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//否则开始时间-30分钟保洁时间,结束时间+30分钟保洁时间
//否则开始时间-30分钟保洁时间,结束时间+30分钟保洁时间
if
(
OrderTypeEnum
.
RESERVER
.
getCode
().
compareTo
(
orderType
)==
0
if
(
OrderTypeEnum
.
RESERVER
.
getCode
().
compareTo
(
orderType
)==
0
||
Objects
.
isNull
(
user
)||
Objects
.
isNull
(
user
.
getId
())||
order
.
getConsumerId
().
compareTo
(
user
.
getId
())!=
0
){
||
Objects
.
isNull
(
user
)||
Objects
.
isNull
(
user
.
getId
())||
order
.
getConsumerId
().
compareTo
(
user
.
getId
())!=
0
){
orderEndDate
=
DateUtils
.
addMinutes
(
orderEndDate
,
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
if
(
order
.
getStatus
().
compareTo
(
OrderStatusEnum
.
USED
.
getCode
())==
0
&&
Objects
.
nonNull
(
cleanRecords
)
&&
cleanRecords
.
getStatus
().
compareTo
(
CleaningStatusEnum
.
CLEANED
.
getCode
())==
0
)
{
if
(
cleanRecords
.
getEndDate
().
compareTo
(
orderEndDate
)>
0
){
//如果订单结束 并且 最后一个保洁订单为保洁结束 并且保洁结束时间大于订单结束时间,设置结束时间为保洁结束时间
orderEndDate
=
cleanRecords
.
getEndDate
();
}
}
else
{
orderEndDate
=
DateUtils
.
addMinutes
(
orderEndDate
,
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
}
orderStartDate
=
DateUtils
.
addMinutes
(
orderStartDate
,
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
orderStartDate
=
DateUtils
.
addMinutes
(
orderStartDate
,
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
}
}
...
...
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
d7e9de3a
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
...
@@ -265,6 +261,19 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
...
@@ -265,6 +261,19 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
}
}
@Override
@Override
public
SCleanRecords
lastCleanByRoomId
(
Long
roomId
)
{
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SCleanRecords:
:
getRoomId
,
roomId
);
queryWrapper
.
gt
(
SCleanRecords:
:
getCreateTime
,
DateUtils
.
addDays
(
new
Date
(),-
1
));
List
<
SCleanRecords
>
records
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
records
)){
Optional
<
SCleanRecords
>
cleanRecords
=
records
.
stream
().
max
(
Comparator
.
comparing
(
SCleanRecords:
:
getCreateTime
));
return
cleanRecords
.
orElse
(
null
);
}
return
null
;
}
@Override
public
int
endCleanRecords
(
SCleanRecords
sCleanRecords
)
{
public
int
endCleanRecords
(
SCleanRecords
sCleanRecords
)
{
SCleanRecords
records
=
baseMapper
.
selectSCleanRecordsById
(
sCleanRecords
.
getId
());
SCleanRecords
records
=
baseMapper
.
selectSCleanRecordsById
(
sCleanRecords
.
getId
());
if
(
records
==
null
)
{
if
(
records
==
null
)
{
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
d7e9de3a
...
@@ -20,7 +20,6 @@ import org.slf4j.Logger;
...
@@ -20,7 +20,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
share.common.constant.Constants
;
import
share.common.constant.Constants
;
import
share.common.core.redis.RedisUtil
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.enums.*
;
...
@@ -100,6 +99,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -100,6 +99,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
@Autowired
private
SmsService
smsService
;
private
SmsService
smsService
;
@Autowired
private
ISCleanRecordsService
cleanRecordsService
;
/**
/**
* 查询订单
* 查询订单
...
@@ -464,9 +466,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -464,9 +466,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
Optional
<
SOrder
>
lastOrderOp
=
orderList
.
stream
().
max
(
Comparator
.
comparing
(
SOrder:
:
getPreEndDate
));
SOrder
lastOrder
=
lastOrderOp
.
orElse
(
null
);
if
(
Objects
.
nonNull
(
lastOrder
)&&
Objects
.
nonNull
(
lastOrder
.
getEndDate
())){
SCleanRecords
sCleanRecords
=
cleanRecordsService
.
lastCleanByRoomId
(
lastOrder
.
getRoomId
());
if
(
sCleanRecords
.
getStatus
().
compareTo
(
CleaningStatusEnum
.
CLEANED
.
getCode
())==
0
&&
sCleanRecords
.
getEndDate
().
compareTo
(
lastOrder
.
getEndDate
())>
0
&&
sCleanRecords
.
getEndDate
().
compareTo
(
request
.
getPreStartDate
())<
0
){
return
;
}
}
throw
new
BaseException
(
"下单时间已被预定!"
);
throw
new
BaseException
(
"下单时间已被预定!"
);
}
}
}
}
private
void
checkOrderPrice
(
SOrder
order
,
SConsumer
user
)
{
private
void
checkOrderPrice
(
SOrder
order
,
SConsumer
user
)
{
...
...
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