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

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;

import com.gci.boot.modules.gis.service.ITbGisSpeedingThresholdService;

import lombok.extern.slf4j.Slf4j;

@Configuration
@EnableScheduling
@Slf4j
public class GisSpeedingThresholdTask {
    @Autowired
    private ITbGisSpeedingThresholdService gisSpeedingThresholdService;

    /**
     * 每次启动生成数据
     */
    @Scheduled(initialDelay = 10000, fixedDelay = 1000 * 60 * 60 * 24)
    public void gen() {
        long l = System.currentTimeMillis();
        log.info("每次启动生成超速规则数据任务开始");
        try {
            gisSpeedingThresholdService.rel();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("每次启动生成超速规则数据任务失败", e);
        }
        log.info("每次启动生成超速规则数据任务结束，耗时：{}", l - System.currentTimeMillis());
    }
}
