Explorar o código

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis

# Conflicts:
#	web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/Involved.java
#	web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/GhostService.java
#	web/gdsx-ghost/src/main/java/com/gyee/ghost/vo/InvolvedVo.java
#	web/runeconomy-xk/src/main/resources/application-test.yml
#	web/runeconomy-xk/src/main/resources/application-yun.yml
chenminghua %!s(int64=2) %!d(string=hai) anos
pai
achega
e9af1870cc
Modificáronse 100 ficheiros con 14979 adicións e 3211 borrados
  1. 3 0
      common/src/main/java/com/gyee/common/contant/Contant.java
  2. 22 2
      common/src/main/java/com/gyee/common/contant/ContantXk.java
  3. 3 0
      common/src/main/java/com/gyee/common/vo/benchmark/DjhxdbtopVo.java
  4. 1 0
      common/src/main/java/com/gyee/common/vo/benchmark/FjjxbVo.java
  5. 1 0
      common/src/main/java/com/gyee/common/vo/benchmark/FjjxbmxVo.java
  6. 1 0
      common/src/main/java/com/gyee/common/vo/curve/CurveVo.java
  7. 1 0
      common/src/main/java/com/gyee/common/vo/specific/SpecificCenterVo.java
  8. 16 0
      common/src/main/java/com/gyee/common/vo/specific/SpecificTarget.java
  9. 5 0
      common/src/main/java/com/gyee/common/vo/specific/SpecificTargetVo.java
  10. 13 13
      common/src/main/java/com/gyee/common/vo/specific/SpecificTopVo.java
  11. 2 2
      realtime/computing-services7003/src/main/resources/application-jn.yml
  12. 45 1
      realtime/generation-service/src/main/java/com/gyee/generation/GenerationMain.java
  13. 11 9
      realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java
  14. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdiController.java
  15. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdisController.java
  16. 203 59
      realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java
  17. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdiMapper.java
  18. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdisMapper.java
  19. 2 2
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpoint.java
  20. 81 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdi.java
  21. 81 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdis.java
  22. 18 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/vo/PointValueVo.java
  23. 543 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/Status_HF_Service.java
  24. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdiService.java
  25. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdisService.java
  26. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdiServiceImpl.java
  27. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdisServiceImpl.java
  28. 90 0
      realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java
  29. 116 0
      realtime/generation-service/src/main/java/com/gyee/generation/util/SpringUtils.java
  30. 1 0
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisAutoConfiguration.java
  31. 6 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisConfig.java
  32. 18 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java
  33. 133 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java
  34. 9 9
      realtime/generationXK-service/src/main/resources/application-jn.yml
  35. 1 1
      realtime/generation-service/src/main/resources/application.yml
  36. 3 3
      realtime/generation-service/src/main/resources/xxl-job-executor.properties
  37. 120 51
      realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  38. 7 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java
  39. 70 68
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java
  40. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicMaintransformerController.java
  41. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicWeatherStationController.java
  42. 64 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java
  43. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicMaintransformerMapper.java
  44. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicWeatherStationMapper.java
  45. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittMonthMainMapper.java
  46. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittMonthSubMapper.java
  47. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittYearMainMapper.java
  48. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittYearSubMapper.java
  49. 4 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittingMainMapper.java
  50. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittingSubMapper.java
  51. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingMapper.java
  52. 5 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingMonthMapper.java
  53. 4 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingYearMapper.java
  54. 119 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicMaintransformer.java
  55. 80 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicWeatherStation.java
  56. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittMonthSub.java
  57. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittYearSub.java
  58. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittingSub.java
  59. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconEquipmentmodel.java
  60. 1 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInOrOutSpeedTotal.java
  61. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInOrOutSpeedTotal2.java
  62. 1 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWindturbineGoodness.java
  63. 2715 306
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWpwindDayInfo.java
  64. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWtwindDayInfo.java
  65. 19 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/CompanyType.java
  66. 18 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/CurveType.java
  67. 17 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/WpType.java
  68. 16 11
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ActivePowerService.java
  69. 88 87
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/CoefficientService.java
  70. 31 14
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo15minuteService.java
  71. 52 24
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  72. 13 9
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  73. 14 9
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  74. 255 132
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  75. 21 11
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  76. 87 55
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java
  77. 124 119
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java
  78. 81 39
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  79. 40 17
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java
  80. 3 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitService.java
  81. 1727 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java
  82. 243 185
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  83. 12 8
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java
  84. 38 23
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java
  85. 26 984
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/TimelinessRateService.java
  86. 147 81
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java
  87. 254 208
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java
  88. 252 207
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java
  89. 398 263
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java
  90. 75 51
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java
  91. 108 70
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo6Service.java
  92. 45 11
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java
  93. 2859 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WpwindDayInfoService.java
  94. 104 30
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java
  95. 2905 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java
  96. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicMaintransformerService.java
  97. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicWeatherStationService.java
  98. 2 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittMonthMainService.java
  99. 2 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittMonthSubService.java
  100. 0 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittYearMainService.java

+ 3 - 0
common/src/main/java/com/gyee/common/contant/Contant.java

