| New file |
| | |
| | | package zy.cloud.wms.common.service.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.exception.CoolException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.manager.entity.Order; |
| | | import zy.cloud.wms.manager.service.OrderService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 订单处理器 |
| | | * Created by vincent on 2021/4/22 |
| | | */ |
| | | @Slf4j |
| | | //@Component |
| | | public class OrderScheduler { |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | /** |
| | | * 取消订单处理器 |
| | | */ |
| | | @Transactional |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | public void cancelOrderExecute(){ |
| | | List<Order> cancelOrders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 5)); |
| | | for (Order order : cancelOrders) { |
| | | |
| | | |
| | | |
| | | if (!orderService.updateSettle(order.getOrderNo(), 3L)) { |
| | | throw new CoolException("修改订单状态失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |