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
2214de02
Commit
2214de02
authored
Jan 13, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
room status bugfix;
parent
88b3b5b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+35
-14
No files found.
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
2214de02
...
...
@@ -87,47 +87,68 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
){
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
}
private
void
changeEndHoldTime
(
RoomStatusVo
vo
,
Date
date
){
if
(
vo
.
getEndHoldTime
().
compareTo
(
date
)<
0
){
vo
.
setEndHoldTime
(
date
);
}
}
private
void
changeStartHoldTime
(
RoomStatusVo
vo
,
Date
date
){
if
(
vo
.
getStartHoldTime
().
compareTo
(
date
)>
0
){
vo
.
setStartHoldTime
(
date
);
}
}
private
void
checkTimeHourToBusiness
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
String
day
){
//门店存在营业时间
if
(
StringUtils
.
isNotBlank
(
store
.
getOpenStartTime
()))
{
//当前时段小于营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()))
==
-
1
)
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
().
split
(
":"
)[
0
]))
==
0
)
{
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()));
changeEndHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()));
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
//当前时段大于营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()))
==
1
&&
!
StringUtils
.
equals
(
store
.
getOpenStartTime
(),
"00:00"
))
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
//判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
().
split
(
":"
)[
0
]))
==
0
)
{
vo
.
setStartHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
changeStartHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
}
else
{
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
}
}
}
}
private
void
checkTimeHourToSysDate
(
RoomStatusVo
vo
,
Date
timeHourDate
,
String
day
,
String
finalNowTime
,
Boolean
isToday
){
//当前时段小于当前时间
if
(
isToday
&&
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
))==-
1
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为当前时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
.
split
(
":"
)[
0
]))
==
0
){
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
changeEndHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
Integer
orderType
){
...
...
@@ -149,18 +170,18 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用开始时间为订单开始时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
vo
.
setStartHoldTime
(
orderStartDate
);
changeStartHoldTime
(
vo
,
orderStartDate
);
}
else
{
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
}
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用结束时间为订单结束时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderEndDate
))){
vo
.
setEndHoldTime
(
orderEndDate
);
changeEndHoldTime
(
vo
,
orderEndDate
);
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
});
...
...
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