package com.zy.asrs.task; import com.zy.asrs.entity.WrkMastSta; import com.zy.asrs.service.WrkMastStaService; import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.WrkMastStaLogHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.List; @Slf4j @Component public class WrkMastStaLogScheduler { @Autowired private WrkMastStaLogHandler wrkMastStaLogHandler; @Autowired private WrkMastStaService wrkMastStaService; @Scheduled(cron = "0/3 * * * * ? ") private void execute(){ List wrkMastStas = wrkMastStaService.selectToBeHistoryData(); if (wrkMastStas.isEmpty()) { return; } for (WrkMastSta wrkMastSta : wrkMastStas) { ReturnT result = wrkMastStaLogHandler.start(wrkMastSta); if (!result.isSuccess()) { log.error("小车工作档工作档[workNo={}]历史档处理失败", wrkMastSta.getWrkNo()); } } } }