package com.gyee.generation.task; import com.gyee.common.util.DateUtils; import com.gyee.generation.init.CacheContext; import com.gyee.generation.service.*; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Date; /** * @ClassName : SaticScheduleTask * @Description : 调度 */ @Component public class SaticSchedulePgTask { private static Logger logger = LoggerFactory.getLogger(SaticSchedulePgTask.class); @Resource private InputOrOutPutService inputOrOutPutService; @Resource private LimitEventnewService limitEventnewService; @Resource private PowerCurveFittingService powerCurveFittingService; @Resource private ShutdownnewService shutdownnewService; @Resource private WindPowerInfo1Service windPowerInfo1Service; @Resource private WindPowerInfo2Service windPowerInfo2Service; @Resource private WindPowerInfo3Service windPowerInfo3Service; @Resource private WindPowerInfo4Service windPowerInfo4Service; @Resource private WindPowerInfo5Service windPowerInfo5Service; @Resource private WindPowerInfo6Service windPowerInfo6Service; @Resource private EquipmentInfo1Service equipmentInfo1Service; @Resource private EquipmentInfo2Service equipmentInfo2Service; @Resource private EquipmentInfo3Service equipmentInfo3Service; @Resource private EquipmentInfo4Service equipmentInfo4Service; @Resource private EquipmentInfo5Service equipmentInfo5Service; @Resource private EquipmentInfoDayTopService equipmentInfoDayTopService; //3.添加定时任务 /** * 切入切出统计 * 每天执行一次 */ @XxlJob("inputOrOutPut_PG") public void inputOrOutPut_PG() { XxlJobHelper.log("切入切出统计调度程序执行开始!........"); try { inputOrOutPutService.inputOrOutput(new Date()); } catch (Exception e) { e.printStackTrace(); } XxlJobHelper.log("切入切出统计调度任务处理完成!........"); } /** * 停机记录 * 每15分钟执行一次 */ @XxlJob("shutdown_PG") public void shutdown_PG() { XxlJobHelper.log("停机记录调度程序执行开始!........"); try { shutdownnewService.execShutdown(new Date()); } catch (Exception e) { e.printStackTrace(); } XxlJobHelper.log("停机记录调度任务处理完成!........"); } /** * 限电停机记录 * 每15分钟执行一次 */ @XxlJob("brownouts_PG") public void brownouts_PG() { XxlJobHelper.log("限电停机记录调度程序执行开始!........"); try { limitEventnewService.execBrownouts(new Date()); } catch (Exception e) { e.printStackTrace(); } XxlJobHelper.log("限电停机记录调度任务处理完成!........"); } /** * 日、月、年功率曲线拟合 * 每天执行一次 */ @XxlJob("powerCurveFitting_PG") public void powerCurveFitting_PG() { XxlJobHelper.log("日、月、年功率曲线拟合调度程序执行开始!........"); Date date=new Date(); try { powerCurveFittingService.cureFitting(date,DateUtils.truncate(date),0, CacheContext.wtls); } catch (Exception e) { e.printStackTrace(); } XxlJobHelper.log("日、月、年功率曲线拟合调度任务处理完成!........"); } /** * 场站1表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo1_PG") public void windPowerInfo1_PG() throws Exception { XxlJobHelper.log("场站指标1调度程序执行开始!........"); Date date=new Date(); windPowerInfo1Service.calLineInfoDay(date); windPowerInfo1Service.calProjectInfoDay(date); windPowerInfo1Service.calWindpowerInfoDay(date); windPowerInfo1Service.calCompanyInfoDay(date); windPowerInfo1Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标1指标调度程序执行完成!........"); } /** * 场站2表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo2_PG") public void windPowerInfo2_PG() throws Exception { XxlJobHelper.log("场站指标2调度程序执行开始!........"); Date date=new Date(); windPowerInfo2Service.calLineInfoDay(date); windPowerInfo2Service.calProjectInfoDay(date); windPowerInfo2Service.calWindpowerInfoDay(date); windPowerInfo2Service.calCompanyInfoDay(date); windPowerInfo2Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标2指标调度程序执行完成!........"); } /** * 场站3表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo3_PG") public void windPowerInfo3_PG() throws Exception { XxlJobHelper.log("场站指标3调度程序执行开始!........"); Date date=new Date(); windPowerInfo3Service.calLineInfoDay(date); windPowerInfo3Service.calProjectInfoDay(date); windPowerInfo3Service.calWindpowerInfoDay(date); windPowerInfo3Service.calCompanyInfoDay(date); windPowerInfo3Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标3指标调度程序执行完成!........"); } /** * 场站4表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo4_PG") public void windPowerInfo4_PG() throws Exception { XxlJobHelper.log("场站指标4调度程序执行开始!........"); Date date=new Date(); windPowerInfo4Service.calLineInfoDay(date); windPowerInfo4Service.calProjectInfoDay(date); windPowerInfo4Service.calWindpowerInfoDay(date); windPowerInfo4Service.calCompanyInfoDay(date); windPowerInfo4Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标4指标调度程序执行完成!........"); } /** * 场站5表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo5_PG") public void windPowerInfo5_PG() throws Exception { XxlJobHelper.log("场站指标5调度程序执行开始!........"); Date date=new Date(); windPowerInfo5Service.calLineInfoDay(date); windPowerInfo5Service.calProjectInfoDay(date); windPowerInfo5Service.calWindpowerInfoDay(date); windPowerInfo5Service.calCompanyInfoDay(date); windPowerInfo5Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标5指标调度程序执行完成!........"); } /** * 场站6表 * 15分钟只执行一次 * */ @XxlJob("windPowerInfo6_PG") public void windPowerInfo6_PG() throws Exception { XxlJobHelper.log("场站指标6调度程序执行开始!........"); Date date=new Date(); windPowerInfo6Service.calLineInfoDay(date); windPowerInfo6Service.calProjectInfoDay(date); windPowerInfo6Service.calWindpowerInfoDay(date); windPowerInfo6Service.calCompanyInfoDay(date); windPowerInfo6Service.calRegionInfoDay(date); XxlJobHelper.log("场站指标6指标调度程序执行完成!........"); } /** * 设备1-6表 * 15分钟只执行一次 * */ @XxlJob("equipment_PowerInfo_PG") public void equipment_PowerInfo_PG() throws Exception { XxlJobHelper.log("设备指标调度程序执行开始!........"); Date date=new Date(); equipmentInfo1Service.calEquipmentInfoDay(date); equipmentInfo2Service.calEquipmentInfoDay(date); equipmentInfo3Service.calEquipmentInfoDay(date); equipmentInfo4Service.calEquipmentInfoDay(date); equipmentInfo5Service.calEquipmentInfoDay(date); XxlJobHelper.log("设备指标调度程序执行完成!........"); } /** * 等级评估统计 * 每天执行一次 */ @XxlJob("equipmentInfoDayTop_PG") public void equipmentInfoDayTop_PG() { XxlJobHelper.log("等级评估统计调度程序执行开始!........"); try { equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date()); } catch (Exception e) { e.printStackTrace(); } XxlJobHelper.log("等级评估统计调度任务处理完成!........"); } }