Browse Source

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

shilin 2 years ago
parent
commit
717a29cf73

+ 27 - 18
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/monitor/MonitorInverterPushController.java

@@ -1,16 +1,15 @@
 package com.gyee.frame.controller.monitor;
 
-import com.google.common.collect.Maps;
 import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.agc.AgcVo;
 import com.gyee.frame.model.auto.Inverter;
-import com.gyee.frame.model.auto.Windturbine;
 import com.gyee.frame.model.custom.InverterVo;
 import com.gyee.frame.model.custom.JunctionboxVo;
 import com.gyee.frame.service.websocket.WtInfoPushService;
 import com.gyee.frame.service.websocket.WtWarnPushService;
+import com.gyee.frame.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -40,26 +40,35 @@ public class MonitorInverterPushController {
 	@ApiOperation(value = "逆变器信息", notes = "逆变器AI点、报警点")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "wtId", value = "逆变器ID", required = true, dataType = "string", paramType = "query") })
 	public AjaxResult findWtInfo(String wtId) throws Exception {
-		List<Object> listAI = wtInfoPushService.findInverterInfo(wtId);
-		Object listDI = wtInfoPushService.findInverterDI(wtId);
-
-
-
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("listAI", listAI);
-		map.put("listDI", listDI);
-
-        if(InitialRunner.wtmap.containsKey(wtId))
-        {
-            Windturbine wt = InitialRunner.wtmap.get(wtId);
-            map.put("info",wt);
-        }else if(InitialRunner.nbqmap.containsKey(wtId))
+//		List<Object> listAI = wtInfoPushService.findInverterInfo(wtId);
+//		Object listDI = wtInfoPushService.findInverterDI(wtId);
+//
+//
+//
+//		Map<String, Object> map = Maps.newHashMap();
+//		map.put("listAI", listAI);
+//		map.put("listDI", listDI);
+//
+//        if(InitialRunner.wtmap.containsKey(wtId))
+//        {
+//            Windturbine wt = InitialRunner.wtmap.get(wtId);
+//            map.put("info",wt);
+//        }else if(InitialRunner.nbqmap.containsKey(wtId))
+//        {
+//            Inverter wt = InitialRunner.nbqmap.get(wtId);
+//            map.put("info",wt);
+//        }
+//
+//		return AjaxResult.successData(AjaxStatus.success.code, map);
+        Map<String, Object> map=new HashMap<>();
+        if(StringUtils.notEmp(wtId) && InitialRunner.nbqmap.containsKey(wtId))
         {
+             map=wtInfoPushService.findNbqInfo(wtId);
+
             Inverter wt = InitialRunner.nbqmap.get(wtId);
             map.put("info",wt);
         }
-
-		return AjaxResult.successData(AjaxStatus.success.code, map);
+        return AjaxResult.successData(AjaxStatus.success.code, map);
 	}
 
     @GetMapping("/findInverterInfoList")

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

