package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.zy.asrs.mapper.LocMastMapper; import com.zy.asrs.service.LocMastService; import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Slf4j @Component public class ClearLiftLocNoScheduler { @Autowired private LocMastMapper locMastMapper; @Autowired private ConfigService configService; @Scheduled(cron = "0/3 * * * * ? ") private void execute(){ Config config = configService.selectOne(new EntityWrapper().eq("code","tmpSwitch")); if (config == null) { return; } if (!config.getValue().equals("true")) { return; } int clearLiftLocNo = locMastMapper.clearLiftLocNo(); if (clearLiftLocNo > 0) { log.info("清理提升机附近库位:" + clearLiftLocNo + "个"); } } }