Commit 4dfba59d by 吕明尚

修改定时任务,房间状态

parent ecd35dd7
......@@ -19,7 +19,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
......@@ -328,13 +327,13 @@ public class RedisTask {
redisUtil.delete(o);
throw new BaseException("订单不存在!");
}
if (extracted(o, sOrders, sOrder)) return;
//更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode());
isOrderService.updateById(sOrder);
//查询当前用户是否只有一个订单
LambdaQueryWrapper<SOrder> sOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
sOrderLambdaQueryWrapper.eq(SOrder :: getConsumerId,sOrder.getConsumerId());
sOrderLambdaQueryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
sOrderLambdaQueryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
sOrderLambdaQueryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
List<SOrder> sOrderList = isOrderService.list(sOrderLambdaQueryWrapper);
if (sOrderList.size() == 1){
//查询是否有上级
......@@ -370,6 +369,10 @@ public class RedisTask {
}
}
}
if (extracted(o, sOrders, sOrder)) return;
//更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode());
isOrderService.updateById(sOrder);
// 修改房间状态
SRoom room = roomService.getById(sOrder.getRoomId());
if (ObjectUtil.isNotEmpty(room)) {
......
......@@ -304,12 +304,15 @@ public class RoomStatusServiceImpl implements RoomStatusService {
}
}
} else {
// orderEndDate = DateUtils.addMinutes(orderEndDate, Constants.ROOM_LOCK_DELAY_MINUTE);
orderEndDate = DateUtils.addMinutes(orderEndDate, Constants.ROMM_LOCK_LAZY_MINUTE);
orderEndDate = DateUtils.addMinutes(orderEndDate, Constants.ROOM_LOCK_DELAY_MINUTE);
// orderEndDate = DateUtils.addMinutes(orderEndDate, Constants.ROMM_LOCK_LAZY_MINUTE);
}
}
// orderStartDate = DateUtils.addMinutes(orderStartDate, -Constants.ROOM_LOCK_DELAY_MINUTE);
orderStartDate = DateUtils.addMinutes(orderStartDate, -Constants.ROMM_LOCK_LAZY_MINUTE);
if (OrderTypeEnum.RESERVER.getCode().compareTo(orderType) == 0) {
orderStartDate = DateUtils.addMinutes(orderStartDate, -Constants.ROOM_LOCK_DELAY_MINUTE);
} else {
orderStartDate = DateUtils.addMinutes(orderStartDate, -Constants.ROMM_LOCK_LAZY_MINUTE);
}
}
if (DateUtils.addSeconds(timeHourDate, 59 * 60 + 59).compareTo(orderStartDate) >= 0 && timeHourDate.compareTo(orderEndDate) <= 0) {
......
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