Browse Source

矩阵代码调整

王波 1 week ago
parent
commit
09986f4dbc

+ 33 - 50
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixHAService.java

@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
 public class MatrixHAService {
     @Resource
     private IEdosUtil edosUtil;
+
     public Map<String, Object> matrixMX(String company, String type) throws Exception {
 
         List<ProBasicPowerstation> wpls = CacheContext.wpls;
@@ -31,19 +32,11 @@ public class MatrixHAService {
         Map<String, Double> modelpower = CacheContext.modelpower;
 
         AiPoints[] aiPoints = CacheContext.agcDeviateConfigMap.get("NX_FGS_HA_FDC_STA").getAiPoints();
-        List<AiPoints> apcollect = Arrays.stream(aiPoints).filter(ap -> ap.getName().equals("实发有功") || ap.getName().equals("理论功率") || ap.getName().equals("平均风速")).collect(Collectors.toList());
+        List<AiPoints> apcollect = Arrays.stream(aiPoints).filter(ap -> ap.getName().equals("实发有功")
+                || ap.getName().equals("理论功率") || ap.getName().equals("平均风速")).collect(Collectors.toList());
 
 //        long timemills = System.currentTimeMillis() - 30_000L;
 
-        if (company.endsWith("ZGS")) {
-            wpls = wpls.stream().filter(wp -> wp.getCompanyId().equals(company)).collect(Collectors.toList());
-        }
-        if (type.equals("-1")) {
-            wpls = wpls.stream().filter(wp -> wp.getWindType().equals("-1")).collect(Collectors.toList());
-        } else if (type.equals("-2")) {
-            wpls = wpls.stream().filter(wp -> wp.getWindType().equals("-2")).collect(Collectors.toList());
-        }
-
         Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = CacheContext.wppointmap;
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
         Map<String, List<ProBasicEquipment>> wpwtmap = CacheContext.wpwtmap;
@@ -81,7 +74,7 @@ public class MatrixHAService {
                 Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
                 wtPoints1.add(equipmentPointMap.get(ContantXk.CJ_SSGL).getNemCode());
                 if (wt.getEquipmentCategory() == -1) {
-                    wtPoints1.add(equipmentPointMap.get(ContantXk.CJ_SSFS).getNemCode());
+                    wtPoints1.add(equipmentPointMap.get(ContantXk.CJ_SSFS).getNemCode());//获取实时风速及转速
                     wtPoints1.add(equipmentPointMap.get(ContantXk.CJ_SSZS).getNemCode());
                 } else if (wt.getEquipmentCategory() == -2) {
                     wtPoints1.add(equipmentPointMap.get(ContantXk.JLDL).getNemCode());
@@ -90,7 +83,7 @@ public class MatrixHAService {
 
             });
             try {
-                List<PointData> wtRealdatas = edosUtil.getRealData(wtPoints);
+                List<PointData> wtRealdatas = edosUtil.getRealData(wtPoints);//一期状态
                 List<PointData> wpRealdatas = edosUtil.getRealData(wpPoints);//总有功-总理论功率
 //                PointData station_zyggl = edosUtil.getSectionData(pointMap.get(ContantXk.SSZYGGL), timemills);
                 PointData station_zyggl = edosUtil.getRealData(apcollect.get(0).getTag());
@@ -101,28 +94,18 @@ public class MatrixHAService {
                 powerVo.setWpid(wp.getId());
                 powerVo.setWpname(wp.getAname());
                 powerVo.setOrderNum(wp.getOrderNum());
-                if (wp.getWindType().equals("-1")) {
-                    powerVo.setCzlx("-1");
-                } else if (wp.getWindType().equals("-2")) {
-                    powerVo.setCzlx("-2");
-                }
+                powerVo.setCzlx("-1");
                 powerVo.setJrts(wp.getJrwindQuantityHs() + wp.getJrwindQuantityLd() + wp.getJrquantityJz() + wp.getJrquantityZc());
 
-
-                if (wp.getWindType().equals("-1")) {
-//                    PointData station_speed = edosUtil.getSectionData(pointMap.get(ContantXk.SSZPJFS),timemills);
-                    PointData station_speed = edosUtil.getRealData(apcollect.get(2).getTag());
-                    powerVo.setSpped(StringUtils.round(station_speed.getPointValueInDouble(), 2));
-                } else if (wp.getWindType().equals("-2")) {
-                    PointData speed = edosUtil.getRealData(pointMap.get(ContantXk.GCGZQD).getNemCode());
-                    powerVo.setSpped(StringUtils.round(speed.getPointValueInDouble(), 2));
-                }
+//              PointData station_speed = edosUtil.getSectionData(pointMap.get(ContantXk.SSZPJFS),timemills);
+                PointData station_speed = edosUtil.getRealData(apcollect.get(2).getTag());
+                powerVo.setSpped(StringUtils.round(station_speed.getPointValueInDouble(), 2));
 
 //                powerVo.setLlgl(StringUtils.round(wpRealdatas.get(1).getPointValueInDouble() /1000,2));//兆瓦
-                powerVo.setLlgl(StringUtils.round(station_zllgl.getPointValueInDouble() /1000,2));//兆瓦
-                powerVo.setSjgl(StringUtils.round(station_zyggl.getPointValueInDouble(),2));//兆瓦
-                if(powerVo.getLlgl()<=powerVo.getSjgl()){
-                    powerVo.setLlgl(StringUtils.round(powerVo.getSjgl() * 1.02,2));
+                powerVo.setLlgl(StringUtils.round(station_zllgl.getPointValueInDouble() / 1000, 2));//兆瓦
+                powerVo.setSjgl(StringUtils.round(station_zyggl.getPointValueInDouble(), 2));//兆瓦
+                if (powerVo.getLlgl() <= powerVo.getSjgl()) {
+                    powerVo.setLlgl(StringUtils.round(powerVo.getSjgl() * 1.02, 2));
                 }
 
 
@@ -138,7 +121,7 @@ public class MatrixHAService {
                     if (equipments.get(j).getProjectId().equals("NX_FGS_HAF01_EG")) {
                         vo.setStatus(wtRealdatas.get(j).getPointValueInDouble());
                     }
-                        vo.setPower(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index).getPointValueInDouble(), 2));
+                    vo.setPower(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index).getPointValueInDouble(), 2));
                     if (equipments.get(j).getEquipmentCategory() == -1) {
                         vo.setSpeed(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index + 1).getPointValueInDouble(), 2));
                         vo.setTransfer(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index + 2).getPointValueInDouble(), 2));
@@ -150,8 +133,8 @@ public class MatrixHAService {
                     vo.setProject(equipments.get(j).getProjectId());
                     volist.add(vo);
                 }
-                for (MatrixVo ztvo: volist){
-                    if (ztvo.getProject().equals("NX_FGS_HAF02_EG")){
+                for (MatrixVo ztvo : volist) {
+                    if (ztvo.getProject().equals("NX_FGS_HAF02_EG")) {
                         List<String> fjztstream = fjztPoints.stream().filter(c -> c.contains(ztvo.getWtname())).collect(Collectors.toList());
                         List<PointData> ztls = edosUtil.getRealData(fjztstream);
                         List<String> zktjstream = zktjPoints.stream().filter(c -> c.contains(ztvo.getWtname())).collect(Collectors.toList());
@@ -172,24 +155,24 @@ public class MatrixHAService {
                         //二期集控状态 0==离线(通讯中断) 1==故障(故障停机) 2==检修(停机维护) 3==待机(待机状态) 4==启动 5==并网(正常运行)
                         //           限功运行==true 解缆==true 中控停机==true
 
-                         if (ztls.get(0).getPointValueInDouble() == 0.0) {
-                            ztvo.setStatus(-1.0);
+                        if (ztls.get(0).getPointValueInDouble() == 0.0) {
+                            ztvo.setStatus(-1.0);//通讯中断
                         } else if (ztls.get(0).getPointValueInDouble() == 1.0) {
-                            ztvo.setStatus(3.0);
+                            ztvo.setStatus(3.0);//故障停机
                         } else if (ztls.get(0).getPointValueInDouble() == 2.0) {
-                            ztvo.setStatus(7.0);
+                            ztvo.setStatus(7.0);//停机维护
                         } else if (ztls.get(0).getPointValueInDouble() == 3.0) {
-                            ztvo.setStatus(2.0);
+                            ztvo.setStatus(2.0);//待机状态
                         } else if (ztls.get(0).getPointValueInDouble() == 4.0) {
                             ztvo.setStatus(10.0);//启动
                         } else if (ztls.get(0).getPointValueInDouble() == 5.0) {
-                            ztvo.setStatus(0.0);
-                        } else if (xglls.get(0).getPointValue().equals("true")){
-                            ztvo.setStatus(1.0);
+                            ztvo.setStatus(0.0);//正常运行
+                        } else if (xglls.get(0).getPointValue().equals("true")) {
+                            ztvo.setStatus(1.0);//限功运行
                         } else if (jlls.get(0).getPointValue().equals("true")) {
                             ztvo.setStatus(11.0);//解缆
                         } else if (zktjls.get(0).getPointValue().equals("true")) {
-                            ztvo.setStatus(-1.0);
+                            ztvo.setStatus(-1.0);//通讯中断
                         }
 
 
@@ -210,20 +193,20 @@ public class MatrixHAService {
                 Double jhtjts = 0.0;
                 Double qdztts = 0.0;
                 Double jlztts = 0.0;
-                for (MatrixVo zt : volist){
-                    if (zt.getStatus() == 0.0){
+                for (MatrixVo zt : volist) {
+                    if (zt.getStatus() == 0.0) {
                         zcyxts++;
-                    } else if (zt.getStatus() == 1.0){
+                    } else if (zt.getStatus() == 1.0) {
                         xgyxts++;
-                    } else if (zt.getStatus() == 2.0){
+                    } else if (zt.getStatus() == 2.0) {
                         djztts++;
-                    } else if (zt.getStatus() == 3.0){
+                    } else if (zt.getStatus() == 3.0) {
                         gztjts++;
-                    } else if (zt.getStatus() == 4.0){
+                    } else if (zt.getStatus() == 4.0) {
                         dwgzts++;
-                    } else if (zt.getStatus() == 5.0){
+                    } else if (zt.getStatus() == 5.0) {
                         zctjts++;
-                    } else if (zt.getStatus() == 6.0){
+                    } else if (zt.getStatus() == 6.0) {
                         tqtjts++;
                     } else if (zt.getStatus() == 7.0) {
                         tjwhts++;