package com.zy.asrs.task; import com.zy.asrs.task.handler.WorkLogHandler; import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * Created by vincent on 2020/7/7 */ @Component public class WorkLogScheduler { @Autowired private WorkLogHandler workLogHandler; @Autowired private ConfigService configService; @Scheduled(cron = "0/3 * * * * ? ") private void execute(){ ReturnT result = workLogHandler.start(); if (!result.isSuccess()) { configService.insert(result.getContent()); } } }