package com.zhgd.xmgl.task; import com.zhgd.xmgl.modules.project.service.IProjectWorkerStatisticsService; import lombok.extern.log4j.Log4j; import lombok.extern.slf4j.Slf4j; import net.javacrumbs.shedlock.core.SchedulerLock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * @program: wisdomSite * @description: * @author: Mr.Peng * @create: 2022-06-13 16:56 **/ @Slf4j @Component public class ProjectWorkerStatisticsTask { @Autowired private IProjectWorkerStatisticsService projectWorkerStatisticsService; /** * 定时统计人员统计数据 * */ @Scheduled(cron = "0 0 */1 * * ?") @SchedulerLock(name = "getProjectWorkerStatisticsTask", lockAtMostFor = 1000*60*10, lockAtLeastFor = 1000*60*3) public void getProjectWorkerStatisticsTask() { try { projectWorkerStatisticsService.saveProjectWorkerStatistics(); } catch (Exception e) { log.error("error:", e); } } }