CalcOilThread.java 3.01 KB
package com.bsth.data.schedule.thread;

import com.bsth.data.alarm.AlarmCenter;
import com.bsth.data.directive.DayOfDirectives;
import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
import com.bsth.data.maintenance_plan.MtPlanCenter;
import com.bsth.data.passenger_flow.PassengerFlowCenter;
import com.bsth.service.calc.CalcWaybillService;
import com.bsth.service.forms.BudgetService;
import com.bsth.service.oil.DlbService;
import com.bsth.data.safe_driv.SafeDrivCenter;
import com.bsth.service.oil.YlbService;
import com.bsth.service.report.SheetService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 计算油、公里加注量 线程
 * Created by panzhao on 2017/3/7.
 */
@Component
public class CalcOilThread extends Thread{

    @Autowired
    YlbService ylbService;
    @Autowired
    DlbService dlbService;
    
    @Autowired
    SheetService sheetService;
    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    DayOfDirectives dayOfDirectives;
    
    @Autowired
    CalcWaybillService calcWaybillService;
    
    @Autowired
    BudgetService budgetService;

    @Autowired
    private PassengerFlowCenter passengerFlowCenter;

    @Override
    public void run() {
        logger.info("开始计算油量平衡表....");
        try{
            ylbService.obtainDsq();
//          logger.info("开始计算班次准点率....");
//			sheetService.saveSheetList("");
//          logger.info("计算班次准点率结束!");
        } catch(Exception e){
            logger.error("计算油量平衡表失败",e);
        }
        try{
            logger.info("开始计算电量平衡表....");
            dlbService.obtainDsq();
        } catch(Exception e){
            logger.error("计算电量平衡表失败",e);
        }
        
        try{
            logger.info("计算路单里程开始");
            calcWaybillService.autoGenerate("", "");
        }catch(Exception e){
            logger.error("计算路单里程失败",e);
        }
        
        logger.info("开始保存统计日报....");
        try{
        	calcWaybillService.calcDaily("", "");
        }catch(Exception e){
            logger.error("统计日报失败",e);
        }
        
        logger.info("开始获取营收人次....");
        try{
        	budgetService.updateRevenueRange("", "");
        }catch(Exception e){
            logger.error("获取营收人次失败",e);
        }
        
        //清除指令数据
        dayOfDirectives.clearAll();
        //清除安全驾驶数据
        SafeDrivCenter.clear();
        //清除报警数据
        AlarmCenter.clear();
        //清除客流数据
        passengerFlowCenter.clear();
        //清除保养计划数据
        MtPlanCenter.clear();
        //清除超速缓存数据
        OverspeedProcess.clear();

        GpsDataLoaderThread.setFlag(0);

    }
}