| @@ -135,7 +135,7 @@ public class OrderExpiringSchedule { | |||||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | ||||
| wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | ||||
| try { | try { | ||||
| proxy.orderGroupExpired((WxOrder) o,true); | |||||
| proxy.orderGroupExpired((WxOrder) o,true,true); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("拼团取消失败" + e.getMessage()); | logger.error("拼团取消失败" + e.getMessage()); | ||||
| } | } | ||||
| @@ -188,7 +188,7 @@ public class OrderExpiringSchedule { | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void expiredAndReturnMoney(WxOrder wxOrder,boolean checkRealPay) { | public void expiredAndReturnMoney(WxOrder wxOrder,boolean checkRealPay) { | ||||
| orderGroupExpired(wxOrder,checkRealPay); | |||||
| orderGroupExpired(wxOrder,checkRealPay,false); | |||||
| returnMoney(wxOrder); | returnMoney(wxOrder); | ||||
| } | } | ||||
| @@ -282,7 +282,7 @@ public class OrderExpiringSchedule { | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void orderGroupExpired(WxOrder order,boolean checkRealPay) { | |||||
| public void orderGroupExpired(WxOrder order,boolean checkRealPay,boolean stockBack) { | |||||
| if (checkRealPay) { | if (checkRealPay) { | ||||
| if (wxPaySuccess(order,true)) { | if (wxPaySuccess(order,true)) { | ||||
| return; | return; | ||||
| @@ -296,14 +296,19 @@ public class OrderExpiringSchedule { | |||||
| updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | ||||
| updateOrder.setUpdateDate(curDate); | updateOrder.setUpdateDate(curDate); | ||||
| wxOrderMapper.updateById(updateOrder); | wxOrderMapper.updateById(updateOrder); | ||||
| // 库存退回 | |||||
| wxOrderService.stockBack(order); | |||||
| if (stockBack) { | |||||
| // 库存退回 | |||||
| wxOrderService.stockBack(order); | |||||
| } | |||||
| // 微信 关单 | // 微信 关单 | ||||
| wxOrderService.orderClose(updateOrder); | wxOrderService.orderClose(updateOrder); | ||||
| logger.info("拼团订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + curDate); | logger.info("拼团订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + curDate); | ||||
| } | } | ||||
| /** | |||||
| * 回调会再次扣减库存 | |||||
| * @param order | |||||
| */ | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void returnMoney(WxOrder order) { | public void returnMoney(WxOrder order) { | ||||
| //支付成功的才退款 | //支付成功的才退款 | ||||