Browse Source

添加逆变器分析接口

宁檬 1 year ago
parent
commit
fa477bf44f

+ 33 - 8
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/goodness/StationAnalysisController.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.controller.goodness;
 import com.gyee.common.model.StringUtils;
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.dto.response.InverterAnalysis;
 import com.gyee.runeconomy.dto.response.StationAnalysis;
 import com.gyee.runeconomy.service.goodness.WindturbinegoodnessService;
 import io.swagger.annotations.Api;
@@ -19,7 +20,7 @@ import java.util.Map;
  */
 @Controller
 @RequestMapping("/economicsOperation")
-@Api(value = "单机信息总览首页",tags =  "单机信息总览首页")
+@Api(value = "单机信息总览首页", tags = "单机信息总览首页")
 public class StationAnalysisController {
 
     @Resource
@@ -32,13 +33,13 @@ public class StationAnalysisController {
     @GetMapping("/analyse/stationAnalyse")
     @ResponseBody
     @ApiOperation(value = "场站性能分析", notes = "场站性能分析")
-    public R cndb(@RequestParam(value = "companys",required = true) String companys,
-                  @RequestParam(value = "type",required = true) String type,
-                  @RequestParam(value = "wpid",required = true) String wpid,
-                  @RequestParam(value = "beginDate",required = true) String beginDate,
-                  @RequestParam(value = "endDate",required = true) String endDate,
-                  @RequestParam(value = "target",required = false) String target,
-                  @RequestParam(value = "sort",required = false) String sort
+    public R stationAnalyse(@RequestParam(value = "companys", required = true) String companys,
+                            @RequestParam(value = "type", required = true) String type,
+                            @RequestParam(value = "wpid", required = true) String wpid,
+                            @RequestParam(value = "beginDate", required = true) String beginDate,
+                            @RequestParam(value = "endDate", required = true) String endDate,
+                            @RequestParam(value = "target", required = false) String target,
+                            @RequestParam(value = "sort", required = false) String sort
     ) throws Exception {
 
         Map<String, List<StationAnalysis>> resultList = windturbinegoodnessService.stationAnalysis(companys, type, wpid, beginDate, endDate, target, sort);
@@ -50,4 +51,28 @@ public class StationAnalysisController {
         }
     }
 
+
+    /**
+     * 逆变器分析
+     */
+    @GetMapping("/analyse/inverterAnalyse")
+    @ResponseBody
+    @ApiOperation(value = "逆变器分析", notes = "逆变器分析")
+    public R inverterAnalysis(@RequestParam(value = "companys", required = true) String companys,
+                              @RequestParam(value = "type", required = true) String type,
+                              @RequestParam(value = "wpid", required = true) String wpid,
+                              @RequestParam(value = "target", required = false) String target,
+                              @RequestParam(value = "sort", required = false) String sort
+    ) throws Exception {
+
+        Map<String, List<InverterAnalysis>> resultList = windturbinegoodnessService.inverterAnalysis(companys, type, wpid, target, sort);
+
+        if (com.gyee.common.model.StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
 }

+ 26 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/dto/response/InverterAnalysis.java

@@ -0,0 +1,26 @@
+package com.gyee.runeconomy.dto.response;
+
+import lombok.Data;
+
+@Data
+public class InverterAnalysis {
+    /**
+     * 输入功率
+     */
+    private Double inputPower;
+
+    /**
+     * 输出功率
+     */
+    private Double outputPower;
+
+    /**
+     * 输入电压
+     */
+    private Double inputVoltage;
+
+    /**
+     * 转换率
+     */
+    private Double conversionRate;
+}

+ 52 - 11
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -9,6 +9,7 @@ import com.gyee.common.util.SortUtils;
 import com.gyee.common.vo.benchmark.DataVo;
 import com.gyee.common.vo.threerate.PvVo;
 import com.gyee.runeconomy.dto.EchartDataVo;
+import com.gyee.runeconomy.dto.response.InverterAnalysis;
 import com.gyee.runeconomy.dto.response.StationAnalysis;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
@@ -1000,21 +1001,21 @@ public class WindturbinegoodnessService {
      * 场站性能分析
      */
     public Map<String, List<StationAnalysis>> stationAnalysis(String companys, String type, String wpid, String beginDate, String endDate, String target, String sort) throws Exception {
-
-
+        Long startTs = DateUtils.parseDate1(beginDate).getTime() / 1000;
+        Long endTs = DateUtils.parseDate1(endDate).getTime() / 1000;
         Map<String, List<StationAnalysis>> resultMap = new HashMap<>();
         List<ProBasicOrganizeTree> eqs = CacheContext.proBasicOrganizeTrees;
         //拿到场站下的环境监测仪id
         List<String> emils = eqs.stream().filter(v -> "EMI".equals(v.getEqType()) && v.getParentCode().equals(wpid))
                 .map(ProBasicOrganizeTree::getId)
                 .collect(Collectors.toList());
-        List<String> emil=null;
+        List<String> emil = null;
         if ("-1".equals(type)) {
             resultMap.put("list", new ArrayList<>());
             resultMap.put("chanrt", new ArrayList<>());
 
             return resultMap;
-        }else {
+        } else {
             emil = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> emils.contains(pbep.getWindturbineId()) && "AIEMI002".equals(pbep.getUniformCode()))
                     .map(ProBasicEquipmentPoint::getNemCode).collect(Collectors.toList());
         }
@@ -1033,16 +1034,16 @@ public class WindturbinegoodnessService {
         double count = 0;
         Map<Long, PointData> gzpd = new HashMap<>();
         for (String em : emil) {
-            List<PointData> historyEmilDatas = edosUtil.getHistoryDatasSnap(em, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
+            List<PointData> historyEmilDatas = edosUtil.getHistoryDatasSnap(em, startTs, endTs, null, 900L);
             for (PointData pd : historyEmilDatas) {
-                if(i==0){
+                if (i == 0) {
                     PointData data = new PointData();
                     data.setPointTime(pd.getPointTime());
                     data.setPointValueInDouble(pd.getPointValueInDouble());
-                    gzpd.put(pd.getPointTime(),data);
-                }else {
+                    gzpd.put(pd.getPointTime(), data);
+                } else {
                     PointData data = gzpd.get(pd.getPointTime());
-                    data.setPointValueInDouble(data.getPointValueInDouble()+pd.getPointValueInDouble());
+                    data.setPointValueInDouble(data.getPointValueInDouble() + pd.getPointValueInDouble());
                 }
             }
             i++;
@@ -1051,9 +1052,9 @@ public class WindturbinegoodnessService {
 
         List<PointData> historyEmilDatas = gzpd.values().stream().peek(g -> g.setPointValueInDouble(g.getPointValueInDouble() / finalI)).collect(Collectors.toList());
         Map<Long, PointData> collect1 = historyEmilDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
-        List<PointData> historySszglDatas = edosUtil.getHistoryDatasSnap(sszgl, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
+        List<PointData> historySszglDatas = edosUtil.getHistoryDatasSnap(sszgl, startTs, endTs, null, 900L);
         Map<Long, PointData> collect2 = historySszglDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
-        List<PointData> historySsznhglzsDatas = edosUtil.getHistoryDatasSnap(ssznhglzs, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
+        List<PointData> historySsznhglzsDatas = edosUtil.getHistoryDatasSnap(ssznhglzs, startTs, endTs, null, 900L);
         Map<Long, PointData> collect3 = historySsznhglzsDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
 
         List<StationAnalysis> lpds = new ArrayList<>();
@@ -1075,4 +1076,44 @@ public class WindturbinegoodnessService {
     }
 
 
+    /**
+     * 逆变器分析
+     */
+    public Map<String, List<InverterAnalysis>> inverterAnalysis(String companys, String type, String wpid, String target, String sort) throws Exception {
+        Map<String, List<InverterAnalysis>> resultMap = new HashMap<>();
+        List<InverterAnalysis> lias = new ArrayList<>();
+        InverterAnalysis ia = new InverterAnalysis();
+        Optional<ProBasicEquipmentPoint> srg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG010".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).findFirst();
+        String srgl = null;
+        if (srg.isPresent()) {
+            srgl = srg.get().getNemCode();
+        }
+        PointData realSrgData = edosUtil.getRealData(srgl);
+        ia.setInputPower(realSrgData.getPointValueInDouble());
+
+        Optional<ProBasicEquipmentPoint> scg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG007".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).findFirst();
+        String scgl = null;
+        if (scg.isPresent()) {
+            scgl = scg.get().getNemCode();
+        }
+        PointData realScgData = edosUtil.getRealData(scgl);
+        ia.setInputPower(realScgData.getPointValueInDouble());
+
+        Optional<ProBasicEquipmentPoint> srd = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "DIHW050".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).findFirst();
+        String srdy = null;
+        if (srd.isPresent()) {
+            srdy = srd.get().getNemCode();
+        }
+        PointData realSrdData = edosUtil.getRealData(srdy);
+        ia.setInputPower(realSrdData.getPointValueInDouble());
+        ia.setConversionRate(realScgData.getPointValueInDouble() / realSrgData.getPointValueInDouble() * 100);
+
+        lias.add(ia);
+        resultMap.put("list", lias);
+        resultMap.put("chanrt", lias);
+
+        return resultMap;
+    }
+
+
 }