package com.gci.boot.modules.task.gps;

import com.gci.boot.modules.gis.service.ITbGisGpsStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
@Slf4j
public class GisGpsStatisticsTask {
    @Autowired
    private ITbGisGpsStatisticsService gisGpsStatisticsService;

    /**
     * 每日凌晨一点半生成昨天的数据
     */
    @Scheduled(cron = "0 30 01 * * ? ")
    public void gen () {
        long l = System.currentTimeMillis();
        log.info("定时每日凌晨一点半生成昨日gps分析数据任务开始");
        try {
            gisGpsStatisticsService.gen();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("定时每日凌晨一点半生成昨日gps分析数据任务失败",e);
        }
        log.info("定时每日凌晨一点半生成昨日gps分析数据任务结束，耗时：{}",l - System.currentTimeMillis());
    }
}
