浏览代码

调整计算

xieshengjie 2 年之前
父节点
当前提交
44cd24a918

+ 19 - 17
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationService.java

@@ -3939,29 +3939,31 @@ public class CycleCalculationService {
     private double generalLoss(List<PointData> ztmxDatasSnap,  List<PointData> zsglDatasSnap, List<PointData> powerDatasSnap,double statusValue) {
         List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
         Double zsss = 0.0;
-        if (statusValue == 2.0 || statusValue == 3.0 || statusValue == 8.0){
-            for(int i= 0;i<ztmxDatasSnap.size();i++){
-                for (int j=0;j<pointDataList.size();j++){
-                    if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
-                        double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
-                        double power = powerDatasSnap.get(i).getPointValueInDouble();
-
-                        double temp1 = zsgl - power;
-                        zsss+=temp1;
+        if (ztmxDatasSnap.size()==zsglDatasSnap.size() && zsglDatasSnap.size()==powerDatasSnap.size()){
+            if (statusValue == 2.0 || statusValue == 3.0 || statusValue == 8.0){
+                for(int i= 0;i<ztmxDatasSnap.size();i++){
+                    for (int j=0;j<pointDataList.size();j++){
+                        if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
+                            double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
+                            double power = powerDatasSnap.get(i).getPointValueInDouble();
+
+                            double temp1 = zsgl - power;
+                            zsss+=temp1;
+                        }
                     }
                 }
-            }
-        }else {
-            for(int i= 0;i<ztmxDatasSnap.size();i++){
-                for (int j=0;j<pointDataList.size();j++){
-                    if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
-                        double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
-                        zsss+=zsgl;
+            }else {
+                for(int i= 0;i<ztmxDatasSnap.size();i++){
+                    for (int j=0;j<pointDataList.size();j++){
+                        if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
+                            double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
+                            zsss+=zsgl;
+                        }
                     }
                 }
             }
+            zsss = zsss/pointDataList.size()>=0?zsss/pointDataList.size():0;
         }
-        zsss = zsss/pointDataList.size()>=0?zsss/pointDataList.size():0;
 
         return zsss;
     }