package com.zcxk.quartz.job;

import com.zcxk.service.RevenueService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * @author Administrator
 * @create 2020-05-06
 */
@Slf4j
@Component
public  class SyncMeterCountJob implements Job, Serializable {

    private static final long serialVersionUID = 3336891083300321324L;

    @Autowired
    private RevenueService revenueService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        try{
            log.info("同步水表数量执行开始");
            revenueService.syncMeterCount();
            log.info("同步水表数量执行结束");
        }catch (Exception e){
            e.printStackTrace();
            log.info("同步水表数量执行异常，{}", e.getMessage());
        }
    }

}