Commit b1e633ed by YG8999

去掉房间最后预定时间查询

parent 28dfeabc
...@@ -137,12 +137,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -137,12 +137,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode()); wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
List<SOrder> list = orderService.list(wrapper); List<SOrder> list = orderService.list(wrapper);
// 查询每一个房间最后一条预定订单下单时间 // 查询每一个房间最后一条预定订单下单时间
Date now = DateUtil.date(); // Date now = DateUtil.date();
SOrder orderQuery = new SOrder(); // SOrder orderQuery = new SOrder();
orderQuery.setStoreId(store.getId()); // orderQuery.setStoreId(store.getId());
orderQuery.setCreateTime(now); // orderQuery.setCreateTime(now);
List<SOrder> orderList = orderService.selectSOrderByMaxTime(orderQuery); // List<SOrder> orderList = orderService.selectSOrderByMaxTime(orderQuery);
Map<Long, SOrder> roomOrder = Optional.ofNullable(orderList).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(SOrder::getRoomId, Function.identity())); // Map<Long, SOrder> roomOrder = Optional.ofNullable(orderList).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(SOrder::getRoomId, Function.identity()));
roomList.stream().forEach(sRoom -> { roomList.stream().forEach(sRoom -> {
SRoomVo vo = new SRoomVo(); SRoomVo vo = new SRoomVo();
...@@ -174,22 +174,22 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements ...@@ -174,22 +174,22 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}); });
} }
// 计算当天预定最后预定时间 // 计算当天预定最后预定时间
SOrder order = roomOrder.get(vo.getId()); // SOrder order = roomOrder.get(vo.getId());
if (order != null) { // if (order != null) {
long betweenMinute = DateUtil.between(order.getCreateTime(), now, DateUnit.MINUTE); // long betweenMinute = DateUtil.between(order.getCreateTime(), now, DateUnit.MINUTE);
if (betweenMinute < 60) { // if (betweenMinute < 60) {
vo.setOrderTimeType(1); // vo.setOrderTimeType(1);
vo.setOrderTime(betweenMinute); // vo.setOrderTime(betweenMinute);
} else { // } else {
long betweenHour = DateUtil.between(order.getCreateTime(), now, DateUnit.HOUR); // long betweenHour = DateUtil.between(order.getCreateTime(), now, DateUnit.HOUR);
vo.setOrderTimeType(2); // vo.setOrderTimeType(2);
vo.setOrderTime(betweenHour); // vo.setOrderTime(betweenHour);
} // }
vo.setOrderType(order.getOrderType()); // vo.setOrderType(order.getOrderType());
} else { // } else {
vo.setOrderTimeType(0); // vo.setOrderTimeType(0);
vo.setOrderTime(0L); // vo.setOrderTime(0L);
} // }
voList.add(vo); voList.add(vo);
}); });
} }
......
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