浏览代码

新增公司计算指标,并将空点置零

xieshengjie 3 年之前
父节点
当前提交
f384b8c907
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      web/monitor-web/src/main/java/com/gyee/monitor/service/matrix/MatrixService.java

+ 12 - 1
web/monitor-web/src/main/java/com/gyee/monitor/service/matrix/MatrixService.java

@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : MatrixService
@@ -37,6 +38,9 @@ public class MatrixService {
         Map<String, Map<String, Windturbinetestingpointnew>> wtPointmap = CacheContext.wtPointmap;
 
         List<Windpowerstation> wpls = CacheContext.wpls;
+        Windpowerstation windpowerstation = new Windpowerstation();
+        windpowerstation.setId("0");
+        wpls.add(windpowerstation);
         wpls.parallelStream().forEach(wp-> {
             List<String> pointList = new ArrayList<>();
             Map<String,String> pointMap = new HashMap<>();
@@ -46,14 +50,21 @@ public class MatrixService {
                 Windpowerstationpointnew windpowerstationtestingpoint = stringWindpowerstationtestingpointMap.get(uniformcode);
                 if (!windpowerstationtestingpoint.getCode().trim().equals("INITIAL")){
                     pointList.add(windpowerstationtestingpoint.getCode());
-                    pointMap.put(windpowerstationtestingpoint.getCode(),wp.getId()+"_"+uniformcode);
                 }
+                pointMap.put(windpowerstationtestingpoint.getCode(),wp.getId()+"_"+uniformcode);
             });
             try {
                 List<PointData> realData = edosUtil.getRealData(pointList);
                 realData.parallelStream().forEach(i -> {
                     wpMap.put(pointMap.get(i.getEdnaId()), i.getPointValueInDouble());
                 });
+                List<String> pointids = realData.stream().map(i -> i.getEdnaId()).collect(Collectors.toList());
+                Set<String> totalpointids = pointMap.keySet();
+                Collection notexists=new ArrayList<String>(totalpointids);
+                notexists.removeAll(pointids);
+                notexists.stream().forEach(n->{
+                    wpMap.put(pointMap.get(n),0.0);
+                });
             } catch (Exception e) {
                 e.printStackTrace();
             }