| @@ -378,8 +378,27 @@ public class OrderExpiringSchedule { | |||||
| updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PRESS_OVERTIME.getCode()); | updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PRESS_OVERTIME.getCode()); | ||||
| updateOrder.setUpdateDate(curDate); | updateOrder.setUpdateDate(curDate); | ||||
| wxOrderMapper.updateById(updateOrder); | wxOrderMapper.updateById(updateOrder); | ||||
| // 库存退回 | |||||
| wxOrderService.stockBack(order); | |||||
| // 库存退回 这里都是未支付的 只有发起扣库存时这里才回滚 | |||||
| boolean isBackStock = true; | |||||
| try { | |||||
| WxCoupon coupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); | |||||
| if (coupon == null) { | |||||
| logger.error("券未找到, " + order.getProductId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| //支付扣库存时不回滚库存 | |||||
| if (EnumCouponType.COUPON_PRESS.getCode().equals(coupon.getType()) | |||||
| && EnumYesOrNo.YES.getCode().equals(coupon.getPressPayReduceStock())) { | |||||
| isBackStock = false; | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("券未找到, e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| if(isBackStock){ | |||||
| wxOrderService.stockBack(order); | |||||
| } | |||||
| if(payExpired) { | if(payExpired) { | ||||
| logger.info("砍价订单(支付过期): " + order.getId() + ", tenantId" + order.getTenantId() + " create at " + order.getCreateDate() + ", update at " + order.getUpdateDate() + " expired at " + curDate); | logger.info("砍价订单(支付过期): " + order.getId() + ", tenantId" + order.getTenantId() + " create at " + order.getCreateDate() + ", update at " + order.getUpdateDate() + " expired at " + curDate); | ||||