Commit 9d50bd7d by wuwenlong

room status opt;

parent 33261ee5
...@@ -15,6 +15,8 @@ import share.system.domain.vo.RoomStatusVo; ...@@ -15,6 +15,8 @@ import share.system.domain.vo.RoomStatusVo;
import share.system.service.ISOrderService; import share.system.service.ISOrderService;
import share.system.service.ISStoreService; import share.system.service.ISStoreService;
import share.system.service.RoomStatusService; import share.system.service.RoomStatusService;
import share.system.service.SConsumerService;
import java.util.*; import java.util.*;
/** /**
...@@ -33,9 +35,15 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -33,9 +35,15 @@ public class RoomStatusServiceImpl implements RoomStatusService {
@Autowired @Autowired
private ISOrderService orderService; private ISOrderService orderService;
@Autowired
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) {
SConsumer user = consumerService.getInfo();
if(user!=null){
FrontTokenComponent.loginSConsumerEntryThreadLocal.set(user);
}
//查询门店营业时间 //查询门店营业时间
SStore store = storeService.getById(storeId); SStore store = storeService.getById(storeId);
// 通过门店及房间查询指定日期T+1的订单 // 通过门店及房间查询指定日期T+1的订单
...@@ -135,21 +143,21 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -135,21 +143,21 @@ public class RoomStatusServiceImpl implements RoomStatusService {
if (DateUtils.addSeconds(timeHourDate, 59 * 60 + 59).compareTo(orderStartDate) >= 0 && timeHourDate.compareTo(orderEndDate) < 0) { if (DateUtils.addSeconds(timeHourDate, 59 * 60 + 59).compareTo(orderStartDate) >= 0 && timeHourDate.compareTo(orderEndDate) < 0) {
vo.setStatus(RoomStatusEnum.HOLD.getValue()); vo.setStatus(RoomStatusEnum.HOLD.getValue());
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用结束时间为订单开始时间 //判断订单开始时间是否是同一个小时,如果是同一个小时,占用开始时间为订单开始时间
if(StringUtils.equals(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,timeHourDate) if(StringUtils.equals(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,timeHourDate)
,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,orderStartDate))){ ,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,orderStartDate))){
vo.setEndHoldTime(orderStartDate); vo.setStartHoldTime(orderStartDate);
}else { }else {
//占用结束时间为当前时段59分59 //占用开始时间为当前时段0分0
vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59)); vo.setStartHoldTime(timeHourDate);
} }
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用开始时间为订单结束时间 //判断订单结束时间是否是同一个小时,如果是同一个小时,占用结束时间为订单结束时间
if(StringUtils.equals(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,timeHourDate) if(StringUtils.equals(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,timeHourDate)
,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,orderStartDate))){ ,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,orderEndDate))){
vo.setStartHoldTime(orderEndDate); vo.setEndHoldTime(orderEndDate);
}else { }else {
//占用开始时间为当前时段0分0 //占用结束时间为当前时段59分59
vo.setStartHoldTime(timeHourDate); vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment