| | |
| | | |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.InventoryReserveExpireHandler; |
| | | import com.zy.common.properties.SchedulerProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 预留库存过期定时任务调度器 |
| | |
| | | @Autowired |
| | | private InventoryReserveExpireHandler inventoryReserveExpireHandler; |
| | | |
| | | @Resource |
| | | private SchedulerProperties schedulerProperties; |
| | | |
| | | /** |
| | | * 每分钟执行一次,检查过期的预留库存 |
| | | */ |
| | | @Scheduled(cron = "0 * * * * ?") |
| | | public void checkExpiredReserve() { |
| | | if (!schedulerProperties.isEnabled()) { |
| | | return; |
| | | } |
| | | try { |
| | | ReturnT<String> result = inventoryReserveExpireHandler.start(); |
| | | if (!result.isSuccess()) { |