Commit 499d0f24 by 吕明尚

修改预约订单时间判断

parent 7081577b
......@@ -1070,7 +1070,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (CollectionUtils.isNotEmpty(orderList)) {
Optional<SOrder> lastOrderOp = orderList.stream().max(Comparator.comparing(SOrder::getPreEndDate));
SOrder lastOrder = lastOrderOp.orElse(null);
if (Objects.nonNull(lastOrder) && Objects.nonNull(lastOrder.getEndDate()) && DateUtils.addMinutes(lastOrder.getEndDate(), Constants.ROOM_LOCK_DELAY_MINUTE).compareTo(request.getPreStartDate()) < 0) {
if (Objects.nonNull(lastOrder) && Objects.nonNull(lastOrder.getEndDate())) {
if (request.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
if (!(DateUtils.addMinutes(lastOrder.getEndDate(), Constants.ROOM_LOCK_DELAY_MINUTE).compareTo(request.getPreStartDate()) < 0)) {
throw new BaseException("下单时间已被预定!");
}
} else if (request.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
if (!(lastOrder.getEndDate().compareTo(request.getPreStartDate()) < 0)) {
throw new BaseException("下单时间已被预定!");
}
}
if (lastOrder.getConsumerId().equals(user.getId())) {
return;
}
......
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