Explorar o código

曲线偏差率分析指标计算调整

王波 hai 4 días
pai
achega
1b2c7f4ec5
Modificáronse 16 ficheiros con 102 adicións e 76 borrados
  1. 62 62
      generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  2. 13 4
      generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusValue.java
  3. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  4. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  5. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  6. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  7. 0 2
      generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java
  8. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPut2Service.java
  9. 0 2
      generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  10. 3 0
      generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  11. 2 2
      generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  12. 0 2
      generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  13. 0 2
      generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java
  14. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java
  15. 2 0
      generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java
  16. 8 0
      generationXK-service/src/main/java/com/gyee/generation/task/AnalysisTask.java

+ 62 - 62
generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -36,68 +36,68 @@ public class GenerationMain {
         System.out.println("启动完成");
 
         //        /*************************风机历史计算服务**************************/
-//        Calendar c1 = Calendar.getInstance();
-//
-//        c1.add(Calendar.DAY_OF_MONTH, -1);
-//        ReCalSevice reCalSevice = SpringUtils.getBean("reCalSevice");
-//
-//        Calendar c = Calendar.getInstance();
-//        Logger logger = LoggerFactory.getLogger(GenerationMain.class);
-//
-//        //        //重算风机
-//        reCalSevice.calWt(c.getTime());
-//
-//                while (true) {
-//
-//                    Date begin = new Date();
-//                    Date end = null;
-//                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                    logger.info(df.format(c.getTime()).toString());
-//
-//
-//                    EquipmentInfo1Service equipmentInfo1Service = SpringUtils.getBean("equipmentInfo1Service");
-//                    EquipmentInfo2Service equipmentInfo2Service = SpringUtils.getBean("equipmentInfo2Service");
-//                    EquipmentInfo3Service equipmentInfo3Service = SpringUtils.getBean("equipmentInfo3Service");
-//
-//
-//                    equipmentInfo1Service.calEquipmentInfoDay(begin);
-//                    logger.info("equipmentInfo1Service完成一次!。。。。。。");
-//                    TimeUnit.SECONDS.sleep(3);
-//                    equipmentInfo2Service.calEquipmentInfoDay(begin);
-//                    logger.info("equipmentInfo2Service完成一次!。。。。。。");
-//                    TimeUnit.SECONDS.sleep(3);
-//                    equipmentInfo3Service.calEquipmentInfoDay(begin);
-//                    logger.info("equipmentInfo3Service完成一次!。。。。。。");
-//                    TimeUnit.SECONDS.sleep(3);
-//                    logger.info("equipmentInfo5Service开始!。。。。。。");
-//                    EquipmentInfo5Service equipmentInfo5Service = SpringUtils.getBean("equipmentInfo5Service");
-//                    TimeUnit.SECONDS.sleep(3);
-//                    EquipmentInfo4Service equipmentInfo4Service = SpringUtils.getBean("equipmentInfo4Service");
-//                    TimeUnit.SECONDS.sleep(3);
-//                    equipmentInfo5Service.calEquipmentInfoDay(begin);
-//                    logger.info("equipmentInfo5Service完成一次!。。。。。。");
-//                    logger.info("equipmentInfo4Service开始!。。。。。。");
-//                    equipmentInfo4Service.calEquipmentInfoDay(begin);
-//                    logger.info("equipmentInfo4Service完成一次!。。。。。。");
-//
-//                    WtAlysisDayService wtAlysisDayService = SpringUtils.getBean("wtAlysisDayService");
-//
-//                    EquipmentInfoDayTopService equipmentInfoDayTopService = SpringUtils.getBean("equipmentInfoDayTopService");
-//                    equipmentInfoDayTopService.calEquipmentInfoDayTop(begin);
-//                    equipmentInfoDayTopService.calEquipmentInfoMonthTop(begin);
-//                    equipmentInfoDayTopService.calEquipmentInfoYearTop(begin);
-//
-//                    TimeUnit.SECONDS.sleep(3);
-//                    logger.info("wtAlysisyService开始!。。。。。。");
-//                    wtAlysisDayService.calEquipmentInfoDay(begin);
-//                    logger.info("wtAlysisyService完成!。。。。。。");
-//                    end = new Date();
-//                    logger.info(df.format(end).toString());
-//                    logger.info("完成一次!。。。。。。");
-//                    logger.info("执行用时" + com.gyee.generation.util.DateUtils.secondsDiff(begin, end) + "秒");
-//
-//                    TimeUnit.MINUTES.sleep(15);
-//                }
+        Calendar c1 = Calendar.getInstance();
+
+        c1.add(Calendar.DAY_OF_MONTH, -1);
+        ReCalSevice reCalSevice = SpringUtils.getBean("reCalSevice");
+
+        Calendar c = Calendar.getInstance();
+        Logger logger = LoggerFactory.getLogger(GenerationMain.class);
+
+        //        //重算风机
+        reCalSevice.calWt(c.getTime());
+
+        while (true) {
+
+            Date begin = new Date();
+            Date end = null;
+            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            logger.info(df.format(c.getTime()).toString());
+
+
+            EquipmentInfo1Service equipmentInfo1Service = SpringUtils.getBean("equipmentInfo1Service");
+//            EquipmentInfo2Service equipmentInfo2Service = SpringUtils.getBean("equipmentInfo2Service");
+//            EquipmentInfo3Service equipmentInfo3Service = SpringUtils.getBean("equipmentInfo3Service");
+
+
+            equipmentInfo1Service.calEquipmentInfoDay(begin);
+            logger.info("equipmentInfo1Service完成一次!。。。。。。");
+            TimeUnit.SECONDS.sleep(3);
+//            equipmentInfo2Service.calEquipmentInfoDay(begin);
+//            logger.info("equipmentInfo2Service完成一次!。。。。。。");
+//            TimeUnit.SECONDS.sleep(3);
+//            equipmentInfo3Service.calEquipmentInfoDay(begin);
+//            logger.info("equipmentInfo3Service完成一次!。。。。。。");
+//            TimeUnit.SECONDS.sleep(3);
+            logger.info("equipmentInfo5Service开始!。。。。。。");
+            EquipmentInfo5Service equipmentInfo5Service = SpringUtils.getBean("equipmentInfo5Service");
+            TimeUnit.SECONDS.sleep(3);
+            EquipmentInfo4Service equipmentInfo4Service = SpringUtils.getBean("equipmentInfo4Service");
+            TimeUnit.SECONDS.sleep(3);
+            equipmentInfo5Service.calEquipmentInfoDay(begin);
+            logger.info("equipmentInfo5Service完成一次!。。。。。。");
+//            logger.info("equipmentInfo4Service开始!。。。。。。");
+//            equipmentInfo4Service.calEquipmentInfoDay(begin);
+//            logger.info("equipmentInfo4Service完成一次!。。。。。。");
+
+            WtAlysisDayService wtAlysisDayService = SpringUtils.getBean("wtAlysisDayService");
+
+            EquipmentInfoDayTopService equipmentInfoDayTopService = SpringUtils.getBean("equipmentInfoDayTopService");
+            equipmentInfoDayTopService.calEquipmentInfoDayTop(begin);
+            equipmentInfoDayTopService.calEquipmentInfoMonthTop(begin);
+            equipmentInfoDayTopService.calEquipmentInfoYearTop(begin);
+
+            TimeUnit.SECONDS.sleep(3);
+            logger.info("wtAlysisyService开始!。。。。。。");
+            wtAlysisDayService.calEquipmentInfoDay(begin);
+            logger.info("wtAlysisyService完成!。。。。。。");
+            end = new Date();
+            logger.info(df.format(end).toString());
+            logger.info("完成一次!。。。。。。");
+            logger.info("执行用时" + com.gyee.generation.util.DateUtils.secondsDiff(begin, end) + "秒");
+
+            TimeUnit.MINUTES.sleep(15);
+        }
         //
         //        /*************************风机历史计算服务**************************/
         //

+ 13 - 4
generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusValue.java

@@ -10,13 +10,22 @@ public enum StatusValue {
     //5	受累
     //6	离线
 
+//    DJ(0.0, "待机"),
+//    YX(1.0, "运行"),
+//    GZ(2.0, "故障"),
+//    JX(3.0, "检修"),
+//    XD(4.0, "限电"),
+//    SL(5.0, "受累"),
+//    LX(6.0, "离线");
+    //0 待机,1   手动停机,2 正常发电,4 故障,6  检修,12  通讯中断
     DJ(0.0, "待机"),
-    YX(1.0, "运行"),
-    GZ(2.0, "故障"),
+    LX(1.0, "离线"),
+    YX(2.0, "运行"),
     JX(3.0, "检修"),
-    XD(4.0, "限电"),
+    GZ(4.0, "故障"),
     SL(5.0, "受累"),
-    LX(6.0, "离线");
+    XD(8.0, "受累"),
+    TXZD(12.0, "通讯中断");
 
     private Double code;
     private String name;

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -14,6 +14,7 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.task.thread.EquipmentInfo1Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -34,6 +35,7 @@ public class EquipmentInfo1Service {
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
     @Resource
+    @Qualifier("applicationTaskExecutor")  // 指定要注入的 Executor Bean
     private Executor executor;
 
     @Resource

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -12,6 +12,7 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
 import com.gyee.generation.task.thread.EquipmentInfo2Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -35,6 +36,7 @@ public class EquipmentInfo2Service {
     private IProEconEquipmentInfoDay2Service proEconEquipmentInfoDay2Service;
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
 
     /**

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -12,6 +12,7 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay3Service;
 import com.gyee.generation.task.thread.EquipmentInfo3Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -34,6 +35,7 @@ public class EquipmentInfo3Service {
 
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
 
     /**

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java

@@ -10,6 +10,7 @@ import com.gyee.generation.service.auto.*;
 import com.gyee.generation.task.thread.EquipmentInfo4Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -69,6 +70,7 @@ public class EquipmentInfo4Service {
 
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
 
     public void calEquipmentInfoDay(Date recordDate) throws Exception {

+ 0 - 2
generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java

@@ -36,8 +36,6 @@ public class GoodnessOfFitService {
     @Resource
     private RedisService redisService;
 
-    @Resource
-    private Executor executor;
 
     public Map<String, Map<String, Double>> goodnessOfFit(String wtId, Date nowDate) throws Exception {
 

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPut2Service.java

@@ -11,6 +11,7 @@ import com.gyee.generation.task.thread.InputOrOutPutkThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -34,6 +35,7 @@ public class InputOrOutPut2Service {
     private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
     @Value("${frequency.cutinandout}")
     private Integer frequency;

+ 0 - 2
generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java

@@ -43,8 +43,6 @@ public class InputOrOutPutService {
     @Resource
     private RemoteServiceBuilder remoteService;
 
-    @Resource
-    private Executor executor;
     @Value("${frequency.cutinandout}")
     private Integer frequency;
 

+ 3 - 0
generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java

@@ -14,6 +14,7 @@ import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -44,8 +45,10 @@ public class LimitEventService {
     private IEdosUtil edosUtil;
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor mainexecutor;
 
     @Value("${frequency.powerrationing}")

+ 2 - 2
generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java

@@ -1711,11 +1711,11 @@ public class PowerCurveFittingByTimeService {
                 fspointstemp.sort(Comparator.comparingLong(PointData::getPointTime));
                 glpointstemp.sort(Comparator.comparingLong(PointData::getPointTime));
                 // 删除最后一条数据
-                if (!fspointstemp.isEmpty()) {
+                if (!fspointstemp.isEmpty() && qfzttemp.size()!= fspointstemp.size()) {
                     fspointstemp.remove(fspointstemp.size() - 1);  // 删除最后一条数据
                 }
                 // 删除最后一条数据
-                if (!glpointstemp.isEmpty()) {
+                if (!glpointstemp.isEmpty() && qfzttemp.size()!= glpointstemp.size()) {
                     glpointstemp.remove(glpointstemp.size() - 1);  // 删除最后一条数据
                 }
 //                // 创建一个新的 List 来存储格式化后的时间字符串

+ 0 - 2
generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java

@@ -54,8 +54,6 @@ public class ShutdownService {
     Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
     Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
 
-    @Resource
-    private Executor executor;
 
 
     public void execShutdown(Date recordDate, List<ProBasicPowerstation> wpls, List<ProBasicEquipment> wtls) throws Exception {

+ 0 - 2
generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java

@@ -54,8 +54,6 @@ public class ShutdownnewService {
 
     public static Logger logger = LoggerFactory.getLogger(ShutdownnewService.class);
 
-    @Resource
-    private Executor executor;
 
     @Resource
     private AdapterApi adapter;

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java

@@ -9,6 +9,7 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.service.auto.IProEconWindturbineGoodnessService;
 import com.gyee.generation.task.thread.GoodnessOfFitThread;
 import com.gyee.generation.util.DateUtils;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -32,6 +33,7 @@ public class WindturbineGoodnessService {
 
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
 
     public void calWindturbineGoodness(Date recordDate) throws Exception {

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java

@@ -11,6 +11,7 @@ import com.gyee.generation.task.thread.EconWtAlysisDayThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.SnowflakeGenerator;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -40,6 +41,7 @@ public class WtAlysisDayService {
     private IProEconEquipmentInfoDay4Service proEconEquipmentInfoDay4Service;
 
     @Resource
+    @Qualifier("applicationTaskExecutor")
     private Executor executor;
 
     private Map<String, ProEconEquipmentInfoDay1> queryEquipmentInfoDay1(Date recordDate) {

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

@@ -5,13 +5,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.Date;
 
 @Component
+@EnableAsync  // 启用异步方法执行
 public class AnalysisTask {
     private static final Logger logger = LoggerFactory.getLogger(AnalysisTask.class);
 
@@ -28,6 +33,9 @@ public class AnalysisTask {
     @Autowired
     private EquipmentInfo4Service equipmentInfo4Service;
 
+    @Resource
+    @Qualifier("taskScheduler") // 指定使用特定的 TaskScheduler
+    private ThreadPoolTaskScheduler taskScheduler;
     // 每日1点 - 日曲线偏差
     @Async
     @Scheduled(cron = "0 0 1 * * ?")