订单15分钟取消
This commit is contained in:
@@ -230,7 +230,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
//发送打票信息
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString());
|
||||
} else {
|
||||
// redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||
}
|
||||
rabbitPublisher.sendOrderStockMsg(orderInfo.getId().toString());
|
||||
return orderInfo;
|
||||
@@ -239,22 +239,29 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
@Override
|
||||
public OrderInfo checkOrderPay(CheckOrderPay param) {
|
||||
OrderInfo orderInfo = getById(param.getOrderId());
|
||||
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||
// if (redisService.hasKey(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId())) {
|
||||
// redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId(), "", 60 * 15);
|
||||
// } else {
|
||||
// throw new ValidateException("订单已过期,请重新下单");
|
||||
// }
|
||||
// }
|
||||
if (!orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||
throw new ValidateException("生成支付订单失败,订单不可支付");
|
||||
}
|
||||
if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||
if (redisService.hasKey(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId())) {
|
||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId(), "", 60 * 15);
|
||||
} else {
|
||||
if (!orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
|
||||
updateChain()
|
||||
.set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
|
||||
.eq(OrderInfo::getId, param.getOrderId())
|
||||
.update();
|
||||
rabbitPublisher.sendOrderCancelMsg(orderInfo.getId().toString());
|
||||
}
|
||||
throw new ValidateException("订单已过期,请重新下单");
|
||||
}
|
||||
}
|
||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
||||
if (param.isVipPrice() && !shopInfo.getIsMemberPrice().equals(1)) {
|
||||
throw new ValidateException("生成订单失败,该店铺不支持使用会员价");
|
||||
}
|
||||
log.info("订单信息:{},优惠信息:{}", JSONObject.toJSONString(orderInfo), JSONObject.toJSONString(param));
|
||||
if (!orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||
throw new ValidateException("生成支付订单失败,订单不可支付");
|
||||
}
|
||||
Long shopId = orderInfo.getShopId();
|
||||
AssertUtil.isNull(shopId, "生成支付订单失败,订单信息异常");
|
||||
orderInfo.setSeatNum(param.getSeatNum());
|
||||
|
||||
Reference in New Issue
Block a user