package com.zy.asrs.task; import com.core.common.Cools; import com.zy.asrs.entity.Pla; import com.zy.asrs.mapper.PlaMapper; import com.zy.asrs.service.PlaService; 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; import java.util.List; @Slf4j @Component public class PlaDetlScheduler { @Autowired private PlaService plaService; @Resource private PlaMapper plaMapper; @Scheduled(cron = "0/60 * * * * ? ") private void execute(){ List plaList = plaService.selectToHistory(); if(Cools.isEmpty(plaList)){ return; } for (Pla pla : plaList){ } } /** * 每隔一天扫描一次冻结的库存,超过三个月则自动解冻 */ @Scheduled(cron = "0 0 0 * * ?") private void autoThaw(){ int i = plaMapper.autoThaw(); log.info("---------------自动解冻库存{}个--------------------------", i); } }