spring任务调度

package com.thunisoft.fy.balcglxt.artery.timer;

import java.util.List;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.thunisoft.fy.balcglxt.artery.dao.WorkNodeDao;
/**
 * 定时进行数据抽取类
 * 
 * @author wuzhenzhong
 *
 */
public class AutoUpdateDateTimer extends QuartzJobBean {
	/**
	 * workdao
	 */
	private WorkNodeDao workNodeDAO;
	/**
	 * 批量执得更新TAJ_TABLE
	 * 
	 */
	@SuppressWarnings("unchecked")
	public void excuteBatchUpateT_aj()
	{
		String sql1=this.getWorkNodeDAO().getUpdateT_aj_Sql(1);
		List list1=this.getWorkNodeDAO().findBySql(sql1);
		this.getWorkNodeDAO().excuteBatchUpateT_aj(list1);
		
		String sql2=this.getWorkNodeDAO().getUpdateT_aj_Sql(2);
		List list2=this.getWorkNodeDAO().findBySql(sql2);
		this.getWorkNodeDAO().excuteBatchUpateT_aj(list2);
		
		String sql6=this.getWorkNodeDAO().getUpdateT_aj_Sql(6);
		List list6=this.getWorkNodeDAO().findBySql(sql6);
		this.getWorkNodeDAO().excuteBatchUpateT_aj(list6);
		
		String sql7=this.getWorkNodeDAO().getUpdateT_aj_Sql(7);
		List list7=this.getWorkNodeDAO().findBySql(sql7);
		this.getWorkNodeDAO().excuteBatchUpateT_aj(list7);
		
		String sql8=this.getWorkNodeDAO().getUpdateT_aj_Sql(8);
		List list8=this.getWorkNodeDAO().findBySql(sql8);
		this.getWorkNodeDAO().excuteBatchUpateT_aj(list8);
	}
	/**
	 * 批量更新TAjGzjd_table数据
	 * 
	 */
	public void extuceBatchUpdateTAjGzjd()
	{
		this.getWorkNodeDAO().BetchUpdateGzjd_Table(1);
		this.getWorkNodeDAO().BetchUpdateGzjd_Table(2);
		this.getWorkNodeDAO().BetchUpdateGzjd_Table(6);
		this.getWorkNodeDAO().BetchUpdateGzjd_Table(7);
		this.getWorkNodeDAO().BetchUpdateGzjd_Table(8);
	}
	
	/**
	 * 批量更新案件流程节点数据
	 */
	public void batchUpdateNode()
	{
		
	}
	/**
	 * 调度需实现的必要方法
	 */
	protected void executeInternal(JobExecutionContext jobexecutioncontext) throws JobExecutionException { 
		excuteBatchUpateT_aj();
		extuceBatchUpdateTAjGzjd();
    }
	public void setWorkNodeDAO(WorkNodeDao workNodeDAO) {
		this.workNodeDAO = workNodeDAO;
	}
	public WorkNodeDao getWorkNodeDAO() {
		return workNodeDAO;
	} 

}

 spring 配置文件

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-lazy-init="false">
    <!-- 定时更新案件的流程工作节点数据 -->
  <bean id="WorkNodeJob"
    class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
      <value>com.thunisoft.fy.balcglxt.artery.scheduling.AutoUpdateDateTimer</value>
    </property>
    <property name="jobDataAsMap">
      <map>
        <entry key="workNodeDAO">
          <ref bean="workNodeDAO" />
        </entry>
      </map>
    </property>
  </bean>
  <bean id="WorkNodeTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
      <ref bean="WorkNodeJob" />
    </property>
    <property name="cronExpression">
      <value>0 59 23 * * ?</value>
    </property>
  </bean>
  <!-- ooooooooooooooo 启动定时任务的工厂Bean ooooooooooooooo -->
  <bean id="schedule"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
      <list>
                  <ref bean="WorkNodeTrigger" />
      </list>
    </property>
  </bean>
</beans>

 

你可能感兴趣的:(DAO,spring,sql,bean,quartz)