Commit b1e633ed by YG8999

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

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