Commit af2a03cd by 吕明尚

修改续单

parent 8466fca6
...@@ -100,22 +100,22 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -100,22 +100,22 @@ public class RoomStatusServiceImpl implements RoomStatusService {
if (orderType.equals(OrderTypeEnum.RENEW.getCode())) { if (orderType.equals(OrderTypeEnum.RENEW.getCode())) {
if (CollectionUtils.isNotEmpty(orderList)) { if (CollectionUtils.isNotEmpty(orderList)) {
//查询当前用户是否有使用中的订单 //查询当前用户是否有使用中的订单
orderList = orderList.stream().filter(order -> order.getConsumerId().compareTo(user.getId()) == 0).collect(Collectors.toList()); orderList = orderList.stream().filter(order -> order.getConsumerId().compareTo(user.getId()) == 0 && order.getStatus().equals(OrderStatusEnum.INUSE.getCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(orderList)) { if (CollectionUtils.isNotEmpty(orderList)) {
isAvailable = true;
}
} else {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, room.getId());
queryWrapper.eq(SOrder::getConsumerId, user.getId());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.USED.getCode(), OrderStatusEnum.INUSE.getCode());
//当前时间减15分钟前的订单
queryWrapper.ge(SOrder::getEndDate, DateUtils.addMinutes(DateUtils.getNowDate(), -15));
SOrder one = orderService.getOne(queryWrapper);
if (!ObjectUtils.isEmpty(one) | redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) {
isAvailable = true; isAvailable = true;
} else { } else {
isAvailable = false; LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, room.getId());
queryWrapper.eq(SOrder::getConsumerId, user.getId());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.USED.getCode(), OrderStatusEnum.INUSE.getCode());
//当前时间减15分钟前的订单
queryWrapper.ge(SOrder::getEndDate, DateUtils.addMinutes(DateUtils.getNowDate(), -15));
SOrder one = orderService.getOne(queryWrapper);
if (!ObjectUtils.isEmpty(one) | redisUtil.exists(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + one.getOrderNo())) {
isAvailable = true;
} else {
isAvailable = false;
}
} }
} }
} else { } else {
......
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