package com.sw.mes.scheduled;

import com.sw.mes.core.utils.DateUtil;
import com.sw.mes.mapper.ProductionExceptionLogMapper;
import com.xxl.job.core.handler.annotation.XxlJob;
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;

@Slf4j
@Component
public class StatisticsCptInspectBalanceScheduled {

    @Autowired
    private ProductionExceptionLogMapper productionExceptionLogMapper;

    @Transactional
    @XxlJob("statisticsCptInspectBalance")
    public void statisticsCptInspectBalance() {
        String dateStr = DateUtil.formatDate(new Date(), "yyyyMMddHHmmss");
        log.info("【开始自动排程】QF" + dateStr + " * * * * * * * * * * *");
        Long start = System.currentTimeMillis();
        productionExceptionLogMapper.statistics(new Date());
        Long end = System.currentTimeMillis();
        log.info("【本次自动排程耗时（" + (end - start) + "）毫秒】QF" + dateStr + " * * * * * * * * * * *");
    }
}
