package com.ssj.task.sz;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.ssj.framework.core.util.SystemResourceLocator;
import com.ssj.service.sys.fx.service.MerchantService;
import com.ssj.service.sys.fx.service.MerchantSignService;

@DisallowConcurrentExecution
@Component
public class MerchantSummaryTask implements Job{

	private static Logger logger = LoggerFactory.getLogger(MerchantSummaryTask.class);
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		
		//12点定时任务，处理签约模式的数据
		try{
			MerchantService merchantService = SystemResourceLocator.getBean(MerchantService.class);
			logger.error("【签约模式】结算扣币定时任务，开始...");
			merchantService.runSummaryByMerchant_new();
			logger.error("【签约模式】结算扣币定时任务，结束。");
		}catch (Exception e) {
			logger.error("【签约模式】结算扣币定时任务，异常："+e.getMessage());
		}
		
		//12点定时任务，处理套餐的数据
	    //1：处理加油包过期的数据
	    //2：处理商户主套餐过期的数据,加油包全过期。
		try{
			MerchantSignService merchantSignService = SystemResourceLocator.getBean(MerchantSignService.class);
			logger.error("【套餐模式】处理套餐的数据定时任务，开始...");
			merchantSignService.runMerchantSignByEndTime();
			logger.error("【套餐模式】处理套餐的数据定时任务，结束。");
		}catch (Exception e) {
			logger.error("【套餐模式】处理套餐的数据定时任务，异常："+e.getMessage());
		}
		
		

	}
}
