package com.steering.pss.ydm.task;

import java.util.Timer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.ParseException;

public class CoreStatisticsServlet extends HttpServlet {
    private static final long serialVersionUID = -7945767895203738668L;
    public void init() throws ServletException {
        try {
            SimpleDateFormat fTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date strDate = fTime.parse("2017-3-18 06:45:00");
            System.out.println("--------------后台线程初始化中--------------------");
            // 领导报表库存综合信息
            new Timer().scheduleAtFixedRate(new CoreSlmYdmStatisticsTask(), strDate,
                    24*60*60*1000);
            // 领导报表收发存信息
            new Timer().scheduleAtFixedRate(new CoreYdmStockTask(), strDate,
                    24*60*60*1000);
         // 领导报表结算
            new Timer().scheduleAtFixedRate(new CoreBalanceTask(), strDate,
                    24*60*60*1000);
            System.out.println("--------------后台线程初始化成功--------------------");
        }
        catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }    
}
