| @@ -37,21 +37,28 @@ public class OrderExpiringSchedule { | |||||
| Map dateMap = new HashMap(); | Map dateMap = new HashMap(); | ||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| Date expireDate = new Date(curDate.getTime() - TIME_OUT_VALUE ); | |||||
| // 只检查券相关订单 | |||||
| // 券相关订单 | |||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", new Date(curDate.getTime() - TIME_OUT_VALUE )); | |||||
| List<WxOrder> wxOrderList = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap); | |||||
| dateMap.put("endDate", expireDate); | |||||
| List<WxOrder> orderCoupons = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap); | |||||
| orderCoupons.parallelStream().forEach( o -> { | |||||
| orderExpired(o); | |||||
| }); | |||||
| for(WxOrder wxOrder: wxOrderList){ | |||||
| orderExpired(wxOrder); | |||||
| } | |||||
| // 卡相关订单 | |||||
| dateMap.put("type", EnumOrderType.PREPAIDCARD.getCode()); | |||||
| dateMap.put("endDate", new Date(curDate.getTime() - TIME_OUT_VALUE )); | |||||
| List<WxOrder> orderCards = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap); | |||||
| orderCards.parallelStream().forEach( o -> { | |||||
| orderExpired(o); | |||||
| }); | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void orderExpired(WxOrder order) { | public void orderExpired(WxOrder order) { | ||||
| order.setUpdateDate(new Date()); | order.setUpdateDate(new Date()); | ||||
| order.setType(EnumOrderType.COUPON.getCode()); | |||||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()); | order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()); | ||||
| wxOrderMapper.updateByPrimaryKeySelective(order); | wxOrderMapper.updateByPrimaryKeySelective(order); | ||||