@@ -15,6 +15,8 @@ public class Contant {
     public static final String opePoints = "CI0668,CI0669,CI0670";
 
     public static final String benchPoints = "RSDJZSDL,RSSTZSDL,RXNZSDL,RSQXZSDL,RGZZSDL,RSZZSDL,RJXZSDL,RLZZSDL,RQFZSDL,RXDZSDL,RWZZSDL,RTZZSDL";
+    //场站五损电量编码
+    public static final String fiveLossPoints = "RXNSSDL,RDJSSDL,RQXJCLSSDL,RSDTJSSDL,RGZSSDL,RCNSLGZSSDL,RJXSSDL,RCNSLJXSSDL,RXDTJSSDL,RQFDL,RCWSLTQSSDL,RCWSLDWSSDL";
 
     public static final String monthbenchPoints = "YSDJZSDL,YSSTZSDL,YXNZSDL,YSQXZSDL,YGZZSDL,YSZZSDL,YJXZSDL,YLZZSDL,YQFZSDL,YXDZSDL,YWZZSDL,YTZZSDL";
 
@@ -271,4 +273,5 @@ public class Contant {
     public static final String RFDLC = "RFDLC"; //日理论发电量
 
 
+    public static final String GZZT = "GZZT"; //故障状态
 }

+ 22 - 2
common/src/main/java/com/gyee/common/contant/ContantXk.java

@@ -5,7 +5,7 @@ package com.gyee.common.contant;
  */
 
 public class ContantXk {
-
+    public static final String  AQTS= "AQTS";//安全天数
     public static final String  CZZT= "CZZT";//场站状态
     public static final String  SBJRZT= "SBJRZT";//场站设备接入状态
     public static final String  DQJRZT= "DQJRZT";//场站电气接入状态
@@ -18,6 +18,7 @@ public class ContantXk {
     public static final String  SSZLLGL= "SSZLLGL";//场站实时总理论功率
     public static final String  SSZBZGL= "SSZBZGL";//场站实时总保证功率
     public static final String  SSZNHGLZS= "SSZNHGLZS";//场站实时总拟合功率(自算)
+    public static final String  ZYCGL = "ZYCGL";   //总预测功率
     public static final String  SSZZYGL= "SSZZYGL";//场站实时总最优功率
     public static final String  SSZKYGL= "SSZKYGL";//场站实时总可用功率
     public static final String  RPJGL= "RPJGL";//日平均功率
@@ -177,17 +178,36 @@ public class ContantXk {
     public static final String TPOINT_WP_CXGL = "AGC001";// 出线
     public static final String TPOINT_WP_XDZT = "AGC009";// 限电状态
     public static final String TPOINT_WP_ZSGL = "AGC010";// 自算功率
-    public static final String TPOINT_WP_YCGL = "AGC011";// 预测功率
+    public static final String TPOINT_WP_YCGL = "FCFGCDQ0001";// 预测功率
 
 
     public static final String FCCFTFS70 = "FCCFTFS70";//测风塔70米风速
+    public static final String FCCFTFX70 = "FCCFTFX70";//测风塔70米风向
+    public static final String CJ_FX = "AI067";//风向
 
 
+    public static final String FCCFTWD = "FCCFTWD";//测风塔温度
+    public static final String QXZWD = "QXZWD";//气象站温度
     //判断数据中断(风速,功率,绕组温度,电流,电压)
     public static final String INTERRUPTION ="AI066,AI114,AI004,AI075,AI093";
     public static final String INTERRUPTIONGF ="AIG013,AIG017,AIG009,AIG006";
 
 
+    public static final String QCZT = "QCZT";  //全场状态
+
+    public static final String JYM = "JYM";
+    public static final String JYS = "JYS";
+    public static final String JYEYHT = "CO2";
+    public static final String JYEYHL = "SO2";
+    public static final String RLYXS = "RLYXS";
+    public static final String YLYXS = "YLYXS";
+    public static final String NLYXS = "NLYXS";
+    public static final String SBKLYL = "SBKLYL";
+    public static final String DXKYXS = "DXKYXS";
+    public static final String FNLYL = "FNLYL";
+
+
+
 
 
 

+ 3 - 0
common/src/main/java/com/gyee/common/vo/benchmark/DjhxdbtopVo.java

@@ -1,5 +1,7 @@
 package com.gyee.common.vo.benchmark;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -16,6 +18,7 @@ public class DjhxdbtopVo  implements Serializable {
     private static final long serialVersionUID = 4849539762497547224L;
 
     private String wtid;
+    private String nemCode;
     private Double fdl;
     private Double yfdl;
     private Double pjgl;

+ 1 - 0
common/src/main/java/com/gyee/common/vo/benchmark/FjjxbVo.java

@@ -26,4 +26,5 @@ public class FjjxbVo  implements Serializable  {
     private Double xn;  //性能
     private Double fnlly;   //风能利用率
     private Double point;
+    private Integer ordernum;
 }

+ 1 - 0
common/src/main/java/com/gyee/common/vo/benchmark/FjjxbmxVo.java

@@ -33,4 +33,5 @@ public class FjjxbmxVo implements Serializable {
     private Double xn4;   //缺陷降出
     private Double fnlly;   //风能利用率
     private Double point;
+    private Integer ordernum;
 }

+ 1 - 0
common/src/main/java/com/gyee/common/vo/curve/CurveVo.java

@@ -12,6 +12,7 @@ import lombok.Data;
 public class CurveVo {
 
     private String wtid;
+    private String nemCode;
     private Double speed;
     private Double theorypower;
     private Double ensurepower;

+ 1 - 0
common/src/main/java/com/gyee/common/vo/specific/SpecificCenterVo.java

@@ -30,4 +30,5 @@ public class SpecificCenterVo implements Serializable {
     private Integer fwjslCompare;
     private Integer ztzhlCompare;
     private Integer xqjslCompare;
+    private Integer ordernum;
 }

+ 16 - 0
common/src/main/java/com/gyee/common/vo/specific/SpecificTarget.java

@@ -0,0 +1,16 @@
+package com.gyee.common.vo.specific;/*
+@author   谢生杰
+@date   2022/12/4-21:40
+*/
+
+import lombok.Data;
+
+import java.util.List;
+@Data
+public class SpecificTarget {
+    private String wpid;
+    private String wpname;
+//    private Integer year;
+    List<SpecificTargetVo> targetList;
+    private Integer orderNum;
+}

+ 5 - 0
common/src/main/java/com/gyee/common/vo/specific/SpecificTargetVo.java

@@ -2,6 +2,8 @@ package com.gyee.common.vo.specific;
 
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * @ClassName : SpecificTargetVo
  * @Author : xieshengjie
@@ -18,4 +20,7 @@ public class SpecificTargetVo {
     private Double current;
     private Double sameperiod;
     private Integer compare;
+
 }
+
+

+ 13 - 13
common/src/main/java/com/gyee/common/vo/specific/SpecificTopVo.java

@@ -14,19 +14,19 @@ import java.io.Serializable;
 public class SpecificTopVo implements Serializable {
     private static final long serialVersionUID = 1407554909175314466L;
     private String type;
-    private Double yllfdl;
-    private Double ysjfdl;
-    private Double yfnlyl;
-    private Double ywhssdl;
-    private Double ywhssl;
-    private Double ygzssdl;
-    private Double ygzssl;
-    private Double yxdssdl;
-    private Double yxdssl;
-    private Double yxnssdl;
-    private Double yxnssl;
-    private Double yslssdl;
-    private Double yslssl;
+    private Double yllfdl;   //理论发电量
+    private Double ysjfdl;   //实际发电量
+    private Double yfnlyl;    //风能利用率
+    private Double ywhssdl;   //维护损失电量
+    private Double ywhssl;    //维护损失率
+    private Double ygzssdl;   //故障损失电量
+    private Double ygzssl;    //故障损失率
+    private Double yxdssdl;   //限电损失电量
+    private Double yxdssl;     //限电损失率
+    private Double yxnssdl;    //性能损失电量
+    private Double yxnssl;     //性能损失率
+    private Double yslssdl;   //受累损失电量
+    private Double yslssl;    //受累损失率
     private Double nllfdl;
     private Double nsjfdl;
     private Double nfnlyl;

+ 2 - 2
realtime/computing-services7003/src/main/resources/application-jn.yml

@@ -85,11 +85,11 @@ logging:
 db:
   url: http://10.81.3.152:8011/ts
 #参与计算的场站
-runWindpowerstation: NJL_FDC,YTY_FDC,BHB_FDC,XWT_FDC #,MLJ_FDC,BHB_FDC,BHB3_FDC,XWT_FDC,
+runWindpowerstation: NJL_FDC,YTY_FDC,BHB_FDC,XWT_FDC,BHB3_FDC #,MLJ_FDC,BHB_FDC,BHB3_FDC,XWT_FDC,
 #计算状态用ai或者di
 clauStatus:
   ai:    #配置期次
-  di: NJL01_GC,NJL02_GC,YTY01_GC,BHB01_GC,XWT01_GC
+  di: NJL01_GC,NJL02_GC,YTY01_GC,BHB01_GC,XWT01_GC,BHB301_GC
 #判断数据终端
 second: 1800
 #判断降出力

+ 45 - 1
realtime/generation-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -1,9 +1,14 @@
 package com.gyee.generation;
 
+import com.gyee.common.util.DateUtils;
+import com.gyee.generation.service.Status_HF_Service;
+import com.gyee.generation.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import java.util.Date;
+
 /**
  * @ClassName : GenerationMain
  * @Author : xieshengjie
@@ -13,7 +18,46 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 @MapperScan("com.gyee.generation.mapper")
 public class GenerationMain {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
+
         SpringApplication.run(GenerationMain.class,args);
+
+
+        Status_HF_Service status_HF_Service=SpringUtils.getBean("status_HF_Service");
+
+        while(true)
+        {
+
+
+
+            Date begin=new Date();
+            System.out.println("开始欠发状态。。。。。。");
+            status_HF_Service.calculateQfStatus();
+            Date end=new Date();
+            System.out.println("结束欠发状态。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+
+            Thread.sleep(500);
+            System.out.println("开始故障状态。。。。。。");
+            begin=new Date();
+            status_HF_Service.calculateGzStatus();
+            end=new Date();
+            System.out.println("结束故障状态。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+            Thread.sleep(500);
+            System.out.println("开始理论发电量。。。。。。");
+            begin=new Date();
+            status_HF_Service.calculateLlgl();
+            end=new Date();
+            System.out.println("结束理论发电量。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+            Thread.sleep(500);
+            System.out.println("开始场站指标。。。。。。");
+            begin=new Date();
+            status_HF_Service.calculateWpPoint();
+            end=new Date();
+            System.out.println("结束场站指标。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+
+
+            Thread.sleep(500);
+        }
+
     }
 }

+ 11 - 9
realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java

@@ -39,8 +39,10 @@ public class GeneratorCodeConfig {
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
         String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath + "/src/main/java");
-        gc.setAuthor("谢生杰");
+//        gc.setOutputDir(projectPath + "/src/main/java");
+//        gc.setAuthor("谢生杰");
+        gc.setOutputDir(projectPath+"/realtime/generation-service"+ "/src/main/java");
+        gc.setAuthor("shilin");
         gc.setOpen(false);
         //实体属性 Swagger2 注解
         gc.setSwagger2(false);
@@ -53,15 +55,15 @@ public class GeneratorCodeConfig {
         dsc.setUsername("root");
         dsc.setPassword("root");
         mpg.setDataSource(dsc);*/
-//        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
-//        dsc.setUsername("gdprod");
-//        dsc.setPassword("gd123");
-//        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
-
-        dsc.setDriverName("org.postgresql.Driver");
+        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
         dsc.setUsername("gdprod");
         dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
+        dsc.setUrl("jdbc:oracle:thin:@10.0.118.71:1521:gdsj");
+
+//        dsc.setDriverName("org.postgresql.Driver");
+//        dsc.setUsername("gdprod");
+//        dsc.setPassword("gd123");
+//        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
         mpg.setDataSource(dsc);
 
 

+ 20 - 0
realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdiController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdi")
+public class WindturbinetestingpointdiController {
+
+}

+ 20 - 0
realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdisController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdis")
+public class WindturbinetestingpointdisController {
+
+}

+ 203 - 59
realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java

@@ -45,126 +45,159 @@ public class CacheContext implements CommandLineRunner {
     private IWindturbinepowerService windturbinepowerService;
     @Resource
     private RedisService redisService;
+    @Resource
+    private IWindturbinetestingpointaiService windturbinetestingpointaiService;
+    @Resource
+    private IWindpowerstationtestingpointService windpowerstationtestingpointService;
+
+    @Resource
+    private IWindturbinepowercurvefittingService windturbinepowercurvefittingService;
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
-
+    @Resource
+    private IWindturbinetestingpointdisService windturbinetestingpointdisService;
     public static List<Windturbine> wtls = new ArrayList<>();
     public static List<Project> projects = new ArrayList<>();
-    public static List<Line>  lines = new ArrayList<>();
-    public static List<Windpowerstation>  wpls = new ArrayList<>();
-    public static List<Meterpoint>  meterpoints = new ArrayList<>();
-    public static Map<String,Meterpoint>  meterpointMap = new HashMap<>();
-    public static Map<String,List<Project>> wppromap = new HashMap<>();
-    public static Map<String,List<Line>> prolinemap = new HashMap<>();
-    public static Map<String,List<Windturbine>> linewtmap = new HashMap<>();
+    public static List<Line> lines = new ArrayList<>();
+    public static List<Windpowerstation> wpls = new ArrayList<>();
+    public static List<Meterpoint> meterpoints = new ArrayList<>();
+    public static Map<String, Meterpoint> meterpointMap = new HashMap<>();
+    public static Map<String, List<Project>> wppromap = new HashMap<>();
+    public static Map<String, List<Line>> prolinemap = new HashMap<>();
+    public static Map<String, List<Windturbine>> linewtmap = new HashMap<>();
     public static Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap = new HashMap<>();// 风电机测点AI表
-    public static Map<String,Map<String, Windpowerstationpointnew>> linepointmap =new HashMap<>();
-    public static Map<String,Map<String, Windpowerstationpointnew>> propointmap =new HashMap<>();
-    public static Map<String,Map<String, Windpowerstationpointnew>> wppointmap =new HashMap<>();
-    public static Map<String,Project> proMap = new HashMap<>();
-    public static Map<String,List<Windturbinestatusdi>> statusMap = new HashMap<>();
-    public static Map<String,Map<Double,Double>> zbzglMap = new HashMap<>();
-    public static Map<String,Equipmentmodel> modelMap = new HashMap<>();
-    public static Map<String,Map<Double,Double>> zzsglMap = new HashMap<>();
-    public static Map<String,Double> modelpower = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> linepointmap = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> propointmap = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> wppointmap = new HashMap<>();
+    public static Map<String, Project> proMap = new HashMap<>();
+    public static Map<String, List<Windturbinestatusdi>> statusMap = new HashMap<>();
+    public static Map<String, Map<Double, Double>> zbzglMap = new HashMap<>();
+    public static Map<String, Equipmentmodel> modelMap = new HashMap<>();
+    public static Map<String, Map<Double, Double>> zzsglMap = new HashMap<>();
+    public static Map<String, Double> modelpower = new HashMap<>();
+
+    public static Map<String, Integer> redisDbMap = new HashMap<>();
+
+    public static Map<String, Map<String, Windturbinetestingpointai>> wtPointmap = new HashMap<>();// 风电机测点AI表
+
+
+    public static Map<String, Map<String, Windpowerstationtestingpoint>> wpPointmap = new HashMap<>();
+
+    public static Map<String, Map<Double, Windturbinepowercurvefitting>> curveFittingPowerMap = new HashMap<>();
+
+    public static List<Windturbinetestingpointdis> pointdis = new ArrayList<>();
+
+    public static Map< String,Map<String, Windturbinetestingpointdis>> pointdismap = new HashMap<>();
+
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
+
+
+
         List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
-        logger.info(runWpids.get(0)+"------------------"+runWpids.size());
+        logger.info(runWpids.get(0) + "------------------" + runWpids.size());
 
         List<Equipmentmodel> equipmentmodels = equipmentmodelService.list();
-        equipmentmodels.stream().forEach(e->{
-            modelMap.put(e.getId(),e);
+        equipmentmodels.stream().forEach(e -> {
+            modelMap.put(e.getId(), e);
         });
 
-        wtls = windturbineService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
-        logger.info(wtls.size()+"");
-        wtls.forEach(wt->{
+        wtls = windturbineService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        logger.info(wtls.size() + "");
+        wtls.forEach(wt -> {
             Equipmentmodel equipmentmodel = modelMap.get(wt.getModelid());
-            modelpower.put(wt.getId(),equipmentmodel.getPowerproduction());
+            modelpower.put(wt.getId(), equipmentmodel.getPowerproduction());
 
             String wtString = redisService.get(wt.getId());
             Map<String, Windturbinetestingpointnew> stringWindturbinetestingpointnewMap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Windturbinetestingpointnew>>() {
             });
-            wtpAimap.put(wt.getId(),stringWindturbinetestingpointnewMap);
+            wtpAimap.put(wt.getId(), stringWindturbinetestingpointnewMap);
 
-            if (linewtmap.containsKey(wt.getLineid())){
+            if (linewtmap.containsKey(wt.getLineid())) {
                 linewtmap.get(wt.getLineid()).add(wt);
-            }else {
+            } else {
                 List<Windturbine> lines = new ArrayList<>();
                 lines.add(wt);
-                linewtmap.put(wt.getLineid(),lines);
+                linewtmap.put(wt.getLineid(), lines);
             }
         });
 
-        projects = projectService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
-        projects.stream().forEach(p->{
-            proMap.put(p.getId(),p);
-            if (wppromap.containsKey(p.getWindpowerstationid())){
+        projects = projectService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        projects.stream().forEach(p -> {
+            proMap.put(p.getId(), p);
+            if (wppromap.containsKey(p.getWindpowerstationid())) {
                 wppromap.get(p.getWindpowerstationid()).add(p);
-            }else {
+            } else {
                 List<Project> prolist = new ArrayList<>();
                 prolist.add(p);
-                wppromap.put(p.getWindpowerstationid(),prolist);
+                wppromap.put(p.getWindpowerstationid(), prolist);
             }
             String pjString = redisService.get(p.getId());
             Map<String, Windpowerstationpointnew> stringWindpowerstationpointnewMap = JSONObject.parseObject(pjString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            propointmap.put(p.getId(),stringWindpowerstationpointnewMap);
+            propointmap.put(p.getId(), stringWindpowerstationpointnewMap);
 
         });
 
-        lines = lineService.list().stream().filter(i-> StringUtils.isNotNull(proMap.get(i.getProjectid())) && runWpids.contains(proMap.get(i.getProjectid()).getWindpowerstationid())).collect(Collectors.toList());
-        lines.stream().forEach(l->{
-            if (prolinemap.containsKey(l.getProjectid())){
+        lines = lineService.list().stream().filter(i -> StringUtils.isNotNull(proMap.get(i.getProjectid())) && runWpids.contains(proMap.get(i.getProjectid()).getWindpowerstationid())).collect(Collectors.toList());
+        lines.stream().forEach(l -> {
+            if (prolinemap.containsKey(l.getProjectid())) {
                 prolinemap.get(l.getProjectid()).add(l);
-            }else {
+            } else {
                 List<Line> lineList = new ArrayList<>();
                 lineList.add(l);
-                prolinemap.put(l.getProjectid(),lineList);
+                prolinemap.put(l.getProjectid(), lineList);
             }
             String lnString = redisService.get(l.getId());
             Map<String, Windpowerstationpointnew> stringWindpowerstationpointnewMap = JSONObject.parseObject(lnString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            linepointmap.put(l.getId(),stringWindpowerstationpointnewMap);
+            linepointmap.put(l.getId(), stringWindpowerstationpointnewMap);
         });
 
-        wpls = windpowerstationService.list().stream().filter(i->runWpids.contains(i.getId())).collect(Collectors.toList());;
-        meterpoints = meterpointService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        wpls = windpowerstationService.list().stream().filter(i -> runWpids.contains(i.getId())).collect(Collectors.toList());
+        ;
+        meterpoints = meterpointService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
         meterpoints.stream().forEach(meterpoint -> {
-            meterpointMap.put(meterpoint.getId(),meterpoint);
+            meterpointMap.put(meterpoint.getId(), meterpoint);
         });
 
 
-        wpls.stream().forEach(wp->{
+        wpls.stream().forEach(wp -> {
             String wpString = redisService.get(wp.getId());
             Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            wppointmap.put(wp.getId(),stringMapMap);
+            wppointmap.put(wp.getId(), stringMapMap);
         });
 
         String sszzt = redisService.get("SSZZT");
-         statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String,List<Windturbinestatusdi>>>() {
+        statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String, List<Windturbinestatusdi>>>() {
         });
 
 
-
         String zbzgl = redisService.get("ZBZGL");
-        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String,Map<Double,Double>>>() {
+        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, Double>>>() {
         });
 
-        List<Windturbinepower> windturbinepowerList = windturbinepowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationid())).collect(Collectors.toList());
-        windturbinepowerList.stream().forEach(w -> {
-            if (zzsglMap.containsKey(w.getWindturbineid())){
-                zzsglMap.get(w.getWindturbineid()).put(w.getSpeed(),w.getTheorypower());
-            }else {
-                Map<Double,Double> tempMap = new HashMap<>();
-                tempMap.put(w.getSpeed(),w.getTheorypower());
-                zzsglMap.put(w.getWindturbineid(),tempMap);
-            }
+//        List<Windturbinepower> windturbinepowerList = windturbinepowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationid())).collect(Collectors.toList());
+//        windturbinepowerList.stream().forEach(w -> {
+//            if (zzsglMap.containsKey(w.getWindturbineid())){
+//                zzsglMap.get(w.getWindturbineid()).put(w.getSpeed(),w.getTheorypower());
+//            }else {
+//                Map<Double,Double> tempMap = new HashMap<>();
+//                tempMap.put(w.getSpeed(),w.getTheorypower());
+//                zzsglMap.put(w.getWindturbineid(),tempMap);
+//            }
+//
+//        });
 
-        });
+        for (int i = 0; i < 8; i++) {
+            Set<String> keys = redisService.keys(i);
+
+            for (String key : keys) {
+                redisDbMap.put(key, i);
+            }
+        }
 
 //        String wpString = redisService.get("PRODUCT-WP");
 //        wppointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
@@ -179,6 +212,117 @@ public class CacheContext implements CommandLineRunner {
 //        String wtString = redisService.get("PRODUCT-WT");
 //        wtpAimap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Map<String, Windturbinetestingpointnew>>>() {
 //        });
+        redisService.select(8);
+
+       // initial();
+
+        String wtPointString = redisService.get("wtPointmap");
+        wtPointmap = JSONObject.parseObject(wtPointString, new TypeReference<Map<String, Map<String, Windturbinetestingpointai>>>() {
+        });
+
+        String wpPointString = redisService.get("wpPointmap");
+        wpPointmap = JSONObject.parseObject(wpPointString, new TypeReference<Map<String, Map<String, Windpowerstationtestingpoint>>>() {
+        });
+
+
+        String curveFittingPowerString = redisService.get("curveFittingPowerMap");
+        curveFittingPowerMap = JSONObject.parseObject(curveFittingPowerString, new TypeReference<Map<String, Map<Double, Windturbinepowercurvefitting>>>() {
+        });
+
+
+        String pointdisString = redisService.get("pointdis");
+        pointdis = JSONObject.parseObject(pointdisString, new TypeReference<List<Windturbinetestingpointdis>>() {
+        });
+
+
+
+
+        Map<String, Windturbinetestingpointdis> items = null;
+        if (pointdis != null && !pointdis.isEmpty()) {
+            for (int i = 0; i < pointdis.size(); i++) {
+                Windturbinetestingpointdis point = pointdis.get(i);
+                if (pointdismap.containsKey(point.getWindturbineid())) {
+                    items = pointdismap.get(point.getWindturbineid());
+                    items.put(point.getUniformcode(), point);
+                } else {
+                    items = new HashMap<String, Windturbinetestingpointdis>();
+                    pointdismap.put(point.getWindturbineid(), items);
+                    items.put(point.getUniformcode(), point);
+                }
+
+            }
+        }
+
+
         logger.info("缓存结束------------------------------------------------------------");
     }
+
+
+    private void initial() {
+
+        List<Windturbinetestingpointai> wtpointlist = windturbinetestingpointaiService.list();
+
+
+        Map<String, Windturbinetestingpointai> map = null;
+
+        if (wtpointlist != null && !wtpointlist.isEmpty()) {
+            for (Windturbinetestingpointai mp : wtpointlist) {
+                if (wtPointmap.containsKey(mp.getWindturbineid())) {
+                    map = wtPointmap.get(mp.getWindturbineid());
+                    map.put(mp.getUniformcode(), mp);
+                } else {
+                    map = new HashMap<String, Windturbinetestingpointai>();
+                    map.put(mp.getUniformcode(), mp);
+                    wtPointmap.put(mp.getWindturbineid(), map);
+                }
+            }
+        }
+
+        String s = JSONObject.toJSONString(wtPointmap);
+        redisService.set("wtPointmap", s);
+
+
+        List<Windpowerstationtestingpoint> list = windpowerstationtestingpointService.list();
+
+        Map<String, Windpowerstationtestingpoint> items = null;
+        if (list != null && !list.isEmpty()) {
+            for (int i = 0; i < list.size(); i++) {
+                Windpowerstationtestingpoint point = list.get(i);
+                if (wpPointmap.containsKey(point.getWindpowerstationid())) {
+                    items = wpPointmap.get(point.getWindpowerstationid());
+                    items.put(point.getUniformcode(), point);
+                } else {
+                    items = new HashMap<String, Windpowerstationtestingpoint>();
+                    wpPointmap.put(point.getWindpowerstationid(), items);
+                    items.put(point.getUniformcode(), point);
+                }
+
+            }
+        }
+        s = JSONObject.toJSONString(wpPointmap);
+        redisService.set("wpPointmap", s);
+
+
+        List<Windturbinepowercurvefitting> econWtPowerCurveFittings = windturbinepowercurvefittingService.list();
+        if (StringUtils.isNotNull(econWtPowerCurveFittings)) {
+            econWtPowerCurveFittings.stream().forEach(curveFitting -> {
+                if (curveFittingPowerMap.containsKey(curveFitting.getWindturbineid())) {
+                    curveFittingPowerMap.get(curveFitting.getWindturbineid()).put(curveFitting.getSpeed(), curveFitting);
+                } else {
+                    Map<Double, Windturbinepowercurvefitting> powerMap = new HashMap<>();
+                    powerMap.put(curveFitting.getSpeed(), curveFitting);
+                    curveFittingPowerMap.put(curveFitting.getWindturbineid(), powerMap);
+                }
+            });
+        }
+
+        s = JSONObject.toJSONString(curveFittingPowerMap);
+        redisService.set("curveFittingPowerMap", s);
+
+
+        pointdis = windturbinetestingpointdisService.list();
+
+        s = JSONObject.toJSONString(pointdis);
+        redisService.set("pointdis", s);
+    }
 }

+ 16 - 0
realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdiMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface WindturbinetestingpointdiMapper extends BaseMapper<Windturbinetestingpointdi> {
+
+}

+ 16 - 0
realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdisMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface WindturbinetestingpointdisMapper extends BaseMapper<Windturbinetestingpointdis> {
+
+}

+ 2 - 2
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpoint.java

@@ -81,10 +81,10 @@ public class Meterpoint extends Model {
     @TableField("MAGNIFICATIONXS")
     private Double magnificationxs;
 
-    @TableField("OTHERVALUE")
+    @TableField(exist = false)
     private Double othervalue;
 
-    @TableField("OTHERDATE")
+    @TableField(exist = false)
     private Date otherdate;
 
 

+ 81 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdi.java

@@ -0,0 +1,81 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINETESTINGPOINTDI")
+public class Windturbinetestingpointdi extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private BigDecimal maxval;
+
+    @TableField("MINVAL")
+    private BigDecimal minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private BigDecimal reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private BigDecimal reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 81 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdis.java

@@ -0,0 +1,81 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINETESTINGPOINTDIS")
+public class Windturbinetestingpointdis extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private BigDecimal maxval;
+
+    @TableField("MINVAL")
+    private BigDecimal minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private BigDecimal reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private BigDecimal reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 18 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/vo/PointValueVo.java

@@ -0,0 +1,18 @@
+package com.gyee.generation.model.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+@Data
+public class PointValueVo {
+
+    private String pointid;
+
+    private Double value;
+
+    private Long timestamp;
+
+    private Date datetime;
+
+    private Integer status;
+}

+ 543 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/Status_HF_Service.java

@@ -0,0 +1,543 @@
+package com.gyee.generation.service;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.algorithm.Underdelivery;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.SpringUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.redis.RedisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : StatusService
+ * @Author : xieshengjie
+ * @Date: 2022/3/28 14:22
+ * @Description : 状态计算
+ */
+@Service
+public class Status_HF_Service {
+
+    @Resource
+    private IEdosUtil edosUtil;
+
+
+
+
+    /**
+     * 判断故障状态
+     *
+     * @throws Exception
+     */
+    public void calculateGzStatus() throws Exception {
+
+
+        RedisService redisService= SpringUtils.getBean("redisService");
+        Date date = new Date();
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+
+            Map<Integer,List<String>> pointmap=new LinkedHashMap<>();
+            for (Windturbine wt : CacheContext.wtls) {
+
+                List<Windturbinetestingpointdis> disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT001")).collect(Collectors.toList());
+
+                if (!disLs.isEmpty()) {
+                    Windturbinetestingpointdis key = disLs.get(0);
+                    if (CacheContext.redisDbMap.containsKey(key.getId())) {
+                        int dbnum = CacheContext.redisDbMap.get(key.getId());
+
+                        if(pointmap.containsKey(dbnum))
+                        {
+                            List<String> ls=pointmap.get(dbnum);
+                            ls.add(key.getId());
+                        }else
+                        {
+                            List<String> ls=new ArrayList<>();
+                            ls.add(key.getId());
+                            pointmap.put(dbnum,ls);
+                        }
+
+                    }
+
+
+                }
+
+               disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT002")).collect(Collectors.toList());
+
+
+                if (!disLs.isEmpty()) {
+                    Windturbinetestingpointdis key = disLs.get(0);
+                    if (CacheContext.redisDbMap.containsKey(key.getId())) {
+                        int dbnum = CacheContext.redisDbMap.get(key.getId());
+
+
+                        if(pointmap.containsKey(dbnum))
+                        {
+                            List<String> ls=pointmap.get(dbnum);
+                            ls.add(key.getId());
+                        }else
+                        {
+                            List<String> ls=new ArrayList<>();
+                            ls.add(key.getId());
+                            pointmap.put(dbnum,ls);
+                        }
+
+
+                    }
+
+                }
+            }
+
+            Map<String,Map<String,String>> valuemap=redisService.hgetall(pointmap);
+            for (Windturbine wt : CacheContext.wtls) {
+
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                    if (map.containsKey(Contant.GZZT)) {
+                        Windturbinetestingpointai pt = map.get(Contant.GZZT);
+                      // redisService.select(8);
+
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", pt.getId());
+
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(pt.getId(), pomap);
+                        // redisService.putHashAllObj(pt.getId(),pomap);
+
+                    }
+                }
+
+                if (wt.getModelid().equals("SL1500-77") || wt.getModelid().equals("SL1500-82")) {
+                    List<Windturbinetestingpointdis> disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT001")).collect(Collectors.toList());
+
+                    if (!disLs.isEmpty()) {
+                        Windturbinetestingpointdis key = disLs.get(0);
+                        if (valuemap.containsKey(key.getId())) {
+
+                            double value = 0.0;
+
+                            if(valuemap.containsKey(key.getId()))
+                            {
+                                Map<String, String> tempmap = valuemap.get(key.getId());
+                                if (tempmap.containsKey("value")) {
+                                    value = Double.valueOf((String) tempmap.get("value"));
+                                }
+                            }
+
+
+                            if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                                Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                                if (map.containsKey(Contant.GZZT)) {
+                                    Windturbinetestingpointai pt = map.get(Contant.GZZT);
+
+                                    if (StringUtils.notEmp(value) && value == 3) {
+                                        redisService.select(8);
+
+
+                                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                        pomap.put("pointid", pt.getId());
+                                        pomap.put("value", 1);
+                                        pomap.put("timestamp", date.getTime() / 1000);
+                                        pomap.put("datetime", DateUtils.toDate(date));
+                                        pomap.put("status", 0);
+
+                                        pipelinedmap.put(pt.getId(), pomap);
+                                        // redisService.putHashAllObj(pt.getId(),pomap);
+
+
+                                    }
+                                }
+                            }
+
+                        }
+
+
+                    }
+                } else {
+                    List<Windturbinetestingpointdis> disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT002")).collect(Collectors.toList());
+
+
+                    if (!disLs.isEmpty()) {
+                        Windturbinetestingpointdis key = disLs.get(0);
+                        if (valuemap.containsKey(key.getId())) {
+                            double value = 0.0;
+                            if(valuemap.containsKey(key.getId()))
+                            {
+                                Map<String, String> tempmap = valuemap.get(key.getId());
+                                if (tempmap.containsKey("value")) {
+                                    value = Double.valueOf((String) tempmap.get("value"));
+                                }
+                            }
+
+
+                            if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                                Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                                if (map.containsKey(Contant.GZZT)) {
+                                    Windturbinetestingpointai pt = map.get(Contant.GZZT);
+
+                                    if (StringUtils.notEmp(value) && value == 1) {
+                                        // redisService.select(8);
+
+
+                                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                        pomap.put("pointid", pt.getId());
+                                        pomap.put("value", 1);
+                                        pomap.put("timestamp", date.getTime() / 1000);
+                                        pomap.put("datetime", DateUtils.toDate(date));
+                                        pomap.put("status", 0);
+                                        pipelinedmap.put(pt.getId(), pomap);
+                                        //redisService.putHashAllObj(pt.getId(),pomap);
+
+
+                                    }
+                                }
+                            }
+                        }
+
+                    }
+                }
+            }
+            redisService.select(8);
+            redisService.putHashAllPipeObj(pipelinedmap);
+
+
+        }
+
+    }
+
+
+    /**
+     * 判断欠发状态
+     *
+     * @throws Exception
+     */
+    public void calculateQfStatus() throws Exception {
+        RedisService redisService= SpringUtils.getBean("redisService");
+        Date date = new Date();
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+            Map<Integer,List<String>> pointmap=new LinkedHashMap<>();
+
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+
+
+                    if (map.containsKey(Contant.AI130) && map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai powerpoint = map.get(Contant.AI130);
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        if (CacheContext.redisDbMap.containsKey(powerpoint.getId()) && CacheContext.redisDbMap.containsKey(speedpoint.getId())) {
+
+                            int dbnum = CacheContext.redisDbMap.get(powerpoint.getId());
+                            if(pointmap.containsKey(dbnum))
+                            {
+                                List<String> ls=pointmap.get(dbnum);
+                                ls.add(powerpoint.getId());
+                            }else
+                            {
+                                List<String> ls=new ArrayList<>();
+                                ls.add(powerpoint.getId());
+                                pointmap.put(dbnum,ls);
+                            }
+
+
+                            dbnum = CacheContext.redisDbMap.get(speedpoint.getId());
+                            if(pointmap.containsKey(dbnum))
+                            {
+                                List<String> ls=pointmap.get(dbnum);
+                                ls.add(speedpoint.getId());
+                            }else
+                            {
+                                List<String> ls=new ArrayList<>();
+                                ls.add(speedpoint.getId());
+                                pointmap.put(dbnum,ls);
+                            }
+
+
+                        }
+                    }
+                }
+            }
+
+            Map<String,Map<String,String>> valuemap=redisService.hgetall(pointmap);
+
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+
+
+                    if (map.containsKey(Contant.RSSQFZT)) {
+                        Windturbinetestingpointai qfpt = map.get(Contant.RSSQFZT);
+                       // redisService.select(8);
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", qfpt.getId());
+
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(qfpt.getId(), pomap);
+                        //redisService.putHashAllObj(qfpt.getId(),pomap);
+                    }
+                    if (map.containsKey(Contant.AI130) && map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai powerpoint = map.get(Contant.AI130);
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        double power = 0.0;
+
+                        if(valuemap.containsKey(powerpoint.getId()))
+                        {
+                            Map<String, String> tempmap = valuemap.get(powerpoint.getId());
+
+                            if (tempmap.containsKey("value")) {
+                                power = Double.valueOf((String) tempmap.get("value"));
+                            }
+                        }
+
+
+
+                        double speed = 0.0;
+                        if(valuemap.containsKey(speedpoint.getId()))
+                        {
+                            Map<String, String> tempmap2 = valuemap.get(speedpoint.getId());
+                            if (tempmap2.containsKey("value")) {
+                                speed = Double.valueOf((String) tempmap2.get("value"));
+                            }
+                        }
+
+
+
+                        if ((speed != 0 && power != 0) && CacheContext.curveFittingPowerMap.containsKey(wt.getId()) && StringUtils.notEmp(power) && StringUtils.notEmp(speed)) {
+                            Map<Double, Windturbinepowercurvefitting> wtcurvemap = CacheContext.curveFittingPowerMap.get(wt.getId());
+
+                            if (wtcurvemap.containsKey(StringUtils.round(speed, 2))) {
+                                Windturbinepowercurvefitting wtcurve = wtcurvemap.get(StringUtils.round(speed, 2));
+                                //拟合功率
+                                Double actualpower = wtcurve.getActualpower();
+
+                                double qfzt = Underdelivery.underdeliveryStatusReal(power, actualpower);
+                                if (map.containsKey(Contant.RSSQFZT)) {
+                                    Windturbinetestingpointai qfpt = map.get(Contant.RSSQFZT);
+//                                        redisService.select(8);
+
+
+                                    Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                    pomap.put("pointid", qfpt.getId());
+
+                                    pomap.put("value", qfzt);
+                                    pomap.put("timestamp", date.getTime() / 1000);
+                                    pomap.put("datetime", DateUtils.toDate(date));
+                                    pomap.put("status", 0);
+                                    pipelinedmap.put(qfpt.getId(), pomap);
+                                    //redisService.putHashAllObj(qfpt.getId(),pomap);
+
+
+                                }
+                            }
+
+                        }
+                    }
+                }
+            }
+            redisService.select(8);
+            redisService.putHashAllPipeObj(pipelinedmap);
+
+        }
+    }
+
+
+    /**
+     * 判断理论功率
+     *
+     * @throws Exception
+     */
+    public void calculateLlgl() throws Exception {
+        RedisService redisService= SpringUtils.getBean("redisService");
+        Date date = new Date();
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+
+            Map<Integer,List<String>> pointmap=new LinkedHashMap<>();
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+
+
+                    if (map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        if (CacheContext.redisDbMap.containsKey(speedpoint.getId())) {
+
+                            int dbnum = CacheContext.redisDbMap.get(speedpoint.getId());
+                            if(pointmap.containsKey(dbnum))
+                            {
+                                List<String> ls=pointmap.get(dbnum);
+                                ls.add(speedpoint.getId());
+                            }else
+                            {
+                                List<String> ls=new ArrayList<>();
+                                ls.add(speedpoint.getId());
+                                pointmap.put(dbnum,ls);
+                            }
+
+                        }
+                    }
+                }
+
+
+            }
+
+            Map<String,Map<String,String>> valuemap=redisService.hgetall(pointmap);
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                    if (map.containsKey(Contant.LLGL)) {
+                        Windturbinetestingpointai qfpt = map.get(Contant.LLGL);
+                        //redisService.select(8);
+
+
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", qfpt.getId());
+
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(qfpt.getId(), pomap);
+                        //  redisService.putHashAllObj(qfpt.getId(),pomap);
+
+                    }
+
+                    if (map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        double speed = 0.0;
+                        if(valuemap.containsKey(speedpoint.getId()))
+                        {
+                            Map<String, String> tempmap = valuemap.get(speedpoint.getId());
+                            if (tempmap.containsKey("value")) {
+                                speed = Double.valueOf((String) tempmap.get("value"));
+                            }
+                        }
+
+
+
+                        if (speed != 0 && CacheContext.curveFittingPowerMap.containsKey(wt.getId()) && StringUtils.notEmp(speed)) {
+                            Map<Double, Windturbinepowercurvefitting> wtcurvemap = CacheContext.curveFittingPowerMap.get(wt.getId());
+
+                            if (wtcurvemap.containsKey(StringUtils.round(speed, 2))) {
+                                Windturbinepowercurvefitting wtcurve = wtcurvemap.get(StringUtils.round(speed, 2));
+                                //拟合功率
+                                Double actualpower = wtcurve.getOptimalpower();
+
+                                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+
+                                    if (map.containsKey(Contant.LLGL)) {
+                                        Windturbinetestingpointai qfpt = map.get(Contant.LLGL);
+                                        // redisService.select(8);
+
+
+                                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                        pomap.put("pointid", qfpt.getId());
+
+                                        pomap.put("value", actualpower);
+                                        pomap.put("timestamp", date.getTime() / 1000);
+                                        pomap.put("datetime", DateUtils.toDate(date));
+                                        pomap.put("status", 0);
+                                        pipelinedmap.put(qfpt.getId(), pomap);
+                                        //redisService.putHashAllObj(qfpt.getId(),pomap);
+
+
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
+
+            }
+            redisService.select(8);
+            redisService.putHashAllPipeObj(pipelinedmap);
+
+        }
+    }
+
+
+    /**
+     * 转存场站计算指标
+     *
+     * @throws Exception
+     */
+    public void calculateWpPoint() throws Exception {
+        RedisService redisService= SpringUtils.getBean("redisService");
+        Date date = new Date();
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wpls.isEmpty()) {
+            for (Windpowerstation wp : CacheContext.wpls) {
+
+
+                if (CacheContext.wpPointmap.containsKey(wp.getId())) {
+                    Map<String, Windpowerstationtestingpoint> map = CacheContext.wpPointmap.get(wp.getId());
+
+                    List<String> ls = new ArrayList<>();
+
+                    ls.add(map.get("CYDLB").getCode());
+                    ls.add(map.get("RFDLB").getCode());
+                    ls.add(map.get("RFDLC").getCode());
+                    ls.add(map.get("RGZSSDL").getCode());
+                    ls.add(map.get("RJXSSDL").getCode());
+                    ls.add(map.get("RWZSSDL").getCode());
+                    ls.add(map.get("RXDSSDL").getCode());
+                    ls.add(map.get("SSFS").getCode());
+                    ls.add(map.get("SSZGL").getCode());
+                    ls.add(map.get("ZLLGL").getCode());
+                    ls.add(map.get("ZZSGL").getCode());
+                    ls.add(map.get("XDZT").getCode());
+                    ls.add(map.get("RXNSSDL").getCode());
+                    ls.add(map.get("QXPCL").getCode());
+
+                    List<PointData> vos = edosUtil.getRealData(ls);
+                    if (!vos.isEmpty()) {
+
+                        for (PointData vo : vos) {
+                            Map<String, Object> pomap = new LinkedHashMap<>();
+
+                            pomap.put("pointid", vo.getEdnaId());
+                            pomap.put("value", vo.getPointValueInDouble());
+                            pomap.put("timestamp", date.getTime()/ 1000);
+                            pomap.put("datetime", DateUtils.toDate(date));
+                            pomap.put("status", 0);
+                            pipelinedmap.put(vo.getEdnaId(), pomap);
+                            //redisService.putHashAllObj(vo.getEdnaId(),pomap);
+                        }
+                    }
+
+                }
+            }
+            redisService.select(8);
+            redisService.putHashAllPipeObj(pipelinedmap);
+
+        }
+    }
+}

+ 16 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdiService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface IWindturbinetestingpointdiService extends IService<Windturbinetestingpointdi> {
+
+}

+ 16 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdisService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface IWindturbinetestingpointdisService extends IService<Windturbinetestingpointdis> {
+
+}

+ 20 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdiServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.gyee.generation.mapper.auto.WindturbinetestingpointdiMapper;
+import com.gyee.generation.service.auto.IWindturbinetestingpointdiService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Service
+public class WindturbinetestingpointdiServiceImpl extends ServiceImpl<WindturbinetestingpointdiMapper, Windturbinetestingpointdi> implements IWindturbinetestingpointdiService {
+
+}

+ 20 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdisServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.gyee.generation.mapper.auto.WindturbinetestingpointdisMapper;
+import com.gyee.generation.service.auto.IWindturbinetestingpointdisService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Service
+public class WindturbinetestingpointdisServiceImpl extends ServiceImpl<WindturbinetestingpointdisMapper, Windturbinetestingpointdis> implements IWindturbinetestingpointdisService {
+
+}

+ 90 - 0
realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java

@@ -36,6 +36,9 @@ public class SaticScheduleTask {
     private FiveLossesService fiveLossesService;
     @Resource
     private SafetyService safetyService;
+
+    @Resource
+    private Status_HF_Service status_HF_Service;
     //3.添加定时任务
     /**
      * 电计量实时计算计算(电量,上网,购网,场用)
@@ -193,10 +196,97 @@ public class SaticScheduleTask {
     @XxlJob("shutdownevent-realtime")
     public void shutdownevent(){
         XxlJobHelper.log("故障事件调度程序执行开始!........");
+
         fiveLossesService.saveShutdownevent();
         XxlJobHelper.log("故障事件调度程序执行完成!........");
     }
 
 
+    /**
+     * 欠发状态
+     * 钟执行一次
+     */
+
+    @XxlJob("calculateQfStatus")
+    public void calculateQfStatus()  {
+
+
+        XxlJobHelper.log("风机欠发状态调度程序执行开始!........");
+        try {
+//            while (true)
+//            {
+//                status_HF_Service.calculateQfStatus();
+//                Thread.sleep(180000);
+//            }
+            status_HF_Service.calculateQfStatus();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机欠发状态调度任务处理完成!........");
+    }
+    /**
+     * 故障状态
+     * 钟执行一次
+     */
+    @XxlJob("calculateGzStatus")
+    public void calculateGzStatus()  {
+
 
+        XxlJobHelper.log("风机故障状态调度程序执行开始!........");
+        try {
+//            while (true)
+//            {
+//                status_HF_Service.calculateGzStatus();
+//                Thread.sleep(180000);
+//            }
+            status_HF_Service.calculateGzStatus();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机故障状态调度任务处理完成!........");
+    }
+    /**
+     * 理论电量
+     * 执行一次
+     */
+    @XxlJob("calculateLlgl")
+    public void calculateLlgl()  {
+
+
+        XxlJobHelper.log("风机理论发电量调度程序执行开始!........");
+        try {
+//            while (true)
+//            {
+//                status_HF_Service.calculateLlgl();
+//                Thread.sleep(180000);
+//            }
+            status_HF_Service.calculateLlgl();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机理论发电量调度任务处理完成!........");
+    }
+    /**
+     * 故障状态
+     * 每1分钟执行一次
+     */
+    @XxlJob("calculateWpPoint")
+    public void calculateWpPoint()  {
+
+
+        XxlJobHelper.log("场站指标调度程序执行开始!........");
+        try {
+//
+//
+//            while (true)
+//            {
+//                status_HF_Service.calculateWpPoint();
+//                Thread.sleep(500);
+//            }
+            status_HF_Service.calculateWpPoint();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("场站指标调度任务处理完成!........");
+    }
 }

+ 116 - 0
realtime/generation-service/src/main/java/com/gyee/generation/util/SpringUtils.java

@@ -0,0 +1,116 @@
+package com.gyee.generation.util;
+
+import org.springframework.aop.framework.AopContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.stereotype.Component;
+
+/**
+* spring工具类 方便在非spring管理环境中获取bean
+* @ClassName: SpringUtils
+* @author gyee
+* @date 2019-09-11 11:28
+*
+ */
+@Component
+public final class SpringUtils implements BeanFactoryPostProcessor
+{
+    /** Spring应用上下文环境 */
+    private static ConfigurableListableBeanFactory beanFactory;
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
+    {
+        SpringUtils.beanFactory = beanFactory;
+    }
+
+    /**
+     * 获取对象
+     *
+     * @param name
+     * @return Object 一个以所给名字注册的bean的实例
+     * @throws BeansException
+     *
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getBean(String name) throws BeansException
+    {
+        return (T) beanFactory.getBean(name);
+    }
+
+    /**
+     * 获取类型为requiredType的对象
+     *
+     * @param clz
+     * @return
+     * @throws BeansException
+     *
+     */
+    public static <T> T getBean(Class<T> clz) throws BeansException
+    {
+        T result = (T) beanFactory.getBean(clz);
+        return result;
+    }
+
+    /**
+     * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
+     *
+     * @param name
+     * @return boolean
+     */
+    public static boolean containsBean(String name)
+    {
+        return beanFactory.containsBean(name);
+    }
+
+    /**
+     * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
+     *
+     * @param name
+     * @return boolean
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.isSingleton(name);
+    }
+
+    /**
+     * @param name
+     * @return Class 注册对象的类型
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.getType(name);
+    }
+
+    /**
+     * 如果给定的bean名字在bean定义中有别名,则返回这些别名
+     *
+     * @param name
+     * @return
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.getAliases(name);
+    }
+
+    /**
+     * 获取aop代理对象
+     * 
+     * @param invoker
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getAopProxy(T invoker)
+    {
+        return (T) AopContext.currentProxy();
+    }
+}

+ 1 - 0
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisAutoConfiguration.java

@@ -25,6 +25,7 @@ public class RedisAutoConfiguration {
             RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
         RedisTemplate<Object, Object> template = new RedisTemplate<>();
         template.setConnectionFactory(redisConnectionFactory);
+        template.setEnableTransactionSupport(false);
         return template;
 
     }

+ 6 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisConfig.java

@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.GenericToStringSerializer;
 import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
@@ -27,6 +28,7 @@ public class RedisConfig {
     public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
         RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
         template.setConnectionFactory(factory);
+        template.setEnableTransactionSupport(false);
         Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
         ObjectMapper om = new ObjectMapper();
         om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
@@ -39,8 +41,11 @@ public class RedisConfig {
         template.setHashKeySerializer(stringRedisSerializer);
         // value序列化方式采用jackson
         template.setValueSerializer(jackson2JsonRedisSerializer);
+
+        GenericToStringSerializer redisSerializer = new GenericToStringSerializer(Object.class);
+
         // hash的value序列化方式采用jackson
-        template.setHashValueSerializer(jackson2JsonRedisSerializer);
+        template.setHashValueSerializer(redisSerializer);
         template.afterPropertiesSet();
         return template;
     }

+ 18 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java

@@ -1,5 +1,9 @@
 package com.gyee.generation.util.redis;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 public interface RedisService {
 
     /**
@@ -45,7 +49,20 @@ public interface RedisService {
 
     boolean hasKey(String key);
 
-
+    boolean hasKey(String key,String value);
     void select(Integer dbIndex);
 
+    Set<String> keys(Integer dbIndex);
+
+    Object getHashObj(final String key,final String value);
+
+     void putHashAllObj(final String key,final Map<String,Object> value);
+     Map<Object,Object> getHashEntries(final String key);
+
+     void putHashAllPipeObj(final Map<String,Map<String,Object> >map);
+
+    Map<String,Map<String,String>> hgetall(Map<Integer,List<String>> pointmap);
+
+    void  unbindConnection();
+
 }

+ 133 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java

@@ -4,22 +4,28 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.data.redis.connection.RedisConnection;
 import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
 import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisConnectionUtils;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.RedisSerializer;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.lang.reflect.Field;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 @Service("redisService")
 public class RedisServiceImpl implements RedisService {
 
+
+  
     @Resource
     private RedisTemplate<String, ?> redisTemplate;
 
     @Override
     public boolean set(final String key, final String value) {;
+
+        
         boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {
             @Override
             public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
@@ -34,6 +40,7 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public String get(final String key) {
+        
         String result = redisTemplate.execute(new RedisCallback<String>() {
             @Override
             public String doInRedis(RedisConnection connection) throws DataAccessException {
@@ -49,11 +56,14 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public boolean expire(final String key, long expire) {
+
+        
         return redisTemplate.expire(key, expire, TimeUnit.SECONDS);
     }
 
     @Override
     public boolean remove(final String key) {
+        
         boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {
             @Override
             public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
@@ -67,6 +77,7 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public boolean hasKey(final String key) {
+        
         try {
             return redisTemplate.hasKey(key);
         } catch (Exception e) {
@@ -74,7 +85,16 @@ public class RedisServiceImpl implements RedisService {
             return false;
         }
     }
+    @Override
+    public boolean hasKey(String key,String value){
 
+        try {
+            return redisTemplate.opsForHash().hasKey(key,value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
     @Override
     public void setObject(Object obj) {
         Field[] fields = obj.getClass().getDeclaredFields();
@@ -111,6 +131,7 @@ public class RedisServiceImpl implements RedisService {
     }
 
     public void select(Integer dbIndex) {
+
         if (dbIndex == null || dbIndex > 15 || dbIndex < 0) {
             dbIndex = 0;
         }
@@ -119,7 +140,118 @@ public class RedisServiceImpl implements RedisService {
         jedisConnectionFactory.setDatabase(dbIndex);
         redisTemplate.setConnectionFactory(jedisConnectionFactory);
         jedisConnectionFactory.afterPropertiesSet();
-//        jedisConnectionFactory.resetConnection();
+        jedisConnectionFactory.resetConnection();
+
+    }
+
+
+    public Set<String> keys(Integer dbIndex) {
+        select(dbIndex);
+        return redisTemplate.keys("*");
 
     }
+
+
+    public Object getHashObj(final String key,String value) {
+
+        
+        Object result = redisTemplate.opsForHash().get(key,value);
+        return result;
+    }
+
+    public Map<Object,Object> getHashEntries(final String key) {
+
+
+        Map<Object,Object> result = redisTemplate.opsForHash().entries(key);
+        return result;
+    }
+
+    public void putHashAllObj(final String key,final Map<String,Object> value)
+    {
+        
+        redisTemplate.opsForHash().putAll(key,value);
+    }
+
+    public void putHashAllPipeObj(final Map<String,Map<String,Object> >map)
+    {
+        RedisSerializer keySerializer = redisTemplate.getHashKeySerializer();
+        RedisSerializer valueSerializer = redisTemplate.getHashValueSerializer();
+        redisTemplate.executePipelined((RedisCallback) connection -> {
+            map.forEach((k, v) -> {
+                Map<byte[], byte[]> byteMap =new HashMap<>();
+                v.forEach((k2, v2) -> {
+                             byteMap.put(valueSerializer.serialize(k2),valueSerializer.serialize(v2));
+                        });
+
+                connection.hMSet(keySerializer.serialize( k), byteMap);
+            });
+            return null;
+        });
+    }
+
+    /**
+     * 批量取hash数据
+     *
+     * @param hashKeys
+     * @return
+     */
+    public List<Object> hashGetBatch(List<String> hashKeys) {
+
+        List list = redisTemplate.executePipelined(new RedisCallback<String>() {
+            @Override
+            public String doInRedis(RedisConnection connection) throws DataAccessException {
+                for (String hashKey : hashKeys) {
+                    Map<byte[], byte[]> map= connection.hGetAll(hashKey.getBytes());
+                }
+                return null;
+            }
+        });
+        return list;
+    }
+
+    public Map<String,Map<String,String>> hgetall(Map<Integer,List<String>> pointmap) {
+
+        Map<String,Map<String,String> >map=new LinkedHashMap<>();
+
+        for(Map.Entry<Integer,List<String>> entry:pointmap.entrySet()){
+
+
+            select(entry.getKey());
+
+            redisTemplate.execute((RedisCallback<Map<String,Map<String,String>>>) con -> {
+
+
+
+                for(String key:entry.getValue())
+                {
+                    Map<byte[], byte[]> result = con.hGetAll(key.getBytes());
+                    if (result.isEmpty()) {
+                        return new HashMap<>(0);
+                    }
+
+                    Map<String, String> ans = new HashMap<>(result.size());
+                    for (Map.Entry<byte[], byte[]> entry2 : result.entrySet()) {
+                        ans.put(new String(entry2.getKey()), new String(entry2.getValue()));
+                    }
+                    map.put(key,ans);
+                }
+
+
+
+                return map;
+            });
+
+
+        };
+
+        return map;
+    }
+
+    public void unbindConnection() {
+
+
+        RedisConnectionUtils.unbindConnection(redisTemplate.getConnectionFactory());
+    }
+
+
 }

+ 9 - 9
realtime/generationXK-service/src/main/resources/application-jn.yml

@@ -9,10 +9,10 @@ spring:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
   #redis集群
   redis:
-    host: 10.81.3.155
+    host: 10.0.118.70
     port: 6379
     timeout: 100000
-    #    集群环境打开下面注释,单机不需要打开
+#    集群环境打开下面注释,单机不需要打开
 #    cluster:
 #      #集群信息
 #      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
@@ -21,19 +21,19 @@ spring:
     password:
     application:
       name: test
-    jedis:
+    lettuce:
       pool:
-        max-active: 8
+        max-active: 10000
         min-idle: 0
-        max-idle: 8
+        max-idle: 10000
         max-wait: -1
     database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-    driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://10.81.3.151:5432/wisdom
+    driver-class-name: oracle.jdbc.driver.OracleDriver
+    url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
     username: gdprod
     password: gd123
     oracle-schema=:
@@ -83,9 +83,9 @@ logging:
     com.example: debug
 #db url
 db:
-  url: http://10.81.3.152:8011/ts
+  url: http://10.0.118.73:8011/ts
 #参与计算的场站
-runWindpowerstation: GJY_FDC,DJY_FDC,YF_FDC,HSM_FDC,PTZ_FDC,YLZ_FDC,ZK_FDC,NJL_FDC,YTY_FDC,PDL_FDC
+runWindpowerstation: TF_FDC,XC_FDC,LH_FDC,FS_FDC,BZ_FDC,XBQ_FDC,DBS_FDC,TZS_FDC
 #计算状态用ai或者di
 clauStatus:
   ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次

+ 1 - 1
realtime/generation-service/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: jn
+    active: hf
 #    active: td

+ 3 - 3
realtime/generation-service/src/main/resources/xxl-job-executor.properties

@@ -1,5 +1,5 @@
 ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
-xxl.job.admin.addresses=http://10.81.3.152:8175/xxl-job-admin
+xxl.job.admin.addresses=http://10.0.118.76:8175/xxl-job-admin
 
 ### xxl-job, access token
 xxl.job.accessToken=
@@ -10,9 +10,9 @@ xxl.job.executor.appname=generation-job
 xxl.job.executor.address=
 ### xxl-job executor server-info
 xxl.job.executor.ip=
-xxl.job.executor.port=9101
+xxl.job.executor.port=9201
 ### xxl-job executor log-path
-xxl.job.executor.logpath=E:\\jobs\\generation-job
+xxl.job.executor.logpath=D:\\jobs\\generation-job
 ### xxl-job executor log-retention-days
 xxl.job.executor.logretentiondays=30
 

+ 120 - 51
realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -1,6 +1,6 @@
 package com.gyee.generation;
 
-import com.gyee.generation.service.initalcache.CacheService;
+import com.gyee.generation.service.initialpoint.InitialPointGoldenXkByEqEdosService;
 import com.gyee.generation.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
@@ -16,50 +16,83 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @MapperScan("com.gyee.generation.mapper")
 public class GenerationMain {
     public static void main(String[] args) throws Exception {
-        SpringApplication.run(GenerationMain.class,args);
+        SpringApplication.run(GenerationMain.class, args);
 
 
-//        InitialPointGoldenXkService InitialPointGoldenXkService= SpringUtils.getBean("initialPointGoldenXkService");
+
+//        CacheService cacheService= SpringUtils.getBean("cacheService");
+//        cacheService.initRedisCache();
 //
-//        System.out.println("开始导出风机测点。。。。。。");
-//        InitialPointGoldenXkService.initalFj();
-//        System.out.println("结束导出风机测点。。。。。。");
-//        System.out.println("开始导出风场测点。。。。。。");
-//        InitialPointGoldenXkService.initalFc();
-//        System.out.println("结束导出风场测点。。。。。。");
 //
-//        InitialPointGoldenXkByEqService initialPointGoldenXkByEqService= SpringUtils.getBean("initialPointGoldenXkByEqService");
+        InitialPointGoldenXkByEqEdosService initialPointGoldenXkByEqEdosService= SpringUtils.getBean("initialPointGoldenXkByEqEdosService");
+//
+//
+//
+//
+//        System.out.println("开始导出主变测点。。。。。。");
+//        initialPointGoldenXkByEqEdosService.initalZb();
+//        System.out.println("结束导出主变测点。。。。。。");
 //
 //        System.out.println("开始导出风机测点。。。。。。");
-//        initialPointGoldenXkByEqService.initalFj();
+//        initialPointGoldenXkByEqEdosService.initalFj();
 //        System.out.println("结束导出风机测点。。。。。。");
 //
 //        System.out.println("开始导出风场测点。。。。。。");
-//        initialPointGoldenXkByEqService.initalFc();
+//        initialPointGoldenXkByEqEdosService.initalFc();
 //        System.out.println("结束导出风场测点。。。。。。");
-//        PowerCurveFittingByTimeService powerCurveFittingByTimeService= SpringUtils.getBean("powerCurveFittingByTimeService");
 //
-//        powerCurveFittingByTimeService.cureFittingDay(new Date());
+//
+//        System.out.println("开始导出测风塔风功率AGC测点表。。。。。。");
+//        initialPointGoldenXkByEqEdosService.initalFgl();
+//        System.out.println("结束导出测风塔风功率AGC测点表。。。。。。");
+//
+//        System.out.println("开始导出气象测点表。。。。。。");
+//        initialPointGoldenXkByEqEdosService.initalQx();
+//        System.out.println("结束导出气象测点表。。。。。。");
+
+////        PowerCurveFittingByTimeService powerCurveFittingByTimeService= SpringUtils.getBean("powerCurveFittingByTimeService");
+//        Calendar c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,7);
+//        c.set(Calendar.DAY_OF_MONTH,2);
+//        Date date =c.getTime();
+//        powerCurveFittingByTimeService.cureFittingDay(date);
 //        powerCurveFittingByTimeService.cureFittingMonth(new Date());
-//        powerCurveFittingByTimeService.cureFittingYear(new Date());
+//        powerCurveFittingByTimeService.cureFittingYear(date);
 //        CacheService cacheService= SpringUtils.getBean("cacheService");
 //        cacheService.initRedisCache();
 //        InputOrOutPutService inputOrOutPutService= SpringUtils.getBean("inputOrOutPutService");
 //       inputOrOutPutService.inputOrOutput(new Date());
+//        Calendar c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,7);
+//        c.set(Calendar.DAY_OF_MONTH,2);
+//        c.set(Calendar.HOUR_OF_DAY, 0);
+//        c.set(Calendar.MINUTE, 0);
+//        c.set(Calendar.SECOND, 0);
+//        c.set(Calendar.MILLISECOND, 0);
+//        Date date = c.getTime();
+//
+//       for(int i=0;i<288*10;i++)
+//       {
+//           inputOrOutPutService.inputOrOutputSpeed(date);
+//           c.add(Calendar.MINUTE, 6);
+//           date = c.getTime();
+//           System.out.println("date"+DateUtils.toDate1(date));
+//       }
 //        while (true)
 //        {
 //            inputOrOutPutService.inputOrOutputSpeed(new Date());
 //        }
-
+//
 //        Date date =new Date();
 //
 //        Calendar c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,1);
+//        c.set(Calendar.DAY_OF_MONTH,10);
+//        Date date = DateUtils.truncate(c.getTime());
 //
-//        c.set(Calendar.DAY_OF_MONTH,20);
-//        Date date =c.getTime();
-//        for(int i=0;i<5;i++)
-//        {
-//            WindPowerInfo1Service windPowerInfo1Service= SpringUtils.getBean("windPowerInfo1Service");
+//        for (int i = 0; i < 6; i++) {
+//
+//            WindPowerInfo1Service windPowerInfo1Service = SpringUtils.getBean("windPowerInfo1Service");
 //
 //            windPowerInfo1Service.calLineInfoDay(date);
 //            windPowerInfo1Service.calProjectInfoDay(date);
@@ -67,35 +100,35 @@ public class GenerationMain {
 //            windPowerInfo1Service.calCompanyInfoDay(date);
 //            windPowerInfo1Service.calRegionInfoDay(date);
 //
-//            WindPowerInfo2Service windPowerInfo2Service= SpringUtils.getBean("windPowerInfo2Service");
+//            WindPowerInfo2Service windPowerInfo2Service = SpringUtils.getBean("windPowerInfo2Service");
 //            windPowerInfo2Service.calLineInfoDay(date);
 //            windPowerInfo2Service.calProjectInfoDay(date);
 //            windPowerInfo2Service.calWindpowerInfoDay(date);
 //            windPowerInfo2Service.calCompanyInfoDay(date);
 //            windPowerInfo2Service.calRegionInfoDay(date);
 //
-//            WindPowerInfo3Service windPowerInfo3Service= SpringUtils.getBean("windPowerInfo3Service");
+//            WindPowerInfo3Service windPowerInfo3Service = SpringUtils.getBean("windPowerInfo3Service");
 //            windPowerInfo3Service.calLineInfoDay(date);
 //            windPowerInfo3Service.calProjectInfoDay(date);
 //            windPowerInfo3Service.calWindpowerInfoDay(date);
 //            windPowerInfo3Service.calCompanyInfoDay(date);
 //            windPowerInfo3Service.calRegionInfoDay(date);
 //
-//            WindPowerInfo4Service windPowerInfo4Service= SpringUtils.getBean("windPowerInfo4Service");
+//            WindPowerInfo4Service windPowerInfo4Service = SpringUtils.getBean("windPowerInfo4Service");
 //            windPowerInfo4Service.calLineInfoDay(date);
 //            windPowerInfo4Service.calProjectInfoDay(date);
 //            windPowerInfo4Service.calWindpowerInfoDay(date);
 //            windPowerInfo4Service.calCompanyInfoDay(date);
 //            windPowerInfo4Service.calRegionInfoDay(date);
 //
-//            WindPowerInfo5Service windPowerInfo5Service= SpringUtils.getBean("windPowerInfo5Service");
+//            WindPowerInfo5Service windPowerInfo5Service = SpringUtils.getBean("windPowerInfo5Service");
 //            windPowerInfo5Service.calLineInfoDay(date);
 //            windPowerInfo5Service.calProjectInfoDay(date);
 //            windPowerInfo5Service.calWindpowerInfoDay(date);
 //            windPowerInfo5Service.calCompanyInfoDay(date);
 //            windPowerInfo5Service.calRegionInfoDay(date);
 //
-//            WindPowerInfo6Service windPowerInfo6Service= SpringUtils.getBean("windPowerInfo6Service");
+//            WindPowerInfo6Service windPowerInfo6Service = SpringUtils.getBean("windPowerInfo6Service");
 //            windPowerInfo6Service.calLineInfoDay(date);
 //            windPowerInfo6Service.calProjectInfoDay(date);
 //            windPowerInfo6Service.calWindpowerInfoDay(date);
@@ -103,25 +136,49 @@ public class GenerationMain {
 //            windPowerInfo6Service.calRegionInfoDay(date);
 //
 //
-//                    EquipmentInfo1Service equipmentInfo1Service= SpringUtils.getBean("equipmentInfo1Service");
-//        equipmentInfo1Service.calEquipmentInfoDay(date);
-//        EquipmentInfo2Service equipmentInfo2Service= SpringUtils.getBean("equipmentInfo2Service");
-//        equipmentInfo2Service.calEquipmentInfoDay(date);
-//        EquipmentInfo3Service equipmentInfo3Service= SpringUtils.getBean("equipmentInfo3Service");
-//        equipmentInfo3Service.calEquipmentInfoDay(date);
-//        EquipmentInfo4Service equipmentInfo4Service= SpringUtils.getBean("equipmentInfo4Service");
-//        equipmentInfo4Service.calEquipmentInfoDay(date);
-//        EquipmentInfo5Service equipmentInfo5Service= SpringUtils.getBean("equipmentInfo5Service");
-//        equipmentInfo5Service.calEquipmentInfoDay(date);
-//            c.add(Calendar.DAY_OF_MONTH,1);
-//            date =c.getTime();
+//            EquipmentInfo1Service equipmentInfo1Service = SpringUtils.getBean("equipmentInfo1Service");
+//            equipmentInfo1Service.calEquipmentInfoDay(date);
+//            EquipmentInfo2Service equipmentInfo2Service = SpringUtils.getBean("equipmentInfo2Service");
+//            equipmentInfo2Service.calEquipmentInfoDay(date);
+//            EquipmentInfo3Service equipmentInfo3Service = SpringUtils.getBean("equipmentInfo3Service");
+//            equipmentInfo3Service.calEquipmentInfoDay(date);
+//            EquipmentInfo4Service equipmentInfo4Service = SpringUtils.getBean("equipmentInfo4Service");
+//            equipmentInfo4Service.calEquipmentInfoDay(date);
+//            EquipmentInfo5Service equipmentInfo5Service = SpringUtils.getBean("equipmentInfo5Service");
+//            equipmentInfo5Service.calEquipmentInfoDay(date);
+//
+//
+//            WtAlysisDayService wtAlysisDayService = SpringUtils.getBean("wtAlysisDayService");
+//            wtAlysisDayService.calEquipmentInfoDay(date);
+//
+//            EquipmentInfoDayTopService equipmentInfoDayTopService = SpringUtils.getBean("equipmentInfoDayTopService");
+//            equipmentInfoDayTopService.calEquipmentInfoDayTop(date);
+//            equipmentInfoDayTopService.calEquipmentInfoMonthTop(date);
+//            equipmentInfoDayTopService.calEquipmentInfoYearTop(date);
+//            c.add(Calendar.DAY_OF_MONTH, 1);
+//            date = c.getTime();
+//            System.out.println(DateUtils.toDate1(date)+"完成");
+//
 //        }
 //
-
-//        EquipmentInfoDayTopService equipmentInfoDayTopService= SpringUtils.getBean("equipmentInfoDayTopService");
-//        equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
-//        equipmentInfoDayTopService.calEquipmentInfoMonthTop(new Date());
-//        equipmentInfoDayTopService.calEquipmentInfoYearTop(new Date());
+//
+//
+//        Calendar c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,1);
+//        c.set(Calendar.DAY_OF_MONTH,10);
+//        Date date = DateUtils.truncate(c.getTime());
+//
+//        for (int i = 0; i < 2; i++) {
+//
+//       WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
+//        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
+//            c.add(Calendar.DAY_OF_MONTH, 1);
+//            date = c.getTime();
+//            System.out.println(DateUtils.toDate1(date)+"完成");
+//
+//        }
+//
+//
 
 //        Calendar c=Calendar.getInstance();
 //        c.set(Calendar.MONTH,7);
@@ -134,17 +191,29 @@ public class GenerationMain {
 //        System.out.println("执行用时"+ DateUtils.secondsDiff(date,end) +"秒");
 //        System.out.println("计算完成");
 //
-        CacheService cacheService= SpringUtils.getBean("cacheService");
-        cacheService.initRedisCache();
+//        CacheService cacheService= SpringUtils.getBean("cacheService");
+//        cacheService.initRedisCache();
 //
 //        PowerCurveFittingModelService powerCurveFittingModelService= SpringUtils.getBean("powerCurveFittingModelService");
 //        powerCurveFittingModelService.cureFittingModel();
-
+//
+//        Calendar c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,7);
+//        c.set(Calendar.DAY_OF_MONTH,2);
 //        WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
-//        windturbineGoodnessService.calWindturbineGoodness(new Date());
-
-//        WtAlysisDayService wtAlysisDayService= SpringUtils.getBean("wtAlysisDayService");
-//        wtAlysisDayService.calEquipmentInfoDay(new Date());
-System.out.println("完成");
+//        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
+//
+//        WtwindDayInfoService wtwindDayInfoService= SpringUtils.getBean("wtwindDayInfoService");
+//        Date date =c.getTime();
+//        wtwindDayInfoService.calWpwindDayInfo(c.getTime());
+//
+//        WpwindDayInfoService wpwindDayInfoService= SpringUtils.getBean("wpwindDayInfoService");
+//        c=Calendar.getInstance();
+//        c.set(Calendar.MONTH,7);
+//        c.set(Calendar.DAY_OF_MONTH,2);
+//        date =c.getTime();
+//
+//        wpwindDayInfoService.calWpwindDayInfo(c.getTime());
+        System.out.println("完成");
     }
 }

+ 7 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java

@@ -59,12 +59,16 @@ public class GeneratorCodeConfig {
 //        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
 
         dsc.setDriverName("org.postgresql.Driver");
+        dsc.setUsername("postgres");
+        dsc.setPassword("gd123");
+        dsc.setUrl("jdbc:postgresql://10.0.118.76:5432/IMS_NEM");
+//        dsc.setDriverName("org.postgresql.Driver");
 //        dsc.setUsername("postgres");
 //        dsc.setPassword("postgres");
 //        dsc.setUrl("jdbc:postgresql://192.168.11.248:5432/IMS_NEM_SD");
-        dsc.setUrl("jdbc:postgresql://124.70.75.91:5432/jn_test");
-        dsc.setUsername("postgres");
-        dsc.setPassword("gd123");
+//        dsc.setUrl("jdbc:postgresql://124.70.75.91:5432/jn_test");
+//        dsc.setUsername("postgres");
+//        dsc.setPassword("gd123");
         mpg.setDataSource(dsc);
 
 

+ 70 - 68
realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java

@@ -1,68 +1,70 @@
-//package com.gyee.generation.config;
-//
-//
-//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.EnvironmentAware;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.PropertySource;
-//import org.springframework.core.env.Environment;
-//
-///**
-// * xxl-job config
-// *
-// * @author xuxueli 2017-04-28
-// */
-//
-//
-//@Configuration
-//@PropertySource("classpath:xxl-job-executor.properties")
-//public class XxlJobConfig implements EnvironmentAware {
-//    private Environment env;
-//
-//
-//    @Override
-//    public void setEnvironment(Environment environment) {
-//        this.env=environment;
-//    }
-//
-//    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
-//
-//
-//
-//    @Bean
-//    public XxlJobSpringExecutor xxlJobExecutor() {
-//    logger.info(">>>>>>>>>>> xxl-job config init.");
-//    XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
-//    xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
-//    xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
-//    xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
-//    xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
-//    xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
-//    xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
-//    xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
-//    xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
-//    return xxlJobSpringExecutor;
-//    }
-//
-//    /**
-//    * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
-//    *
-//    *      1、引入依赖:
-//    *          <dependency>
-//    *             <groupId>org.springframework.cloud</groupId>
-//    *             <artifactId>spring-cloud-commons</artifactId>
-//    *             <version>${version}</version>
-//    *         </dependency>
-//    *
-//    *      2、配置文件,或者容器启动变量
-//    *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
-//    *
-//    *      3、获取IP
-//    *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
-//    */
-//
-//
-//}
+package com.gyee.generation.config;
+
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+@Configuration
+@PropertySource("classpath:xxl-job-executor.properties")
+//@PropertySource("classpath:xxl-job-executorWPXNY.properties")
+//@PropertySource("classpath:xxl-job-executorRG.properties")
+public class XxlJobConfig implements EnvironmentAware {
+    private Environment env;
+
+
+    @Override
+    public void setEnvironment(Environment environment) {
+        this.env=environment;
+    }
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init.");
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+        return xxlJobSpringExecutor;
+    }
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicMaintransformerController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 主变表 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-01-30
+ */
+@RestController
+@RequestMapping("//pro-basic-maintransformer")
+public class ProBasicMaintransformerController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicWeatherStationController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 气象站名称 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-29
+ */
+@RestController
+@RequestMapping("//pro-basic-weather-station")
+public class ProBasicWeatherStationController {
+
+}

+ 64 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java

@@ -43,6 +43,9 @@ public class CacheContext implements CommandLineRunner {
     private IProEconEquipmentmodelService proEconEquipmentmodelService;
 
     @Resource
+    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
+
+    @Resource
     private IProBasicWindturbinePowerService proBasicWindturbinePowerService;
     @Resource
     private RedisService redisService;
@@ -61,6 +64,8 @@ public class CacheContext implements CommandLineRunner {
 
     @Resource
     private IProBasicModelPowerRdService proBasicModelPowerRdService;
+    @Resource
+    private IProBasicWeatherStationService proBasicWeatherStationService;
 
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
@@ -69,6 +74,7 @@ public class CacheContext implements CommandLineRunner {
     public static List<ProBasicProject> pjls = new ArrayList<>();
     public static List<ProBasicLine>  lnls = new ArrayList<>();
     public static List<ProBasicSubStation>  subwpls = new ArrayList<>();
+    public static List<ProBasicWeatherStation>  wswpls = new ArrayList<>();
 
     public static List<ProBasicSquare> sqls = new ArrayList<>();
     public static List<ProBasicPowerstation>  wpls = new ArrayList<>();
@@ -92,7 +98,8 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,List<ProBasicEquipment>> wpwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> pjwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> lnwtmap = new HashMap<>();
-
+    public static List<ProBasicWeatherStation> wsls=new ArrayList<>();
+    public static Map<String,List<ProBasicWeatherStation>> poWsStationMap = new HashMap<>();
 
     public static Map<String,List<ProBasicEquipment>> sqwtmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = new HashMap<>();// 风电机测点AI表
@@ -100,6 +107,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,Map<String, ProBasicPowerstationPoint>> propointmap =new HashMap<>();
     public static Map<String,Map<String, ProBasicPowerstationPoint>> wppointmap =new HashMap<>();
     public static Map<String,Map<String, ProBasicPowerstationPoint>> subwppointmap =new HashMap<>();
+    public static Map<String,Map<String, ProBasicPowerstationPoint>> wswppointmap =new HashMap<>();
     public static Map<String,Map<String, ProBasicPowerstationPoint>> companypointmap =new HashMap<>();
     public static Map<String,Map<String, ProBasicPowerstationPoint>> regionpointmap =new HashMap<>();
 
@@ -123,7 +131,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String, Map<Double,ProBasicModelPowerRd>> theoreticalPowerMap = new HashMap<>(); //理论,保证功率
     public static Map<String, Map<Double,ProEconWtPowerCurveFitting>> curveFittingPowerMap = new HashMap<>(); //自算,最优功率
     public static Map<String,List<ProBasicStatusPoint>> statusMap = new HashMap<>();
-
+    public static Map<String,Map<String, ProBasicPowerstationPoint>> wspointmap =new HashMap<>();
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
@@ -131,7 +139,25 @@ public class CacheContext implements CommandLineRunner {
 
         List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
         logger.info(runWpids.get(0)+"------------------"+runWpids.size());
+        wsls= proBasicWeatherStationService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId()) && i.getIsAble()==1).collect(Collectors.toList());
+        if(!wsls.isEmpty())
+        {
 
+            for(ProBasicWeatherStation ws:wsls)
+            {
+                if(poWsStationMap.containsKey(ws.getWindpowerstationId()))
+                {
+                    List<ProBasicWeatherStation> ls=poWsStationMap.get(ws.getWindpowerstationId());
+                    ls.add(ws);
+                    poWsStationMap.put(ws.getWindpowerstationId(),ls);
+
+                }else {
+                    List<ProBasicWeatherStation> ls=new ArrayList<>();
+                    ls.add(ws);
+                    poWsStationMap.put(ws.getWindpowerstationId(),ls);
+                }
+            }
+        }
         theoreticalPowerList= proBasicModelPowerRdService.list();
         equipmentmodels = proEconEquipmentmodelService.list();
         equipmentmodels.stream().forEach(e->{
@@ -250,6 +276,15 @@ public class CacheContext implements CommandLineRunner {
             }
         }
 
+        wsls.stream().forEach(p->{
+
+
+            String wsString = redisService.get(p.getId());
+            Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(wsString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
+            });
+            wspointmap.put(p.getId(),stringWindpowerstationpointnewMap);
+
+        });
 
         wtls = proBasicEquipmentService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId()) && i.getIsable()==1).collect(Collectors.toList());
         logger.info(wtls.size()+"");
@@ -370,6 +405,19 @@ public class CacheContext implements CommandLineRunner {
             });
             subwppointmap.put(sub.getId(),stringWindpowerstationpointnewMap);
 
+            List<ProBasicEquipment> collect = wtls.stream().filter(wt -> wt.getSubstationId().equals(sub.getId())).collect(Collectors.toList());
+            subWtsMap.put(sub.getId(),collect);
+
+        });
+
+        wswpls = proBasicWeatherStationService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId()) && i.getIsAble()==1).collect(Collectors.toList());
+        wswpls.stream().forEach(ws->{
+
+            String subString = redisService.get(ws.getId());
+            Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
+            });
+            wswppointmap.put(ws.getId(),stringWindpowerstationpointnewMap);
+
 //            List<ProBasicEquipment> collect = wtls.stream().filter(wt -> wt.getSubstationId().equals(sub.getId())).collect(Collectors.toList());
 //            subWtsMap.put(sub.getId(),collect);
 
@@ -397,7 +445,7 @@ public class CacheContext implements CommandLineRunner {
         wpls = proBasicWindpowerstationService.list().stream().filter(i->runWpids.contains(i.getId()) && i.getIsAble()==1).collect(Collectors.toList());;
         meterpoints = proBasicMeterPointService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId()) && i.getIsAble()==1).collect(Collectors.toList());
         meterpoints.stream().forEach(meterpoint -> {
-            meterpointMap.put(meterpoint.getId(),meterpoint);
+            meterpointMap.put(meterpoint.getNemCode(),meterpoint);
         });
 
 
@@ -419,6 +467,19 @@ public class CacheContext implements CommandLineRunner {
         statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String,List<ProBasicStatusPoint>>>() {
         });
 
+        List<ProEconWtPowerCurveFitting> econWtPowerCurveFittings = proEconWtPowerCurveFittingService.list();
+        if (StringUtils.isNotNull(econWtPowerCurveFittings)){
+            econWtPowerCurveFittings.stream().forEach(curveFitting->{
+                if (curveFittingPowerMap.containsKey(curveFitting.getWindturbineId())){
+                    curveFittingPowerMap.get(curveFitting.getWindturbineId()).put(curveFitting.getSpeed(),curveFitting);
+                }else {
+                    Map<Double,ProEconWtPowerCurveFitting> powerMap = new HashMap<>();
+                    powerMap.put(curveFitting.getSpeed(),curveFitting);
+                    curveFittingPowerMap.put(curveFitting.getWindturbineId(),powerMap);
+                }
+            });
+        }
+
 
 
         logger.info("缓存结束------------------------------------------------------------");

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicMaintransformerMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProBasicMaintransformer;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 主变表 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-01-30
+ */
+public interface ProBasicMaintransformerMapper extends BaseMapper<ProBasicMaintransformer> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicWeatherStationMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProBasicWeatherStation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 气象站名称 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-29
+ */
+public interface ProBasicWeatherStationMapper extends BaseMapper<ProBasicWeatherStation> {
+
+}

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittMonthMainMapper.java

@@ -15,6 +15,9 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ProEconCurveFittMonthMainMapper extends BaseMapper<ProEconCurveFittMonthMain> {
 
-    @Delete(" delete from pro_econ_curve_fitt_month_main where year=#{year} and month=#{month}")
-    public int deleteProEconCurveFittMonthSubByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
+    @Delete(" delete from pro_econ_curve_fitt_month_main where year=#{year} and month=#{month}  AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconCurveFittMonthSubFByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
+
+    @Delete(" delete from pro_econ_curve_fitt_month_main where year=#{year} and month=#{month}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittMonthSubGByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittMonthSubMapper.java

@@ -15,6 +15,9 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ProEconCurveFittMonthSubMapper extends BaseMapper<ProEconCurveFittMonthSub> {
 
-    @Delete(" delete from pro_econ_curve_fitt_month_sub where year=#{year} and month=#{month}")
-    public int deleteProEconCurveFittMonthSubByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
+    @Delete(" delete from pro_econ_curve_fitt_month_sub where year=#{year} and month=#{month}  AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconCurveFittMonthSubFByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
+
+    @Delete(" delete from pro_econ_curve_fitt_month_sub where year=#{year} and month=#{month}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittMonthSubGByMonth(@Param(value = "year") String year, @Param(value = "month") String month);
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittYearMainMapper.java

@@ -14,6 +14,9 @@ import org.apache.ibatis.annotations.Param;
  * @since 2022-11-07
  */
 public interface ProEconCurveFittYearMainMapper extends BaseMapper<ProEconCurveFittYearMain> {
-    @Delete(" delete from pro_econ_curve_fitt_year_main where year=#{year}")
-    public int deleteProEconCurveFittYearMainByYear(@Param(value = "year") String year);
+    @Delete(" delete from pro_econ_curve_fitt_year_main where year=#{year}  AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconCurveFittYearMainFByYear(@Param(value = "year") String year);
+
+    @Delete(" delete from pro_econ_curve_fitt_year_main where year=#{year}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittYearMainGByYear(@Param(value = "year") String year);
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittYearSubMapper.java

@@ -14,6 +14,9 @@ import org.apache.ibatis.annotations.Param;
  * @since 2022-11-07
  */
 public interface ProEconCurveFittYearSubMapper extends BaseMapper<ProEconCurveFittYearSub> {
-    @Delete(" delete from pro_econ_curve_fitt_year_sub where year=#{year}")
-    public int deleteProEconCurveFittYearSubByYear(@Param(value = "year") String year);
+    @Delete(" delete from pro_econ_curve_fitt_year_sub where year=#{year}  AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconCurveFittYearSubFByYear(@Param(value = "year") String year);
+
+    @Delete(" delete from pro_econ_curve_fitt_year_sub where year=#{year}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittYearSubGByYear(@Param(value = "year") String year);
 }

+ 4 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittingMainMapper.java

@@ -17,6 +17,8 @@ import java.util.Date;
  */
 public interface ProEconCurveFittingMainMapper extends BaseMapper<ProEconCurveFittingMain> {
 
-    @Delete(" delete from pro_econ_curve_fitting_main where recordDate=#{recordDate} ")
-    public int deleteProEconCurveFittingMainByDay(@Param(value = "recordDate") Date recordDate);
+    @Delete(" delete from pro_econ_curve_fitting_main where record_date=#{recordDate}  AND  windturbine_id like '%_F_%'  ")
+    public int deleteProEconCurveFittingMainFByDay(@Param(value = "recordDate") Date recordDate);
+    @Delete(" delete from pro_econ_curve_fitting_main where record_date=#{recordDate}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittingMainGByDay(@Param(value = "recordDate") Date recordDate);
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconCurveFittingSubMapper.java

@@ -18,6 +18,9 @@ import java.util.Date;
 public interface ProEconCurveFittingSubMapper extends BaseMapper<ProEconCurveFittingSub> {
 
 
-    @Delete(" delete from pro_econ_curve_fitting_sub where recordDate=#{recordDate} ")
-    public int deleteProEconCurveFittingSubByDay(@Param(value = "recordDate") Date recordDate);
+    @Delete(" delete from pro_econ_curve_fitting_sub where record_date=#{recordDate}  AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconCurveFittingSubFByDay(@Param(value = "recordDate") Date recordDate);
+
+    @Delete(" delete from pro_econ_curve_fitting_sub where record_date=#{recordDate}  AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconCurveFittingSubGByDay(@Param(value = "recordDate") Date recordDate);
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingMapper.java

@@ -17,7 +17,10 @@ import java.util.Date;
  */
 public interface ProEconWtCurveFittingMapper extends BaseMapper<ProEconWtCurveFitting> {
 
-    @Delete(" delete from pro_econ_wt_curve_fitting where recordDate=#{recordDate} ")
-    public int deleteProEconWtCurveFittingByDay(@Param(value = "recordDate") Date recordDate);
+    @Delete(" delete from pro_econ_wt_curve_fitting where record_date=#{recordDate} AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconWtCurveFittingFByDay(@Param(value = "recordDate") Date recordDate);
+
+    @Delete(" delete from pro_econ_wt_curve_fitting where record_date=#{recordDate} AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconWtCurveFittingGByDay(@Param(value = "recordDate") Date recordDate);
 
 }

+ 5 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingMonthMapper.java

@@ -15,6 +15,9 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ProEconWtCurveFittingMonthMapper extends BaseMapper<ProEconWtCurveFittingMonth> {
 
-    @Delete(" delete from pro_econ_wt_curve_fitting_month where year=#{year} and month=#{month}")
-    public int deleteProEconWtCurveFittingByMonth(@Param(value = "year") String year,@Param(value = "month") String month);
+    @Delete(" delete from pro_econ_wt_curve_fitting_month where year=#{year} and month=#{month} AND  windturbine_id like '%_F_%' " )
+    public int deleteProEconWtCurveFittingFByMonth(@Param(value = "year") String year,@Param(value = "month") String month);
+
+    @Delete(" delete from pro_econ_wt_curve_fitting_month where year=#{year} and month=#{month} AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconWtCurveFittingGByMonth(@Param(value = "year") String year,@Param(value = "month") String month);
 }

+ 4 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconWtCurveFittingYearMapper.java

@@ -15,6 +15,8 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ProEconWtCurveFittingYearMapper extends BaseMapper<ProEconWtCurveFittingYear> {
 
-    @Delete(" delete from pro_econ_wt_curve_fitting_year where year=#{year}")
-    public int deleteProEconWtCurveFittingByYear(@Param(value = "year") String year);
+    @Delete(" delete from pro_econ_wt_curve_fitting_year where year=#{year} AND  windturbine_id like '%_F_%' ")
+    public int deleteProEconWtCurveFittingFByYear(@Param(value = "year") String year);
+    @Delete(" delete from pro_econ_wt_curve_fitting_year where year=#{year} AND  windturbine_id like '%_G_%' ")
+    public int deleteProEconWtCurveFittingGByYear(@Param(value = "year") String year);
 }

+ 119 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicMaintransformer.java

@@ -0,0 +1,119 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 主变表
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-01-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProBasicMaintransformer extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 别名
+     */
+    private String aname;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 装机容量
+     */
+    private BigDecimal capacity;
+
+    /**
+     * 容量单位
+     */
+    private String capacityUnit;
+
+    /**
+     * 装机数量
+     */
+    private Integer quantity;
+
+    /**
+     * 机型
+     */
+    private String model;
+
+    /**
+     * 投产日期
+     */
+    private LocalDate commissionDate;
+
+    /**
+     * 主控电话
+     */
+    private String masterPhone;
+
+    /**
+     * 值长
+     */
+    private String shiftforeMan;
+
+    /**
+     * 值长电话
+     */
+    private String shiftforeManPhone;
+
+    /**
+     * 顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 是否可用
+     */
+    private Integer isAble;
+
+    /**
+     * 备用1
+     */
+    private String spare1;
+
+    /**
+     * 备用2
+     */
+    private String spare2;
+
+    /**
+     * 备用3
+     */
+    private String spare3;
+
+    /**
+     * 备用4
+     */
+    private String spare4;
+
+
+}

+ 80 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicWeatherStation.java

@@ -0,0 +1,80 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 气象站名称
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-29
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProBasicWeatherStation extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 别名
+     */
+    private String aname;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 是否可用
+     */
+    private Integer isAble;
+
+    /**
+     * 备用1
+     */
+    private String spare1;
+
+    /**
+     * 备用2
+     */
+    private String spare2;
+
+    /**
+     * 备用3
+     */
+    private String spare3;
+
+    /**
+     * 备用4
+     */
+    private String spare4;
+
+    private BigDecimal capacity;
+
+
+}

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittMonthSub.java

@@ -45,7 +45,7 @@ public class ProEconCurveFittMonthSub extends Model {
     /**
      * 风速
      */
-    private String speed;
+    private Double speed;
 
     /**
      * 环比

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittYearSub.java

@@ -39,7 +39,7 @@ public class ProEconCurveFittYearSub extends Model {
     /**
      * 风速
      */
-    private String speed;
+    private Double speed;
 
     /**
      * 环比

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconCurveFittingSub.java

@@ -57,7 +57,7 @@ public class ProEconCurveFittingSub extends Model {
     /**
      * 风速
      */
-    private String speed;
+    private Double speed;
 
     /**
      * 实际/最优

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconEquipmentmodel.java

@@ -90,7 +90,7 @@ public class ProEconEquipmentmodel extends Model {
     /**
      * 设备类别
      */
-    private Integer equipmentCategory;
+    private String equipmentCategory;
 
 
 }

+ 1 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInOrOutSpeedTotal.java

@@ -376,4 +376,5 @@ public class ProEconInOrOutSpeedTotal extends Model {
 
     private String companyId;
     private String types;
+    private String regionId;
 }

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInOrOutSpeedTotal2.java

@@ -475,5 +475,5 @@ public class ProEconInOrOutSpeedTotal2 extends Model {
     private String lineId;
     private String companyId;
     private String types;
-
+    private String regionId;
 }

+ 1 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWindturbineGoodness.java

@@ -99,4 +99,5 @@ public class ProEconWindturbineGoodness extends Model {
     private Double daySpeed;
     private Double monthSpeed;
     private Double yearSpeed;
+    private String regionId;
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2715 - 306
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWpwindDayInfo.java


+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconWtwindDayInfo.java

@@ -43,7 +43,7 @@ public class ProEconWtwindDayInfo extends Model {
      * 编号
      */
     @TableId(value = "ID",type = IdType.ASSIGN_ID)
-    private Integer id;
+    private Long id;
 
     /**
      * 风机编号

+ 19 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/CompanyType.java

@@ -0,0 +1,19 @@
+package com.gyee.generation.model.vo;
+
+public enum CompanyType {
+
+
+    qb("qb"),
+    fd("fd"),
+    gf("gf");
+
+    public String id;
+    CompanyType(final  String c) {
+        id = c;
+    }
+
+    public String getValue()
+    {
+        return id;
+    }
+}

+ 18 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/CurveType.java

@@ -0,0 +1,18 @@
+package com.gyee.generation.model.vo;
+
+public enum CurveType {
+
+    dayCurve("dayCurve"),
+    monthCurve("monthCurve"),
+    yearCurve("yearCurve");
+
+    public String id;
+    CurveType(final  String c) {
+        id = c;
+    }
+
+    public String getValue()
+    {
+        return id;
+    }
+}

+ 17 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/WpType.java

@@ -0,0 +1,17 @@
+package com.gyee.generation.model.vo;
+
+public enum WpType {
+
+    FDC("FDC"),
+    GDC("GDC");
+
+    public String id;
+    WpType(final  String c) {
+        id = c;
+    }
+
+    public String getValue()
+    {
+        return id;
+    }
+}

+ 16 - 11
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ActivePowerService.java

@@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 public class ActivePowerService {
@@ -37,11 +36,16 @@ public class ActivePowerService {
         Date endDate=c.getTime();
         for (ProBasicPowerstation station : CacheContext.wpls) {
 
-            List<ProEconEquipmentInfo15minute> ei15ls = proEconEquipmentInfo15minuteService.list().stream()
-                    .filter(i -> i.getWindpowerstationId().equals(station.getId())
-                            && ( i.getRecordDate().compareTo(beginDate)==0 || i.getRecordDate().after(beginDate))
-                            && (i.getRecordDate().compareTo(endDate)==0 || i.getRecordDate().before(endDate))
-                    ).collect(Collectors.toList());
+            QueryWrapper<ProEconEquipmentInfo15minute> queryWrapper = new QueryWrapper<>();
+            queryWrapper.ge("record_date",beginDate)
+                    .le("record_date",endDate)
+                    .eq("windPowerStation_Id",station.getId());
+            List<ProEconEquipmentInfo15minute> ei15ls = proEconEquipmentInfo15minuteService.list(queryWrapper);
+//                    .stream()
+//                    .filter(i -> i.getWindpowerstationId().equals(station.getId())
+//                            && ( i.getRecordDate().compareTo(beginDate)==0 || i.getRecordDate().after(beginDate))
+//                            && (i.getRecordDate().compareTo(endDate)==0 || i.getRecordDate().before(endDate))
+//                    ).collect(Collectors.toList());
 
 
 
@@ -91,11 +95,12 @@ public class ActivePowerService {
                 for (Double speed : intnalMap.keySet()) {
                     List<Double> powers = intnalMap.get(speed);
 
-                    Optional<ProEconActivePowerData> data = proEconActivePowerDataService.list().stream()
-                            .filter(i -> i.getWindturbineId().equals(windturbineId)
-                                    && i.getRecordDate().compareTo(beginDate) == 0
-                                    && i.getSpeed() == speed
-                            ).findFirst();
+                    QueryWrapper<ProEconActivePowerData> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",beginDate)
+                            .eq("windturbine_id",windturbineId).eq("speed",speed);
+
+                    Optional<ProEconActivePowerData> data = proEconActivePowerDataService.list(queryWrapper2)
+                            .stream().findFirst();
 
                     ProEconActivePowerData apdata;
                     if (!data.isPresent()) {

+ 88 - 87
realtime/generationXK-service/src/main/java/com/gyee/generation/service/CoefficientService.java

@@ -1,13 +1,12 @@
 package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.ProBasicEquipment;
-import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
-import com.gyee.generation.model.auto.ProEconActivePowerData;
-import com.gyee.generation.model.auto.ProEconWtPowerCurveFitting;
+import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.StatData;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconWtPowerCurveFittingService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
@@ -44,7 +43,7 @@ public class CoefficientService {
 
 
 
-        Date endDate = c.getTime();
+        Date endDate = currentDate;
 
         Map<String, Map<String, Double>> resultmap = new HashMap<>();
         //查询风机
@@ -56,103 +55,103 @@ public class CoefficientService {
 //        for (ProBasicEquipment wt : wtls) {
 
 //****************************************年功率一致性统计********************************************************************/
-            List<ProEconActivePowerData> yearList;
-
-            List<ProEconActivePowerData> queryYear = new ArrayList<>();
-
-            Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wt.getId());
-            ProBasicEquipmentPoint fspoint = wtpointmap.get(ContantXk.CJ_SSFS);
-            List<PointData> fsls = edosUtil.getHistStat(fspoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
-
-            ProBasicEquipmentPoint glpoint = wtpointmap.get(ContantXk.CJ_SSGL);
-            List<PointData> glls = edosUtil.getHistStat(glpoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
-
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
-                        ProEconActivePowerData po=new ProEconActivePowerData();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-                        po.setFrequency(fsls.size());
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        queryYear.add(po);
-                    }
-                }
+        List<ProEconActivePowerData> yearList;
+
+        List<ProEconActivePowerData> queryYear = new ArrayList<>();
+
+        Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wt.getId());
+        ProBasicEquipmentPoint fspoint = wtpointmap.get(ContantXk.CJ_SSFS);
+        List<PointData> fsls = edosUtil.getHistStat(fspoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+
+        ProBasicEquipmentPoint glpoint = wtpointmap.get(ContantXk.CJ_SSGL);
+        List<PointData> glls = edosUtil.getHistStat(glpoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+
+        if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
+        {
+            for(int i=0;i<fsls.size();i++)
+            {
+                PointData fspd=fsls.get(i);
+                PointData glpd=fsls.get(i);
+                ProEconActivePowerData po=new ProEconActivePowerData();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setFrequency(fsls.size());
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
+                queryYear.add(po);
+            }
+        }
 
 
-            yearList = calCoefficient(queryYear, wt);
+        yearList = calCoefficient(queryYear, wt);
 
 //****************************************月功率一致性统计********************************************************************/
 
-            List<ProEconActivePowerData> monthList;
-            List<ProEconActivePowerData> queryMonth = new ArrayList<>();
-
-
-            fsls = edosUtil.getHistStat(fspoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
-            glls = edosUtil.getHistStat(glpoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
-
-            if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
-                for (int i = 0; i < fsls.size(); i++) {
-                    PointData fspd = fsls.get(i);
-                    PointData glpd = fsls.get(i);
-                    ProEconActivePowerData po = new ProEconActivePowerData();
-                    po.setWindturbineId(wt.getId());
-                    po.setModelId(wt.getModelId());
-                    po.setWindpowerstationId(wt.getWindpowerstationId());
-                    po.setFrequency(fsls.size());
-                    po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
-                    po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
-                    queryMonth.add(po);
-                }
+        List<ProEconActivePowerData> monthList;
+        List<ProEconActivePowerData> queryMonth = new ArrayList<>();
+
+
+        fsls = edosUtil.getHistStat(fspoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+        glls = edosUtil.getHistStat(glpoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+
+        if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
+            for (int i = 0; i < fsls.size(); i++) {
+                PointData fspd = fsls.get(i);
+                PointData glpd = fsls.get(i);
+                ProEconActivePowerData po = new ProEconActivePowerData();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setFrequency(fsls.size());
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
+                queryMonth.add(po);
             }
+        }
 
 
-            monthList = calCoefficient(queryMonth, wt);
+        monthList = calCoefficient(queryMonth, wt);
 
 
 //*****************************************日功率一致性统计********************************************************************/
 
 
-            List<ProEconActivePowerData> dayList;
+        List<ProEconActivePowerData> dayList;
 
 
-            List<ProEconActivePowerData> queryDay = new ArrayList<>();
+        List<ProEconActivePowerData> queryDay = new ArrayList<>();
 
 
-            fsls = edosUtil.getHistStat(fspoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
-            glls = edosUtil.getHistStat(glpoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+        fsls = edosUtil.getHistStat(fspoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+        glls = edosUtil.getHistStat(glpoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
 
-            if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
-                for (int i = 0; i < fsls.size(); i++) {
-                    PointData fspd = fsls.get(i);
-                    PointData glpd = fsls.get(i);
-                    ProEconActivePowerData po = new ProEconActivePowerData();
-                    po.setWindturbineId(wt.getId());
-                    po.setModelId(wt.getModelId());
-                    po.setWindpowerstationId(wt.getWindpowerstationId());
-                    po.setFrequency(fsls.size());
-                    po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
-                    po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
-                    queryDay.add(po);
-                }
+        if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
+            for (int i = 0; i < fsls.size(); i++) {
+                PointData fspd = fsls.get(i);
+                PointData glpd = fsls.get(i);
+                ProEconActivePowerData po = new ProEconActivePowerData();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setFrequency(fsls.size());
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
+                queryDay.add(po);
             }
-            dayList = calCoefficient(queryDay, wt);
+        }
+        dayList = calCoefficient(queryDay, wt);
 
 
-            Double resultYear = coefficient(yearList, currentDate, wt.getId());
-            Double resultMonth = coefficient(monthList, currentDate, wt.getId());
-            Double resultDay = coefficient(dayList, currentDate, wt.getId());
+        Double resultYear = coefficient(yearList, currentDate, wt.getId());
+        Double resultMonth = coefficient(monthList, currentDate, wt.getId());
+        Double resultDay = coefficient(dayList, currentDate, wt.getId());
 
-            Map<String, Double> tempmap = new HashMap<>();
-            tempmap.put("year", resultYear);
-            tempmap.put("month", resultMonth);
-            tempmap.put("day", resultDay);
-            resultmap.put(wt.getId(), tempmap);
+        Map<String, Double> tempmap = new HashMap<>();
+        tempmap.put("year", resultYear);
+        tempmap.put("month", resultMonth);
+        tempmap.put("day", resultDay);
+        resultmap.put(wt.getId(), tempmap);
 
 //        }
 
@@ -205,22 +204,24 @@ public class CoefficientService {
             Calendar c = Calendar.getInstance();
             c.setTime(currentDate);
 
-
-            powerList = proEconWtPowerCurveFittingService.list().stream()
-                    .filter(i -> i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtPowerCurveFitting> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("windturbine_id",windturbineId);
+            powerList = proEconWtPowerCurveFittingService.list(queryWrapper);
+//                    .stream()
+//                    .filter(i -> i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
 
 
             for (ProEconActivePowerData data : dataList) {
                 Double p1 = data.getPower();
                 Double speed = data.getSpeed();
-                if (speed < 3 || speed > 25) {
-                    continue;
-                }
+//                if (speed < 3 || speed > 25) {
+//                    continue;
+//                }
 
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
 
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         speed /= 100;
                         speed = StringUtils.round(speed, 2);
                         speed *= 100;

+ 31 - 14
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo15minuteService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -34,19 +35,37 @@ public class EquipmentInfo15minuteService {
     /**
      * 计算设备15分钟信息
      */
-    public void calLineInfoMinute15(Date recordDate) throws Exception {
+    public void calEquipmentInfo15minute(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 
+       int minute= c.get(Calendar.MINUTE);
+        if(minute>=0 && minute<15){
+            c.set(Calendar.MINUTE,0);
+        }
+        else if(minute>=15 && minute<30)
+        {
+            c.set(Calendar.MINUTE,15);
+        }else if(minute>=30 && minute<45){
+           c.set(Calendar.MINUTE,30);
+       }else if(minute>=45 ){
+           c.set(Calendar.MINUTE,45);
+       }
+       c.set(Calendar.SECOND,0);
         Date end=c.getTime();
         c.add(Calendar.MINUTE,-15);
         Date begin= DateUtils.truncate(c.getTime());
 
+        QueryWrapper<ProEconEquipmentInfo15minute> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",recordDate);
+
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconEquipmentInfo15minuteService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())
-           ).map(ProEconEquipmentInfo15minute::getId)
+        List<String> idls = proEconEquipmentInfo15minuteService.list(queryWrapper)
+               .stream()
+//                .filter(i -> i.getRecordDate().compareTo(recordDate)==0
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId())
+//           )
+                .map(ProEconEquipmentInfo15minute::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -56,7 +75,7 @@ public class EquipmentInfo15minuteService {
         }
         for(ProBasicEquipment wt:CacheContext.wtls)
         {
-            if(CacheContext.wppointmap.containsKey(wt.getId()))
+            if(CacheContext.wtpAimap.containsKey(wt.getId()))
             {
                 Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
 
@@ -67,13 +86,13 @@ public class EquipmentInfo15minuteService {
                 pewp.setLineId(wt.getLineId());
                 pewp.setProjectId(wt.getProjectId());
                 pewp.setRegionId(wt.getRegionId());
-                pewp.setRecordDate(DateUtils.truncate(recordDate));
+                pewp.setRecordDate(recordDate);
+                pewp.setWindturbineId(wt.getId());
 
 
-
-                if(pointmap.containsKey(ContantXk.SSPJFS))
+                if(pointmap.containsKey(ContantXk.CJ_SSFS))
                 {
-                    ProBasicEquipmentPoint point= pointmap.get(ContantXk.SSPJFS);
+                    ProBasicEquipmentPoint point= pointmap.get(ContantXk.CJ_SSFS);
                     List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                     if(!pointls.isEmpty())
                     {
@@ -84,9 +103,9 @@ public class EquipmentInfo15minuteService {
 
                 }
 
-                if(pointmap.containsKey(ContantXk.SSZGL))
+                if(pointmap.containsKey(ContantXk.CJ_SSGL))
                 {
-                    ProBasicEquipmentPoint point= pointmap.get(ContantXk.SSZGL);
+                    ProBasicEquipmentPoint point= pointmap.get(ContantXk.CJ_SSGL);
                     List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                     if(!pointls.isEmpty())
                     {
@@ -331,8 +350,6 @@ public class EquipmentInfo15minuteService {
 
                     }
 
-
-
                 }
 
             }

+ 52 - 24
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -7,6 +8,7 @@ import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -27,10 +29,6 @@ public class EquipmentInfo1Service {
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
 
-
-
-
-
     /**
      * 计算设备日信息
      */
@@ -42,16 +40,16 @@ public class EquipmentInfo1Service {
 
         Date begin= DateUtils.truncate(c.getTime());
 
+        QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",recordDate);
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconEquipmentInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDay1::getId)
+        List<String> idls = proEconEquipmentInfoDay1Service.list(queryWrapper).stream()
+                .map(ProEconEquipmentInfoDay1::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
 
             proEconEquipmentInfoDay1Service.removeByIds(idls);
-
         }
 
         List<ProEconEquipmentInfoDay1> dayls=new ArrayList<>();
@@ -77,10 +75,14 @@ public class EquipmentInfo1Service {
                 cl.setTime(recordDate);
                 if(cl.get(Calendar.DAY_OF_MONTH)!=1)
                 {
-                    pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && CacheContext.wtmap.containsKey(i.getWindturbineId())
-                            ).collect(Collectors.toList());
+                    QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",cl.getTime())
+                            .eq("windturbine_Id",wt.getId());
+                    pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && CacheContext.wtmap.containsKey(i.getWindturbineId())
+//                            ).collect(Collectors.toList());
                 }
                 extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
 
@@ -95,24 +97,50 @@ public class EquipmentInfo1Service {
     }
 
     private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {
-        //*******************************************日信息统计*********************************************************/
-        if(pointmap.containsKey(ContantXk.RPJFS))
+
+
+        if(pewp.getWindpowerstationId().contains(WpType.FDC.id))
         {
-            ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJFS);
-            List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
-            if(!pointls.isEmpty())
+            //*******************************************日信息统计*********************************************************/
+            if(pointmap.containsKey(ContantXk.RPJFS))
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
-                //日最大风速
-                pewp.setRzdfs(summaryStatistics.getMax());
-                //日最小风速
-                pewp.setRzxfs(summaryStatistics.getMin());
-                //日平均风速
-                pewp.setRpjfs(summaryStatistics.getAverage());
+                ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJFS);
+                List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+                if(!pointls.isEmpty())
+                {
+                    DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+                    //日最大风速
+                    pewp.setRzdfs(summaryStatistics.getMax());
+                    //日最小风速
+                    pewp.setRzxfs(summaryStatistics.getMin());
+                    //日平均风速
+                    pewp.setRpjfs(summaryStatistics.getAverage());
+                }
+
             }
+        }else
+        {
+            //*******************************************日信息统计*********************************************************/
+            if(pointmap.containsKey(ContantXk.RPJGZD))
+            {
+                ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGZD);
+                List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+                if(!pointls.isEmpty())
+                {
+                    DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+                    //日最大风速
+                    pewp.setRzdfs(summaryStatistics.getMax());
+                    //日最小风速
+                    pewp.setRzxfs(summaryStatistics.getMin());
+                    //日平均风速
+                    pewp.setRpjfs(summaryStatistics.getAverage());
+                }
 
+            }
         }
 
+
+
         if(pointmap.containsKey(ContantXk.RPJGL))
         {
             ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGL);

+ 13 - 9
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -43,10 +44,9 @@ public class EquipmentInfo2Service {
         Date begin= DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconEquipmentInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())
-           ).map(ProEconEquipmentInfoDay2::getId)
+        QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",recordDate);
+        List<String> idls = proEconEquipmentInfoDay2Service.list(queryWrapper).stream().map(ProEconEquipmentInfoDay2::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -77,11 +77,15 @@ public class EquipmentInfo2Service {
                 if(cl.get(Calendar.DAY_OF_MONTH)!=1)
 
                 {
-                    pepidls = proEconEquipmentInfoDay2Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getWindturbineId().equals(wt.getId())
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",cl.getTime())
+                            .eq("windturbine_Id",wt.getId());
+                    pepidls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 calDetiall( pewp, end, begin, wt,pepidls);
                 calSimple( pewp, end, begin, wt,pepidls);

+ 14 - 9
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -42,10 +43,10 @@ public class EquipmentInfo3Service {
         Date begin= DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconEquipmentInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())
-                         ).map(ProEconEquipmentInfoDay3::getId)
+        QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",recordDate);
+        List<String> idls = proEconEquipmentInfoDay3Service.list(queryWrapper).stream()
+                .map(ProEconEquipmentInfoDay3::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -77,11 +78,15 @@ public class EquipmentInfo3Service {
                 if(cl.get(Calendar.DAY_OF_MONTH)!=1)
 
                 {
-                    pepidls = proEconEquipmentInfoDay3Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getWindturbineId().equals(wt.getId())
-                                  )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",cl.getTime())
+                            .eq("windturbine_Id",wt.getId());
+                    pepidls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                                  )
+//                            .collect(Collectors.toList());
                 }
                 calDetiall( pewp, end, begin,wt,pepidls);
                 calSimple( pewp, end, begin, wt,pepidls);

+ 255 - 132
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -61,6 +62,9 @@ public class EquipmentInfo4Service {
 
     @Resource
     private IProEconWindturbineGoodnessService proEconWindturbineGoodnessService;
+
+
+
    
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
@@ -70,11 +74,13 @@ public class EquipmentInfo4Service {
 
         Date begin = DateUtils.truncate(c.getTime());
 
+        Date lastDay=DateUtils.addDays(begin,-1);
+
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconEquipmentInfoDay4Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())
-                ).map(ProEconEquipmentInfoDay4::getId)
+        QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",begin);
+        List<String> idls = proEconEquipmentInfoDay4Service.list(queryWrapper).stream()
+                .map(ProEconEquipmentInfoDay4::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -86,10 +92,13 @@ public class EquipmentInfo4Service {
         //获取曲线风机切入风速
         Map<String, ProEconInOrOutSpeedTotal> peioomap = new HashMap<>();
 
-        List<ProEconInOrOutSpeedTotal> peioostls = proEconInOrOutSpeedTotalService.list().stream().filter(i ->
-                (i.getRecordDate().compareTo(begin) == 0 || i.getRecordDate().after(begin))
-                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-        ).collect(Collectors.toList());
+        QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("record_date",begin);
+
+        List<ProEconInOrOutSpeedTotal> peioostls = proEconInOrOutSpeedTotalService.list(queryWrapper2);
+//                .stream().filter(i ->
+//                i.getRecordDate().compareTo(begin) == 0
+//        ).collect(Collectors.toList());
 
         if (!peioostls.isEmpty()) {
             for (ProEconInOrOutSpeedTotal peioo : peioostls) {
@@ -97,10 +106,15 @@ public class EquipmentInfo4Service {
             }
         }
         Map<String,ProEconWindturbineGoodness> wgmap=new HashMap<>();
-        List<ProEconWindturbineGoodness> wgls = proEconWindturbineGoodnessService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(begin))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
-                .collect(Collectors.toList());
+
+        QueryWrapper<ProEconWindturbineGoodness> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.eq("record_date",lastDay);
+
+        List<ProEconWindturbineGoodness> wgls = proEconWindturbineGoodnessService.list(queryWrapper3);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(begin))==0
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+//                .collect(Collectors.toList());
 
         if(!wgls.isEmpty())
         {
@@ -133,20 +147,28 @@ public class EquipmentInfo4Service {
                 cl.setTime(recordDate);
                 cl.add(Calendar.DAY_OF_MONTH,-1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepidls = proEconEquipmentInfoDay4Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getWindturbineId().equals(wt.getId())
-                            )
-                            .collect(Collectors.toList());
+
+                    QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+                    queryWrapper4.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("windturbine_id",wt.getId());
+                    pepidls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                            )
+//                            .collect(Collectors.toList());
                 }
 
                 //获得当日设备统计2表数据
                 ProEconEquipmentInfoDay2 pepid2 = null;
                 List<ProEconEquipmentInfoDay2> pepid2ls;
-                pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        ).collect(Collectors.toList());
+                QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper5 = new QueryWrapper<>();
+                queryWrapper5.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
+                pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper5);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getWindturbineId().equals(wt.getId())
+//                        ).collect(Collectors.toList());
 
                 if (!pepid2ls.isEmpty()) {
                     pepid2 = pepid2ls.get(0);
@@ -154,10 +176,13 @@ public class EquipmentInfo4Service {
                 //获得当日设备统计3表数据
                 ProEconEquipmentInfoDay3 pepid3 = null;
                 List<ProEconEquipmentInfoDay3> pepid3ls;
-                pepid3ls = proEconEquipmentInfoDay3Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        ).collect(Collectors.toList());
+                QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper6 = new QueryWrapper<>();
+                queryWrapper6.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
+                pepid3ls = proEconEquipmentInfoDay3Service.list(queryWrapper6);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getWindturbineId().equals(wt.getId())
+//                        ).collect(Collectors.toList());
 
                 if (!pepid3ls.isEmpty()) {
                     pepid3 = pepid3ls.get(0);
@@ -251,10 +276,10 @@ public class EquipmentInfo4Service {
                 if (StringUtils.notEmp(peiost) && !fsls.isEmpty()) {
                     double dayjfsc = 0.0;
                     for (PointData po : fsls) {
-                        //小风切入风速
-                        double xfqr = peiost.getDayInputSmall();
-                        //小于小风切入算静风时长累计
-                        if (po.getPointValueInDouble() < xfqr) {
+//                        //小风切入风速
+//                        double xfqr = peiost.getDayInputSmall();
+//                        //小于小风切入算静风时长累计
+                        if (po.getPointValueInDouble() < 3) {
                             dayjfsc++;
                         }
 
@@ -293,15 +318,29 @@ public class EquipmentInfo4Service {
 
                     point = wtpointmap.get(ContantXk.BZGL);
                     List<PointData> bzglls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
-                    if (!bzglls.isEmpty() && glls.size() == bzglls.size()) {
+                    point = wtpointmap.get(ContantXk.CJ_FX);
+                    List<PointData> fxls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
+
+                    if (!bzglls.isEmpty() && !fsls.isEmpty() && glls.size() == bzglls.size() && fsls.size() == bzglls.size()) {
                         double number = 0.0;
-                        for (int i = 0; i < bzglls.size(); i++) {
+                        double totalnumbere=0.0;
+                        double lastvalue=-1;
+                        for (int i = 0; i < fxls.size(); i++) {
                             double bzgl = bzglls.get(i).getPointValueInDouble();
                             double sjgl = glls.get(i).getPointValueInDouble();
-                            //日对风偏差次数(-50 +50之间)
-                            if (Math.abs(bzgl - sjgl) < 50) {
-                                number++;
+                            double fx = fxls.get(i).getPointValueInDouble();
+
+                            if(lastvalue!=fx)
+                            {
+                                //日对风偏差大于(-50 +50之间)
+                                if (Math.abs(bzgl - sjgl) > 50) {
+                                    //日对风偏差次数
+                                    number++;
+                                }
+                                //对风次数
+                                totalnumbere++;
                             }
+
                         }
 
                         pewp.setRdfpcl(number);
@@ -313,10 +352,12 @@ public class EquipmentInfo4Service {
             }
         }
 
-
-        List<ProEconCurveFittingMain> pecfmls = proEconCurveFittingMainService.list().stream().filter(i -> i.getRecordDate().compareTo(begin) == 0
-                && i.getWindturbineId().equals(wt.getId())
-        ).collect(Collectors.toList());
+        QueryWrapper<ProEconCurveFittingMain> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",begin).eq("windturbine_id",wt.getId());
+        List<ProEconCurveFittingMain> pecfmls = proEconCurveFittingMainService.list(queryWrapper);
+//                .stream().filter(i -> i.getRecordDate().compareTo(begin) == 0
+//                && i.getWindturbineId().equals(wt.getId())
+//        ).collect(Collectors.toList());
 
         if (!pecfmls.isEmpty()) {
             ProEconCurveFittingMain pecfm = pecfmls.get(0);
@@ -330,10 +371,12 @@ public class EquipmentInfo4Service {
 
 //**************************************************日三率统计****************************************************************/
 
-
-        List<ProEconStateTransitionRates> pestrls = proEconStateTransitionRatesService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconStateTransitionRates> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("record_date",begin).eq("windturbine_id",wt.getId());
+        List<ProEconStateTransitionRates> pestrls = proEconStateTransitionRatesService.list(queryWrapper2);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
         //大于3米20分钟转换及时次数
         DoubleSummaryStatistics timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
         //大于3米20分钟转换及时次数合计
@@ -369,9 +412,12 @@ public class EquipmentInfo4Service {
         } else {
             pewp.setRfwjsl(100.0);
         }
-        List<ProEconFaultLiminatedefects> peflls=proEconFaultLiminatedefectsService.list().stream()
-                .filter(i -> i.getDateTime().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconFaultLiminatedefects> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.ge("date_time",begin).le("date_time",end).eq("windturbine_id",wt.getId());
+        List<ProEconFaultLiminatedefects> peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
+//                .stream()
+//                .filter(i -> i.getDateTime().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
         //消缺及时次数
         DoubleSummaryStatistics right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
         //消缺及时次数合计
@@ -391,31 +437,48 @@ public class EquipmentInfo4Service {
         }
 //**************************************************日三率统计****************************************************************/
 
-        List<ProEconCurveFittingSub> pointls=proEconCurveFittingSubService.list().stream().filter(x-> x.getSpeed() !=null
-                && Double.valueOf(x.getSpeed())>=3.0
-                && Double.valueOf(x.getSpeed())<5.0
-                && x.getRecordDate().compareTo(begin) == 0
-                && x.getWindturbineId().equals(wt.getId())
-        ).collect(Collectors.toList());
+        QueryWrapper<ProEconCurveFittingSub> queryWrapper6 = new QueryWrapper<>();
+        queryWrapper6.eq("record_date",begin).isNotNull("speed")
+                .lt("speed",5.0)
+                .ge("speed",3.0)
+                .eq("windturbine_id",wt.getId());
+        List<ProEconCurveFittingSub> pointls=proEconCurveFittingSubService.list(queryWrapper6);
+//                .stream().filter(x-> x.getSpeed() !=null
+//                && Double.valueOf(x.getSpeed())>=3.0
+//                && Double.valueOf(x.getSpeed())<5.0
+//                && x.getRecordDate().compareTo(begin) == 0
+//                && x.getWindturbineId().equals(wt.getId())
+//        ).collect(Collectors.toList());
 
         DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
         pewp.setR35mqxpcl(summaryStatistics.getAverage());
 
-          pointls=proEconCurveFittingSubService.list().stream().filter(x-> x.getSpeed() !=null
-              && Double.valueOf(x.getSpeed())>=5.0
-                && Double.valueOf(x.getSpeed())<11.0
-                && x.getRecordDate().compareTo(begin) == 0
-                && x.getWindturbineId().equals(wt.getId())
-        ).collect(Collectors.toList());
+        queryWrapper6 = new QueryWrapper<>();
+        queryWrapper6.eq("record_date",begin).isNotNull("speed")
+                .lt("speed",11.0)
+                .ge("speed",5.0)
+                .eq("windturbine_id",wt.getId());
+          pointls=proEconCurveFittingSubService.list(queryWrapper6);
+//                  .stream().filter(x-> x.getSpeed() !=null
+//              && Double.valueOf(x.getSpeed())>=5.0
+//                && Double.valueOf(x.getSpeed())<11.0
+//                && x.getRecordDate().compareTo(begin) == 0
+//                && x.getWindturbineId().equals(wt.getId())
+//        ).collect(Collectors.toList());
 
         summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
         pewp.setR511mqxpcl(summaryStatistics.getAverage());
 
-        pointls=proEconCurveFittingSubService.list().stream().filter(x-> x.getSpeed() !=null
-                && Double.valueOf(x.getSpeed())>=11.0
-                && x.getRecordDate().compareTo(begin) == 0
-                && x.getWindturbineId().equals(wt.getId())
-        ).collect(Collectors.toList());
+        queryWrapper6 = new QueryWrapper<>();
+        queryWrapper6.eq("record_date",begin).isNotNull("speed")
+                .ge("speed",11.0)
+                .eq("windturbine_id",wt.getId());
+        pointls=proEconCurveFittingSubService.list(queryWrapper6);
+//                .stream().filter(x-> x.getSpeed() !=null
+//                && Double.valueOf(x.getSpeed())>=11.0
+//                && x.getRecordDate().compareTo(begin) == 0
+//                && x.getWindturbineId().equals(wt.getId())
+//        ).collect(Collectors.toList());
 
         summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
         pewp.setR11mycqxpcl(summaryStatistics.getAverage());
@@ -519,10 +582,12 @@ public class EquipmentInfo4Service {
                 }
             }
 
-
-            List<ProEconCurveFittMonthMain> pecfmmls = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getYear().equals(year) && i.getMonth().equals(month)
-                    && i.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            QueryWrapper<ProEconCurveFittMonthMain> queryWrapper4 = new QueryWrapper<>();
+            queryWrapper4.eq("year",year).eq("month",month).eq("windturbine_id",wt.getId());
+            List<ProEconCurveFittMonthMain> pecfmmls = proEconCurveFittMonthMainService.list(queryWrapper4);
+//                    .stream().filter(i -> i.getYear().equals(year) && i.getMonth().equals(month)
+//                    && i.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             if (!pecfmmls.isEmpty()) {
                 ProEconCurveFittMonthMain pecfm = pecfmmls.get(0);
@@ -542,13 +607,16 @@ public class EquipmentInfo4Service {
             cal.set(Calendar.DAY_OF_MONTH, 1);
             Date monthbiegin = c.getTime();
 
+            queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.ge("record_date",monthbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
 
-            pestrls =proEconStateTransitionRatesService.list().stream()
-                    .filter(i ->
-                            (i.getRecordDate().compareTo(monthbiegin) == 0 || i.getRecordDate().after(monthbiegin))
-                                    && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                                    && i.getWindturbineId().equals(wt.getId())
-                    ).collect(Collectors.toList());
+            pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
+//                    .stream()
+//                    .filter(i ->
+//                            (i.getRecordDate().compareTo(monthbiegin) == 0 || i.getRecordDate().after(monthbiegin))
+//                                    && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                    ).collect(Collectors.toList());
             //大于3米20分钟转换及时次数
             timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
             //大于3米20分钟转换及时次数合计
@@ -584,13 +652,15 @@ public class EquipmentInfo4Service {
             } else {
                 pewp.setYfwjsl(100.0);
             }
-
-            peflls=proEconFaultLiminatedefectsService.list().stream()
-                    .filter(i ->
-                            (i.getDateTime().compareTo(monthbiegin) == 0 || i.getDateTime().after(monthbiegin))
-                                    && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
-                                    && i.getWindturbineId().equals(wt.getId())
-                    ).collect(Collectors.toList());
+            queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.ge("date_time",monthbiegin).le("date_time",end).eq("windturbine_id",wt.getId());
+            peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
+//                    .stream()
+//                    .filter(i ->
+//                            (i.getDateTime().compareTo(monthbiegin) == 0 || i.getDateTime().after(monthbiegin))
+//                                    && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                    ).collect(Collectors.toList());
             //消缺及时次数
             right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
             //消缺及时次数合计
@@ -609,33 +679,58 @@ public class EquipmentInfo4Service {
                 pewp.setYgzxqjsl(100.0);
             }
 //**************************************************月三率统计****************************************************************/
-            List<ProEconCurveFittMonthSub> monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=3.0
-                    && Double.valueOf(x.getSpeed())<5.0
-                    && x.getYear().equals(year)
-                    && x.getMonth().equals(month)
-                    && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            QueryWrapper<ProEconCurveFittMonthSub> queryWrapper7 = new QueryWrapper<>();
+            queryWrapper7.isNotNull("speed")
+                    .lt("speed",5.0)
+                    .ge("speed",3.0)
+                    .eq("year",year)
+                    .eq("month",month)
+                    .eq("windturbine_id",wt.getId());
+            List<ProEconCurveFittMonthSub> monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
+//            .stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=3.0
+//                    && Double.valueOf(x.getSpeed())<5.0
+//                    && x.getYear().equals(year)
+//                    && x.getMonth().equals(month)
+//                    && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
             pewp.setY35mqxpcl(summaryStatistics.getAverage());
-            monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=5.0
-                    && Double.valueOf(x.getSpeed())<11.0
-                    && x.getYear().equals(year)
-                    && x.getMonth().equals(month)
-                    && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+
+            queryWrapper7 = new QueryWrapper<>();
+            queryWrapper7.isNotNull("speed")
+                    .lt("speed",11.0)
+                    .ge("speed",5.0)
+                    .eq("year",year)
+                    .eq("month",month)
+                    .eq("windturbine_id",wt.getId());
+           monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
+//            monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=5.0
+//                    && Double.valueOf(x.getSpeed())<11.0
+//                    && x.getYear().equals(year)
+//                    && x.getMonth().equals(month)
+//                    && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
             pewp.setY511mqxpcl(summaryStatistics.getAverage());
 
-            monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=11.0
-                    && x.getYear().equals(year)
-                    && x.getMonth().equals(month)
-                    && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            queryWrapper7 = new QueryWrapper<>();
+            queryWrapper7.isNotNull("speed")
+//                    .lt("speed",11.0)
+                    .ge("speed",11.0)
+                    .eq("year",year)
+                    .eq("month",month)
+                    .eq("windturbine_id",wt.getId());
+            monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
+//            monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=11.0
+//                    && x.getYear().equals(year)
+//                    && x.getMonth().equals(month)
+//                    && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
             pewp.setY11mycqxpcl(summaryStatistics.getAverage());
@@ -736,10 +831,13 @@ public class EquipmentInfo4Service {
                 }
             }
 
+            QueryWrapper<ProEconCurveFittYearMain> queryWrapper8 = new QueryWrapper<>();
+            queryWrapper8.eq("year",year).eq("windturbine_id",wt.getId());
 
-            List<ProEconCurveFittYearMain> pecfYmls = proEconCurveFittYearMainService.list().stream().filter(i -> i.getYear().equals(year)
-                    && i.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            List<ProEconCurveFittYearMain> pecfYmls = proEconCurveFittYearMainService.list(queryWrapper8);
+//                    .stream().filter(i -> i.getYear().equals(year)
+//                    && i.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             if (!pecfYmls.isEmpty()) {
                 ProEconCurveFittYearMain pecfm = pecfYmls.get(0);
@@ -758,12 +856,15 @@ public class EquipmentInfo4Service {
             cal.set(Calendar.DAY_OF_YEAR, 1);
             Date yearbiegin = c.getTime();
 
-            pestrls =proEconStateTransitionRatesService.list().stream()
-                    .filter(i ->
-                            (i.getRecordDate().compareTo(yearbiegin) == 0 || i.getRecordDate().after(yearbiegin))
-                                    && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                                    && i.getWindturbineId().equals(wt.getId())
-                    ).collect(Collectors.toList());
+            queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.ge("record_date",yearbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
+            pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
+//                    .stream()
+//                    .filter(i ->
+//                            (i.getRecordDate().compareTo(yearbiegin) == 0 || i.getRecordDate().after(yearbiegin))
+//                                    && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                    ).collect(Collectors.toList());
             //大于3米20分钟转换及时次数
             timerate8_summary =pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
             //大于3米20分钟转换及时次数合计
@@ -799,12 +900,15 @@ public class EquipmentInfo4Service {
             } else {
                 pewp.setNfwjsl(100.0);
             }
-            peflls=proEconFaultLiminatedefectsService.list().stream()
-                    .filter(i ->
-                            (i.getDateTime().compareTo(yearbiegin) == 0 || i.getDateTime().after(yearbiegin))
-                                    && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
-                                    && i.getWindturbineId().equals(wt.getId())
-                    ).collect(Collectors.toList());
+            queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.ge("date_time",yearbiegin).le("date_time",end).eq("windturbine_id",wt.getId());
+            peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
+//                    .stream()
+//                    .filter(i ->
+//                            (i.getDateTime().compareTo(yearbiegin) == 0 || i.getDateTime().after(yearbiegin))
+//                                    && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
+//                                    && i.getWindturbineId().equals(wt.getId())
+//                    ).collect(Collectors.toList());
             //消缺及时次数
             right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
             //消缺及时次数合计
@@ -823,30 +927,49 @@ public class EquipmentInfo4Service {
                 pewp.setNgzxqjsl(100.0);
             }
 //**************************************************年三率统计****************************************************************/
-            List<ProEconCurveFittYearSub> yearpointls=proEconCurveFittYearSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=3.0
-                    && Double.valueOf(x.getSpeed())<5.0
-                    && x.getYear().equals(year)
-                    && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            QueryWrapper<ProEconCurveFittYearSub> queryWrapper7 = new QueryWrapper<>();
+            queryWrapper.isNotNull("speed")
+                    .lt("speed",5.0)
+                    .ge("speed",3.0)
+                    .eq("year",year)
+                    .eq("windturbine_id",wt.getId());
+            List<ProEconCurveFittYearSub> yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
+//                    .stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=3.0
+//                    && Double.valueOf(x.getSpeed())<5.0
+//                    && x.getYear().equals(year)
+//                    && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
             pewp.setN35mqxpcl(summaryStatistics.getAverage());
-            yearpointls=proEconCurveFittYearSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=5.0
-                    && Double.valueOf(x.getSpeed())<11.0
-                    && x.getYear().equals(year)
-                    && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            queryWrapper7 = new QueryWrapper<>();
+            queryWrapper7.isNotNull("speed")
+                    .lt("speed",11.0)
+                    .ge("speed",5.0)
+                    .eq("year",year)
+                    .eq("windturbine_id",wt.getId());
+            yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
+//                    .stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=5.0
+//                    && Double.valueOf(x.getSpeed())<11.0
+//                    && x.getYear().equals(year)
+//                    && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
             pewp.setN511mqxpcl(summaryStatistics.getAverage());
-
-            yearpointls=proEconCurveFittYearSubService.list().stream().filter(x-> x.getSpeed() !=null
-                    && Double.valueOf(x.getSpeed())>=11.0
-                    && x.getYear().equals(year)
-                     && x.getWindturbineId().equals(wt.getId())
-            ).collect(Collectors.toList());
+            queryWrapper7 = new QueryWrapper<>();
+            queryWrapper.isNotNull("speed")
+                    .ge("speed",11.0)
+                    .eq("year",year)
+                    .eq("windturbine_id",wt.getId());
+            yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
+//            yearpointls=proEconCurveFittYearSubService.list().stream().filter(x-> x.getSpeed() !=null
+//                    && Double.valueOf(x.getSpeed())>=11.0
+//                    && x.getYear().equals(year)
+//                     && x.getWindturbineId().equals(wt.getId())
+//            ).collect(Collectors.toList());
 
             summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
             pewp.setN11mycqxpcl(summaryStatistics.getAverage());

+ 21 - 11
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
@@ -39,17 +40,20 @@ public class EquipmentInfo5Service {
      * 复位及时率
      */
     public void resetRate(Date currentDate) throws Exception {
-        //调度时间是第二天,currentDate 是第一天
+        //调度时间是第二天,currentDate 是第一天
         Date endDate = DateUtils.addDays(currentDate, 1);
 
-
-        List<ProEconShutdownEvent2> shutdownevents = proEconShutdownEvent2Service.list().stream().filter(i ->
-                i.getWinpowerstationId().contains("FDC")
-                        && (i.getStopTime().compareTo(currentDate) == 0 || i.getStopTime().after(currentDate))
-                        && (i.getStopTime().compareTo(endDate) == 0 || i.getStopTime().before(endDate))
-                        && i.getStopTypeId() != null && i.getStopHours() != null
-                        && !i.getStopTypeId().equals("wh")
-        ).collect(Collectors.toList());
+        QueryWrapper<ProEconShutdownEvent2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("stop_Time",currentDate).le("stop_Time",endDate)
+                .isNotNull("stop_Type_Id").isNotNull("stop_Hours").ne("stop_Type_Id","wh");
+        List<ProEconShutdownEvent2> shutdownevents = proEconShutdownEvent2Service.list(queryWrapper);
+//                .stream().filter(i ->
+//                i.getWinpowerstationId().contains(WpType.FDC.id)
+//                        && (i.getStopTime().compareTo(currentDate) == 0 || i.getStopTime().after(currentDate))
+//                        && (i.getStopTime().compareTo(endDate) == 0 || i.getStopTime().before(endDate))
+//                        && i.getStopTypeId() != null && i.getStopHours() != null
+//                        && !i.getStopTypeId().equals("wh")
+//        ).collect(Collectors.toList());
 
 
         Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<>();
@@ -146,8 +150,14 @@ public class EquipmentInfo5Service {
             stateRate(currentDate,rates);
         }
         List<ProEconEquipmentInfoDay5> dayls=new ArrayList<>();
-            List<String> dayInfoids = proEconEquipmentInfoDay5Service.list().stream().filter(i -> i.getRecordDate().compareTo(currentDate) == 0
-            ).map(ProEconEquipmentInfoDay5::getId).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay5> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.ge("record_date",currentDate);
+
+            List<String> dayInfoids = proEconEquipmentInfoDay5Service.list(queryWrapper2)
+                    .stream()
+//                    .filter(i -> i.getRecordDate().compareTo(currentDate) == 0
+//            )
+        .map(ProEconEquipmentInfoDay5::getId).collect(Collectors.toList());
 
             ProEconEquipmentInfoDay5 dayInfo;
             if (!dayInfoids.isEmpty()) {

+ 87 - 55
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
@@ -36,12 +37,14 @@ public class EquipmentInfoDayTopService {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
 
-
+        QueryWrapper<ProEconEquipmentInfoDayTop> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("types",1);
         //判断是否有重复记录,先删除重复记录
-        List<Long> idls = proEconEquipmentInfoDayTopService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getTypes() ==1
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDayTop::getId)
+        List<Long> idls = proEconEquipmentInfoDayTopService.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getTypes() ==1
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+                .map(ProEconEquipmentInfoDayTop::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -92,10 +95,13 @@ public class EquipmentInfoDayTopService {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<Long> idls = proEconEquipmentInfoDayTopService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getTypes() ==2
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDayTop::getId)
+        QueryWrapper<ProEconEquipmentInfoDayTop> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("types",2);
+        List<Long> idls = proEconEquipmentInfoDayTopService.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getTypes() ==2
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+                .map(ProEconEquipmentInfoDayTop::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -147,10 +153,13 @@ public class EquipmentInfoDayTopService {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<Long> idls = proEconEquipmentInfoDayTopService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getTypes() ==3
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDayTop::getId)
+        QueryWrapper<ProEconEquipmentInfoDayTop> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("types",3);
+        List<Long> idls = proEconEquipmentInfoDayTopService.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getTypes() ==3
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+                .map(ProEconEquipmentInfoDayTop::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -207,10 +216,13 @@ public class EquipmentInfoDayTopService {
         peeidt.setYear(DateUtils.getYear(recordDate));
         peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
         initial(peeidt);
-        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -240,11 +252,13 @@ public class EquipmentInfoDayTopService {
 
         }
 
-
-        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -284,11 +298,13 @@ public class EquipmentInfoDayTopService {
 
 
         }
-
-        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+        queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
@@ -327,10 +343,13 @@ public class EquipmentInfoDayTopService {
         peeidt.setYear(DateUtils.getYear(recordDate));
         peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
         initial(peeidt);
-        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -360,11 +379,13 @@ public class EquipmentInfoDayTopService {
 
         }
 
-
-        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -404,11 +425,13 @@ public class EquipmentInfoDayTopService {
 
 
         }
-
-        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+        queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
@@ -447,10 +470,15 @@ public class EquipmentInfoDayTopService {
         peeidt.setYear(DateUtils.getYear(recordDate));
         peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
         initial(peeidt);
-        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+
+        QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+
+        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -480,11 +508,13 @@ public class EquipmentInfoDayTopService {
 
         }
 
-
-        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+//        .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -524,11 +554,13 @@ public class EquipmentInfoDayTopService {
 
 
         }
-
-        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getWindturbineId().equals(wt.getId())
-                ).collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+        queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
+        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+//        .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getWindturbineId().equals(wt.getId())
+//                ).collect(Collectors.toList());
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);

+ 124 - 119
realtime/generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java

@@ -1,6 +1,7 @@
 package com.gyee.generation.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
@@ -9,6 +10,7 @@ import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconWtCurveFittingMonth;
 import com.gyee.generation.model.vo.FitClassVo;
 import com.gyee.generation.model.vo.StatData;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconWtCurveFittingMonthService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
@@ -17,21 +19,22 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 public class GoodnessOfFitService {
 
 
-//        private static final Logger logger = LoggerFactory.getLogger(GoodnessOfFitService.class);
-        @Resource
-        private IEdosUtil edosUtil;
-        @Resource
-        private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
+    //        private static final Logger logger = LoggerFactory.getLogger(GoodnessOfFitService.class);
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
 
     public Map<String,Map<String,Double>> goodnessOfFit(String wtId,Date nowDate) throws Exception {
+
+        Date endDate =DateUtils.truncate(nowDate);
         Date startDate = DateUtils.addDays(nowDate,-1);
-        Date endDate =new Date();
+
 
 
         Calendar c= Calendar.getInstance();
@@ -54,136 +57,138 @@ public class GoodnessOfFitService {
 
         List<FitClassVo> theList = new ArrayList<>();
 
-           List<ProEconWtCurveFittingMonth> powerList;
-
-            powerList = proEconWtCurveFittingMonthService.list().stream().filter(i->i.getMonth().equals(month)
-                && i.getWindturbineId().equals(wtId)
-                && i.getYear().equals(year)).collect(Collectors.toList());
+        List<ProEconWtCurveFittingMonth> powerList;
+        QueryWrapper<ProEconWtCurveFittingMonth> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("year",year).eq("month",month).eq("windturbine_id",wtId);
+        powerList = proEconWtCurveFittingMonthService.list(queryWrapper);
+//                    .stream().filter(i->i.getMonth().equals(month)
+//                && i.getWindturbineId().equals(wtId)
+//                && i.getYear().equals(year)).collect(Collectors.toList());
         ProBasicEquipment wt=CacheContext.wtmap.get(wtId);
 //            for (ProBasicEquipment wt : CacheContext.wtls)
 //
 //            {
 
-                List<FitClassVo> fitsD= new ArrayList<>();
-                List<FitClassVo> fitsM= new ArrayList<>();
-                List<FitClassVo> fitsY= new ArrayList<>();
+        List<FitClassVo> fitsD= new ArrayList<>();
+        List<FitClassVo> fitsM= new ArrayList<>();
+        List<FitClassVo> fitsY= new ArrayList<>();
 
 
-                //月数据筛选日分钟间隔
-                Map<String, ProBasicEquipmentPoint> wtpointmap= CacheContext.wtpAimap.get(wt.getId());
-                ProBasicEquipmentPoint fspoint=wtpointmap.get(ContantXk.CJ_SSFS);
-                List<PointData>  fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null, 900L, StatData.AVG.getValue());
+        //月数据筛选日分钟间隔
+        Map<String, ProBasicEquipmentPoint> wtpointmap= CacheContext.wtpAimap.get(wt.getId());
+        ProBasicEquipmentPoint fspoint=wtpointmap.get(ContantXk.CJ_SSFS);
+        List<PointData>  fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null, 900L, StatData.AVG.getValue());
 
-                ProBasicEquipmentPoint glpoint=wtpointmap.get(ContantXk.CJ_SSGL);
-                List<PointData>  glls=edosUtil.getHistStat(glpoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+        ProBasicEquipmentPoint glpoint=wtpointmap.get(ContantXk.CJ_SSGL);
+        List<PointData>  glls=edosUtil.getHistStat(glpoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=glls.get(i);
-                        FitClassVo po=new FitClassVo();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        fitsD.add(po);
-                    }
-                }
+        if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
+        {
+            for(int i=0;i<fsls.size();i++)
+            {
+                PointData fspd=fsls.get(i);
+                PointData glpd=glls.get(i);
+                FitClassVo po=new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
+                fitsD.add(po);
+            }
+        }
 
-                //月数据筛选15分钟间隔
-                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
-                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+        //月数据筛选15分钟间隔
+        fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+        glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=glls.get(i);
-                        FitClassVo po=new FitClassVo();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        fitsM.add(po);
-                    }
-                }
-                //年数据筛选15分钟间隔
-                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
-                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+        if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
+        {
+            for(int i=0;i<fsls.size();i++)
+            {
+                PointData fspd=fsls.get(i);
+                PointData glpd=glls.get(i);
+                FitClassVo po=new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
+                fitsM.add(po);
+            }
+        }
+        //年数据筛选15分钟间隔
+        fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+        glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=glls.get(i);
-                        FitClassVo po=new FitClassVo();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        fitsY.add(po);
-                    }
-                }
+        if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
+        {
+            for(int i=0;i<fsls.size();i++)
+            {
+                PointData fspd=fsls.get(i);
+                PointData glpd=glls.get(i);
+                FitClassVo po=new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+
+                po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
+                po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
+                fitsY.add(po);
+            }
+        }
 
-                buildList(theMapY, theList, wt.getWindpowerstationId(), fitsY, powerList);
-                buildList(theMapM, theList, wt.getWindpowerstationId(), fitsM, powerList);
-                buildList(theMapD, theList, wt.getWindpowerstationId(), fitsD, powerList);
+        buildList(theMapY, theList, wt.getWindpowerstationId(), fitsY, powerList);
+        buildList(theMapM, theList, wt.getWindpowerstationId(), fitsM, powerList);
+        buildList(theMapD, theList, wt.getWindpowerstationId(), fitsD, powerList);
 
 
-                theMapD.forEach((key,value)->{
-                    if(resultmap.containsKey(key))
-                    {
-                        Map<String,Double> tempmap=resultmap.get(key);
-                        tempmap.put("day",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }else
-                    {
-                        Map<String,Double> tempmap=new HashMap<>();
-                        tempmap.put("day",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }
+        theMapD.forEach((key,value)->{
+            if(resultmap.containsKey(key))
+            {
+                Map<String,Double> tempmap=resultmap.get(key);
+                tempmap.put("day",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }else
+            {
+                Map<String,Double> tempmap=new HashMap<>();
+                tempmap.put("day",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }
 
-                });
+        });
 
-                theMapM.forEach((key,value)->{
-                    if(resultmap.containsKey(key))
-                    {
-                        Map<String,Double> tempmap=resultmap.get(key);
-                        tempmap.put("month",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }else
-                    {
-                        Map<String,Double> tempmap=new HashMap<>();
-                        tempmap.put("month",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }
+        theMapM.forEach((key,value)->{
+            if(resultmap.containsKey(key))
+            {
+                Map<String,Double> tempmap=resultmap.get(key);
+                tempmap.put("month",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }else
+            {
+                Map<String,Double> tempmap=new HashMap<>();
+                tempmap.put("month",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }
 
-                });
+        });
 
-                theMapY.forEach((key,value)->{
-                    if(resultmap.containsKey(key))
-                    {
-                        Map<String,Double> tempmap=resultmap.get(key);
-                        tempmap.put("year",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }else
-                    {
-                        Map<String,Double> tempmap=new HashMap<>();
-                        tempmap.put("year",value.getPower() > 1 ? 1 : value.getPower());
-                        resultmap.put(key,tempmap);
-                    }
+        theMapY.forEach((key,value)->{
+            if(resultmap.containsKey(key))
+            {
+                Map<String,Double> tempmap=resultmap.get(key);
+                tempmap.put("year",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }else
+            {
+                Map<String,Double> tempmap=new HashMap<>();
+                tempmap.put("year",value.getPower() > 1 ? 1 : value.getPower());
+                resultmap.put(key,tempmap);
+            }
 
-                });
+        });
 //            }
 
 
@@ -219,7 +224,7 @@ public class GoodnessOfFitService {
         for (FitClassVo item : fitsY)
         {
             Double speed;
-            if (windpowerstationId.contains("GDC"))
+            if (windpowerstationId.contains(WpType.GDC.id))
             {
                 speed = item.getSpeed();
                 speed /= 100;
@@ -306,7 +311,7 @@ public class GoodnessOfFitService {
             int number=vo.getNumber();
             vo.setSpeed(item.getSpeed()+speed);
             vo.setPower(item.getPower()+value1);
-            vo.setEpower(item.getEpower()+value2);
+            vo.setEpower(epower+value2);
             number=number+1;
             vo.setNumber(number);
             theMap.put(item.getWindturbineId(),vo);

+ 81 - 39
realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java

@@ -5,6 +5,7 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotal2Service;
 import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotalService;
 import com.gyee.generation.service.auto.IProEconInputOrOutputSpeedService;
@@ -47,14 +48,21 @@ public class InputOrOutPutService {
         Date end = recordDate;
         for(ProBasicEquipment wt:CacheContext.wtls)
         {
+            if(wt.getWindpowerstationId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
 
             Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getNemCode());
 
-            List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
-                    .filter(i -> i.getWindturbineId().equals(wt.getId())
-                            && (i.getRecordDate().compareTo(daybegin) == 0 || i.getRecordDate().after(daybegin))
-                            && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                           ).collect(Collectors.toList());
+            QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+            queryWrapper.ge("record_date",daybegin).le("record_date",end).eq("windturbine_id",wt.getId());
+            List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+//            .stream()
+//                    .filter(i -> i.getWindturbineId().equals(wt.getId())
+//                            && (i.getRecordDate().compareTo(daybegin) == 0 || i.getRecordDate().after(daybegin))
+//                            && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                           ).collect(Collectors.toList());
 
             if(!recordList.isEmpty())
             {
@@ -68,17 +76,18 @@ public class InputOrOutPutService {
 
 
             ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.MXZT);
-
+            ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
 
             //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
             List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxzt.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
-            List<PointData> ssfsls = edosUtil.getHistoryDatasSnap(mxzt.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+            List<PointData> ssfsls = edosUtil.getHistoryDatasSnap(ssfs.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
 
             if(!statusls.isEmpty() && !ssfsls.isEmpty() && ssfsls.size()==statusls.size())
             {
                 for(int i=0;i<statusls.size();i++)
                 {
 
+
                     if(wtLastStatusMap.containsKey(wt.getId()))
                     {
                         lastStatus=wtLastStatusMap.get(wt.getId());
@@ -88,10 +97,14 @@ public class InputOrOutPutService {
                     PointData ssfspo=ssfsls.get(i);
                     double status=StringUtils.round(statuspo.getPointValueInDouble(),0);
 
+                    if(i==0)
+                    {
+                        lastStatus=status;
+                    }
                     if (!Objects.equals(lastStatus, status))
                     {
 
-                        //    #region 切入切出风速
+                        //     切入切出风速
                         if (lastStatus == 0 && status == 2)
                         {
                             ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
@@ -110,6 +123,7 @@ public class InputOrOutPutService {
                             {
                                 proEconInputOrOutputSpeedService.save(input);
                             }
+                            lastStatus=status;
 
                         }
                         else if (lastStatus == 2 && status== 0)
@@ -128,6 +142,7 @@ public class InputOrOutPutService {
                             {
                                 proEconInputOrOutputSpeedService.save(input);
                             }
+                            lastStatus=status;
                         }
 
                         wtLastStatusMap.put(wt.getId(), status);
@@ -159,6 +174,11 @@ public class InputOrOutPutService {
         Date yearbegin = c.getTime();
 
         for (ProBasicPowerstation wp : CacheContext.wpls) {
+
+            if(wp.getId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
             List<ProBasicEquipment> wtls = null;
             if (CacheContext.wpwtmap.containsKey(wp.getId())) {
                 wtls = CacheContext.wpwtmap.get(wp.getId());
@@ -167,18 +187,26 @@ public class InputOrOutPutService {
             if (null != wtls && !wtls.isEmpty()) {
                 for (ProBasicEquipment wt : wtls) {
 
+
                     ProEconInOrOutSpeedTotal total1 = null;
                     ProEconInOrOutSpeedTotal2 total2 = null;
-                    Optional<ProEconInOrOutSpeedTotal> total1o = proEconInOrOutSpeedTotalService.list().stream()
-                            .filter(i -> i.getWindturbineId().equals(wt.getId())
-                                    && i.getRecordDate().compareTo(daybegin) == 0).findFirst();
+                    QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("record_date",daybegin).eq("windturbine_id",wt.getId());
+                    Optional<ProEconInOrOutSpeedTotal> total1o = proEconInOrOutSpeedTotalService.list(queryWrapper)
+                            .stream()
+//                            .filter(i -> i.getWindturbineId().equals(wt.getId())
+//                                    && i.getRecordDate().compareTo(daybegin) == 0)
+                            .findFirst();
 
                     if (total1o.isPresent()) {
                         total1 = total1o.get();
                     }
-
-                    Optional<ProEconInOrOutSpeedTotal2> total2o = proEconInOrOutSpeedTotal2Service.list().stream().filter(i -> i.getWindturbineId().equals(wt.getId())
-                            && i.getRecordDate().compareTo(daybegin) == 0).findFirst();
+                    QueryWrapper<ProEconInOrOutSpeedTotal2> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",daybegin).eq("windturbine_id",wt.getId());
+                    Optional<ProEconInOrOutSpeedTotal2> total2o = proEconInOrOutSpeedTotal2Service.list(queryWrapper2).stream()
+//                            .filter(i -> i.getWindturbineId().equals(wt.getId())
+//                            && i.getRecordDate().compareTo(daybegin) == 0)
+                            .findFirst();
 
                     if (total2o.isPresent()) {
                         total2 = total2o.get();
@@ -204,7 +232,8 @@ public class InputOrOutPutService {
                     total1.setLineId(wt.getLineId());
                     total1.setRecordDate(daybegin);
                     total1.setCompanyId(wt.getCompanyId());
-                    if(wt.getWindpowerstationId().contains("FDC"))
+                    total1.setRegionId(wt.getRegionId());
+                    if(wt.getWindpowerstationId().contains(WpType.FDC.id))
                     {
                         total1.setTypes("-1");
                     }else
@@ -217,8 +246,9 @@ public class InputOrOutPutService {
                     total2.setProjectId(wt.getProjectId());
                     total2.setLineId(wt.getLineId());
                     total2.setRecordDate(daybegin);
+                    total2.setRegionId(wt.getRegionId());
                     total2.setCompanyId(wt.getCompanyId());
-                    if(wt.getWindpowerstationId().contains("FDC"))
+                    if(wt.getWindpowerstationId().contains(WpType.FDC.id))
                     {
                         total2.setTypes("-1");
                     }else
@@ -786,8 +816,11 @@ public class InputOrOutPutService {
         buildMonth(end, monthbegin, windturbineId, total1, total2);
         buildyear(end, yearbegin, windturbineId, total1, total2);
 
-        List<ProEconInOrOutSpeedTotal> items = proEconInOrOutSpeedTotalService.list().stream()
-                .filter(i -> i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
+        QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("windturbine_id",windturbineId);
+        List<ProEconInOrOutSpeedTotal> items = proEconInOrOutSpeedTotalService.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
 
         items.add(total1);
 
@@ -856,10 +889,12 @@ public class InputOrOutPutService {
 
 
 
-
-        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
-                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
-                        && i.getSpeed() != 0).collect(Collectors.toList());
+        QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("windturbine_id",windturbineId).isNotNull("speed").ne("speed",0);
+        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper2);
+//                .stream()
+//                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
+//                        && i.getSpeed() != 0).collect(Collectors.toList());
 
 
         List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
@@ -924,12 +959,14 @@ public class InputOrOutPutService {
     private void buildDay(Date end, Date daybegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
         int count;
 
-
-        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
-                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
-                        && (i.getRecordDate().compareTo(daybegin) == 0 || i.getRecordDate().after(daybegin))
-                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                        && i.getSpeed() != 0).collect(Collectors.toList());
+        QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",daybegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
+        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
+//                        && (i.getRecordDate().compareTo(daybegin) == 0 || i.getRecordDate().after(daybegin))
+//                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                        && i.getSpeed() != 0).collect(Collectors.toList());
 
 
         List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
@@ -1136,12 +1173,14 @@ public class InputOrOutPutService {
 
     private void buildMonth(Date end, Date monthbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
         int count;
-
-        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
-                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
-                        && (i.getRecordDate().compareTo(monthbegin) == 0 || i.getRecordDate().after(monthbegin))
-                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                        && i.getSpeed() != 0).collect(Collectors.toList());
+        QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",monthbegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
+        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+//        .stream()
+//                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
+//                        && (i.getRecordDate().compareTo(monthbegin) == 0 || i.getRecordDate().after(monthbegin))
+//                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                        && i.getSpeed() != 0).collect(Collectors.toList());
 
 
         List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
@@ -1345,11 +1384,14 @@ public class InputOrOutPutService {
 
     private void buildyear(Date end, Date yearbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
         int count;
-        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
-                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
-                        && (i.getRecordDate().compareTo(yearbegin) == 0 || i.getRecordDate().after(yearbegin))
-                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
-                        && i.getSpeed() != 0).collect(Collectors.toList());
+        QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",yearbegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
+        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+//        .stream()
+//                .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
+//                        && (i.getRecordDate().compareTo(yearbegin) == 0 || i.getRecordDate().after(yearbegin))
+//                        && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                        && i.getSpeed() != 0).collect(Collectors.toList());
 
 
         List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()

+ 40 - 17
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
@@ -123,9 +124,10 @@ public class LimitEventnewService {
 
         //读取数据库存在的恢复时间为NULL的数据,并通过风机编号把数据遍历到对应的map
 
-
-        List<ProEconMainBrownouts> oldStatusQuery = proEconMainBrownoutsService.list().stream()
-                .filter(i -> StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconMainBrownouts> queryWrapper = new QueryWrapper<>();
+        queryWrapper.isNull("start_Time");
+        List<ProEconMainBrownouts> oldStatusQuery = proEconMainBrownoutsService.list(queryWrapper).stream()
+//                .filter(i -> StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconMainBrownouts::getStopTime)).collect(Collectors.toList());
 
         for (ProEconMainBrownouts oldMainBrownouts : oldStatusQuery) {
@@ -133,9 +135,10 @@ public class LimitEventnewService {
                 oldMainBrownoutsMap.put(oldMainBrownouts.getWindpowerstationId(), oldMainBrownouts);
             }
         }
-
-        List<ProEconMainBrownouts2> oldStatus2Query = proEconMainBrownouts2Service.list().stream()
-                .filter(i -> StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconMainBrownouts2> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.isNull("start_Time");
+        List<ProEconMainBrownouts2> oldStatus2Query = proEconMainBrownouts2Service.list(queryWrapper2).stream()
+//                .filter(i -> StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconMainBrownouts2::getStopTime)).collect(Collectors.toList());
 
         for (ProEconMainBrownouts2 oldMainBrownouts2 : oldStatus2Query) {
@@ -143,9 +146,10 @@ public class LimitEventnewService {
                 oldMainBrownouts2Map.put(oldMainBrownouts2.getWindpowerstationId(), oldMainBrownouts2);
             }
         }
-
-        List<ProEconBrownoutsEvent> oldStatus3Query = proEconBrownoutsEventService.list().stream()
-                .filter(i -> StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconBrownoutsEvent> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.isNull("start_Time");
+        List<ProEconBrownoutsEvent> oldStatus3Query = proEconBrownoutsEventService.list(queryWrapper3).stream()
+//                .filter(i -> StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconBrownoutsEvent::getStopTime)).collect(Collectors.toList());
 
         for (ProEconBrownoutsEvent oldBrownouts : oldStatus3Query) {
@@ -153,9 +157,10 @@ public class LimitEventnewService {
                 oldBrownoutsStatusMap.put(oldBrownouts.getWindturbineId(), oldBrownouts);
             }
         }
-
-        List<ProEconBrownoutsEvent2> oldStatus4Query = proEconBrownoutsEvent2Service.list().stream()
-                .filter(i -> StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconBrownoutsEvent2> queryWrapper4 = new QueryWrapper<>();
+        queryWrapper4.isNull("start_Time");
+        List<ProEconBrownoutsEvent2> oldStatus4Query = proEconBrownoutsEvent2Service.list(queryWrapper4).stream()
+//                .filter(i -> StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconBrownoutsEvent2::getStopTime)).collect(Collectors.toList());
 
         for (ProEconBrownoutsEvent2 oldBrownouts2 : oldStatus4Query) {
@@ -247,8 +252,14 @@ public class LimitEventnewService {
 
                 if (mainBrownouts != null) {
                     ProEconMainBrownouts finalItem = mainBrownouts;
-                    List<ProEconMainBrownouts> ls = proEconMainBrownoutsService.list().stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId()) && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
-
+                    QueryWrapper<ProEconMainBrownouts> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconMainBrownouts> ls = proEconMainBrownoutsService.list(queryWrapper5);
+//                            .stream()
+//                            .filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0)
+                    //.collect(Collectors.toList());
+//
                     if (ls.isEmpty()) {
                         proEconMainBrownoutsService.save(finalItem);
                         oldMainBrownoutsMap.put(wpId, null);
@@ -273,7 +284,11 @@ public class LimitEventnewService {
                 mainBrownouts2 = oldMainBrownouts2Map.get(wpId);
                 if (mainBrownouts2 != null) {
                     ProEconMainBrownouts2 finalItem = mainBrownouts2;
-                    List<ProEconMainBrownouts2> ls = proEconMainBrownouts2Service.list().stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId()) && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
+                    QueryWrapper<ProEconMainBrownouts2> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconMainBrownouts2> ls = proEconMainBrownouts2Service.list(queryWrapper5);
+//                            .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
 
                     if (ls.isEmpty()) {
                         proEconMainBrownouts2Service.save(finalItem);
@@ -375,7 +390,11 @@ public class LimitEventnewService {
                 brownoutsEvent = oldBrownoutsStatusMap.get(wtId);
                 if (brownoutsEvent != null) {
                     ProEconBrownoutsEvent finalItem = brownoutsEvent;
-                    List<ProEconBrownoutsEvent> ls = proEconBrownoutsEventService.list().stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId()) && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
+                    QueryWrapper<ProEconBrownoutsEvent> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconBrownoutsEvent> ls = proEconBrownoutsEventService.list(queryWrapper5);
+//                            .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
 
                     if (ls.isEmpty()) {
                         proEconBrownoutsEventService.save(finalItem);
@@ -393,7 +412,11 @@ public class LimitEventnewService {
                 brownoutsEvent2 = oldBrownoutsStatus2Map.get(wtId);
                 if (brownoutsEvent2 != null) {
                     ProEconBrownoutsEvent2 finalItem = brownoutsEvent2;
-                    List<ProEconBrownoutsEvent2> ls = proEconBrownoutsEvent2Service.list().stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId()) && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
+                    QueryWrapper<ProEconBrownoutsEvent2> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconBrownoutsEvent2> ls = proEconBrownoutsEvent2Service.list(queryWrapper5);
+//                            .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
 
                     if (ls.isEmpty()) {
                         proEconBrownoutsEvent2Service.save(finalItem);

+ 3 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitService.java

@@ -7,6 +7,7 @@ import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProBasicPowerstationPoint;
 import com.gyee.generation.model.vo.StatData;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -63,7 +64,7 @@ public  class LimitService {
             Map<String,Map<String, ProBasicPowerstationPoint>> wppointmap =CacheContext.wppointmap;
             CacheContext.wpls.forEach(wp->{
             Map<String, ProBasicPowerstationPoint> wppMap = wppointmap.get(wp.getId());
-            if(wp.getId().contains("FDC"))
+            if(wp.getId().contains(WpType.FDC.id))
             {
                 if(wppMap.containsKey(ContantXk.TPOINT_WP_AGC))
                 {
@@ -115,7 +116,7 @@ public  class LimitService {
                 //风机转速限值1.5MV && 有功控制给定值2MV
 
             wtls.stream().forEach(wt->{
-                if(wt.getWindpowerstationId().contains("FDC"))
+                if(wt.getWindpowerstationId().contains(WpType.FDC.id))
                 {
                     Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
                     if(windturbinetestingpointnewMap.containsKey(ContantXk.XDZT))

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1727 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java


+ 243 - 185
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java

@@ -1,22 +1,23 @@
 package com.gyee.generation.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
-import com.gyee.generation.model.vo.CureFittingVo;
-import com.gyee.generation.model.vo.PointVo;
-import com.gyee.generation.model.vo.PointfVo;
+import com.gyee.generation.model.vo.*;
 import com.gyee.generation.service.auto.*;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.realtimesource.math.LineUtil;
+import com.gyee.generation.util.redis.RedisService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -36,6 +37,9 @@ public class PowerCurveFittingByTimeService {
     private String initialcode;
     public Map<String, Double> windturbineCapacity;
 
+
+    @Resource
+    private RedisService redisService;
     @Resource
     private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
 
@@ -70,9 +74,9 @@ public class PowerCurveFittingByTimeService {
 
         Date begin = DateUtils.addDays(end, -6);
 
-        proEconWtCurveFittingService.deleteProEconWtCurveFittingByDay(DateUtils.truncate(recordDate));
-        proEconCurveFittingMainService.deleteProEconCurveFittingMainByDay(DateUtils.truncate(recordDate));
-        proEconCurveFittingSubService.deleteProEconCurveFittingSubByDay(DateUtils.truncate(recordDate));
+        proEconWtCurveFittingService.deleteProEconWtCurveFittingFByDay(DateUtils.truncate(recordDate));
+        proEconCurveFittingMainService.deleteProEconCurveFittingMainFByDay(DateUtils.truncate(recordDate));
+        proEconCurveFittingSubService.deleteProEconCurveFittingSubFByDay(DateUtils.truncate(recordDate));
         Map<String, CureFittingVo> windMap = new HashMap<>();
 
         //初始化风机装机容量
@@ -90,33 +94,31 @@ public class PowerCurveFittingByTimeService {
         for (ProBasicEquipment wt : CacheContext.wtls) {
             String windturbineId = wt.getId();
 
+            if(wt.getWindpowerstationId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
+
 
             Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
             //设备有功功率
-            String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
+            String pointIdGL = null;
             //设备明细状态
-            String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
-
-            String pointIdFS;
-            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
-
-                if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
-                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
-
-                    if (StringUtils.notEmp(point.getNemCode()) && !point.getNemCode().equals(initialcode)) {
-                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
-                    } else {
-                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
-                    }
-                } else {
-                    pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
-                }
+            String pointIdZT =  null;
 
+            String pointIdFS = null;
+            if (windturbinetestingpointnewMap.containsKey(ContantXk.CJ_SSFS)) {
 
-            } else {   //设备风速
                 pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
             }
+            if (windturbinetestingpointnewMap.containsKey(ContantXk.CJ_SSGL)) {
 
+                pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
+            }
+            if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
+
+                pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
+            }
 
             CureFittingVo item = new CureFittingVo();
 
@@ -194,16 +196,23 @@ public class PowerCurveFittingByTimeService {
 //*********************************************日曲线偏差上个日和上一年记录**********************************************************/
             Date d1 = DateUtils.addDays(recordDate, -1);
             Date d2 = DateUtils.addYears(recordDate, -1);
-
-            List<ProEconWtCurveFitting> wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
-                    i.getRecordDate().compareTo(d1) == 0).sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtCurveFitting> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("record_date",d1).eq("windturbine_id",key);
+            List<ProEconWtCurveFitting> wcfls = proEconWtCurveFittingService.list(queryWrapper)
+                    .stream()
+//                    .filter(i -> i.getWindturbineId().equals(key) &&
+//                    i.getRecordDate().compareTo(d1) == 0)
+                    .sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
 
 
             dayBuildPoints(wcfls, dayLastMonthPoints);
 
-
-            wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
-                    i.getRecordDate().compareTo(d2) == 0).sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtCurveFitting> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",d2).eq("windturbine_id",key);
+            wcfls = proEconWtCurveFittingService.list(queryWrapper2).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key) &&
+//                    i.getRecordDate().compareTo(d2) == 0)
+                    .sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
 
             //与轶总的原始代码对比不一致,临时修改测试
             dayBuildPoints(wcfls, dayLastMonthPoints);
@@ -227,8 +236,12 @@ public class PowerCurveFittingByTimeService {
 
 
             //*********************************************当日曲线偏差记录**********************************************************/
-            Optional<ProEconCurveFittingMain> cfmdayo = proEconCurveFittingMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                    && i.getRecordDate().compareTo(recordDate) == 0).findFirst();
+            QueryWrapper<ProEconCurveFittingMain> queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.eq("record_date",recordDate).eq("windturbine_id",key);
+            Optional<ProEconCurveFittingMain> cfmdayo = proEconCurveFittingMainService.list(queryWrapper3).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key)
+//                    && i.getRecordDate().compareTo(recordDate) == 0)
+                    .findFirst();
             ProEconCurveFittingMain cfmday;
 
             if (cfmdayo.isPresent()) {
@@ -295,9 +308,9 @@ public class PowerCurveFittingByTimeService {
         int day_month = c.get(Calendar.MONTH) + 1;
 
 
-        proEconWtCurveFittingMonthService.deleteProEconWtCurveFittingByMonth(String.valueOf(day_year),String.valueOf(day_month));
-        proEconCurveFittMonthMainService.deleteProEconCurveFittMonthMainByMonth(String.valueOf(day_year),String.valueOf(day_month));
-        proEconCurveFittMonthSubService.deleteProEconCurveFittMonthSubByMonth(String.valueOf(day_year),String.valueOf(day_month));
+        proEconWtCurveFittingMonthService.deleteProEconWtCurveFittingFByMonth(String.valueOf(day_year),String.valueOf(day_month));
+        proEconCurveFittMonthMainService.deleteProEconCurveFittMonthMainFByMonth(String.valueOf(day_year),String.valueOf(day_month));
+        proEconCurveFittMonthSubService.deleteProEconCurveFittMonthSubFByMonth(String.valueOf(day_year),String.valueOf(day_month));
         c.set(Calendar.DAY_OF_MONTH, 1);
         Date begin = c.getTime();
 
@@ -326,7 +339,10 @@ public class PowerCurveFittingByTimeService {
         for (ProBasicEquipment wt : CacheContext.wtls) {
             String windturbineId = wt.getId();
 
-
+            if(wt.getWindpowerstationId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
             Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
             //设备有功功率
             String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
@@ -334,7 +350,7 @@ public class PowerCurveFittingByTimeService {
             String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
 
             String pointIdFS;
-            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
+            if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {   //测风塔70米风速
 
                 if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
                     ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
@@ -435,14 +451,20 @@ public class PowerCurveFittingByTimeService {
 
 
 //*********************************************月曲线偏差上个月和上一年记录**********************************************************/
-
-            List<ProEconWtCurveFittingMonth> wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
-                    i.getYear().equals(stringyear2) && i.getMonth().equals(stringmonth2)).sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtCurveFittingMonth> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("year",stringyear2).eq("month",stringmonth2).eq("windturbine_id",key);
+            List<ProEconWtCurveFittingMonth> wcfmls = proEconWtCurveFittingMonthService.list(queryWrapper).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key) &&
+//                    i.getYear().equals(stringyear2) && i.getMonth().equals(stringmonth2))
+                    .sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
 
             monthBuildPoints(wcfmls, monthLastMonthPoints);
-
-            wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
-                    i.getYear().equals(stringyear3) && i.getMonth().equals(stringmonth3)).sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtCurveFittingMonth> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("year",stringyear3).eq("month",stringmonth3).eq("windturbine_id",key);
+            wcfmls = proEconWtCurveFittingMonthService.list(queryWrapper2).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key) &&
+//                    i.getYear().equals(stringyear3) && i.getMonth().equals(stringmonth3))
+                    .sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
 
             monthBuildPoints(wcfmls, monthLastYearPoints);
 //*********************************************月曲线偏差上个月和上一年记录**********************************************************/
@@ -466,8 +488,12 @@ public class PowerCurveFittingByTimeService {
 
 
 //*********************************************当月曲线偏差记录**********************************************************/
-            Optional<ProEconCurveFittMonthMain> cfmmontho = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                    && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth)).findFirst();
+            QueryWrapper<ProEconCurveFittMonthMain> queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.eq("year",stringyear).eq("month",stringmonth).eq("windturbine_id",key);
+            Optional<ProEconCurveFittMonthMain> cfmmontho = proEconCurveFittMonthMainService.list(queryWrapper3).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key)
+//                    && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth))
+                    .findFirst();
             ProEconCurveFittMonthMain cfmmonth;
             if (cfmmontho.isPresent()) {
                 cfmmonth = cfmmontho.get();
@@ -497,7 +523,7 @@ public class PowerCurveFittingByTimeService {
             cfmmonth.setStandardDeviationRate(pcl(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower));
 
             mainls.add(cfmmonth);
-           // proEconCurveFittMonthMainService.save(cfmmonth);
+            // proEconCurveFittMonthMainService.save(cfmmonth);
 
             //*********************************************当月曲线偏差记录**********************************************************/
             List<ProEconCurveFittMonthSub> subls=new ArrayList<>();
@@ -542,9 +568,9 @@ public class PowerCurveFittingByTimeService {
         int day_year = c.get(Calendar.YEAR);
 
 
-        proEconWtCurveFittingYearService.deleteProEconWtCurveFittingByYear(String.valueOf(day_year));
-        proEconCurveFittYearMainService.deleteProEconCurveFittYearMainByYear(String.valueOf(day_year));
-        proEconCurveFittYearSubService.deleteProEconCurveFittYearSubByYear(String.valueOf(day_year));
+        proEconWtCurveFittingYearService.deleteProEconWtCurveFittingFByYear(String.valueOf(day_year));
+        proEconCurveFittYearMainService.deleteProEconCurveFittYearMainFByYear(String.valueOf(day_year));
+        proEconCurveFittYearSubService.deleteProEconCurveFittYearSubFByYear(String.valueOf(day_year));
         c.set(Calendar.DAY_OF_MONTH, 1);
         c.set(Calendar.MONTH, 0);
         Date begin = c.getTime();
@@ -570,7 +596,10 @@ public class PowerCurveFittingByTimeService {
         for (ProBasicEquipment wt : CacheContext.wtls) {
             String windturbineId = wt.getId();
 
-
+            if(wt.getWindpowerstationId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
             Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
             //设备有功功率
             String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
@@ -578,7 +607,7 @@ public class PowerCurveFittingByTimeService {
             String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
 
             String pointIdFS;
-            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
+            if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {   //测风塔70米风速
 
                 if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
                     ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
@@ -630,9 +659,13 @@ public class PowerCurveFittingByTimeService {
 
 
             //拟合年功率曲线
-          //  curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
-
-            List<ProEconWtPowerCurveFitting> wtpowerls= proEconWtPowerCurveFittingService.list().stream().filter(i->i.getWindturbineId().equals(key)).sorted(Comparator.comparing(ProEconWtPowerCurveFitting::getSpeed)).collect(Collectors.toList());
+            //  curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
+            QueryWrapper<ProEconWtPowerCurveFitting> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("windturbine_id",key);
+            List<ProEconWtPowerCurveFitting> wtpowerls= proEconWtPowerCurveFittingService.list(queryWrapper)
+                    .stream()
+//                    .filter(i->i.getWindturbineId().equals(key))
+                    .sorted(Comparator.comparing(ProEconWtPowerCurveFitting::getSpeed)).collect(Collectors.toList());
 
             List<PointVo> zyglls=new ArrayList<>();
             List<PointVo> sjglls=new ArrayList<>();
@@ -704,9 +737,12 @@ public class PowerCurveFittingByTimeService {
 
             // /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
 
-
-            List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
-                    i.getYear().equals(stringyear3)).sorted(Comparator.comparing(ProEconWtCurveFittingYear::getSpeed)).collect(Collectors.toList());
+            QueryWrapper<ProEconWtCurveFittingYear> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("year",stringyear3).eq("windturbine_id",key);
+            List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list(queryWrapper).stream()
+//                    .filter(i -> i.getWindturbineId().equals(key) &&
+//                    i.getYear().equals(stringyear3))
+                    .sorted(Comparator.comparing(ProEconWtCurveFittingYear::getSpeed)).collect(Collectors.toList());
 
             //与轶总的原始代码对比不一致,新增代码修改测试
             yearBuildPoints(wcfyls, yearLastMonthPoints);
@@ -732,8 +768,13 @@ public class PowerCurveFittingByTimeService {
 //*********************************************年曲线偏差记录**********************************************************/
 
 //*********************************************当年曲线偏差记录**********************************************************/
-            Optional<ProEconCurveFittYearMain> cfmyearo = proEconCurveFittYearMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                    && i.getYear().equals(stringyear)).findFirst();
+            QueryWrapper<ProEconCurveFittYearMain> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("year",stringyear).eq("windturbine_id",key);
+            Optional<ProEconCurveFittYearMain> cfmyearo = proEconCurveFittYearMainService.list(queryWrapper2)
+                    .stream()
+//                    .filter(i -> i.getWindturbineId().equals(key)
+//                    && i.getYear().equals(stringyear))
+                    .findFirst();
             ProEconCurveFittYearMain cfmyear;
             if (cfmyearo.isPresent()) {
                 cfmyear = cfmyearo.get();
@@ -763,7 +804,7 @@ public class PowerCurveFittingByTimeService {
             cfmyear.setStandardDeviationRate(pcl(windMap.get(key).getNsjglPoints(), yearStandardPoints, modelpower));
 
             mainls.add(cfmyear);
-           // proEconCurveFittYearMainService.save(cfmyear);
+            // proEconCurveFittYearMainService.save(cfmyear);
 
 //*********************************************当年曲线偏差记录**********************************************************/
             List<ProEconCurveFittYearSub> subls=new ArrayList<>();
@@ -793,14 +834,19 @@ public class PowerCurveFittingByTimeService {
 
 
     public ProEconCurveFittingSub pLCBuild(String key, Date current, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
-                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+                                           List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
     ) {
 
-        String speedStr = String.valueOf(speed);
+//        String speedStr = String.valueOf(speed);
 
 //*********************************************当日曲线偏差子表记录**********************************************************/
-        Optional<ProEconCurveFittingSub> cfmso = proEconCurveFittingSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                && i.getRecordDate().compareTo(current) == 0 && i.getSpeed().equals(speedStr)).findFirst();
+        QueryWrapper<ProEconCurveFittingSub> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("record_date",current).eq("speed",speed).eq("windturbine_id",key);
+        Optional<ProEconCurveFittingSub> cfmso = proEconCurveFittingSubService.list(queryWrapper2)
+                .stream()
+//                .filter(i -> i.getWindturbineId().equals(key)
+//                && i.getRecordDate().compareTo(current) == 0 && i.getSpeed().equals(speedStr))
+                .findFirst();
         ProEconCurveFittingSub cfms;
 
         if (cfmso.isPresent()) {
@@ -813,7 +859,7 @@ public class PowerCurveFittingByTimeService {
 
         cfms = new ProEconCurveFittingSub();
         cfms.setWindturbineId(key);
-        cfms.setSpeed(String.valueOf(speed));
+        cfms.setSpeed(speed);
         cfms.setRecordDate(DateUtils.truncate(current));
 
 
@@ -836,14 +882,17 @@ public class PowerCurveFittingByTimeService {
     }
 
     public ProEconCurveFittMonthSub pLCBuild(String key, String stringyear, String stringmonth, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
-                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+                                             List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
     ) {
-        String speedStr = String.valueOf(speed);
+//        String speedStr = String.valueOf(speed);
 
         //*********************************************当月曲线偏差子表记录**********************************************************/
-
-        Optional<ProEconCurveFittMonthSub> cfmsmontho = proEconCurveFittMonthSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth) && i.getSpeed().equals(speedStr)).findFirst();
+        QueryWrapper<ProEconCurveFittMonthSub> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("year",stringyear).eq("month",stringmonth).eq("speed",speed).eq("windturbine_id",key);
+        Optional<ProEconCurveFittMonthSub> cfmsmontho = proEconCurveFittMonthSubService.list(queryWrapper2).stream()
+//                .filter(i -> i.getWindturbineId().equals(key)
+//                && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth) && i.getSpeed().equals(speedStr))
+                .findFirst();
         ProEconCurveFittMonthSub cfmsmonth;
 
         if (cfmsmontho.isPresent()) {
@@ -859,7 +908,7 @@ public class PowerCurveFittingByTimeService {
         cfmsmonth.setWindturbineId(key);
         cfmsmonth.setYear(stringyear);
         cfmsmonth.setMonth(stringmonth);
-        cfmsmonth.setSpeed(String.valueOf(speed));
+        cfmsmonth.setSpeed(speed);
 
 
 
@@ -883,14 +932,17 @@ public class PowerCurveFittingByTimeService {
     }
 
     public ProEconCurveFittYearSub pLCBuild(String key, String stringyear, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
-                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+                                            List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
     ) {
-        String speedStr = String.valueOf(speed);
+//        String speedStr = String.valueOf(speed);
 
         //*********************************************当年曲线偏差子表记录**********************************************************/
-
-        Optional<ProEconCurveFittYearSub> cfmsyearo = proEconCurveFittYearSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
-                && i.getYear().equals(stringyear) && i.getSpeed().equals(speedStr)).findFirst();
+        QueryWrapper<ProEconCurveFittYearSub> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("year",stringyear).eq("speed",speed).eq("windturbine_id",key);
+        Optional<ProEconCurveFittYearSub> cfmsyearo = proEconCurveFittYearSubService.list(queryWrapper).stream()
+//                .filter(i -> i.getWindturbineId().equals(key)
+//                && i.getYear().equals(stringyear) && i.getSpeed().equals(speedStr))
+                .findFirst();
         ProEconCurveFittYearSub cfmsyear;
 
         if (cfmsyearo.isPresent()) {
@@ -904,22 +956,22 @@ public class PowerCurveFittingByTimeService {
         cfmsyear = new ProEconCurveFittYearSub();
         cfmsyear.setWindturbineId(key);
         cfmsyear.setYear(stringyear);
-        cfmsyear.setSpeed(String.valueOf(speed));
+        cfmsyear.setSpeed(speed);
 
-       // proEconCurveFittYearSubService.save(cfmsyear);
+        // proEconCurveFittYearSubService.save(cfmsyear);
 
         //年---实际/最优
-        cfmsyear.setDeviationRate1(pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
+        cfmsyear.setDeviationRate1(pcl2(windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), modelpower, speed));
         //年---实际/保证
-        cfmsyear.setDeviationRate2(pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsyear.setDeviationRate2(pcl2(windMap.get(key).getNsjglPoints(), bzglpowerPoints, modelpower, speed));
         //年---最优/保证
-        cfmsyear.setDeviationRate3(pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsyear.setDeviationRate3(pcl2(windMap.get(key).getNzyglPoints(), bzglpowerPoints, modelpower, speed));
         //年---实际/上月实际
-        cfmsyear.setMonthDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastMonthPoints, modelpower, speed));
+        cfmsyear.setMonthDeviationRate(pcl2(windMap.get(key).getNsjglPoints(), lastMonthPoints, modelpower, speed));
         //年---实际/同期实际
-        cfmsyear.setYearDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastYearPoints, modelpower, speed));
+        cfmsyear.setYearDeviationRate(pcl2(windMap.get(key).getNsjglPoints(), lastYearPoints, modelpower, speed));
         //年---实际/标杆实际
-        cfmsyear.setStandardDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastStandardPoints, modelpower, speed));
+        cfmsyear.setStandardDeviationRate(pcl2(windMap.get(key).getNsjglPoints(), lastStandardPoints, modelpower, speed));
 
 //        proEconCurveFittYearSubService.save(cfmsyear);
         return cfmsyear;
@@ -946,7 +998,7 @@ public class PowerCurveFittingByTimeService {
 
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         // item.SPEED = Double.Truncate(pointsF2[i].X);
                     } else {
@@ -978,7 +1030,7 @@ public class PowerCurveFittingByTimeService {
 
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         //item.SPEED = Double.Truncate(pointsF2[i].X);
                     } else {
@@ -1009,6 +1061,8 @@ public class PowerCurveFittingByTimeService {
             //*********************************************当日曲线偏差记录**********************************************************/
         }
         proEconWtCurveFittingService.saveBatch(wtcfls);
+        String s = JSONObject.toJSONString(wtcfls);
+        redisService.set(CurveType.dayCurve.id+"_"+windturbineId, s);
 
     }
 
@@ -1031,7 +1085,7 @@ public class PowerCurveFittingByTimeService {
                 item.setWindturbineId(windturbineId);
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1043,7 +1097,7 @@ public class PowerCurveFittingByTimeService {
                     item.setYear(String.valueOf(year));
                     item.setMonth(String.valueOf(month));
                     wtcfls.add(item);
-                   // proEconWtCurveFittingMonthService.save(item);
+                    // proEconWtCurveFittingMonthService.save(item);
                 }
 
             }
@@ -1057,7 +1111,7 @@ public class PowerCurveFittingByTimeService {
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1086,6 +1140,8 @@ public class PowerCurveFittingByTimeService {
         //*********************************************当月曲线偏差记录**********************************************************/
 
         proEconWtCurveFittingMonthService.saveBatch(wtcfls);
+        String s = JSONObject.toJSONString(wtcfls);
+        redisService.set(CurveType.monthCurve.id+"_"+windturbineId, s);
     }
 
     private void insertPoints(String year,  List<PointVo> sjglls, List<PointVo> zyglls, String windturbineId) {
@@ -1104,7 +1160,7 @@ public class PowerCurveFittingByTimeService {
                 item.setWindturbineId(windturbineId);
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1115,7 +1171,7 @@ public class PowerCurveFittingByTimeService {
                     item.setOptimalPower(zyglls.get(i).getY());
                     item.setYear(String.valueOf(year));
                     wtcfls.add(item);
-                   // proEconWtCurveFittingYearService.save(item);
+                    // proEconWtCurveFittingYearService.save(item);
                 }
 
             }
@@ -1129,7 +1185,7 @@ public class PowerCurveFittingByTimeService {
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1157,6 +1213,8 @@ public class PowerCurveFittingByTimeService {
         //*********************************************当年曲线偏差记录**********************************************************/
 
         proEconWtCurveFittingYearService.saveBatch(wtcfls);
+        String s = JSONObject.toJSONString(wtcfls);
+        redisService.set(CurveType.yearCurve.id+"_"+windturbineId, s);
     }
     private void insertPoints2(List<PointVo> monthSjglls, List<PointVo> monthZyglls, String windturbineId) {
 
@@ -1182,7 +1240,7 @@ public class PowerCurveFittingByTimeService {
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1214,7 +1272,7 @@ public class PowerCurveFittingByTimeService {
                 if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                    if (wt.getWindpowerstationId().contains("GDC")) {
+                    if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                         continue;
                         //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
@@ -1356,99 +1414,99 @@ public class PowerCurveFittingByTimeService {
                 return false;
             }
         }
-
-        //判定状态不为运行的进行过滤
-        if (zt.getPointValueInDouble() != 2) {
-            return false;
-        }
-
-
-        //设置时间为10分钟前,10钟前有停机事件数据进行过滤
-        Calendar c = Calendar.getInstance();
-        c.setTimeInMillis(zt.getPointTime());
-        Date end = c.getTime();
-        c.add(Calendar.MINUTE, -10);
-        Date bedin = c.getTime();
-        List<PointData> points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
-        if (!points.isEmpty()) {
-            for (PointData p : points) {
-                if (p.getPointValueInDouble() == 4) {
-
-                    return false;
-                }
-
-            }
-
-        }
-
-        //设置时间为10分钟后,运行后10分钟数据进行过滤
-
-        points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
-        if (!points.isEmpty()) {
-            for (PointData p : points) {
-                if (p.getPointValueInDouble() != 2) {
-                    return false;
-
-                }
-
-            }
-
-        }
-
-
-        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
-        Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
-
-
-        List<PointVo> bzPointls=new ArrayList<>();
-        List<PointVo> sjPointls=new ArrayList<>();
-
-        double modelpower=0.0;
-        if (CacheContext.wtmap.containsKey(windturbineId)) {
-            String modelid = CacheContext.wtmap.get(windturbineId).getModelId();
-            if (StringUtils.notEmp(modelid)) {
-                //获取保证功率曲线中的风速和功率
-                if (CacheContext.theoreticalPowerMap.containsKey(modelid)) {
-                    Map<Double,ProBasicModelPowerRd> theoreticalMap= CacheContext.theoreticalPowerMap.get(modelid);
-
-                    PointVo point = new PointVo();
-                    double speed=StringUtils.round(fs.getPointValueInDouble(),2);
-                    point.setX(speed);
-                    point.setY(theoreticalMap.get(speed).getEnsurePower());
-                    modelpower=point.getY();
-                    bzPointls.add(point);
-                }
-            }
-        }
-
-        PointVo point = new PointVo();
-        double speed=StringUtils.round(fs.getPointValueInDouble(),2);
-        double power=StringUtils.round(gl.getPointValueInDouble(),2);
-        point.setX(speed);
-        point.setY(power);
-        sjPointls.add(point);
-
-        //与保证功率进行对比,偏差大于25%的进行过滤
-        double value= pcl2( sjPointls, bzPointls, modelpower, speed);
-
-        if (value > Math.abs(0.25)) {
-            return false;
-        }
-
-        List<String> pointid = new ArrayList<>();
-        //欠发状态大于2过滤掉
-        pointid.add(wtpointmap.get(ContantXk.LSQFZT).getNemCode());
-        List<PointData> values = edosUtil.getHistMatrix(pointid, gl.getPointTime() / 1000);
-        if (null != values && values.size() > 0) {
-            double qfzt = values.get(0).getPointValueInDouble();
-
-            return !(qfzt > 2);
-        }
+//
+//        //判定状态不为运行的进行过滤
+//        if (zt.getPointValueInDouble() != 2) {
+//            return false;
+//        }
+//
+//
+//        //设置时间为10分钟前,10钟前有停机事件数据进行过滤
+//        Calendar c = Calendar.getInstance();
+//        c.setTimeInMillis(zt.getPointTime());
+//        Date end = c.getTime();
+//        c.add(Calendar.MINUTE, -10);
+//        Date bedin = c.getTime();
+//        List<PointData> points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
+//        if (!points.isEmpty()) {
+//            for (PointData p : points) {
+//                if (p.getPointValueInDouble() == 4) {
+//
+//                    return false;
+//                }
+//
+//            }
+//
+//        }
+//
+//        //设置时间为10分钟后,运行后10分钟数据进行过滤
+//
+//        points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
+//        if (!points.isEmpty()) {
+//            for (PointData p : points) {
+//                if (p.getPointValueInDouble() != 2) {
+//                    return false;
+//
+//                }
+//
+//            }
+//
+//        }
+//
+//
+//        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+//        Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
+//
+//
+//        List<PointVo> bzPointls=new ArrayList<>();
+//        List<PointVo> sjPointls=new ArrayList<>();
+//
+//        double modelpower=0.0;
+//        if (CacheContext.wtmap.containsKey(windturbineId)) {
+//            String modelid = CacheContext.wtmap.get(windturbineId).getModelId();
+//            if (StringUtils.notEmp(modelid)) {
+//                //获取保证功率曲线中的风速和功率
+//                if (CacheContext.theoreticalPowerMap.containsKey(modelid)) {
+//                    Map<Double,ProBasicModelPowerRd> theoreticalMap= CacheContext.theoreticalPowerMap.get(modelid);
+//
+//                    PointVo point = new PointVo();
+//                    double speed=StringUtils.round(fs.getPointValueInDouble(),2);
+//                    point.setX(speed);
+//                    point.setY(theoreticalMap.get(speed).getEnsurePower());
+//                    modelpower=point.getY();
+//                    bzPointls.add(point);
+//                }
+//            }
+//        }
+//
+//        PointVo point = new PointVo();
+//        double speed=StringUtils.round(fs.getPointValueInDouble(),2);
+//        double power=StringUtils.round(gl.getPointValueInDouble(),2);
+//        point.setX(speed);
+//        point.setY(power);
+//        sjPointls.add(point);
+//
+//        //与保证功率进行对比,偏差大于25%的进行过滤
+//        double value= pcl2( sjPointls, bzPointls, modelpower, speed);
+//
+//        if (value > Math.abs(0.25)) {
+//            return false;
+//        }
+//
+//        List<String> pointid = new ArrayList<>();
+//        //欠发状态大于2过滤掉
+//        pointid.add(wtpointmap.get(ContantXk.LSQFZT).getNemCode());
+//        List<PointData> values = edosUtil.getHistMatrix(pointid, gl.getPointTime() / 1000);
+//        if (null != values && values.size() > 0) {
+//            double qfzt = values.get(0).getPointValueInDouble();
+//
+//            return !(qfzt > 2);
+//        }
         return true;
     }
 
     //功率曲线拟合
-    public void curveFittingBuilder(Date begin, Date end, int dimension, double scale, String pointIdGL, String pointIdFS, String pointIdZT, List<PointVo> sjglPoints, List<PointVo> zyglPoints, String windturbineId) throws Exception {
+    private void curveFittingBuilder(Date begin, Date end, int dimension, double scale, String pointIdGL, String pointIdFS, String pointIdZT, List<PointVo> sjglPoints, List<PointVo> zyglPoints, String windturbineId) throws Exception {
         double maxPower = windturbineCapacity.get(windturbineId) * 1.3;
         double maxSpeed = 25;
         List<PointfVo> sjglnhpoints = new ArrayList<>();
@@ -1505,7 +1563,7 @@ public class PowerCurveFittingByTimeService {
                         if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                             ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                            if (wt.getWindpowerstationId().contains("GDC")) {
+                            if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                                 b = (x >= 0 && y > 0);
                             } else {
                                 if (z == 2) {
@@ -1561,7 +1619,7 @@ public class PowerCurveFittingByTimeService {
                         if (CacheContext.wtmap.containsKey(windturbineId)) {
 
                             ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
-                            if (wt.getWindpowerstationId().contains("GDC")) {
+                            if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
                                 b = (x >= 0 && y > 0);
                             } else {
                                 if (z == 2) {

+ 12 - 8
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java

@@ -8,6 +8,7 @@ import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.CureFittingVo;
 import com.gyee.generation.model.vo.PointVo;
 import com.gyee.generation.model.vo.PointfVo;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.*;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.math.LineUtil;
@@ -117,7 +118,10 @@ public class PowerCurveFittingService {
         for (ProBasicEquipment wt : wtls) {
             String windturbineId = wt.getId();
 
-
+            if(wt.getWindpowerstationId().contains(WpType.GDC.id))
+            {
+                continue;
+            }
             Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
             //设备有功功率
             String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
@@ -252,7 +256,7 @@ public class PowerCurveFittingService {
             String stringyear3 = String.valueOf(year3);
             String stringmonth3 = String.valueOf(month3);
 
-           // /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
+            // /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
 
 
             List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
@@ -286,7 +290,7 @@ public class PowerCurveFittingService {
 
             dayBuildPoints(wcfls, dayLastMonthPoints);
 
-            
+
             wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
                     i.getRecordDate().compareTo(d2) == 0).collect(Collectors.toList());
 
@@ -465,7 +469,7 @@ public class PowerCurveFittingService {
         cfmsyear = new ProEconCurveFittYearSub();
         cfmsyear.setWindturbineId(key);
         cfmsyear.setYear(stringyear);
-        cfmsyear.setSpeed(String.valueOf(speed));
+        cfmsyear.setSpeed(speed);
 
         proEconCurveFittYearSubService.save(cfmsyear);
 
@@ -502,7 +506,7 @@ public class PowerCurveFittingService {
         cfmsmonth.setWindturbineId(key);
         cfmsmonth.setYear(stringyear);
         cfmsmonth.setMonth(stringmonth);
-        cfmsmonth.setSpeed(String.valueOf(speed));
+        cfmsmonth.setSpeed(speed);
 
         proEconCurveFittMonthSubService.save(cfmsmonth);
 
@@ -536,7 +540,7 @@ public class PowerCurveFittingService {
 
         cfms = new ProEconCurveFittingSub();
         cfms.setWindturbineId(key);
-        cfms.setSpeed(String.valueOf(speed));
+        cfms.setSpeed(speed);
         cfms.setRecordDate(current);
 
 
@@ -1239,12 +1243,12 @@ public class PowerCurveFittingService {
         double maxval =0.0;
         if(sjglPoints.stream().min(Comparator.comparing(PointVo::getX)).isPresent())
         {
-             min = sjglPoints.stream().min(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
+            min = sjglPoints.stream().min(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
 
         }
         if(sjglPoints.stream().max(Comparator.comparing(PointVo::getX)).isPresent())
         {
-             max = sjglPoints.stream().max(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
+            max = sjglPoints.stream().max(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
         }
         if(sjglPoints.stream().max(Comparator.comparing(PointVo::getY)).isPresent())
         {

+ 38 - 23
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
@@ -105,8 +106,10 @@ public class ShutdownnewService {
 //******************************************************************************************************/
 
         //读取数据库存在的恢复时间为NULL的数据,并通过风机编号把数据遍历到对应的map
-        List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list().stream()
-                .filter(i->StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconWindturbineStatus> queryWrapper = new QueryWrapper<>();
+        queryWrapper.isNull("start_Time");
+        List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list(queryWrapper).stream()
+//                .filter(i->StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconWindturbineStatus::getStopTime)).collect(Collectors.toList());
 
         for (ProEconWindturbineStatus oldStatus : oldStatusQuery)
@@ -116,9 +119,10 @@ public class ShutdownnewService {
                 oldStatusMap.put(oldStatus.getWindturbineId(),oldStatus);
             }
         }
-
-        List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list().stream()
-                .filter(i->StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconShutdownEvent> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.isNull("start_Time");
+        List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list(queryWrapper2).stream()
+//                .filter(i->StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconShutdownEvent::getStopTime)).collect(Collectors.toList());
 
         for (ProEconShutdownEvent shutdown : oldShutdwonQuery)
@@ -128,9 +132,10 @@ public class ShutdownnewService {
                 oldShutdownEvent.put(shutdown.getWindturbineId(),shutdown);
             }
         }
-
-        List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list().stream()
-                .filter(i->StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconInterruption> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.isNull("start_Time");
+        List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list(queryWrapper3).stream()
+//                .filter(i->StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconInterruption::getStopTime)).collect(Collectors.toList());
 
         for (ProEconInterruption interrup : oldInterrupQuery)
@@ -140,9 +145,10 @@ public class ShutdownnewService {
                 oldInterrup.put(interrup.getWindturbineId(),interrup);
             }
         }
-
-        List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list().stream()
-                .filter(i->StringUtils.empty(i.getStartTime()))
+        QueryWrapper<ProEconShutdownEvent2> queryWrapper4 = new QueryWrapper<>();
+        queryWrapper4.isNull("start_Time");
+        List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list(queryWrapper4).stream()
+//                .filter(i->StringUtils.empty(i.getStartTime()))
                 .sorted(Comparator.comparing(ProEconShutdownEvent2::getStopTime)).collect(Collectors.toList());
 
         for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2)
@@ -309,7 +315,11 @@ public class ShutdownnewService {
                 if(item!=null)
                 {
                     ProEconWindturbineStatus finalItem = item;
-                    List<ProEconWindturbineStatus> ls= proEconWindturbineStatusService.list().stream().filter(i->i.getWindturbineId().equals(finalItem.getWindturbineId()) && i.getStopTime().compareTo(finalItem.getStopTime())==0).collect(Collectors.toList());
+                    QueryWrapper<ProEconWindturbineStatus> queryWrapper9 = new QueryWrapper<>();
+                    queryWrapper9.eq("stop_Time",finalItem.getStopTime()).eq("windturbine_id",finalItem.getWindturbineId());
+                    List<ProEconWindturbineStatus> ls= proEconWindturbineStatusService.list(queryWrapper9);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalItem.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime())==0).collect(Collectors.toList());
 
                     if(ls.isEmpty())
                     {
@@ -330,7 +340,12 @@ public class ShutdownnewService {
                 if(shutdwonEvent!=null)
                 {
                     ProEconShutdownEvent finalShutdwonEvent = shutdwonEvent;
-                    List<ProEconShutdownEvent> ls= proEconShutdownEventService.list().stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent.getWindturbineId()) && i.getStopTime().compareTo(finalShutdwonEvent.getStopTime())==0).collect(Collectors.toList());
+                    QueryWrapper<ProEconShutdownEvent> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("stop_Time",finalShutdwonEvent.getStopTime()).eq("windturbine_id",finalShutdwonEvent.getWindturbineId());
+                    List<ProEconShutdownEvent> ls= proEconShutdownEventService.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalShutdwonEvent.getStopTime())==0)
+//                            .collect(Collectors.toList());
 
                     if(ls.isEmpty())
                     {
@@ -348,7 +363,11 @@ public class ShutdownnewService {
                 if(interrup!=null)
                 {
                     ProEconInterruption finalInterrup = interrup;
-                    List<ProEconInterruption> ls= proEconInterruptionService.list().stream().filter(i->i.getWindturbineId().equals(finalInterrup.getWindturbineId()) && i.getStopTime().compareTo(finalInterrup.getStopTime())==0).collect(Collectors.toList());
+                    QueryWrapper<ProEconInterruption> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("stop_Time",finalInterrup.getStopTime()).eq("windturbine_id",finalInterrup.getWindturbineId());
+                    List<ProEconInterruption> ls= proEconInterruptionService.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalInterrup.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalInterrup.getStopTime())==0).collect(Collectors.toList());
 
                     if(ls.isEmpty())
                     {
@@ -367,7 +386,11 @@ public class ShutdownnewService {
                 if(shutdwonEvent2!=null)
                 {
                     ProEconShutdownEvent2 finalShutdwonEvent1 = shutdwonEvent2;
-                    List<ProEconShutdownEvent2> ls= proEconShutdownEvent2Service.list().stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent1.getWindturbineId()) && i.getStopTime().compareTo(finalShutdwonEvent1.getStopTime())==0).collect(Collectors.toList());
+                    QueryWrapper<ProEconShutdownEvent2> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("stop_Time",finalShutdwonEvent1.getStopTime()).eq("windturbine_id",finalShutdwonEvent1.getWindturbineId());
+                    List<ProEconShutdownEvent2> ls= proEconShutdownEvent2Service.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent1.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalShutdwonEvent1.getStopTime())==0).collect(Collectors.toList());
 
                     if(ls.isEmpty())
                     {
@@ -563,8 +586,6 @@ public class ShutdownnewService {
     }
 
 
-
-
     private  String newMethod( String windturbineId, Date begin, Date end)
     {
         String result = "";
@@ -642,21 +663,16 @@ public class ShutdownnewService {
                 }
             }
 
-
-
-
             //日故障损失电量
             if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
             {
 
                 double endvalue;
 
-
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
                 List<PointData> xdend=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
 
-
                 if(xdend.size()==1)
                 {
 
@@ -668,7 +684,6 @@ public class ShutdownnewService {
                 }
             }
 
-
         }
 
         return result;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 26 - 984
realtime/generationXK-service/src/main/java/com/gyee/generation/service/TimelinessRateService.java


+ 147 - 81
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -1,11 +1,14 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay1Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -32,11 +35,14 @@ public class WindPowerInfo1Service {
      */
     public void calRegionInfoDay(Date recordDate) throws Exception {
 
-        List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.cp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+        List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.cp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay1>>> rgmap = new HashMap<>();
@@ -46,9 +52,9 @@ public class WindPowerInfo1Service {
 
                 if (rgmap.containsKey(wpinfo.getRegionId())) {
                     Map<String, List<ProEconPowerstationInfoDay1>> map = rgmap.get(wpinfo.getRegionId());
-                    List<ProEconPowerstationInfoDay1> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay1> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay1> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay1> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay1> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay1> gfls = map.get(CompanyType.gf.id);
 
                     if (wpinfo.getForeignKeyId().contains("-1")) {
                         fdls.add(wpinfo);
@@ -73,19 +79,23 @@ public class WindPowerInfo1Service {
                         qbls.add(wpinfo);
                     }
 
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     rgmap.put(wpinfo.getRegionId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay1::getId)
+            QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.rg.getValue());
+            List<String> idls = proEconPowerstationInfoDay1Service.list(queryWrapper2)
+            .stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.rg.getValue()))
+                    .map(ProEconPowerstationInfoDay1::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -95,9 +105,9 @@ public class WindPowerInfo1Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay1>>> entry : rgmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay1>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay1> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay1> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay1> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay1> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay1> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay1> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -158,11 +168,13 @@ public class WindPowerInfo1Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
-
-        List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && i.getLocation().equals(Location.wp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && i.getLocation().equals(Location.wp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay1>>> cpmap = new HashMap<>();
@@ -172,11 +184,11 @@ public class WindPowerInfo1Service {
 
                 if (cpmap.containsKey(wpinfo.getCompanyId())) {
                     Map<String, List<ProEconPowerstationInfoDay1>> map = cpmap.get(wpinfo.getCompanyId());
-                    List<ProEconPowerstationInfoDay1> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay1> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay1> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay1> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay1> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay1> gfls = map.get(CompanyType.gf.id);
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
@@ -189,24 +201,27 @@ public class WindPowerInfo1Service {
                     List<ProEconPowerstationInfoDay1> gfls = new ArrayList<>();
                     List<ProEconPowerstationInfoDay1> fdls = new ArrayList<>();
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
                     }
                     qbls.add(wpinfo);
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     cpmap.put(wpinfo.getCompanyId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                            && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay1::getId)
+            QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+            List<String> idls = proEconPowerstationInfoDay1Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                            && i.getLocation().equals(Location.cp.getValue()))
+                    .map(ProEconPowerstationInfoDay1::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -216,9 +231,9 @@ public class WindPowerInfo1Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay1>>> entry : cpmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay1>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay1> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay1> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay1> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay1> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay1> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay1> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -547,10 +562,14 @@ public class WindPowerInfo1Service {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay1::getId)
+        QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.wp.getValue());
+        List<String> idls = proEconPowerstationInfoDay1Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+                .map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -579,13 +598,18 @@ public class WindPowerInfo1Service {
                 //昨日的统计结果
                 cl.add(Calendar.DAY_OF_MONTH, -1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-
-                                    && i.getLocation().equals(Location.wp.getValue())
-                                    && i.getWindpowerstationId().equals(wp.getId())
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("windpowerstation_id",wp.getId())
+                            .eq("location",Location.wp.getValue());
+                    pepid1ls = proEconPowerstationInfoDay1Service.list(queryWrapper2);
+//                    .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//
+//                                    && i.getLocation().equals(Location.wp.getValue())
+//                                    && i.getWindpowerstationId().equals(wp.getId())
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 extracted(recordDate, end, begin, pointmap, pewp, pepid1ls);
 //*******************************************年信息统计*********************************************************/
@@ -613,10 +637,14 @@ public class WindPowerInfo1Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.pjmap.containsKey(i.getProjectId())
-                        && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay1::getId)
+        QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.pj.getValue());
+        List<String> idls = proEconPowerstationInfoDay1Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.pjmap.containsKey(i.getProjectId())
+//                        && i.getLocation().equals(Location.pj.getValue()))
+                .map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -650,13 +678,18 @@ public class WindPowerInfo1Service {
                 //昨日的统计结果
                 cl.add(Calendar.DAY_OF_MONTH, -1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.pj.getValue())
-                                    && i.getProjectId().equals(pj.getId())
-
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("location",Location.pj.getValue())
+                            .eq("project_id",pj.getId());
+                    pepid1ls = proEconPowerstationInfoDay1Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.pj.getValue())
+//                                    && i.getProjectId().equals(pj.getId())
+//                            .collect(Collectors.toList());
+//
+//                            )
                 }
                 extracted(recordDate, end, begin, pointmap, pewp, pepid1ls);
 
@@ -682,10 +715,14 @@ public class WindPowerInfo1Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.lnmap.containsKey(i.getLineId())
-                        && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay1::getId)
+        QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.ln.getValue());
+        List<String> idls = proEconPowerstationInfoDay1Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.lnmap.containsKey(i.getLineId())
+//                        && i.getLocation().equals(Location.ln.getValue()))
+                .map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -724,12 +761,17 @@ public class WindPowerInfo1Service {
                 //昨日的统计结果
                 cl.add(Calendar.DAY_OF_MONTH, -1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.ln.getValue())
-                                    && i.getLineId().equals(ln.getId())
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("location",Location.ln.getValue())
+                            .eq("line_id",ln.getId());
+                    pepid1ls = proEconPowerstationInfoDay1Service.list(queryWrapper2);
+//                    .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.ln.getValue())
+//                                    && i.getLineId().equals(ln.getId())
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 extracted(recordDate, end, begin, pointmap, pewp, pepid1ls);
 
@@ -744,22 +786,46 @@ public class WindPowerInfo1Service {
     }
 
     private void extracted(Date recordDate, Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay1 pewp, List<ProEconPowerstationInfoDay1> pepid1ls) throws Exception {
+
+
         //*******************************************日信息统计*********************************************************/
-        if (pointmap.containsKey(ContantXk.RPJFS)) {
-            ProBasicPowerstationPoint point = pointmap.get(ContantXk.RPJFS);
-            List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
-            if (!pointls.isEmpty()) {
-                DoubleSummaryStatistics summaryStatistics = pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
-                //日最大风速
-                pewp.setRzdfs(summaryStatistics.getMax());
-                //日最小风速
-                pewp.setRzxfs(summaryStatistics.getMin());
-                //日平均风速
-                pewp.setRpjfs(summaryStatistics.getAverage());
+
+        if(pewp.getWindpowerstationId().contains(WpType.FDC.id))
+        {
+            if (pointmap.containsKey(ContantXk.RPJFS)) {
+                ProBasicPowerstationPoint point = pointmap.get(ContantXk.RPJFS);
+                List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
+                if (!pointls.isEmpty()) {
+                    DoubleSummaryStatistics summaryStatistics = pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+                    //日最大风速
+                    pewp.setRzdfs(summaryStatistics.getMax());
+                    //日最小风速
+                    pewp.setRzxfs(summaryStatistics.getMin());
+                    //日平均风速
+                    pewp.setRpjfs(summaryStatistics.getAverage());
+                }
+
             }
+        }else{
 
+            if (pointmap.containsKey(ContantXk.RPJGZD)) {
+                ProBasicPowerstationPoint point = pointmap.get(ContantXk.RPJGZD);
+                List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
+                if (!pointls.isEmpty()) {
+                    DoubleSummaryStatistics summaryStatistics = pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+                    //日最大风速
+                    pewp.setRzdfs(summaryStatistics.getMax());
+                    //日最小风速
+                    pewp.setRzxfs(summaryStatistics.getMin());
+                    //日平均风速
+                    pewp.setRpjfs(summaryStatistics.getAverage());
+                }
+
+            }
         }
 
+
+
         if (pointmap.containsKey(ContantXk.RPJGL)) {
             ProBasicPowerstationPoint point = pointmap.get(ContantXk.RPJGL);
             List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
@@ -1199,7 +1265,7 @@ public class WindPowerInfo1Service {
 
             if(pointmap.containsKey(ContantXk.NPJGL))
             {
-                ProBasicPowerstationPoint point= pointmap.get(ContantXk.NPJFS);
+                ProBasicPowerstationPoint point= pointmap.get(ContantXk.NPJGL);
                 List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                 if(!pointls.isEmpty())
                 {

+ 254 - 208
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java

@@ -1,11 +1,14 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay2Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -34,11 +37,14 @@ public class WindPowerInfo2Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.cp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+        List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.cp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay2>>> rgmap = new HashMap<>();
@@ -48,9 +54,9 @@ public class WindPowerInfo2Service {
 
                 if (rgmap.containsKey(wpinfo.getRegionId())) {
                     Map<String, List<ProEconPowerstationInfoDay2>> map = rgmap.get(wpinfo.getRegionId());
-                    List<ProEconPowerstationInfoDay2> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay2> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay2> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay2> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay2> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay2> gfls = map.get(CompanyType.gf.id);
 
                     if (wpinfo.getForeignKeyId().contains("-1")) {
                         fdls.add(wpinfo);
@@ -73,19 +79,22 @@ public class WindPowerInfo2Service {
                     } else if (wpinfo.getForeignKeyId().contains("0")) {
                         qbls.add(wpinfo);
                     }
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     rgmap.put(wpinfo.getRegionId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay2::getId)
+            QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.rg.getValue());
+            List<String> idls = proEconPowerstationInfoDay2Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.rg.getValue()))
+                    .map(ProEconPowerstationInfoDay2::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -95,9 +104,9 @@ public class WindPowerInfo2Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay2>>> entry : rgmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay2>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay2> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay2> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay2> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay2> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay2> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay2> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -157,12 +166,14 @@ public class WindPowerInfo2Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
-
-        List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay2>>> cpmap = new HashMap<>();
@@ -172,11 +183,11 @@ public class WindPowerInfo2Service {
 
                 if (cpmap.containsKey(wpinfo.getCompanyId())) {
                     Map<String, List<ProEconPowerstationInfoDay2>> map = cpmap.get(wpinfo.getCompanyId());
-                    List<ProEconPowerstationInfoDay2> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay2> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay2> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay2> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay2> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay2> gfls = map.get(CompanyType.gf.id);
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
@@ -189,25 +200,28 @@ public class WindPowerInfo2Service {
                     List<ProEconPowerstationInfoDay2> gfls = new ArrayList<>();
                     List<ProEconPowerstationInfoDay2> fdls = new ArrayList<>();
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
                     }
                     qbls.add(wpinfo);
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     cpmap.put(wpinfo.getCompanyId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay2::getId)
+            QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+            List<String> idls = proEconPowerstationInfoDay2Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.cp.getValue()))
+                    .map(ProEconPowerstationInfoDay2::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -217,9 +231,9 @@ public class WindPowerInfo2Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay2>>> entry : cpmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay2>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay2> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay2> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay2> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay2> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay2> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay2> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -386,10 +400,14 @@ public class WindPowerInfo2Service {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay2::getId)
+        QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+
+        List<String> idls = proEconPowerstationInfoDay2Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+                .map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -419,13 +437,19 @@ public class WindPowerInfo2Service {
                 //昨日的统计结果
                 cl.add(Calendar.DAY_OF_MONTH, -1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepidls = proEconPowerstationInfoDay2Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
 
-                                    && i.getLocation().equals(Location.wp.getValue())
-                                    && i.getWindpowerstationId().equals(wp.getId())
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("windpowerstation_id","wp.getId()")
+                            .eq("location",Location.wp.getValue());
+                    pepidls = proEconPowerstationInfoDay2Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//
+//                                    && i.getLocation().equals(Location.wp.getValue())
+//                                    && i.getWindpowerstationId().equals(wp.getId())
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 calDetiall(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
 
@@ -454,10 +478,14 @@ public class WindPowerInfo2Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.pjmap.containsKey(i.getProjectId())
-                        && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay2::getId)
+        QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.pj.getValue());
+        List<String> idls = proEconPowerstationInfoDay2Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.pjmap.containsKey(i.getProjectId())
+//                        && i.getLocation().equals(Location.pj.getValue()))
+                        .map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -492,13 +520,18 @@ public class WindPowerInfo2Service {
             //昨日的统计结果
             cl.add(Calendar.DAY_OF_MONTH, -1);
             if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                pepidls = proEconPowerstationInfoDay2Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-
-                                && i.getLocation().equals(Location.pj.getValue())
-                                && i.getProjectId().equals(pj.getId())
-                        )
-                        .collect(Collectors.toList());
+                QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                        .eq("location",Location.pj.getValue())
+                        .eq("project_id",pj.getId());
+                pepidls = proEconPowerstationInfoDay2Service.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//
+//                                && i.getLocation().equals(Location.pj.getValue())
+//                                && i.getProjectId().equals(pj.getId())
+//                        )
+//                        .collect(Collectors.toList());
             }
             calDetiall(pewp, end, begin, CacheContext.pjwtmap.get(pj.getId()), pepidls);
             calSimple(pewp, end, begin, CacheContext.pjwtmap.get(pj.getId()), pepidls);
@@ -525,10 +558,14 @@ public class WindPowerInfo2Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.lnmap.containsKey(i.getLineId())
-                        && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay2::getId)
+        QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.ln.getValue());
+        List<String> idls = proEconPowerstationInfoDay2Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.lnmap.containsKey(i.getLineId())
+//                        && i.getLocation().equals(Location.ln.getValue()))
+                .map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -569,12 +606,17 @@ public class WindPowerInfo2Service {
             //昨日的统计结果
             cl.add(Calendar.DAY_OF_MONTH, -1);
             if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                pepidls = proEconPowerstationInfoDay2Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getLocation().equals(Location.ln.getValue())
-                                && i.getLineId().equals(ln.getId())
-                        )
-                        .collect(Collectors.toList());
+                QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                        .eq("location",Location.ln.getValue())
+                        .eq("line_id",ln.getId());
+                pepidls = proEconPowerstationInfoDay2Service.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getLocation().equals(Location.ln.getValue())
+//                                && i.getLineId().equals(ln.getId())
+//                        )
+//                        .collect(Collectors.toList());
             }
             calDetiall(pewp, end, begin, CacheContext.lnwtmap.get(ln.getId()), pepidls);
             calSimple(pewp, end, begin, CacheContext.lnwtmap.get(ln.getId()), pepidls);
@@ -623,154 +665,158 @@ public class WindPowerInfo2Service {
 
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
 
-        for (ProBasicEquipment wt : wtls) {
-
-            lastState = -1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap = wtpAimap.get(wt.getId());
-            if (aimap.containsKey(ContantXk.MXZT)) {
-
-                ProBasicEquipmentPoint point = aimap.get(ContantXk.MXZT);
-                //按照分钟时间进行统计状态快照值
-                List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
-                if (!pointls.isEmpty()) {
-                    for (PointData po : pointls) {
-
-                        if (po.getPointValueInDouble() == 0) {
-
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-                            //待机时长加1分钟
-                            djsc++;
-                        } else if (po.getPointValueInDouble() == 1) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //手动停机时长加1分钟
-                            sdtjsc++;
-                        } else if (po.getPointValueInDouble() == 2) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-                            //正常发电时长加1分钟
-                            zcfdsc++;
-                        } else if (po.getPointValueInDouble() == 3) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
+        if(!wtls.isEmpty())
+        {
+            for (ProBasicEquipment wt : wtls) {
+
+                lastState = -1;//上一分钟状态
+                Map<String, ProBasicEquipmentPoint> aimap = wtpAimap.get(wt.getId());
+                if (aimap.containsKey(ContantXk.MXZT)) {
+
+                    ProBasicEquipmentPoint point = aimap.get(ContantXk.MXZT);
+                    //按照分钟时间进行统计状态快照值
+                    List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
+                    if (!pointls.isEmpty()) {
+                        for (PointData po : pointls) {
+
+                            if (po.getPointValueInDouble() == 0) {
+
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+                                //待机时长加1分钟
+                                djsc++;
+                            } else if (po.getPointValueInDouble() == 1) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //手动停机时长加1分钟
+                                sdtjsc++;
+                            } else if (po.getPointValueInDouble() == 2) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+                                //正常发电时长加1分钟
+                                zcfdsc++;
+                            } else if (po.getPointValueInDouble() == 3) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //发电降出力时长加1分钟
+                                fdjclsc++;
+                            } else if (po.getPointValueInDouble() == 4) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //故障时长加1分钟
+                                gzsc++;
+                            } else if (po.getPointValueInDouble() == 5) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //故障受累时长加1分钟
+                                gzslsc++;
+                            } else if (po.getPointValueInDouble() == 6) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //检修时长加1分钟
+                                jxsc++;
+                            } else if (po.getPointValueInDouble() == 7) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //检修受累时长加1分钟
+                                jxslsc++;
+                            } else if (po.getPointValueInDouble() == 8) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //限电降出力时长加1分钟
+                                xdjclsc++;
+                            } else if (po.getPointValueInDouble() == 9) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //限电停机时长加1分钟
+                                xdtjsc++;
+                            } else if (po.getPointValueInDouble() == 10) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+
+                                //电网受累时长加1分钟
+                                dwslsc++;
+                            } else if (po.getPointValueInDouble() == 11) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+                                //环境受累时长加1分钟
+                                hjslsc++;
+                            } else if (po.getPointValueInDouble() == 12) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
+                                //通讯中断时长加1分钟
+                                txzdsc++;
+                            } else if (po.getPointValueInDouble() == 13) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+
+                                }
 
+                                //设备离线时长加1分钟
+                                sblxsc++;
                             }
 
-                            //发电降出力时长加1分钟
-                            fdjclsc++;
-                        } else if (po.getPointValueInDouble() == 4) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //故障时长加1分钟
-                            gzsc++;
-                        } else if (po.getPointValueInDouble() == 5) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //故障受累时长加1分钟
-                            gzslsc++;
-                        } else if (po.getPointValueInDouble() == 6) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //检修时长加1分钟
-                            jxsc++;
-                        } else if (po.getPointValueInDouble() == 7) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //检修受累时长加1分钟
-                            jxslsc++;
-                        } else if (po.getPointValueInDouble() == 8) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //限电降出力时长加1分钟
-                            xdjclsc++;
-                        } else if (po.getPointValueInDouble() == 9) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //限电停机时长加1分钟
-                            xdtjsc++;
-                        } else if (po.getPointValueInDouble() == 10) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //电网受累时长加1分钟
-                            dwslsc++;
-                        } else if (po.getPointValueInDouble() == 11) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-                            //环境受累时长加1分钟
-                            hjslsc++;
-                        } else if (po.getPointValueInDouble() == 12) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-                            //通讯中断时长加1分钟
-                            txzdsc++;
-                        } else if (po.getPointValueInDouble() == 13) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-
-                            }
-
-                            //设备离线时长加1分钟
-                            sblxsc++;
                         }
 
                     }
 
                 }
-
             }
         }
+
         //日合计故障小时(明细)
         pewp.setRhjgzxsmx(new BigDecimal(gzsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
         //日合计场内受累故障小时(明细)

+ 252 - 207
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java

@@ -1,11 +1,14 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay3Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -32,11 +35,14 @@ public class WindPowerInfo3Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.cp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+        List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.cp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay3>>> rgmap = new HashMap<>();
@@ -46,9 +52,9 @@ public class WindPowerInfo3Service {
 
                 if (rgmap.containsKey(wpinfo.getRegionId())) {
                     Map<String, List<ProEconPowerstationInfoDay3>> map = rgmap.get(wpinfo.getRegionId());
-                    List<ProEconPowerstationInfoDay3> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay3> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay3> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay3> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay3> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay3> gfls = map.get(CompanyType.gf.id);
 
                     if (wpinfo.getForeignKeyId().contains("-1")) {
                         fdls.add(wpinfo);
@@ -71,19 +77,22 @@ public class WindPowerInfo3Service {
                     } else if (wpinfo.getForeignKeyId().contains("0")) {
                         qbls.add(wpinfo);
                     }
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     rgmap.put(wpinfo.getRegionId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay3Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay3::getId)
+            QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.rg.getValue());
+            List<String> idls = proEconPowerstationInfoDay3Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.rg.getValue()))
+                    .map(ProEconPowerstationInfoDay3::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -93,9 +102,9 @@ public class WindPowerInfo3Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay3>>> entry : rgmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay3>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay3> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay3> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay3> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay3> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay3> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay3> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -157,11 +166,14 @@ public class WindPowerInfo3Service {
      */
     public void calCompanyInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay3>>> cpmap = new HashMap<>();
@@ -171,11 +183,11 @@ public class WindPowerInfo3Service {
 
                 if (cpmap.containsKey(wpinfo.getCompanyId())) {
                     Map<String, List<ProEconPowerstationInfoDay3>> map = cpmap.get(wpinfo.getCompanyId());
-                    List<ProEconPowerstationInfoDay3> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay3> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay3> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay3> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay3> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay3> gfls = map.get(CompanyType.gf.id);
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
@@ -188,25 +200,28 @@ public class WindPowerInfo3Service {
                     List<ProEconPowerstationInfoDay3> gfls = new ArrayList<>();
                     List<ProEconPowerstationInfoDay3> fdls = new ArrayList<>();
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
                     }
                     qbls.add(wpinfo);
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     cpmap.put(wpinfo.getCompanyId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay3Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay3::getId)
+            QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+            List<String> idls = proEconPowerstationInfoDay3Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.cp.getValue()))
+                    .map(ProEconPowerstationInfoDay3::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -216,9 +231,9 @@ public class WindPowerInfo3Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay3>>> entry : cpmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay3>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay3> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay3> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay3> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay3> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay3> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay3> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -388,10 +403,13 @@ public class WindPowerInfo3Service {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay3::getId)
+        QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<String> idls = proEconPowerstationInfoDay3Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+                .map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -420,13 +438,18 @@ public class WindPowerInfo3Service {
                 //昨日的统计结果
                 cl.add(Calendar.DAY_OF_MONTH, -1);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepidls = proEconPowerstationInfoDay3Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.wp.getValue())
-                                    && i.getWindpowerstationId().equals(wp.getId())
-
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("windpowerstation_id",wp.getId())
+                            .eq("location",Location.wp.getValue());
+                    pepidls = proEconPowerstationInfoDay3Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.wp.getValue())
+//                                    && i.getWindpowerstationId().equals(wp.getId())
+//
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 calDetiall(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
                 calSimple(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
@@ -454,10 +477,14 @@ public class WindPowerInfo3Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.pjmap.containsKey(i.getProjectId())
-                        && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay3::getId)
+        QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.pj.getValue());
+        List<String> idls = proEconPowerstationInfoDay3Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.pjmap.containsKey(i.getProjectId())
+//                        && i.getLocation().equals(Location.pj.getValue()))
+                .map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -491,13 +518,18 @@ public class WindPowerInfo3Service {
             //昨日的统计结果
             cl.add(Calendar.DAY_OF_MONTH, -1);
             if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                pepidls = proEconPowerstationInfoDay3Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getLocation().equals(Location.pj.getValue())
-                                && i.getProjectId().equals(pj.getId())
-
-                        )
-                        .collect(Collectors.toList());
+                QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                        .eq("location",Location.pj.getValue())
+                        .eq("project_id",pj.getId());
+                pepidls = proEconPowerstationInfoDay3Service.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getLocation().equals(Location.pj.getValue())
+//                                && i.getProjectId().equals(pj.getId())
+//
+//                        )
+//                        .collect(Collectors.toList());
             }
             calDetiall(pewp, end, begin, CacheContext.pjwtmap.get(pj.getId()), pepidls);
 
@@ -524,10 +556,14 @@ public class WindPowerInfo3Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay3Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.lnmap.containsKey(i.getLineId())
-                        && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay3::getId)
+        QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate))
+                .eq("location",Location.ln.getValue());
+        List<String> idls = proEconPowerstationInfoDay3Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.lnmap.containsKey(i.getLineId())
+//                        && i.getLocation().equals(Location.ln.getValue()))
+                .map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -566,13 +602,18 @@ public class WindPowerInfo3Service {
             //昨日的统计结果
             cl.add(Calendar.DAY_OF_MONTH, -1);
             if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                pepidls = proEconPowerstationInfoDay3Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getLocation().equals(Location.ln.getValue())
-                                && i.getLineId().equals(ln.getId())
-
-                        )
-                        .collect(Collectors.toList());
+                QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                        .eq("location",Location.ln.getValue())
+                        .eq("line_id",ln.getId());
+                pepidls = proEconPowerstationInfoDay3Service.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getLocation().equals(Location.ln.getValue())
+//                                && i.getLineId().equals(ln.getId())
+//
+//                        )
+//                        .collect(Collectors.toList());
             }
             calDetiall(pewp, end, begin, CacheContext.lnwtmap.get(ln.getId()), pepidls);
             calSimple(pewp, end, begin, CacheContext.lnwtmap.get(ln.getId()), pepidls);
@@ -621,142 +662,146 @@ public class WindPowerInfo3Service {
 
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
 
-        for (ProBasicEquipment wt : wtls) {
-
-            lastState = -1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap = wtpAimap.get(wt.getId());
-            if (aimap.containsKey(ContantXk.MXZT)) {
-
-                ProBasicEquipmentPoint point = aimap.get(ContantXk.MXZT);
-                //按照分钟时间进行统计状态快照值
-                List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
-                if (!pointls.isEmpty()) {
-                    for (PointData po : pointls) {
-
-                        if (po.getPointValueInDouble() == 0) {
-
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //待机次数加1
-                                djcs++;
-                            }
-
-                        } else if (po.getPointValueInDouble() == 1) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //手动停机次数加1
-                                sdtjcs++;
-                            }
-
-                        } else if (po.getPointValueInDouble() == 2) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //正常发电次数加1
-                                zcfdcs++;
-                            }
-
-                        } else if (po.getPointValueInDouble() == 3) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //发电降出力次数加1
-                                fdjclcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 4) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //故障次数加1
-                                gzcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 5) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //故障受累次数加1
-                                gzslcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 6) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //检修次数加1
-                                jxcs++;
-                            }
-
+        if(!wtls.isEmpty())
+        {
+            for (ProBasicEquipment wt : wtls) {
+
+                lastState = -1;//上一分钟状态
+                Map<String, ProBasicEquipmentPoint> aimap = wtpAimap.get(wt.getId());
+                if (aimap.containsKey(ContantXk.MXZT)) {
+
+                    ProBasicEquipmentPoint point = aimap.get(ContantXk.MXZT);
+                    //按照分钟时间进行统计状态快照值
+                    List<PointData> pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
+                    if (!pointls.isEmpty()) {
+                        for (PointData po : pointls) {
+
+                            if (po.getPointValueInDouble() == 0) {
+
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //待机次数加1
+                                    djcs++;
+                                }
+
+                            } else if (po.getPointValueInDouble() == 1) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //手动停机次数加1
+                                    sdtjcs++;
+                                }
+
+                            } else if (po.getPointValueInDouble() == 2) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //正常发电次数加1
+                                    zcfdcs++;
+                                }
+
+                            } else if (po.getPointValueInDouble() == 3) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //发电降出力次数加1
+                                    fdjclcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 4) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //故障次数加1
+                                    gzcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 5) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //故障受累次数加1
+                                    gzslcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 6) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //检修次数加1
+                                    jxcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 7) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //检修受累次数加1
+                                    jxslcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 8) {
+                                if (lastState != po.getPointValueInDouble()) {
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //限电降出力次数加1
+                                    xdjclcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 9) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //限电停机次数加1
+                                    xdtjcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 10) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //电网受累次数加1
+                                    dwslcs++;
+                                }
+
+
+                            } else if (po.getPointValueInDouble() == 11) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //环境受累次数加1
+                                    hjslcs++;
+                                }
+
+                            } else if (po.getPointValueInDouble() == 12) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //通讯中断次数加1
+                                    txzdcs++;
+                                }
+
+                            } else if (po.getPointValueInDouble() == 13) {
+                                if (lastState != po.getPointValueInDouble()) {
+
+                                    //将当前状态保存到上一分钟状态
+                                    lastState = po.getPointValueInDouble();
+                                    //设备离线次数加1
+                                    sblxcs++;
+                                }
 
-                        } else if (po.getPointValueInDouble() == 7) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //检修受累次数加1
-                                jxslcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 8) {
-                            if (lastState != po.getPointValueInDouble()) {
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //限电降出力次数加1
-                                xdjclcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 9) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //限电停机次数加1
-                                xdtjcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 10) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //电网受累次数加1
-                                dwslcs++;
-                            }
-
-
-                        } else if (po.getPointValueInDouble() == 11) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //环境受累次数加1
-                                hjslcs++;
-                            }
-
-                        } else if (po.getPointValueInDouble() == 12) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //通讯中断次数加1
-                                txzdcs++;
-                            }
-
-                        } else if (po.getPointValueInDouble() == 13) {
-                            if (lastState != po.getPointValueInDouble()) {
-
-                                //将当前状态保存到上一分钟状态
-                                lastState = po.getPointValueInDouble();
-                                //设备离线次数加1
-                                sblxcs++;
                             }
 
                         }
@@ -764,10 +809,10 @@ public class WindPowerInfo3Service {
                     }
 
                 }
-
             }
         }
 
+
         //日合计故障次数(明细)
         pewp.setRhjgzcsmx(gzcs);
         //日合计场内受累故障次数(明细)

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 398 - 263
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java


+ 75 - 51
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java

@@ -1,11 +1,14 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay5Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -32,11 +35,14 @@ public class WindPowerInfo5Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.cp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+        List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.cp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay5>>> rgmap = new HashMap<>();
@@ -46,9 +52,9 @@ public class WindPowerInfo5Service {
 
                 if (rgmap.containsKey(wpinfo.getRegionId())) {
                     Map<String, List<ProEconPowerstationInfoDay5>> map = rgmap.get(wpinfo.getRegionId());
-                    List<ProEconPowerstationInfoDay5> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay5> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay5> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay5> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay5> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay5> gfls = map.get(CompanyType.gf.id);
 
                     if (wpinfo.getForeignKeyId().contains("-1")) {
                         fdls.add(wpinfo);
@@ -72,19 +78,22 @@ public class WindPowerInfo5Service {
                     }else if (wpinfo.getForeignKeyId().contains("0")) {
                         qbls.add(wpinfo);
                     }
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     rgmap.put(wpinfo.getRegionId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay5::getId)
+            QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.rg.getValue());
+            List<String> idls = proEconPowerstationInfoDay5Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.rg.getValue()))
+                    .map(ProEconPowerstationInfoDay5::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -94,9 +103,9 @@ public class WindPowerInfo5Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay5>>> entry : rgmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay5>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay5> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay5> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay5> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay5> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay5> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay5> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -157,11 +166,14 @@ public class WindPowerInfo5Service {
      */
     public void calCompanyInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay5>>> cpmap = new HashMap<>();
@@ -171,11 +183,11 @@ public class WindPowerInfo5Service {
 
                 if (cpmap.containsKey(wpinfo.getCompanyId())) {
                     Map<String, List<ProEconPowerstationInfoDay5>> map = cpmap.get(wpinfo.getCompanyId());
-                    List<ProEconPowerstationInfoDay5> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay5> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay5> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay5> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay5> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay5> gfls = map.get(CompanyType.gf.id);
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
@@ -188,25 +200,28 @@ public class WindPowerInfo5Service {
                     List<ProEconPowerstationInfoDay5> gfls = new ArrayList<>();
                     List<ProEconPowerstationInfoDay5> fdls = new ArrayList<>();
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
                     }
                     qbls.add(wpinfo);
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     cpmap.put(wpinfo.getCompanyId(), map);
                 }
             }
 
 
-            //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay5::getId)
+            //判断是否有重复记录,
+            QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+            List<String> idls = proEconPowerstationInfoDay5Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.cp.getValue()))
+                    .map(ProEconPowerstationInfoDay5::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -216,9 +231,9 @@ public class WindPowerInfo5Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay5>>> entry : cpmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay5>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay5> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay5> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay5> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay5> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay5> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay5> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -342,10 +357,13 @@ public class WindPowerInfo5Service {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay5::getId)
+        QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper= new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<String> idls = proEconPowerstationInfoDay5Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+                        .map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -406,10 +424,13 @@ public class WindPowerInfo5Service {
 //        Date begin= DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.pjmap.containsKey(i.getProjectId())
-                        && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay5::getId)
+        QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper= new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.pj.getValue());
+        List<String> idls = proEconPowerstationInfoDay5Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.pjmap.containsKey(i.getProjectId())
+//                        && i.getLocation().equals(Location.pj.getValue()))
+                .map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -474,10 +495,13 @@ public class WindPowerInfo5Service {
 //        Date begin= DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.lnmap.containsKey(i.getLineId())
-                        && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay5::getId)
+        QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper= new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.ln.getValue());
+        List<String> idls = proEconPowerstationInfoDay5Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.lnmap.containsKey(i.getLineId())
+//                        && i.getLocation().equals(Location.ln.getValue()))
+                .map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {

+ 108 - 70
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo6Service.java

@@ -1,10 +1,13 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay6Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
@@ -38,11 +41,14 @@ public class WindPowerInfo6Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
-        List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.cp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+        List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list(queryWrapper);
+//                .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.cp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay6>>> rgmap = new HashMap<>();
@@ -52,9 +58,9 @@ public class WindPowerInfo6Service {
 
                 if (rgmap.containsKey(wpinfo.getRegionId())) {
                     Map<String, List<ProEconPowerstationInfoDay6>> map = rgmap.get(wpinfo.getRegionId());
-                    List<ProEconPowerstationInfoDay6> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay6> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay6> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay6> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay6> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay6> gfls = map.get(CompanyType.gf.id);
 
                     if (wpinfo.getForeignKeyId().contains("-1")) {
                         fdls.add(wpinfo);
@@ -78,19 +84,22 @@ public class WindPowerInfo6Service {
                     }else if (wpinfo.getForeignKeyId().contains("0")) {
                         qbls.add(wpinfo);
                     }
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     rgmap.put(wpinfo.getRegionId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay6Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay6::getId)
+            QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.rg.getValue());
+            List<String> idls = proEconPowerstationInfoDay6Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.rg.getValue()))
+                    .map(ProEconPowerstationInfoDay6::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -100,9 +109,9 @@ public class WindPowerInfo6Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay6>>> entry : rgmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay6>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay6> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay6> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay6> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay6> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay6> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay6> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -162,12 +171,14 @@ public class WindPowerInfo6Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
-
-        List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue()))
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list(queryWrapper);
+//        .stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+//                .collect(Collectors.toList());
         if (!wpinfodayls.isEmpty()) {
 
             Map<String, Map<String, List<ProEconPowerstationInfoDay6>>> cpmap = new HashMap<>();
@@ -177,11 +188,11 @@ public class WindPowerInfo6Service {
 
                 if (cpmap.containsKey(wpinfo.getCompanyId())) {
                     Map<String, List<ProEconPowerstationInfoDay6>> map = cpmap.get(wpinfo.getCompanyId());
-                    List<ProEconPowerstationInfoDay6> qbls = map.get("qb");
-                    List<ProEconPowerstationInfoDay6> fdls = map.get("fd");
-                    List<ProEconPowerstationInfoDay6> gfls = map.get("gf");
+                    List<ProEconPowerstationInfoDay6> qbls = map.get(CompanyType.qb.id);
+                    List<ProEconPowerstationInfoDay6> fdls = map.get(CompanyType.fd.id);
+                    List<ProEconPowerstationInfoDay6> gfls = map.get(CompanyType.gf.id);
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
@@ -194,25 +205,28 @@ public class WindPowerInfo6Service {
                     List<ProEconPowerstationInfoDay6> gfls = new ArrayList<>();
                     List<ProEconPowerstationInfoDay6> fdls = new ArrayList<>();
 
-                    if (wpinfo.getWindpowerstationId().contains("FDC")) {
+                    if (wpinfo.getWindpowerstationId().contains(WpType.FDC.id)) {
                         fdls.add(wpinfo);
                     } else {
                         gfls.add(wpinfo);
                     }
                     qbls.add(wpinfo);
-                    map.put("qb", qbls);
-                    map.put("fd", fdls);
-                    map.put("gf", gfls);
+                    map.put(CompanyType.qb.id, qbls);
+                    map.put(CompanyType.fd.id, fdls);
+                    map.put(CompanyType.gf.id, gfls);
                     cpmap.put(wpinfo.getCompanyId(), map);
                 }
             }
 
 
             //判断是否有重复记录,先删除重复记录
-            List<String> idls = proEconPowerstationInfoDay6Service.list().stream()
-                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                            && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay6::getId)
+            QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
+            List<String> idls = proEconPowerstationInfoDay6Service.list(queryWrapper2).stream()
+//                    .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+////                            && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                            && i.getLocation().equals(Location.cp.getValue()))
+                    .map(ProEconPowerstationInfoDay6::getId)
                     .collect(Collectors.toList());
 
             if (idls.size() > 0) {
@@ -222,9 +236,9 @@ public class WindPowerInfo6Service {
             }
             for (Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay6>>> entry : cpmap.entrySet()) {
                 Map<String, List<ProEconPowerstationInfoDay6>> map = entry.getValue();
-                List<ProEconPowerstationInfoDay6> qbls = map.get("qb");
-                List<ProEconPowerstationInfoDay6> fdls = map.get("fd");
-                List<ProEconPowerstationInfoDay6> gfls = map.get("gf");
+                List<ProEconPowerstationInfoDay6> qbls = map.get(CompanyType.qb.id);
+                List<ProEconPowerstationInfoDay6> fdls = map.get(CompanyType.fd.id);
+                List<ProEconPowerstationInfoDay6> gfls = map.get(CompanyType.gf.id);
 //                if(CacheContext.cpwpmap.size()==qbls.size())
 //                {
 
@@ -380,10 +394,13 @@ public class WindPowerInfo6Service {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay6Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
-                        && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay6::getId)
+        QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
+        List<String> idls = proEconPowerstationInfoDay6Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
+//                        && i.getLocation().equals(Location.wp.getValue()))
+                .map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -410,12 +427,17 @@ public class WindPowerInfo6Service {
                 Calendar cl = Calendar.getInstance();
                 cl.setTime(recordDate);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay6Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.wp.getValue())
-                                    && i.getWindpowerstationId().equals(wp.getId())
-                                  )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("windPowerStation_Id",wp.getId())
+                            .eq("location",Location.wp.getValue());
+                    pepid1ls = proEconPowerstationInfoDay6Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.wp.getValue())
+//                                    && i.getWindpowerstationId().equals(wp.getId())
+//                                  )
+//                            .collect(Collectors.toList());
                 }
                 extracted(end, begin, pointmap, pewp, pepid1ls);
 //*******************************************年信息统计*********************************************************/
@@ -442,10 +464,13 @@ public class WindPowerInfo6Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay6Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.pjmap.containsKey(i.getProjectId())
-                        && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay6::getId)
+        QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.pj.getValue());
+        List<String> idls = proEconPowerstationInfoDay6Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.pjmap.containsKey(i.getProjectId())
+//                        && i.getLocation().equals(Location.pj.getValue()))
+                .map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -476,13 +501,18 @@ public class WindPowerInfo6Service {
                 Calendar cl = Calendar.getInstance();
                 cl.setTime(recordDate);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay6Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.pj.getValue())
-                                    && i.getProjectId().equals(pj.getId())
-
-                            )
-                            .collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("project_Id",pj.getId())
+                            .eq("location",Location.pj.getValue());
+                    pepid1ls = proEconPowerstationInfoDay6Service.list(queryWrapper2);
+//                    .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.pj.getValue())
+//                                    && i.getProjectId().equals(pj.getId())
+//
+//                            )
+//                            .collect(Collectors.toList());
                 }
                 extracted(end, begin, pointmap, pewp, pepid1ls);
 
@@ -509,10 +539,13 @@ public class WindPowerInfo6Service {
         Date begin = DateUtils.truncate(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
-        List<String> idls = proEconPowerstationInfoDay6Service.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-                        && CacheContext.lnmap.containsKey(i.getLineId())
-                        && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay6::getId)
+        QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.ln.getValue());
+        List<String> idls = proEconPowerstationInfoDay6Service.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                        && CacheContext.lnmap.containsKey(i.getLineId())
+//                        && i.getLocation().equals(Location.ln.getValue()))
+                .map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -548,12 +581,17 @@ public class WindPowerInfo6Service {
                 Calendar cl = Calendar.getInstance();
                 cl.setTime(recordDate);
                 if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-                    pepid1ls = proEconPowerstationInfoDay6Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                    && i.getLocation().equals(Location.ln.getValue())
-                                    && i.getLineId().equals(ln.getId())
-
-                            ).collect(Collectors.toList());
+                    QueryWrapper<ProEconPowerstationInfoDay6> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime()))
+                            .eq("line_Id",ln.getId())
+                            .eq("location",Location.ln.getValue());
+                    pepid1ls = proEconPowerstationInfoDay6Service.list(queryWrapper2);
+//                            .stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                    && i.getLocation().equals(Location.ln.getValue())
+//                                    && i.getLineId().equals(ln.getId())
+//
+//                            ).collect(Collectors.toList());
                 }
                 extracted(end, begin, pointmap, pewp, pepid1ls);
 

+ 45 - 11
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java

@@ -1,10 +1,12 @@
 package com.gyee.generation.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.model.auto.ProEconWindturbineGoodness;
+import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.service.auto.IProEconWindturbineGoodnessService;
 import com.gyee.generation.util.DateUtils;
@@ -33,9 +35,12 @@ public class WindturbineGoodnessService {
 
 
         //判断是否有重复记录,先删除重复记录
-        List<Long> idls = proEconWindturbineGoodnessService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconWindturbineGoodness::getId)
+        QueryWrapper<ProEconWindturbineGoodness> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<Long> idls = proEconWindturbineGoodnessService.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+                .map(ProEconWindturbineGoodness::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -47,13 +52,24 @@ public class WindturbineGoodnessService {
 
 
         List<ProEconWindturbineGoodness> vos=new ArrayList<>();
+
+        System.out.println("拟合优度风机数量"+CacheContext.wtls.size());
         for(ProBasicEquipment wt: CacheContext.wtls)
         {
+            Map<String, Map<String, Double>> coefficientMap=new HashMap<>();
+            Map<String, Map<String,Double>> fitMap=new HashMap<>();
+            try {
+               coefficientMap=coefficientService.coefficient(wt.getId(),DateUtils.truncate(recordDate));
+               fitMap=goodnessOfFitService.goodnessOfFit(wt.getId(),DateUtils.truncate(recordDate));
+            }catch (Exception e)
+            {
+                System.out.println(e.getMessage());
+            }
 
-            Map<String, Map<String, Double>> coefficientMap=coefficientService.coefficient(wt.getId(),DateUtils.truncate(recordDate));
-            Map<String, Map<String,Double>> fitMap=goodnessOfFitService.goodnessOfFit(wt.getId(),DateUtils.truncate(recordDate));
 
-          List<ProEconEquipmentInfoDay1> day1ls=  proEconEquipmentInfoDay1Service.list().stream().filter(i->
+            QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("windturbine_id",wt.getId());
+          List<ProEconEquipmentInfoDay1> day1ls=  proEconEquipmentInfoDay1Service.list(queryWrapper2).stream().filter(i->
                     i.getWindturbineId().equals(wt.getId())
             && i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
             ).collect(Collectors.toList());
@@ -64,8 +80,8 @@ public class WindturbineGoodnessService {
             po.setRecordDate(DateUtils.truncate(recordDate));
             po.setWindtpowerstationId(wt.getWindpowerstationId());
             po.setCompanyId(wt.getCompanyId());
-
-            if(wt.getWindpowerstationId().contains("FDC"))
+            po.setRegionId(wt.getRegionId());
+            if(wt.getWindpowerstationId().contains(WpType.FDC.id))
             {
                 po.setTypes("-1");
             }else
@@ -87,20 +103,38 @@ public class WindturbineGoodnessService {
                 po.setDaySpeed(day1ls.get(0).getRpjfs());
                 po.setMonthSpeed(day1ls.get(0).getYpjfs());
                 po.setYearSpeed(day1ls.get(0).getYpjfs());
+            }else
+            {
+                po.setDaySpeed(0.0);
+                po.setMonthSpeed(0.0);
+                po.setYearSpeed(0.0);
             }
+
             if(fitMap.containsKey(wt.getId()))
             {
                 Map<String, Double> map=fitMap.get(wt.getId());
                 po.setDayGoodness(map.get("day"));
                 po.setYearGoodness(map.get("month"));
                 po.setMonthGoodness(map.get("year"));
+            }else
+            {
+                po.setDayGoodness(0.0);
+                po.setYearGoodness(0.0);
+                po.setMonthGoodness(0.0);
             }
+
             if(coefficientMap.containsKey(wt.getId()))
             {
                 Map<String, Double> map=coefficientMap.get(wt.getId());
                 po.setDayCoefficient(map.get("day"));
                 po.setMonthCoefficient(map.get("month"));
                 po.setMonthCoefficient(map.get("year"));
+            }else
+            {
+
+                po.setDayCoefficient(0.0);
+                po.setMonthCoefficient(0.0);
+                po.setMonthCoefficient(0.0);
             }
 
 
@@ -178,9 +212,9 @@ public class WindturbineGoodnessService {
             ProEconWindturbineGoodness vo=vos.get(i);
             vo.setYearTop(i+1);
         }
-
-        proEconWindturbineGoodnessService.saveBatch(vos);
-
+        System.out.println("拟合优度风机存储数量"+vos.size());
+        proEconWindturbineGoodnessService.saveOrUpdateBatch(vos);
+        System.out.println("拟合优度风机存储结束");
     }
 
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2859 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WpwindDayInfoService.java


+ 104 - 30
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
+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;
@@ -40,22 +41,24 @@ public class WtAlysisDayService {
 
     private Map<String, ProEconEquipmentInfoDay1> queryEquipmentInfoDay1(Date recordDate) {
 
-
-        List<ProEconEquipmentInfoDay1> iostls= proEconEquipmentInfoDay1Service.list()
-                .stream().filter(i-> i.getRecordDate().compareTo(recordDate) == 0
-                )
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<ProEconEquipmentInfoDay1> iostls= proEconEquipmentInfoDay1Service.list(queryWrapper);
+//                .stream().filter(i-> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                )
+//                .collect(Collectors.toList());
         //List转map
         Map<String, ProEconEquipmentInfoDay1> iostmap=iostls.stream().
                 collect(Collectors.toMap(ProEconEquipmentInfoDay1::getWindturbineId, Function.identity(), (key1, key2) -> key2));
         return iostmap;
     }
     private Map<String, ProEconEquipmentInfoDay2> queryEquipmentInfoDay2(Date recordDate) {
-
-        List<ProEconEquipmentInfoDay2> iostls= proEconEquipmentInfoDay2Service.list()
-                .stream().filter(i-> i.getRecordDate().compareTo(recordDate) == 0
-                )
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<ProEconEquipmentInfoDay2> iostls= proEconEquipmentInfoDay2Service.list(queryWrapper);
+//                .stream().filter(i-> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                )
+//                .collect(Collectors.toList());
         //List转map
         Map<String, ProEconEquipmentInfoDay2> iostmap=iostls.stream().
                 collect(Collectors.toMap(ProEconEquipmentInfoDay2::getWindturbineId, Function.identity(), (key1, key2) -> key2));
@@ -63,11 +66,12 @@ public class WtAlysisDayService {
     }
     private Map<String, ProEconEquipmentInfoDay3> queryEquipmentInfoDay3(Date recordDate) {
 
-
-        List<ProEconEquipmentInfoDay3> iostls= proEconEquipmentInfoDay3Service.list()
-                .stream().filter(i-> i.getRecordDate().compareTo(recordDate) == 0
-                )
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<ProEconEquipmentInfoDay3> iostls= proEconEquipmentInfoDay3Service.list(queryWrapper);
+//                .stream().filter(i-> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                )
+//                .collect(Collectors.toList());
         //List转map
         Map<String, ProEconEquipmentInfoDay3> iostmap=iostls.stream().
                 collect(Collectors.toMap(ProEconEquipmentInfoDay3::getWindturbineId, Function.identity(), (key1, key2) -> key2));
@@ -76,11 +80,12 @@ public class WtAlysisDayService {
 
     private Map<String, ProEconEquipmentInfoDay4> queryEquipmentInfoDay4(Date recordDate) {
 
-
-        List<ProEconEquipmentInfoDay4> iostls= proEconEquipmentInfoDay4Service.list()
-                .stream().filter(i-> i.getRecordDate().compareTo(recordDate) == 0
-                )
-                .collect(Collectors.toList());
+        QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<ProEconEquipmentInfoDay4> iostls= proEconEquipmentInfoDay4Service.list(queryWrapper);
+//                .stream().filter(i-> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
+//                )
+//                .collect(Collectors.toList());
         //List转map
         Map<String, ProEconEquipmentInfoDay4> iostmap=iostls.stream().
                 collect(Collectors.toMap(ProEconEquipmentInfoDay4::getWindturbineId, Function.identity(), (key1, key2) -> key2));
@@ -97,10 +102,13 @@ public class WtAlysisDayService {
 
         Date begin= DateUtils.truncate(c.getTime());
 
-        //判断是否有重复记录,先删除重复记录
-        List<Long> idls = proEconWtAlysisDayService.list().stream()
-                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
-                        && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconWtAlysisDay::getId)
+        //判断是否有重复记录,
+        QueryWrapper<ProEconWtAlysisDay> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date",DateUtils.truncate(recordDate));
+        List<Long> idls = proEconWtAlysisDayService.list(queryWrapper).stream()
+//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate))==0
+//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
+                .map(ProEconWtAlysisDay::getId)
                 .collect(Collectors.toList());
 
         if (idls.size() > 0) {
@@ -141,6 +149,37 @@ public class WtAlysisDayService {
 
                 double ssdl=gzss+jxss+xnss+xdss+slss;
                 pewp.setRssdl(StringUtils.round(ssdl,2));
+
+                pewp.setYfdl(dayinfo.getYfdl());
+                pewp.setYpjfs(dayinfo.getYpjfs());
+                pewp.setYpjgl(dayinfo.getYpjgl());
+                pewp.setYyfdl(dayinfo.getYllfdl());
+
+
+                gzss=dayinfo.getYgzssdl();
+                jxss=dayinfo.getYjxssdl();
+                xnss=dayinfo.getYxnssdl();
+                xdss=dayinfo.getYxdtjssdl()+dayinfo.getYxdjclssdl();
+                slss=dayinfo.getYcwsltqssdl()+dayinfo.getYcwsldwssdl();
+
+                ssdl=gzss+jxss+xnss+xdss+slss;
+                pewp.setYssdl(StringUtils.round(ssdl,2));
+
+                pewp.setNfdl(dayinfo.getNfdl());
+                pewp.setNpjfs(dayinfo.getNpjfs());
+                pewp.setNpjgl(dayinfo.getNpjgl());
+                pewp.setNyfdl(dayinfo.getNllfdl());
+
+
+                gzss=dayinfo.getNgzssdl();
+                jxss=dayinfo.getNjxssdl();
+                xnss=dayinfo.getNxnssdl();
+                xdss=dayinfo.getNxdtjssdl()+dayinfo.getNxdjclssdl();
+                slss=dayinfo.getNcwsltqssdl()+dayinfo.getNcwsldwssdl();
+
+                ssdl=gzss+jxss+xnss+xdss+slss;
+                pewp.setNssdl(StringUtils.round(ssdl,2));
+
             }
 
 
@@ -156,12 +195,36 @@ public class WtAlysisDayService {
                 int dayTimes=24;
                 double sbklyl =  new BigDecimal(dayTimes-dayinfo.getRgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
                 pewp.setRsbklyl(StringUtils.round(sbklyl, 2));
+
+                pewp.setYyxxs(dayinfo.getYyxxs());
+                pewp.setYgzxs(dayinfo.getYgztjxs());
+                pewp.setYjxxs(dayinfo.getYjxtjxs());
+                pewp.setYzdxs(dayinfo.getYxdxs());
+                pewp.setYzdxs(dayinfo.getYtxzdxs());
+                c.setTime(recordDate);
+                int days=c.get(Calendar.DAY_OF_MONTH);
+                dayTimes=24*days;
+                sbklyl =  new BigDecimal(dayTimes-dayinfo.getYgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+                pewp.setYsbklyl(StringUtils.round(sbklyl, 2));
+
+                pewp.setNyxxs(dayinfo.getNyxxs());
+                pewp.setNgzxs(dayinfo.getNgztjxs());
+                pewp.setNjxxs(dayinfo.getNjxtjxs());
+                pewp.setNzdxs(dayinfo.getNxdxs());
+                pewp.setNzdxs(dayinfo.getNtxzdxs());
+
+                days=c.get(Calendar.DAY_OF_YEAR);
+                dayTimes=24*days;
+                sbklyl =  new BigDecimal(dayTimes-dayinfo.getNgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+                pewp.setNsbklyl(StringUtils.round(sbklyl, 2));
             }
 
             if(eqday3map.containsKey(wt.getId()))
             {
                 ProEconEquipmentInfoDay3 dayinfo= eqday3map.get(wt.getId());
                 pewp.setRtjcs(dayinfo.getRgztjcs()+dayinfo.getRjxtjcs());
+                pewp.setYtjcs(dayinfo.getYgztjcs()+dayinfo.getYjxtjcs());
+                pewp.setNtjcs(dayinfo.getNgztjcs()+dayinfo.getNjxtjcs());
 
             }
 
@@ -172,6 +235,14 @@ public class WtAlysisDayService {
                 pewp.setRsjbz(dayinfo.getRqxpcbbzsj());
                 pewp.setRyxfs(dayinfo.getRyxfss());
 
+                pewp.setYnhyd(dayinfo.getYnhyd());
+                pewp.setYsjbz(dayinfo.getYqxpcbbzsj());
+                pewp.setYyxfs(dayinfo.getYyxfss());
+
+                pewp.setNnhyd(dayinfo.getNnhyd());
+                pewp.setNsjbz(dayinfo.getNqxpcbbzsj());
+                pewp.setNyxfs(dayinfo.getNyxfss());
+
             }
             //昨日的统计结果
             List<ProEconWtAlysisDay> pepidls =new ArrayList<>();
@@ -180,11 +251,14 @@ public class WtAlysisDayService {
             cl.add(Calendar.DAY_OF_MONTH,-1);
             if(cl.get(Calendar.DAY_OF_MONTH)!=1)
             {
-                pepidls = proEconWtAlysisDayService.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        )
-                        .collect(Collectors.toList());
+                QueryWrapper<ProEconWtAlysisDay> queryWrapper2 = new QueryWrapper<>();
+               queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windTurbine_Id",wt.getId());
+               pepidls = proEconWtAlysisDayService.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getWindturbineId().equals(wt.getId())
+//                        )
+//                        .collect(Collectors.toList());
             }
             calSimple(pewp, end, begin, wt, pepidls);
             dayls.add(pewp);
@@ -253,7 +327,7 @@ public class WtAlysisDayService {
         //*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
-            pewp.setYbbhcs(pewp.getRbbhcs());
+            pewp.setNbbhcs(pewp.getRbbhcs());
 
         }else
         {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2905 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java


+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicMaintransformerService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProBasicMaintransformer;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 主变表 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-01-30
+ */
+public interface IProBasicMaintransformerService extends IService<ProBasicMaintransformer> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicWeatherStationService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProBasicWeatherStation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 气象站名称 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-29
+ */
+public interface IProBasicWeatherStationService extends IService<ProBasicWeatherStation> {
+
+}

+ 2 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittMonthMainService.java

@@ -13,5 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IProEconCurveFittMonthMainService extends IService<ProEconCurveFittMonthMain> {
 
-    public int deleteProEconCurveFittMonthMainByMonth(String year, String month);
+    public int deleteProEconCurveFittMonthMainFByMonth(String year, String month);
+    public int deleteProEconCurveFittMonthMainGByMonth(String year, String month);
 }

+ 2 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittMonthSubService.java

@@ -13,5 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IProEconCurveFittMonthSubService extends IService<ProEconCurveFittMonthSub> {
 
-    public int deleteProEconCurveFittMonthSubByMonth(String year, String month);
+    public int deleteProEconCurveFittMonthSubFByMonth(String year, String month);
+    public int deleteProEconCurveFittMonthSubGByMonth(String year, String month);
 }

+ 0 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconCurveFittYearMainService.java


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio