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
d2e4c813
Commit
d2e4c813
authored
Dec 09, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open the door bugfix;
room status opt;
parent
9c6faff6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+8
-3
RoomStatusService.java
...src/main/java/share/system/service/RoomStatusService.java
+2
-1
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+13
-11
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+2
-2
No files found.
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
d2e4c813
...
@@ -4,6 +4,7 @@ import java.util.*;
...
@@ -4,6 +4,7 @@ import java.util.*;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -66,9 +67,13 @@ public class SRoomController extends BaseController {
...
@@ -66,9 +67,13 @@ public class SRoomController extends BaseController {
*/
*/
@ApiOperation
(
value
=
"房间状态(房间详情下单时段列表T+1天)"
)
@ApiOperation
(
value
=
"房间状态(房间详情下单时段列表T+1天)"
)
@RequestMapping
(
value
=
"/roomStatus"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/roomStatus"
,
method
=
RequestMethod
.
GET
)
public
R
<
List
<
RoomStatusVo
>>
getRoomStatus
(
@RequestParam
(
"storeId"
)
Long
storeId
public
R
<
List
<
RoomStatusVo
>>
getRoomStatus
(
,
@RequestParam
(
"roomId"
)
Long
roomId
,
@RequestParam
(
"day"
)
Date
day
)
{
@ApiParam
(
name
=
"storeId"
,
value
=
"门店ID"
,
required
=
true
)
@RequestParam
(
"storeId"
)
Long
storeId
return
R
.
ok
(
roomStatusService
.
roomStatus
(
storeId
,
roomId
,
day
));
,
@ApiParam
(
name
=
"roomId"
,
value
=
"房间ID"
,
required
=
true
)
@RequestParam
(
"roomId"
)
Long
roomId
,
@ApiParam
(
name
=
"day"
,
value
=
"下单选择的日期"
,
required
=
true
)
@RequestParam
(
"day"
)
Date
day
,
@ApiParam
(
name
=
"orderType"
,
value
=
"订单类型 1:预约;2:续单"
,
defaultValue
=
"1"
)
@RequestParam
(
value
=
"orderType"
,
defaultValue
=
"1"
)
Integer
orderType
)
{
return
R
.
ok
(
roomStatusService
.
roomStatus
(
storeId
,
roomId
,
day
,
orderType
));
}
}
/**
/**
...
...
share-system/src/main/java/share/system/service/RoomStatusService.java
View file @
d2e4c813
...
@@ -15,8 +15,9 @@ public interface RoomStatusService {
...
@@ -15,8 +15,9 @@ public interface RoomStatusService {
* 通过门店ID,房间ID,日期查询房间T+1天时段状态
* 通过门店ID,房间ID,日期查询房间T+1天时段状态
* @param storeId
* @param storeId
* @param roomId
* @param roomId
* @param orderType
* @return List<RoomStatusVo>
* @return List<RoomStatusVo>
*/
*/
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
);
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
,
Integer
orderType
);
}
}
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
d2e4c813
...
@@ -4,6 +4,7 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -4,6 +4,7 @@ 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.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
;
...
@@ -39,7 +40,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -39,7 +40,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
private
SConsumerService
consumerService
;
private
SConsumerService
consumerService
;
@Override
@Override
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
)
{
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
,
Integer
orderType
)
{
SConsumer
user
=
consumerService
.
getInfo
();
SConsumer
user
=
consumerService
.
getInfo
();
if
(
user
!=
null
){
if
(
user
!=
null
){
FrontTokenComponent
.
loginSConsumerEntryThreadLocal
.
set
(
user
);
FrontTokenComponent
.
loginSConsumerEntryThreadLocal
.
set
(
user
);
...
@@ -48,12 +49,12 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -48,12 +49,12 @@ 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
);
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
day
,
orderType
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
DateUtils
.
addDays
(
day
,
1
)));
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
DateUtils
.
addDays
(
day
,
1
)
,
orderType
));
return
voList
;
return
voList
;
}
}
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
Date
day
){
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
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
)
...
@@ -77,14 +78,14 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -77,14 +78,14 @@ 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
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
orderList
,
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
){
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
());
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
//门店存在营业时间
//门店存在营业时间
if
(
StringUtils
.
isNotBlank
(
store
.
getOpenStartTime
()))
{
if
(
StringUtils
.
isNotBlank
(
store
.
getOpenStartTime
()))
{
...
@@ -126,18 +127,19 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -126,18 +127,19 @@ public class RoomStatusServiceImpl implements RoomStatusService {
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
}
}
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
}
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
){
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
Integer
orderType
){
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
consumerService
.
getInfo
();
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
orderList
.
stream
().
forEach
(
order
->
{
orderList
.
stream
().
forEach
(
order
->
{
Date
orderStartDate
=
Objects
.
nonNull
(
order
.
getStartDate
())?
order
.
getStartDate
():
order
.
getPreStartDate
();
Date
orderStartDate
=
Objects
.
nonNull
(
order
.
getStartDate
())?
order
.
getStartDate
():
order
.
getPreStartDate
();
Date
orderEndDate
=
Objects
.
nonNull
(
order
.
getEndDate
())?
order
.
getEndDate
():
order
.
getPreEndDate
();
Date
orderEndDate
=
Objects
.
nonNull
(
order
.
getEndDate
())?
order
.
getEndDate
():
order
.
getPreEndDate
();
//如果
当前用户已登陆,并且在已下单的房间下单,不
计算当前订单的保洁时间
//如果
订单类型为预约,或者当前当前登陆用户为空,或者当前当前登陆用户ID为空,或者订单不属于当前用户,
计算当前订单的保洁时间
//否则开始时间-30分钟保洁时间,结束时间+30分钟保洁时间
//否则开始时间-30分钟保洁时间,结束时间+30分钟保洁时间
if
(
Objects
.
isNull
(
user
)||
Objects
.
isNull
(
user
.
getId
())||
order
.
getConsumerId
().
compareTo
(
user
.
getId
())!=
0
){
if
(
OrderTypeEnum
.
RESERVER
.
getCode
().
compareTo
(
orderType
)==
0
||
Objects
.
isNull
(
user
)||
Objects
.
isNull
(
user
.
getId
())||
order
.
getConsumerId
().
compareTo
(
user
.
getId
())!=
0
){
orderEndDate
=
DateUtils
.
addMinutes
(
orderEndDate
,
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
orderEndDate
=
DateUtils
.
addMinutes
(
orderEndDate
,
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
orderStartDate
=
DateUtils
.
addMinutes
(
orderEndDate
,-
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
orderStartDate
=
DateUtils
.
addMinutes
(
orderEndDate
,-
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
}
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
d2e4c813
...
@@ -891,8 +891,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -891,8 +891,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
}
}
//判断预约时间是否到达,可提前一个小时开门
//判断预约时间是否到达,可提前一个小时开门
if
(
DateUtils
.
addHours
(
sOrder
.
getPreStartDate
(),
-
Constants
.
OPEN_DOOR_AHEAD_HOUR
).
compareTo
(
new
Date
())<
0
){
if
(
DateUtils
.
addHours
(
sOrder
.
getPreStartDate
(),
Constants
.
OPEN_DOOR_AHEAD_HOUR
).
compareTo
(
new
Date
())<
0
){
throw
new
BaseException
(
"预约时间未到达,可提前"
+
Constants
.
OPEN_DOOR_AHEAD_HOUR
+
"进场,请耐心等候!"
);
throw
new
BaseException
(
"预约时间未到达,可提前"
+
Constants
.
OPEN_DOOR_AHEAD_HOUR
+
"
小时
进场,请耐心等候!"
);
}
}
//更改订单状态,房间状态,开始时间,结束时间
//更改订单状态,房间状态,开始时间,结束时间
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
...
...
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