package com.zy.acs.wcs.core; import com.zy.acs.common.utils.RedisSupport; import com.zy.acs.wcs.asrs.entity.TaskReport; import com.zy.acs.wcs.asrs.entity.WrkMast; import com.zy.acs.wcs.asrs.service.TaskReportService; import com.zy.acs.wcs.asrs.service.WrkMastService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @Slf4j @Component public class ReportThirdScheduler { private final RedisSupport redis = RedisSupport.defaultRedisSupport; @Autowired private TaskReportService taskReportService; @Autowired private WrkMastService wrkMastService; // @Scheduled(fixedDelay = 1000) public void execute() { List list = taskReportService.list(); for (TaskReport taskReport : list) { report(taskReport); } } @Transactional public void report(TaskReport taskReport) { //TODO 原先应该调用接口,现在直接修改数据 WrkMast wrkMast = wrkMastService.getById(taskReport.getSeqNum()); if (wrkMast != null) { wrkMast.setWrkSts(14L); wrkMast.setModiTime(new Date()); wrkMastService.updateById(wrkMast); } } }