Bläddra i källkod

处理矩阵状态

王波 3 dagar sedan
förälder
incheckning
2244fec6fe

+ 4 - 1
common/src/main/java/com/gyee/common/contant/ContantXk.java

@@ -13,8 +13,10 @@ public class ContantXk {
     public static final String GLYCJRZT = "GLYCJRZT";//场站功率预测接入状态
     public static final String QXZJRZT = "QXZJRZT";//场站测风塔接入状态
     public static final String SSPJFS = "SSPJFS";//场站实时平均风速
+    public static final String SSZPJFS = "SSZPJFS";//场站实时总平均风速
     public static final String SSPJGZD = "SSPJGZD";
     public static final String SSZGL = "SSZGL";//场站实时总功率
+    public static final String SSZYGGL = "SSZYGGL";//场站实时总有功功率
     public static final String SSZGLSYZ = "SSZGLSYZ";//场站实时总功率 升压站
     public static final String SSZLLGL = "SSZLLGL";//场站实时总理论功率
     public static final String SSZBZGL = "SSZBZGL";//场站实时总保证功率
@@ -155,6 +157,7 @@ public class ContantXk {
 
     public static final String SBZT = "SBZT";//设备状态
     public static final String MXZT = "MXZT";//设备明细状态
+    public static final String JKZT = "JKZT";//设备智深状态
     public static final String ZTCXSJ = "ZTCXSJ";//设备当前状态下持续时间
     public static final String SSBF = "SSBF";//设备实时补风风速
     public static final String SSBG = "SSBG";//设备实时补光
@@ -365,7 +368,7 @@ public class ContantXk {
 
 
     //二期风机状态配置
-    public static final String JLGZ = "DI0948"; //无风解缆故障
+    public static final String JLZT = "DI0948"; //无风解缆故障
     public static final String XGLYX = "DI1280"; //限功率运行
     public static final String ZGTJ = "DI0896"; //中控停机
     public static final String FJZT = "DI1485"; //风机状态

+ 38 - 0
common/src/main/java/com/gyee/common/vo/monitor/MatrixHAPowerVo.java

@@ -0,0 +1,38 @@
+package com.gyee.common.vo.monitor;/*
+@author   谢生杰
+@date   2023/3/28-9:22
+*/
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MatrixHAPowerVo {
+    private String wpid;
+    private String wpname;
+    private Integer orderNum;
+    private Integer jrts;
+    private Double txzdts;
+    private Double zcyxts;
+    private Double xgyxts;
+    private Double djztts;
+    private Double gztjts;
+    private Double dwgzts;
+    private Double zctjts;
+    private Double tqtjts;
+    private Double tjwhts;
+    private Double xgtjts;
+    private Double jhtjts;
+    private Double qdztts;
+    private Double jlztts;
+    private Double spped;
+//    private Double ycgl;
+//    private Double bzgl;
+    private Double llgl;
+    private Double sjgl;
+//    private Double agc;
+//    private Double cxgl;
+//    private String czlx;
+    private List<MatrixVo> wtlist;
+}

+ 20 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/MatrixController.java

@@ -15,6 +15,7 @@ import com.gyee.runeconomy.model.auto.ProEconAlarmType;
 import com.gyee.runeconomy.model.vo.PoliceVo;
 import com.gyee.runeconomy.service.auto.IProEconAlarmTypeService;
 import com.gyee.runeconomy.service.monitor.AlarmService;
+import com.gyee.runeconomy.service.monitor.MatrixHAService;
 import com.gyee.runeconomy.service.monitor.MatrixService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -41,6 +42,8 @@ public class MatrixController {
 
     @Resource
     private AlarmService alarmService;
+    @Resource
+    private MatrixHAService matrixHAService;
     /**
      * 基础矩阵
      *
@@ -79,7 +82,24 @@ public class MatrixController {
             return JsonResult.error();
         }
     }
+    /**
+     * 惠安明细矩阵
+     *
+     * @return
+     */
+    @GetMapping("/HAdetailed")
+    @ResponseBody
+    @ApiOperation(value = "明细矩阵", notes = "明细矩阵")
+    public JSONObject HAdetailed(@RequestParam(value = "type", required = true) String type,
+                               @RequestParam(value = "company", required = true) String company) throws Exception {
 
+        Map<String, Object> resultMap = matrixHAService.matrixMX(company, type);
+        if (StringUtils.isNotNull(resultMap)) {
+            return JsonResult.successData(ResultCode.SUCCESS, resultMap);
+        } else {
+            return JsonResult.error();
+        }
+    }
     /**
      * 明细矩阵弹窗-报警分类
      *

+ 256 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixHAService.java

@@ -0,0 +1,256 @@
+package com.gyee.runeconomy.service.monitor;
+/*
+@author   谢生杰
+@date   2023/3/28-8:49
+*/
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.util.DoubleUtils;
+import com.gyee.common.util.SortUtils;
+import com.gyee.common.vo.monitor.*;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.*;
+import com.gyee.runeconomy.service.auto.IProBasicPowerPointService;
+import com.gyee.runeconomy.util.StringUtils;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+@Service
+public class MatrixHAService {
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private IProBasicPowerPointService powerPointService;
+
+    public Map<String, Object> matrixMX(String company, String type) throws Exception {
+
+        List<ProBasicPowerstation> wpls = CacheContext.wpls;
+
+        Map<String, Double> modelpower = CacheContext.modelpower;
+
+        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;
+
+        List<MatrixHAPowerVo> powerVos = new ArrayList<>();
+        AtomicInteger jrts = new AtomicInteger();//接入台数
+
+        wpls.parallelStream().forEach(wp -> {
+            List<MatrixVo> volist = new ArrayList<>();
+            List<String> wpPoints = new ArrayList<>();
+            List<String> wtPoints = new ArrayList<>();
+            List<String> fjztPoints = new ArrayList<>();//二期风机状态
+            List<String> zktjPoints = new ArrayList<>();//中控停机
+            List<String> xglyxPoints = new ArrayList<>();//限功率运行
+            List<String> jlztPoints = new ArrayList<>();//解缆状态
+            List<String> wtPoints1 = new ArrayList<>();
+            Map<String, ProBasicPowerstationPoint> pointMap = wppointmap.get(wp.getId());
+            wpPoints.add(pointMap.get(ContantXk.SSZYGGL).getNemCode());
+            wpPoints.add(pointMap.get(ContantXk.SSZLLGL).getNemCode());
+
+
+            List<ProBasicEquipment> equipments = wpwtmap.get(wp.getId());
+            equipments.stream().forEach(wt -> {
+                Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
+                if (wt.getProjectId().equals("NX_FGS_HAF01_EG")) {
+                    wtPoints.add(equipmentPointMap.get(ContantXk.JKZT).getNemCode());//一期状态
+                } else {
+                    fjztPoints.add(equipmentPointMap.get(ContantXk.FJZT).getNemCode());//二期状态
+                    jlztPoints.add(equipmentPointMap.get(ContantXk.JLZT).getNemCode());//解缆状态
+                    xglyxPoints.add(equipmentPointMap.get(ContantXk.XGLYX).getNemCode());//限功率运行
+                    zktjPoints.add(equipmentPointMap.get(ContantXk.ZGTJ).getNemCode());//中控停机
+                }
+            });
+            equipments.stream().forEach(wt -> {
+                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_SSZS).getNemCode());
+                } else if (wt.getEquipmentCategory() == -2) {
+                    wtPoints1.add(equipmentPointMap.get(ContantXk.JLDL).getNemCode());
+                    wtPoints1.add(equipmentPointMap.get(ContantXk.JLDY).getNemCode());
+                }
+
+            });
+            try {
+                List<PointData> wtRealdatas = edosUtil.getRealData(wtPoints);
+                List<PointData> wpRealdatas = edosUtil.getRealData(wpPoints);
+                List<PointData> wtRealdatas1 = edosUtil.getRealData(wtPoints1);
+
+                MatrixHAPowerVo powerVo = new MatrixHAPowerVo();
+                powerVo.setWpid(wp.getId());
+                powerVo.setWpname(wp.getAname());
+                powerVo.setOrderNum(wp.getOrderNum());
+                powerVo.setJrts(wp.getJrwindQuantityHs() + wp.getJrwindQuantityLd() + wp.getJrquantityJz() + wp.getJrquantityZc());
+
+
+                if (wp.getWindType().equals("-1")) {
+                    PointData speed = edosUtil.getRealData(pointMap.get(ContantXk.SSZPJFS).getNemCode());
+                    powerVo.setSpped(StringUtils.round(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));
+                }
+
+                powerVo.setLlgl(StringUtils.round(wpRealdatas.get(1).getPointValueInDouble(),2));//千瓦
+                powerVo.setSjgl(StringUtils.round(wpRealdatas.get(0).getPointValueInDouble() * 1000,2));//千瓦
+
+
+                jrts.addAndGet(powerVo.getJrts());
+
+                int index = 3;
+                for (int j = 0; j < equipments.size(); j++) {
+
+                    MatrixVo vo = new MatrixVo();
+                    vo.setWtid(equipments.get(j).getId());
+                    vo.setWtname(equipments.get(j).getAname());
+
+                    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));
+                    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));
+                    } else if (equipments.get(j).getEquipmentCategory() == -2) {
+                        vo.setCurrent(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index + 1).getPointValueInDouble(), 2));
+                        vo.setVoltage(DoubleUtils.keepPrecision(wtRealdatas1.get(j * index + 2).getPointValueInDouble(), 2));
+                    }
+                    vo.setRate(DoubleUtils.keepPrecision(modelpower.containsKey(equipments.get(j).getId()) ? vo.getPower() / modelpower.get(equipments.get(j).getId()) * 100 : 0, 2));
+                    vo.setProject(equipments.get(j).getProjectId());
+                    volist.add(vo);
+                }
+                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());
+                        List<PointData> zktjls = edosUtil.getRealData(zktjstream);
+                        List<String> jlztstream = jlztPoints.stream().filter(c -> c.contains(ztvo.getWtname())).collect(Collectors.toList());
+                        List<PointData> jlls = edosUtil.getRealData(jlztstream);
+                        List<String> xglyxstream = xglyxPoints.stream().filter(c -> c.contains(ztvo.getWtname())).collect(Collectors.toList());
+                        List<PointData> xglls = edosUtil.getRealData(xglyxstream);
+
+                        //计算状态 0==待机 1==停机 2==发电 4==故障 6==检修  8==限电  12==离线
+
+                        //集控总状态 -1==通讯中断 0==正常运行 1==限功运行 2==待机状态  3==故障停机 4==电网故障 5==正常停机 6==天气停机 7==停机维护
+                        //          8==限功停机 9==计划停机 10==启动  11==解缆状态
+
+                        //一期集控状态 -1==离线 0==正常发电 1==限功发电 2==风机待命 3==故障停机 4==电网故障 5==正常停机 6==天气停机
+                        //            7==服务 8==限功停机 9==计划停机
+
+                        //二期集控状态 0==离线(通讯中断) 1==故障(故障停机) 2==检修(停机维护) 3==待机(待机状态) 4==启动 5==并网(正常运行)
+                        //           限功运行==true 解缆==true 中控停机==true
+
+                        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(7.0);
+                        } else if (ztls.get(0).getPointValueInDouble() == 0.0) {
+                            ztvo.setStatus(-1.0);
+                        } else if (ztls.get(0).getPointValueInDouble() == 1.0) {
+                            ztvo.setStatus(3.0);
+                        } else if (ztls.get(0).getPointValueInDouble() == 2.0) {
+                            ztvo.setStatus(7.0);
+                        } else if (ztls.get(0).getPointValueInDouble() == 3.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);
+                        }
+
+
+                    }
+                }
+                //集控总状态 -1==通讯中断 0==正常运行 1==限功运行 2==待机状态  3==故障停机 4==电网故障 5==正常停机 6==天气停机 7==停机维护
+                //          8==限功停机 9==计划停机 10==启动  11==解缆状态
+                Double txzdts = 0.0;
+                Double zcyxts = 0.0;
+                Double xgyxts = 0.0;
+                Double djztts = 0.0;
+                Double gztjts = 0.0;
+                Double dwgzts = 0.0;
+                Double zctjts = 0.0;
+                Double tqtjts = 0.0;
+                Double tjwhts = 0.0;
+                Double xgtjts = 0.0;
+                Double jhtjts = 0.0;
+                Double qdztts = 0.0;
+                Double jlztts = 0.0;
+                for (MatrixVo zt : volist){
+                    if (zt.getStatus() == 0.0){
+                        zcyxts++;
+                    } else if (zt.getStatus() == 1.0){
+                        xgyxts++;
+                    } else if (zt.getStatus() == 2.0){
+                        djztts++;
+                    } else if (zt.getStatus() == 3.0){
+                        gztjts++;
+                    } else if (zt.getStatus() == 4.0){
+                        dwgzts++;
+                    } else if (zt.getStatus() == 5.0){
+                        zctjts++;
+                    } else if (zt.getStatus() == 6.0){
+                        tqtjts++;
+                    } else if (zt.getStatus() == 7.0) {
+                        tjwhts++;
+                    } else if (zt.getStatus() == 8.0) {
+                        xgtjts++;
+                    } else if (zt.getStatus() == 9.0) {
+                        jhtjts++;
+                    } else if (zt.getStatus() == 10.0) {
+                        qdztts++;
+                    } else if (zt.getStatus() == 11.0) {
+                        jlztts++;
+                    } else if (zt.getStatus() == -1.0) {
+                        txzdts++;
+                    }
+                }
+                powerVo.setZcyxts(zcyxts);
+                powerVo.setXgyxts(xgyxts);
+                powerVo.setDjztts(djztts);
+                powerVo.setGztjts(gztjts);
+                powerVo.setDwgzts(dwgzts);
+                powerVo.setZctjts(zctjts);
+                powerVo.setTqtjts(tqtjts);
+                powerVo.setTjwhts(tjwhts);
+                powerVo.setXgtjts(xgtjts);
+                powerVo.setJhtjts(jhtjts);
+                powerVo.setQdztts(qdztts);
+                powerVo.setJlztts(jlztts);
+                powerVo.setTxzdts(txzdts);
+                powerVo.setWtlist(volist);
+                powerVos.add(powerVo);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+
+        });
+        SortUtils.sort(powerVos, "orderNum", SortUtils.ASC);
+        Map<String, Object> dataMap = new HashMap<>();
+        dataMap.put("jrts", jrts.doubleValue());
+        dataMap.put("powerVos", powerVos);
+        return dataMap;
+    }
+
+}

