package com.xmomen.module.schedule;


import com.xmomen.framework.support.SpringContextUtil;
import com.xmomen.module.order.model.CreatePurchase;
import com.xmomen.module.order.service.PurchaseService;
import com.xmomen.module.plan.service.TablePlanSercvice;

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.text.SimpleDateFormat;
import java.util.Date;

/**
 * 计划任务
 */
@Component(value = "planJob")
public class PlanJob implements Job {

    // 注入TablePlanSercvice
    @Autowired
	TablePlanSercvice tablePlanSercvice;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        // 如果tablePlanSercvice为空，则从Spring上下文中获取
        if(tablePlanSercvice == null){
        	tablePlanSercvice = (TablePlanSercvice) SpringContextUtil.getApplicationContext().getBean(TablePlanSercvice.class);
            // 调用createTablePlanOrder方法
            tablePlanSercvice.createTablePlanOrder();
        }
    }
}