@@ -96,11 +96,148 @@ public class WtInfoPushService {
                     Map<String,List<WtTargetConfig>> wtcmap=wtTargetConfigService.findWtTargetConfigMap(wt.getModelid());
                     if(!wtcmap.isEmpty())
                     {
-                        List<WtTargetConfigVo> vos=new ArrayList<>();
+
                         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())
+                            {
+                                for(WtTargetConfig wtc:wtcls)
+                                {
+
+
+                                    if(StringUtils.notEmp(wtc.getUniformcode()))
+                                    {
+                                        codels.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, wtc.getUniformcode()).getCode());
+
+                                        WtTargetConfigVo vo=new WtTargetConfigVo();
+                                        vo.setCode(wtc.getCode());
+                                        vo.setModelid(wtc.getModelid());
+                                        vo.setName(wtc.getName());
+                                        vo.setPointtype(wtc.getPointtype());
+                                        vo.setTypes(wtc.getTypes());
+                                        vo.setUnit(wtc.getUnit());
+                                        vo.setRate(wtc.getRate());
+                                        vos.add(vo);
+                                    }
+
+                                }
+
+                                List<PointData> pols=  realApiUtil.getRealData(codels);
+                                if(!pols.isEmpty() && pols.size()==codels.size())
+                                {
+                                    for( int i=0;i<vos.size();i++)
+                                    {
+                                        WtTargetConfigVo wtc=vos.get(i);
+                                        if(StringUtils.notEmp(wtc.getRate()))
+                                        {
+                                            PointData po=pols.get(i);
+                                            double rate=wtc.getRate();
+                                            double result=new BigDecimal(po.getPointValueInDouble()).multiply(new BigDecimal(rate)).doubleValue();
+                                            result= StringUtils.round(result,2);
+                                            wtc.setValue(result);
+                                        }
+
+                                    }
+                                }
+
+                            }
+                            map.put(entry.getKey(), vos);
+                        }
+                    }
+                }
+
+            }
+
+
+/*************************************************关系库指标**************************************************************/
+
+            Map<String, Object> gxkmap = new HashMap<>();
+            Date date = DateUtils.truncate(new Date());
+            List<WindTurbineInfoDay> wtdls = windturbineinfodayService.getWindturbineinfo(id, date);
+            if (!wtdls.isEmpty()) {
+                WindTurbineInfoDay wd = wtdls.get(0);
+                gxkmap.put("ndxkyss", wd.getYeardxkyxs());
+                gxkmap.put("nsbklyl", wd.getYearsbklyl());
+                gxkmap.put("ydxkyss", wd.getMonthdxkyxs());
+                gxkmap.put("ysbklyl", wd.getMonthsbklyl());
+
+                gxkmap.put("yyxxs", wd.getMonthruntime());
+                gxkmap.put("ygzxs", wd.getMonthfaulttime());
+                gxkmap.put("yjxxs", wd.getMonthmaintaintime());
+                gxkmap.put("ytjxs", wd.getMonhtstoptime());
 
+                Map<String, Object> jczbmap =(Map<String, Object>)map.get("jczbmap");
+                jczbmap.put("FJKYL", wd.getDaysbklyl());
+                map.put("jczbmap", jczbmap);
+
+            } else {
+                gxkmap.put("ndxkyss", 0.0);
+                gxkmap.put("nsbklyl", 0.0);
+                gxkmap.put("ydxkyss", 0.0);
+                gxkmap.put("ysbklyl", 0.0);
+
+                gxkmap.put("yyxxs", 0.0);
+                gxkmap.put("ygzxs", 0.0);
+                gxkmap.put("yjxxs", 0.0);
+                gxkmap.put("ytjxs", 0.0);
+            }
+
+            WarningRecords warningRecords= warningRecordsService.getWarningRecords(id);
+
+            if(null !=warningRecords && null !=warningRecords.getWarningid() && InitialRunner.warningmap.containsKey(warningRecords.getWarningid()))
+            {
+                Warning2 warning2=InitialRunner.warningmap.get(warningRecords.getWarningid());
+                gxkmap.put("bjmc", warning2.getChinesetext());
+                gxkmap.put("bjsj", DateUtils.formatDateTime(warningRecords.getWarningtime()));
+            }
+
+//            List<SawVo> ls=alarmsnapService.getWarningRecordsList(id);
+//            if(!ls.isEmpty())
+//            {
+//                gxkmap.put("bjmc", ls.get(0).getName());
+//                gxkmap.put("bjsj", DateUtils.formatDateTime(ls.get(0).getTime()));
+//            }
+            map.put("gxkmap", gxkmap);
+
+/*************************************************关系库指标**************************************************************/
+        }
+
+        return map;
+    }
+
+
+    public Map<String, Object> findNbqInfo(String id) throws Exception {
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        if (StringUtils.notEmp(id)) {
+
+            if (InitialRunner.nbqmap.containsKey(id)) {
+
+                Map<String, String[]> namemap = new HashMap<String, String[]>();
+                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());
+
+
+                if(StringUtils.notEmp(wt.getModelid()))
+                {
+                    Map<String,List<WtTargetConfig>> wtcmap=wtTargetConfigService.findWtTargetConfigMap(wt.getModelid());
+                    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())
                             {
                                 for(WtTargetConfig wtc:wtcls)