+ 9 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixService.java

@@ -133,7 +133,7 @@ public class MatrixService {
 
                 if (wt.getProjectId().equals("NX_FGS_HAF02_EG")) {
                     fjztPoints.add(equipmentPointMap.get(ContantXk.FJZT).getNemCode());
-                    jlgzPoints.add(equipmentPointMap.get(ContantXk.JLGZ).getNemCode());
+                    jlgzPoints.add(equipmentPointMap.get(ContantXk.JLZT).getNemCode());
                     xglyxPoints.add(equipmentPointMap.get(ContantXk.XGLYX).getNemCode());
                     zktjPoints.add(equipmentPointMap.get(ContantXk.ZGTJ).getNemCode());
                 }
@@ -341,7 +341,14 @@ public class MatrixService {
 
                         //计算状态 0==待机 1==停机 2==发电 4==故障 6==检修  8==限电  12==离线
 
-                        //集控状态 0==离线 1==故障 2==检修 3==待机 4==启动 5==并网
+                        //集控总状态 -1==通讯中断 0==正常运行 1==限功运行 2==待机状态  3==故障停机 4==电网故障 5==正常停机 6==天气停机 7==停机维护
+                        //          8==限功停机 9==计划停机 10==启动  11==解缆状态
+
+                        //一期集控状态 -1==离线 0==正常发电 1==限功发电 2==风机待命 3==故障停机 4==电网故障 5==正常停机 6==天气停机
+                        //            7==服务 8==限功停机 9==计划停机
+
+                        //二期集控状态 0==离线(通讯中断) 1==故障(故障停机) 2==检修(停机维护) 3==待机(待机状态) 4==启动 5==并网(正常运行)
+                        //           限功运行==true 解缆==true 中控停机==true
 
                         if (xglls.get(0).getPointValue().equals("true")){
                             ztvo.setStatus(8.0);