Bladeren bron

增加定时计算

王波 2 dagen geleden
bovenliggende
commit
9d7cc96a1b

+ 5 - 3
generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
+import com.gyee.generation.config.feign.RemoteServiceBuilder;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.mapper.auto.ProEconEquipmentInfoDay1Mapper;
 import com.gyee.generation.model.auto.ProBasicEquipment;
@@ -31,7 +32,8 @@ public class EquipmentInfo1Service {
     //    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo1Service.class);
     @Resource
     private IEdosUtil edosUtil;
-
+    @Resource
+    private RemoteServiceBuilder remoteService;
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
     @Resource
@@ -121,7 +123,7 @@ public class EquipmentInfo1Service {
                 for (ProBasicEquipment wt1 : wttemps) {
                     new Thread(new EquipmentInfo1Thread(executor, wt1, pep1map,
                             recordDate, end, begin, dayls,
-                            edosUtil, latch)).start();
+                            edosUtil,remoteService, latch)).start();
                 }
                 latch.await();
                 Thread.sleep(12);
@@ -136,7 +138,7 @@ public class EquipmentInfo1Service {
             for (ProBasicEquipment wt1 : wttemps) {
                 new Thread(new EquipmentInfo1Thread(executor, wt1, pep1map,
                         recordDate, end, begin, dayls,
-                        edosUtil, latch)).start();
+                        edosUtil, remoteService,latch)).start();
             }
             latch.await();
         }

+ 13 - 0
generationXK-service/src/main/java/com/gyee/generation/task/AnalysisTask.java

@@ -80,6 +80,19 @@ public class AnalysisTask {
         }
     }
 
+    // 每日1点 - 切入切出统计
+    @Async
+    @Scheduled(cron = "0 0 1 * * ?")
+    public void qrqctool() {
+        try {
+            logger.info("切入切出统计调度程序执行开始");
+            inputOrOutPutService.inputOrOutput(new Date());
+            logger.info("切入切出统计调度任务处理完成");
+        } catch (Exception e) {
+            logger.error("切入切出统计调度任务执行失败", e);
+        }
+    }
+
     // 每日2点 - 功率一致性系数和拟合优度统计
     @Async
     @Scheduled(cron = "0 0 2 * * ?")

+ 6 - 2
generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo1Thread.java

@@ -1,11 +1,13 @@
 package com.gyee.generation.task.thread;
 
+import com.gyee.generation.config.feign.RemoteServiceBuilder;
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -28,12 +30,13 @@ public class EquipmentInfo1Thread implements Runnable {
     private Date begin;
     private List<ProEconEquipmentInfoDay1> dayls;
     private IEdosUtil edosUtil;
+    private RemoteServiceBuilder remoteService;
 
     private CountDownLatch latch;
 
     public EquipmentInfo1Thread(Executor executor, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> pep1map,
                                 Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay1> dayls,
-                                IEdosUtil edosUtil,
+                                IEdosUtil edosUtil, RemoteServiceBuilder remoteService,
                                 CountDownLatch latch) {
         this.executor = executor;
         this.wt = wt;
@@ -43,6 +46,7 @@ public class EquipmentInfo1Thread implements Runnable {
         this.begin = begin;
         this.dayls = dayls;
         this.edosUtil = edosUtil;
+        this.remoteService = remoteService;
         this.latch = latch;
     }
 
@@ -54,7 +58,7 @@ public class EquipmentInfo1Thread implements Runnable {
         FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo1ThreadPool(task,
                 wt, pep1map,
                 recordDate, end, begin, dayls,
-                edosUtil));
+                edosUtil,remoteService));
 
         executor.execute(futureTask);
         // 在这里可以做别的任何事情

+ 7 - 1
generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo1ThreadPool.java

@@ -3,6 +3,8 @@ package com.gyee.generation.task.thread;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
+import com.gyee.generation.config.feign.RemoteServiceBuilder;
+import com.gyee.generation.config.feign.TsDoubleData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
@@ -14,6 +16,7 @@ import com.gyee.generation.util.statisticcs.Initial;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Resource;
 import java.io.Serializable;
 import java.util.*;
 import java.util.concurrent.Callable;
@@ -38,10 +41,11 @@ public class EquipmentInfo1ThreadPool implements Callable<String>, Serializable
     private List<ProEconEquipmentInfoDay1> dayls;
     private IEdosUtil edosUtil;
 
+    private RemoteServiceBuilder remoteService;
 
     public EquipmentInfo1ThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> pep1map,
                                     Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay1> dayls,
-                                    IEdosUtil edosUtil
+                                    IEdosUtil edosUtil, RemoteServiceBuilder remoteService
     ) {
 
         this.threadPoolTaskData = tasks;
@@ -52,6 +56,7 @@ public class EquipmentInfo1ThreadPool implements Callable<String>, Serializable
         this.begin = begin;
         this.dayls = dayls;
         this.edosUtil = edosUtil;
+        this.remoteService = remoteService;
     }
 
     public synchronized String call() throws Exception {
@@ -121,6 +126,7 @@ public class EquipmentInfo1ThreadPool implements Callable<String>, Serializable
                 ProBasicEquipmentPoint point = pointmap.get(ContantXk.CJ_SSFS);
                 List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
 
+//                List<TsDoubleData> historySnap = remoteService.adapterfd().getHistorySnap(point.getNemCode(), begin.getTime(), end.getTime(), 60);
                 pointls = pointls.stream().filter(n -> (n.getPointValueInDouble() > 0 && n.getPointValueInDouble() < 30)).collect(Collectors.toList());
 
                 if (!pointls.isEmpty()) {