|
@@ -0,0 +1,88 @@
|
|
|
+package com.gyee.generation.task;
|
|
|
+
|
|
|
+
|
|
|
+import com.gyee.common.util.DateUtils;
|
|
|
+import com.gyee.generation.service.GenerationService;
|
|
|
+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;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : SaticScheduleTask
|
|
|
+ * @Description : 调度
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+@Component
|
|
|
+public class SaticScheduleTask {
|
|
|
+
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private GenerationService generationService;
|
|
|
+ //3.添加定时任务
|
|
|
+ /**
|
|
|
+ * 电计量实时计算计算(电量,上网,购网,场用)
|
|
|
+ * 每15分钟执行一次
|
|
|
+ */
|
|
|
+
|
|
|
+ @XxlJob("electricityMetering-realtime")
|
|
|
+ public void configureTasks1() {
|
|
|
+
|
|
|
+
|
|
|
+ XxlJobHelper.log("电计量实时调度程序执行开始!........");
|
|
|
+
|
|
|
+ try {
|
|
|
+// System.out.println(11111111);
|
|
|
+ generationService.saveGenerationDatas();
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ XxlJobHelper.log("电计量实时调度任务处理完成!........");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 存储meterpointvalue
|
|
|
+ * 每10分钟执行一次
|
|
|
+ */
|
|
|
+ @XxlJob("electricityMetering-history1")
|
|
|
+ public void history1() {
|
|
|
+
|
|
|
+ XxlJobHelper.log("电计量历史1调度程序执行开始!........");
|
|
|
+ String yesterdayStr = DateUtils.getYesterdayStr("yyyy-MM-dd");
|
|
|
+ String date = DateUtils.toDate1(DateUtils.getCurrentDate());
|
|
|
+ try {
|
|
|
+ generationService.saveMeterpointValue(date,date);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ XxlJobHelper.log("电计量历史1调度任务处理完成!........");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 存储meterpointvalue(处理每天最后一个值,保证是第二天0点值)
|
|
|
+ * 每天0:30执行
|
|
|
+ */
|
|
|
+ @XxlJob("electricityMetering-history2")
|
|
|
+ public void history2() {
|
|
|
+
|
|
|
+ XxlJobHelper.log("电计量历史1调度程序执行开始!........");
|
|
|
+ String yesterdayStr = DateUtils.getYesterdayStr("yyyy-MM-dd");
|
|
|
+ try {
|
|
|
+ generationService.saveMeterpointValue(yesterdayStr,yesterdayStr);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ XxlJobHelper.log("电计量历史1调度任务处理完成!........");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|