Browse Source

修改风机监视和逆变器监视界面动态配置接口

shilin 2 years ago
parent
commit
08dd81f527

+ 8 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/common/spring/Constant.java

@@ -279,6 +279,14 @@ public static final String[] TPOINT_WP_AGC = { "AGC001", "AGC002",
 	public static final String NXDZSDL = "NXDZSDL";
 	public static final String NWZZSDL = "NWZZSDL";
 	public static final String NTZZSDL = "NTZZSDL";
+
+
+
+    public static final String GZSSDL ="GZSSDL";
+    public static final String WHSSDL ="WHSSDL";
+    public static final String XDSSDL ="XDSSDL";
+    public static final String XNSSDL ="XNSSDL";
+    public static final String SLSSDL ="SLSSDL";
 	/********************************* end ***********************************/
 
 	public static final String[] TPOINT_WP_CFT = { "FCCFTFS10", "FCCFTFS30",

+ 25 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/MatrixPjVo.java

@@ -0,0 +1,25 @@
+package com.gyee.frame.model.custom;
+
+import java.util.List;
+
+public class MatrixPjVo {
+
+	private String name;
+	private List<SquareVo> squareVos;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<SquareVo> getSquareVos() {
+        return squareVos;
+    }
+
+    public void setSquareVos(List<SquareVo> squareVos) {
+        this.squareVos = squareVos;
+    }
+}

+ 25 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/SquareVo.java

@@ -0,0 +1,25 @@
+package com.gyee.frame.model.custom;
+
+import java.util.List;
+
+public class SquareVo {
+
+    private String name;
+    private List<InverterVo> inverterVos;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<InverterVo> getInverterVos() {
+        return inverterVos;
+    }
+
+    public void setInverterVos(List<InverterVo> inverterVos) {
+        this.inverterVos = inverterVos;
+    }
+}

+ 50 - 14
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/MatrixPushByWpService.java

@@ -5,10 +5,7 @@ import com.gyee.frame.common.conf.V2Config;
 import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.*;
-import com.gyee.frame.model.custom.InverterVo;
-import com.gyee.frame.model.custom.MatrixVo;
-import com.gyee.frame.model.custom.PointData;
-import com.gyee.frame.model.custom.SimpleVo;
+import com.gyee.frame.model.custom.*;
 import com.gyee.frame.service.*;
 import com.gyee.frame.service.photovolatic.PhotovoltaicTestingPointNewService;
 import com.gyee.frame.util.IRealTimeDataBaseUtil;
@@ -20,10 +17,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class MatrixPushByWpService {
@@ -82,9 +76,9 @@ public class MatrixPushByWpService {
     private Map<String, Object> findMatrix(String wpId) throws Exception {
 
 
-        Map<String, Object> map = new HashMap<>();
-        Map<String, Object> zcmap = new HashMap<>();
-        Map<String, Object> jzmap = new HashMap<>();
+        Map<String, Object> map = new LinkedHashMap<>();
+
+        Map<String, Object> pjmap = new LinkedHashMap<>();
         int djts = 0;
         int yxts = 0;
         int gzts = 0;
@@ -93,7 +87,7 @@ public class MatrixPushByWpService {
         int xdts = 0;
         int slts = 0;
         int jrts = 0;
-        Map<String, Object> fczbmap = new HashMap<>();
+        Map<String, Object> fczbmap = new LinkedHashMap<>();
         if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
             List<InverterVo> vos = new ArrayList<>();
             if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
@@ -182,12 +176,22 @@ public class MatrixPushByWpService {
 
                         }
 
-
+                        Map<String, Object> zcmap = null;
                         if (StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid())) {
                             Square square = InitialRunner.sqmap.get(wt.getSquareid());
 
                             if (square.getTypes().equals(ZC)) {
 
+
+                                if (pjmap.containsKey(square.getProjectid())) {
+
+                                    zcmap =(Map<String, Object>)pjmap.get(square.getProjectid());
+                                } else {
+                                    zcmap = new LinkedHashMap<>();
+                                    pjmap.put(square.getProjectid(), zcmap);
+
+                                }
+
                                 if (zcmap.containsKey(square.getId())) {
                                     List<InverterVo> ls = (List<InverterVo>) zcmap.get(square.getId());
 
@@ -229,7 +233,39 @@ public class MatrixPushByWpService {
                         }
                     }
                     map.put(JZ,vos);
-                    map.put(ZC,zcmap);
+                    List<MatrixPjVo> pjls=new ArrayList<>();
+                    if(!pjmap.isEmpty())
+                    {
+                        for (Map.Entry<String, Object> entry : pjmap.entrySet()) {
+
+                            if(InitialRunner.pjmap.containsKey(entry.getKey()))
+                            {
+                                Project pj=InitialRunner.pjmap.get(entry.getKey());
+                                MatrixPjVo pjvo=new MatrixPjVo();
+                                pjvo.setName(pj.getName());
+                                List<SquareVo> sqls=new ArrayList<>();
+                                Map<String, Object> zcmap =(Map<String, Object>)pjmap.get(entry.getKey());
+                                pjvo.setSquareVos(sqls);
+                                for (Map.Entry<String, Object> sqentry : zcmap.entrySet()) {
+
+
+                                    if(InitialRunner.sqmap.containsKey(sqentry.getKey()))
+                                    {
+                                        Square sq=InitialRunner.sqmap.get(sqentry.getKey());
+                                        SquareVo sqvo=new SquareVo();
+                                        sqvo.setName(sq.getName());
+
+                                        sqvo.setInverterVos((List<InverterVo>)sqentry.getValue());
+                                        sqls.add(sqvo);
+                                    }
+
+                                }
+                                pjls.add(pjvo);
+                            }
+
+                        }
+                    }
+                    map.put(ZC,pjls);
                 }
 
             }

+ 5 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/MatrixPushService.java

@@ -205,6 +205,7 @@ public class MatrixPushService {
                 jczbmap.put("xdts", 0.0);
             }
 
+
             fczbmap.put(wp.getId(), jczbmap);
 /*************************************************风场指标统计*************************************************************/
 
@@ -328,6 +329,7 @@ public class MatrixPushService {
                         //受累台数
                         jczbmap.put("slts", slnum);
                         vo.setFjzt(fjzt);
+                        jczbmap.put("jrts",StringUtils.round(djnum+yxnum+gznum+lxnum+whnum+xdnum+slnum,0));
                         vo.setFs(MathUtil.twoBit(fjzblist.get(i * step + 1).getPointValueInDouble()));
                         vo.setGl(MathUtil.twoBit(fjzblist.get(i * step + 2).getPointValueInDouble()));
                         vo.setWtCode(wt.getCode());
@@ -401,6 +403,9 @@ public class MatrixPushService {
                         jczbmap.put("xdts", xdnum);
                         //受累台数
                         jczbmap.put("slts", slnum);
+
+                        jczbmap.put("jrts",StringUtils.round(djnum+yxnum+gznum+lxnum+whnum+xdnum+slnum,0));
+
                         vo.setFjzt(fjzt);
                         vo.setFs(MathUtil.twoBit(fjzblist.get(i * step + 1).getPointValueInDouble()));
                         vo.setGl(MathUtil.twoBit(fjzblist.get(i * step + 2).getPointValueInDouble()));

+ 122 - 121
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/WtInfoPushService.java

@@ -97,12 +97,13 @@ public class WtInfoPushService {
                     if(!wtcmap.isEmpty())
                     {
 
-                        List<String> codels=new ArrayList<>();
+
                         for (Map.Entry<String, List<WtTargetConfig>> entry : wtcmap.entrySet()) {
                             List<WtTargetConfig> wtcls=entry.getValue();
                             List<WtTargetConfigVo> vos=new ArrayList<>();
                             if(!wtcls.isEmpty())
                             {
+                                List<String> codels=new ArrayList<>();
                                 for(WtTargetConfig wtc:wtcls)
                                 {
 
@@ -464,13 +465,13 @@ public class WtInfoPushService {
                     msls.add("YYYW");//液压油温
                     msls.add("PCS_WD");//PSC温度
 
-                        uids.add(Constant.TPOINT_WT_U1YZWD);//U1绕组温度
-                        uids.add(Constant.TPOINT_WT_V1YZWD);//V1绕组温度
-                        uids.add(Constant.TPOINT_WT_W1YZWD);//W1绕组温度
+                    uids.add(Constant.TPOINT_WT_U1YZWD);//U1绕组温度
+                    uids.add(Constant.TPOINT_WT_V1YZWD);//V1绕组温度
+                    uids.add(Constant.TPOINT_WT_W1YZWD);//W1绕组温度
 
-                        msls.add("U1YZWD");//U1绕组温度
-                        msls.add("V1YZWD");//V1绕组温度
-                        msls.add("W1YZWD");//W1绕组温度
+                    msls.add("U1YZWD");//U1绕组温度
+                    msls.add("V1YZWD");//V1绕组温度
+                    msls.add("W1YZWD");//W1绕组温度
 
                     uids.add(Constant.TPOINT_WT_U2YZWD);//U2绕组温度
                     uids.add(Constant.TPOINT_WT_V2YZWD);//V2绕组温度
@@ -496,8 +497,8 @@ public class WtInfoPushService {
                     msls.add("JCWD");//机舱温度
                     msls.add("JCWWD");//机舱外温度
                     msls.add("FDJHHWD");//发电机滑环温度
-                    
-                    
+
+
                     initialpoint(id, zbls, keyls, namemap,uids,msls);
 
 
@@ -642,13 +643,13 @@ public class WtInfoPushService {
         return vos;
     }
 
-	public List<JunctionboxVo> findInverterInfoList(String wpId) throws Exception {
+    public List<JunctionboxVo> findInverterInfoList(String wpId) throws Exception {
         List<JunctionboxVo> vos=new ArrayList<>();
-		if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
-			List<Inverter> wtls = InitialRunner.gp_nbqmap.get(wpId);
-			for (Inverter wt : wtls) {
+        if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
+            List<Inverter> wtls = InitialRunner.gp_nbqmap.get(wpId);
+            for (Inverter wt : wtls) {
 
-			    if(StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid()))
+                if(StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid()))
                 {
                     Square square=InitialRunner.sqmap.get(wt.getSquareid());
 
@@ -707,10 +708,10 @@ public class WtInfoPushService {
 
                 }
 
-			}
-		}
-		return vos;
-	}
+            }
+        }
+        return vos;
+    }
 
 
 
@@ -746,7 +747,7 @@ public class WtInfoPushService {
                     {
                         zt=Double.valueOf(ptlist.get(0).getPointValueInDouble()).intValue();
                         gl=StringUtils.round(ptlist.get(1).getPointValueInDouble(),2);
-                         dl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
+                        dl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
                         fdl=StringUtils.round(ptlist.get(3).getPointValueInDouble(),2);
                     }
 
@@ -978,40 +979,40 @@ public class WtInfoPushService {
 
         return matrixmap;
     }
-	public Object findInverterDI(String id) throws Exception {
-		List<PhotovoltaicTestingPointNew> pointList = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNewDiList(id);
-		Map<String, String> idName = Maps.newHashMap();
-		List<String> pointids = Lists.newArrayList();
-		for (PhotovoltaicTestingPointNew point : pointList) {
-			idName.put(point.getCode(), point.getName());
-			pointids.add(point.getCode());
-		}
-		List<PointData> realData = realApiUtil.getRealData(pointids);
-		List<Object> onList = Lists.newArrayList();
-		List<Object> allList = Lists.newArrayList();
-		for (PointData p : realData) {
-			Map<String, Object> row = Maps.newHashMap();
-			row.put("id", p.getEdnaId());
-			row.put("name", idName.get(p.getEdnaId()));
-			row.put("value", p.getPointValueInDouble());
-			allList.add(row);
-			if (1 == p.getPointValueInDouble()) {
-				onList.add(row);
-			}
-		}
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("allList", allList);
-		map.put("onList", onList);
-		return map;
-	}
-
-	public List<AgcVo> findInverterPowerCurve(String id) throws Exception {
-
-		Map<String,Object> map =new HashMap<>();
-		Date endDate = new Date();
-		Date beginDate = DateUtil.beginOfDay(endDate);
-
-		int length=DateUtils.hoursDiff(beginDate,endDate)*2;
+    public Object findInverterDI(String id) throws Exception {
+        List<PhotovoltaicTestingPointNew> pointList = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNewDiList(id);
+        Map<String, String> idName = Maps.newHashMap();
+        List<String> pointids = Lists.newArrayList();
+        for (PhotovoltaicTestingPointNew point : pointList) {
+            idName.put(point.getCode(), point.getName());
+            pointids.add(point.getCode());
+        }
+        List<PointData> realData = realApiUtil.getRealData(pointids);
+        List<Object> onList = Lists.newArrayList();
+        List<Object> allList = Lists.newArrayList();
+        for (PointData p : realData) {
+            Map<String, Object> row = Maps.newHashMap();
+            row.put("id", p.getEdnaId());
+            row.put("name", idName.get(p.getEdnaId()));
+            row.put("value", p.getPointValueInDouble());
+            allList.add(row);
+            if (1 == p.getPointValueInDouble()) {
+                onList.add(row);
+            }
+        }
+        Map<String, Object> map = Maps.newHashMap();
+        map.put("allList", allList);
+        map.put("onList", onList);
+        return map;
+    }
+
+    public List<AgcVo> findInverterPowerCurve(String id) throws Exception {
+
+        Map<String,Object> map =new HashMap<>();
+        Date endDate = new Date();
+        Date beginDate = DateUtil.beginOfDay(endDate);
+
+        int length=DateUtils.hoursDiff(beginDate,endDate)*2;
 
         List<AgcVo> vos = new ArrayList<>();
         for (int i = 0; i < length; i++) {
@@ -1019,7 +1020,7 @@ public class WtInfoPushService {
             vo.setSjgl(0.0);
             vos.add(vo);
         }
-		String pointid = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(id, Constant.TPOINT_NBQ_GL).getCode();
+        String pointid = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(id, Constant.TPOINT_NBQ_GL).getCode();
         List<PointData> sjglls = realApiUtil.getHistoryDatasSnap(pointid, beginDate.getTime() / 1000,
                 endDate.getTime() / 1000, (long) length, 1800L);
         double temp = 0;
@@ -1028,74 +1029,74 @@ public class WtInfoPushService {
             vos.get(i).setTime(sjglls.get(i).getPointTime()*1000);
             vos.get(i).setSjgl(StringUtils.round(temp, 2));// 实际功率
         }
-		return vos;
-	}
+        return vos;
+    }
 
-	public List<Object> findInverterInfo(String id) throws Exception {
-		Map<String, Object> map = new HashMap<String, Object>();
-		if (StringUtils.notEmp(id)) {
-			if (InitialRunner.nbqmap.containsKey(id)) {
+    public List<Object> findInverterInfo(String id) throws Exception {
+        Map<String, Object> map = new HashMap<String, Object>();
+        if (StringUtils.notEmp(id)) {
+            if (InitialRunner.nbqmap.containsKey(id)) {
                 Inverter wt = InitialRunner.nbqmap.get(id);
-				map.put("model", wt.getModelid());
-				map.put("wpid", wt.getWindpowerstationid());
-				map.put("pjid", wt.getProjectid());
-				map.put("lnid", wt.getLineid());
-				map.put("code", wt.getCode());
-				Line ln = InitialRunner.lnmap.get(wt.getLineid());
-				map.put("lnname", ln.getName());
-				List<String> zbls = new ArrayList<>();
-
-
-				String[] codeName[] = {
-						{Constant.TPOINT_NBQ_JLDY, "交流电压","V"},
-						{Constant.TPOINT_NBQ_ZLDY, "直流电压","V"},
-						{Constant.TPOINT_NBQ_JLDL, "交流电流","A"},
-						{Constant.TPOINT_NBQ_ZLDL, "直流电流","A"},
-						{Constant.TPOINT_NBQ_DWPL, "电网频率","Hz"},
-						{Constant.TPOINT_NBQ_GL, "功率","W"},
-						{Constant.TPOINT_NBQ_GLYS, "功率因数",""},
-						{Constant.TPOINT_NBQ_RFDL, "日发电量","kwh"},//TODO 疑似 各厂发电量单位不統一
-						{Constant.TPOINT_NBQ_YFDL, "月发电量","kwh"},
-						{Constant.TPOINT_NBQ_NFDL, "年发电量","kwh"},
-						{Constant.TPOINT_NBQ_ZFDL, "累计发电量","kwh"},
-						{Constant.TPOINT_NBQ_WD, "逆变器温度","℃"},
-						{Constant.TPOINT_NBQ_XL, "效率",""},
-						{Constant.TPOINT_NBQ_EYHT, "累计二氧化碳减排量","kg"}
-				};
-				// 遍历定义码,获取测点Id集合
-				Map<String, String> pointUniformMap = Maps.newHashMap();
-				for (String[] str1 : codeName) {
-					String pointid = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(id, str1[0]).getCode();
-					zbls.add(pointid);
-					pointUniformMap.put(pointid, str1[0]);
-				}
-				// 获取测点值,与定义码绑定
-				List<PointData> zblist = realApiUtil.getRealData(zbls);
-				Map<String, Object> uniformValueMap = Maps.newHashMap();
-				for (PointData p : zblist) {
-					String ednaId = p.getEdnaId();
-					Double val = MathUtil.twoBit(p.getPointValueInDouble());
-					String uniformCode = pointUniformMap.get(ednaId);
-					uniformValueMap.put(uniformCode, val);
-				}
-				// 遍历定义码,添加测点值、单位、名称
-				List<Object> list = Lists.newArrayList();
-				for (String[] str1 : codeName) {
-					list.add(buildResult(str1[0], str1[1], uniformValueMap.get(str1[0]), str1[2]));
-				}
-				return list;
-			}
-		}
-		return Lists.newArrayList();
-	}
-
-	private Map<String, Object> buildResult(String uniCode, String name, Object value, String unit) {
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("uniCode", uniCode);
-		map.put("name", name);
-		map.put("value", value);
-		map.put("unit", unit);
-		return map;
-	}
+                map.put("model", wt.getModelid());
+                map.put("wpid", wt.getWindpowerstationid());
+                map.put("pjid", wt.getProjectid());
+                map.put("lnid", wt.getLineid());
+                map.put("code", wt.getCode());
+                Line ln = InitialRunner.lnmap.get(wt.getLineid());
+                map.put("lnname", ln.getName());
+                List<String> zbls = new ArrayList<>();
+
+
+                String[] codeName[] = {
+                        {Constant.TPOINT_NBQ_JLDY, "交流电压","V"},
+                        {Constant.TPOINT_NBQ_ZLDY, "直流电压","V"},
+                        {Constant.TPOINT_NBQ_JLDL, "交流电流","A"},
+                        {Constant.TPOINT_NBQ_ZLDL, "直流电流","A"},
+                        {Constant.TPOINT_NBQ_DWPL, "电网频率","Hz"},
+                        {Constant.TPOINT_NBQ_GL, "功率","W"},
+                        {Constant.TPOINT_NBQ_GLYS, "功率因数",""},
+                        {Constant.TPOINT_NBQ_RFDL, "日发电量","kwh"},//TODO 疑似 各厂发电量单位不統一
+                        {Constant.TPOINT_NBQ_YFDL, "月发电量","kwh"},
+                        {Constant.TPOINT_NBQ_NFDL, "年发电量","kwh"},
+                        {Constant.TPOINT_NBQ_ZFDL, "累计发电量","kwh"},
+                        {Constant.TPOINT_NBQ_WD, "逆变器温度","℃"},
+                        {Constant.TPOINT_NBQ_XL, "效率",""},
+                        {Constant.TPOINT_NBQ_EYHT, "累计二氧化碳减排量","kg"}
+                };
+                // 遍历定义码,获取测点Id集合
+                Map<String, String> pointUniformMap = Maps.newHashMap();
+                for (String[] str1 : codeName) {
+                    String pointid = photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(id, str1[0]).getCode();
+                    zbls.add(pointid);
+                    pointUniformMap.put(pointid, str1[0]);
+                }
+                // 获取测点值,与定义码绑定
+                List<PointData> zblist = realApiUtil.getRealData(zbls);
+                Map<String, Object> uniformValueMap = Maps.newHashMap();
+                for (PointData p : zblist) {
+                    String ednaId = p.getEdnaId();
+                    Double val = MathUtil.twoBit(p.getPointValueInDouble());
+                    String uniformCode = pointUniformMap.get(ednaId);
+                    uniformValueMap.put(uniformCode, val);
+                }
+                // 遍历定义码,添加测点值、单位、名称
+                List<Object> list = Lists.newArrayList();
+                for (String[] str1 : codeName) {
+                    list.add(buildResult(str1[0], str1[1], uniformValueMap.get(str1[0]), str1[2]));
+                }
+                return list;
+            }
+        }
+        return Lists.newArrayList();
+    }
+
+    private Map<String, Object> buildResult(String uniCode, String name, Object value, String unit) {
+        Map<String, Object> map = Maps.newHashMap();
+        map.put("uniCode", uniCode);
+        map.put("name", name);
+        map.put("value", value);
+        map.put("unit", unit);
+        return map;
+    }
 
 }