4 Incheckningar d00fc219f4 ... 7ea9661de7

Upphovsman SHA1 Meddelande Datum
  wsy 7ea9661de7 Merge branch 'master' of http://49.4.49.126:3000/GYEE_R.D/Gyee_Frame_NX 3 år sedan
  wsy a4122d700a 逆变器单机页面 3 år sedan
  wsy 66706684f7 逆变器单机接口 3 år sedan
  wsy 2b84bb3ef2 光伏列表接口 3 år sedan

+ 5 - 0
src/main/java/com/gyee/frame/common/spring/InitialRunner.java

@@ -65,6 +65,8 @@ public class InitialRunner implements CommandLineRunner {
     public static List<Windturbine> wtallls = new ArrayList<Windturbine>(); // 风电机LIST集合(包含光电电)
 
     public static List<Windpowerstation> wpls = new ArrayList<Windpowerstation>(); // 风电场LIST集合
+    public static List<Windpowerstation> spls = new ArrayList<Windpowerstation>(); // 光伏场LIST集合
+    
     public static List<Project> pjls = new ArrayList<Project>(); // 项目LIST集合
     public static List<Line> linels = new ArrayList<Line>(); // 线路LIST集合
     public static List<Windturbine> wtls = new ArrayList<Windturbine>(); // 风电机LIST集合
@@ -189,6 +191,9 @@ public class InitialRunner implements CommandLineRunner {
                 if (wp.getId().endsWith("FDC")) {
                     wpls.add(wp);
                 }
+                if (wp.getId().endsWith("GDC")) {
+                	spls.add(wp);
+                }
                 wpmap.put(wp.getId(), wp);
             }
         }

+ 17 - 0
src/main/java/com/gyee/frame/controller/monitor/MatrixPushController.java

@@ -1,9 +1,12 @@
 package com.gyee.frame.controller.monitor;
 
+import com.google.common.collect.Lists;
+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.auto.Windpowerstation;
+import com.gyee.frame.model.auto.Windturbine;
 import com.gyee.frame.model.custom.MatrixVo;
 import com.gyee.frame.service.websocket.*;
 import io.swagger.annotations.Api;
@@ -187,4 +190,18 @@ public class MatrixPushController {
 
     }
 
+    @PostMapping("/findPVSimpleMatrixAll")
+    @ResponseBody
+    @ApiOperation(value = "全光伏场简单矩阵", notes = "全光伏场简单矩阵")
+	public AjaxResult findPVSimpleMatrixAll() throws Exception {
+		List<Object> vos = new ArrayList<>();
+		for (Windpowerstation wp : InitialRunner.spls) {
+			Map<String, Object> map = new HashMap<>();
+			List<List<MatrixVo>> inverterls = matrixPushByWpService.findSimpleMatrixList(wp.getId());
+			map.put("wpName", wp.getName());
+			map.put("inverterls", inverterls.get(0));
+			vos.add(map);
+		}
+		return AjaxResult.successData(AjaxStatus.success.code, vos);
+	}
 }

+ 49 - 0
src/main/java/com/gyee/frame/controller/monitor/MonitorInverterPushController.java

@@ -0,0 +1,49 @@
+package com.gyee.frame.controller.monitor;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.service.websocket.WtInfoPushService;
+import com.gyee.frame.service.websocket.WtWarnPushService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+@Controller
+@RequestMapping("/monitorinverter")
+@Api(value = "逆变器监视", tags = "逆变器监视")
+public class MonitorInverterPushController {
+
+	@Resource
+	private WtInfoPushService wtInfoPushService;
+	@Resource
+	private WtWarnPushService wtWarnPushService;
+
+	@PostMapping("/findInverterInfo")
+	@ResponseBody
+	@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> list = wtInfoPushService.findInverterInfo(wtId);
+		return AjaxResult.successData(AjaxStatus.success.code, list);
+	}
+
+	@PostMapping("/findInverterPowerLine")
+	@ResponseBody
+	@ApiOperation(value = "逆变器开网频率", notes = "逆变器当日0点至今功率,间隔30分钟")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "wtId", value = "逆变器ID", required = true, dataType = "string", paramType = "query") })
+	public AjaxResult findInverterPowerLine(String wtId) throws Exception {
+		List<Object> list = wtInfoPushService.findInverterPowerCurve(wtId);
+		return AjaxResult.successData(AjaxStatus.success.code, list);
+	}
+}

+ 94 - 2
src/main/java/com/gyee/frame/service/websocket/WtInfoPushService.java

@@ -1,6 +1,7 @@
 package com.gyee.frame.service.websocket;
 
 
+import com.google.common.collect.Maps;
 import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.*;
@@ -10,6 +11,11 @@ import com.gyee.frame.service.WindTurbineTestingPointAiService;
 import com.gyee.frame.service.WindTurbineTestingPointDiService;
 import com.gyee.frame.service.WindturbineinfodayService;
 import com.gyee.frame.util.*;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+
+import org.apache.commons.compress.utils.Lists;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -1135,6 +1141,92 @@ public class WtInfoPushService {
         return vos;
     }
 
-}
-
+    public List<Object> findInverterDI(String id) throws Exception {
+		return null;
+    }
+    
+	public List<Object> findInverterPowerCurve(String id) throws Exception {
+		List<Object> list = Lists.newArrayList();
+		Date now = new Date();
+		Date date = DateUtil.beginOfDay(now);
+		String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, "AI130").getId();
+		while (date.before(now)) {
+			Date begin = DateUtils.addMinutes(date, -30);
+			List<PointData> histStat = realApiUtil.getHistStat(pointid, begin.getTime() / 1000, date.getTime() / 1000, 1L, 30L * 60, 0);
+			Double val = 0D;
+			if (histStat != null && !histStat.isEmpty() && histStat.get(0) != null) {
+				val = histStat.get(0).getPointValueInDouble();
+				val = MathUtil.twoBit(val);
+			}
+			list.add(val);
+			date = DateUtils.addMinutes(date, 30);
+		}
+		return list;
+	}
+
+	public List<Object> findInverterInfo(String id) throws Exception {
+		Map<String, Object> map = new HashMap<String, Object>();
+		if (StringUtils.notEmp(id)) {
+			if (InitialRunner.wtmap.containsKey(id)) {
+				Windturbine wt = InitialRunner.wtmap.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[] = {
+						{"AIG061", "交流电压","V"},
+						{"AIG081", "直流电压","V"},
+						{"AIG060", "交流电流","A"},
+						{"AIG078", "直流电流","A"},
+						{"AIG073", "电网频率","Hz"},
+						{"AI130", "功率","W"},
+						{"AIG104", "功率因数",""},
+						{"RFDL", "日发电量","kwh"},//TODO 疑似 各厂发电量单位不同意
+						{"YFDL", "月发电量","kwh"},
+						{"NFDL", "年发电量","kwh"},
+						{"AIG064", "累计发电量","kwh"},
+						{"AIG071", "逆变器温度","℃"},
+						{"AIG072", "效率",""},
+						{"eyht", "累计二氧化碳减排量","kg"}
+				};
+				// 遍历定义码,获取测点Id集合
+				Map<String, String> pointUniformMap = Maps.newHashMap();
+				for (String[] str1 : codeName) {
+					String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, str1[0]).getId();
+					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;
+	}
 
+}