Browse Source

逆变器分析接口

宁檬 1 year ago
parent
commit
fe07ad28ba

+ 7 - 9
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/goodness/StationAnalysisController.java

@@ -5,6 +5,7 @@ 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.InverterAnalysis2;
 import com.gyee.runeconomy.dto.response.StationAnalysis;
 import com.gyee.runeconomy.service.goodness.WindturbinegoodnessService;
 import io.swagger.annotations.Api;
@@ -16,12 +17,9 @@ import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 
-/**
- * 单机性能分析列表
- */
 @Controller
 @RequestMapping("/economicsOperation")
-@Api(value = "单机信息总览首页", tags = "单机信息总览首页")
+@Api(value = "分析", tags = "分析")
 public class StationAnalysisController {
 
     @Resource
@@ -69,7 +67,7 @@ public class StationAnalysisController {
 
     ) throws Exception {
 
-         Page<InverterAnalysis> resultList = windturbinegoodnessService.inverterAnalysis(companys, type, wpid, pageSize, pageNum, target, sort);
+        Page<InverterAnalysis> resultList = windturbinegoodnessService.inverterAnalysis(companys, type, wpid, pageSize, pageNum, target, sort);
 
         if (com.gyee.common.model.StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
@@ -82,9 +80,9 @@ public class StationAnalysisController {
     /**
      * 逆变器分析二次页面
      */
-   /* @GetMapping("/analyse/stationAnalyse")
+    @GetMapping("/analyse/inverterAnalyse2")
     @ResponseBody
-    @ApiOperation(value = "场站性能分析", notes = "场站性能分析")
+    @ApiOperation(value = "逆变器分析二次页面", notes = "逆变器分析二次页面")
     public R inverterAnalysis2(
             @RequestParam(value = "wtid", required = true) String wtid,
             @RequestParam(value = "beginDate", required = true) String beginDate,
@@ -95,14 +93,14 @@ public class StationAnalysisController {
             @RequestParam(value = "sort", required = false) String sort
     ) throws Exception {
 
-       Map<String, List<StationAnalysis>> resultList = windturbinegoodnessService.inverterAnalysis2(wtid, beginDate, endDate, pageSize, pageNum, target, sort);
+        Page<InverterAnalysis2> resultList = windturbinegoodnessService.inverterAnalysis2(wtid, beginDate, endDate, pageSize, pageNum, target, sort);
 
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
         } else {
             return R.error(ResultMsg.error());
         }
-    }*/
+    }
 
 
 }

+ 113 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/dto/response/InverterAnalysis2.java

@@ -0,0 +1,113 @@
+package com.gyee.runeconomy.dto.response;
+
+import lombok.Data;
+
+
+public class InverterAnalysis2 {
+    /**
+     * 逆变器id
+     */
+    private String inverterId;
+
+    /**
+     * 逆变器名称
+     */
+    private String inverterName;
+
+    /**
+     * 时间
+     */
+    private Long time;
+
+    /**
+     * 输入功率
+     */
+    private Double inputPower;
+
+    /**
+     * 输出功率
+     */
+    private Double outputPower;
+
+    /**
+     * 输入电压
+     */
+    private Double inputVoltage;
+
+    /**
+     * 转换率
+     */
+    private Double conversionRate;
+
+    public String getInverterId() {
+        return inverterId;
+    }
+
+    public void setInverterId(String inverterId) {
+        this.inverterId = inverterId;
+    }
+
+    public String getInverterName() {
+        return inverterName;
+    }
+
+    public void setInverterName(String inverterName) {
+        this.inverterName = inverterName;
+    }
+
+    public Long getTime() {
+        return time;
+    }
+
+    public void setTime(Long time) {
+        this.time = time;
+    }
+
+    public Double getInputPower() {
+        return inputPower;
+    }
+
+    public void setInputPower(Double inputPower) {
+        if (inputPower == null) {
+            this.inputPower = 0.0;
+        } else {
+            this.inputPower = inputPower;
+        }
+    }
+
+    public Double getOutputPower() {
+        return outputPower;
+    }
+
+    public void setOutputPower(Double outputPower) {
+        if (outputPower == null) {
+            this.outputPower = 0.0;
+        } else {
+            this.outputPower = outputPower;
+        }
+    }
+
+    public Double getInputVoltage() {
+        return inputVoltage;
+    }
+
+    public void setInputVoltage(Double inputVoltage) {
+        if (inputVoltage == null) {
+            this.inputVoltage = 0.0;
+        } else {
+            this.inputVoltage = inputVoltage;
+        }
+    }
+
+    public Double getConversionRate() {
+        return conversionRate;
+    }
+
+    public void setConversionRate(Double conversionRate) {
+        if (conversionRate == null) {
+            this.conversionRate = 0.0;
+        } else {
+            this.conversionRate = conversionRate;
+        }
+    }
+}

+ 70 - 3
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -10,6 +10,7 @@ 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.InverterAnalysis2;
 import com.gyee.runeconomy.dto.response.StationAnalysis;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
@@ -1136,9 +1137,12 @@ public class WindturbinegoodnessService {
             }
             lias.add(ia);
         }
+        int total = lias.size();
+        long offset = (pageNum - 1) * pageSize;
+        lias = lias.stream().skip(offset).limit(pageSize).collect(Collectors.toList());
 
         analysisPage.setRecords(lias);
-        analysisPage.setTotal(lias.size());
+        analysisPage.setTotal(total);
         analysisPage.setCurrent(pageNum);
         analysisPage.setSize(pageSize);
 
@@ -1149,8 +1153,71 @@ public class WindturbinegoodnessService {
     /**
      * 逆变器分析二次页面
      */
-   /* public Map<String, List<StationAnalysis>> inverterAnalysis2(String wtid, String beginDate, String endDate, Long pageSize, Long pageNum, String target, String sort) {
+    public Page<InverterAnalysis2> inverterAnalysis2(String wtid, String beginDate, String endDate, Long pageSize, Long pageNum, String target, String sort) throws Exception {
+        Long startTs = DateUtils.parseDate1(beginDate).getTime() / 1000;
+        Long endTs = DateUtils.parseDate1(endDate).getTime() / 1000;
+
+        Page<InverterAnalysis2> analysisPage = new Page<>();
+
+        List<ProBasicEquipmentPoint> srg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG010".equals(pbep.getUniformCode()) && wtid.equals(pbep.getWindturbineId())).collect(Collectors.toList());
+
+        List<ProBasicEquipmentPoint> scg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG007".equals(pbep.getUniformCode()) && wtid.equals(pbep.getWindturbineId())).collect(Collectors.toList());
+
+        List<ProBasicEquipmentPoint> srd = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "DIHW050".equals(pbep.getUniformCode()) && wtid.equals(pbep.getWindturbineId())).collect(Collectors.toList());
+        if (srd.size() == 0) {
+            srd = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG019".equals(pbep.getUniformCode()) && wtid.equals(pbep.getWindturbineId())).collect(Collectors.toList());
+        }
+
+        //所有逆变器的输入功率测点
+        String srgTag = srg.stream().map(epp -> epp.getNemCode()).collect(Collectors.joining(";"));
+        List<PointData> historySrgDatas = edosUtil.getHistoryDatasSnap(srgTag, startTs, endTs, null, 900L);
+        Map<Long, PointData> srgMap = historySrgDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
+
+        //所有逆变器的输出功率测点
+        String scgTag = scg.stream().map(epp -> epp.getNemCode()).collect(Collectors.joining(";"));
+        List<PointData> historyScgDatas = edosUtil.getHistoryDatasSnap(scgTag, startTs, endTs, null, 900L);
+        Map<Long, PointData> scgMap = historyScgDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
+
+        //所有逆变器的输出电压测点
+        String srdTag = srd.stream().map(epp -> epp.getNemCode()).collect(Collectors.joining(";"));
+        List<PointData> historySrdDatas = edosUtil.getHistoryDatasSnap(srdTag, startTs, endTs, null, 900L);
+        Map<Long, PointData> srdMap = historySrdDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
 
 
-    }*/
+        List<InverterAnalysis2> lpds = new ArrayList<>();
+        for (PointData data : historySrgDatas) {
+            Long pointTime = data.getPointTime();
+            InverterAnalysis2 ia = new InverterAnalysis2();
+            ia.setTime(pointTime);
+            ia.setInverterId(wtid);
+            ia.setInverterName(CacheContext.proBasicOrganizeTreesMap.get(wtid).getNemName());
+            ia.setInputPower(srgMap.get(pointTime).getPointValueInDouble());
+            ia.setOutputPower(scgMap.get(pointTime).getPointValueInDouble());
+            ia.setInputVoltage(srdMap.get(pointTime).getPointValueInDouble());
+            /*if (srgMap.get(pointTime).getPointValueInDouble() == null || srgMap.get(pointTime).getPointValueInDouble() == 0.0 || scgMap.get(pointTime).getPointValueInDouble() == null || scgMap.get(pointTime).getPointValueInDouble() == 0.0) {
+                ia.setConversionRate(0.0);
+            } else {
+                ia.setConversionRate(scgMap.get(pointTime).getPointValueInDouble() / srgMap.get(pointTime).getPointValueInDouble() * 100);
+            }*/
+            Double srgValue = srgMap.get(pointTime) != null ? srgMap.get(pointTime).getPointValueInDouble() : null;
+            Double scgValue = scgMap.get(pointTime) != null ? scgMap.get(pointTime).getPointValueInDouble() : null;
+            if (srgValue == null || Double.valueOf(0.0).equals(srgValue) || scgValue == null || Double.valueOf(0.0).equals(scgValue)) {
+                ia.setConversionRate(0.0);
+            } else {
+                ia.setConversionRate(scgValue / srgValue * 100);
+            }
+            lpds.add(ia);
+        }
+        List<InverterAnalysis2> lias2 = lpds.stream().sorted(Comparator.comparing(InverterAnalysis2::getTime)).collect(Collectors.toList());
+        int total = lias2.size();
+        long offset = (pageNum - 1) * pageSize;
+        lias2 = lias2.stream().skip(offset).limit(pageSize).collect(Collectors.toList());
+
+        analysisPage.setRecords(lias2);
+        analysisPage.setTotal(total);
+        analysisPage.setCurrent(pageNum);
+        analysisPage.setSize(pageSize);
+
+        return analysisPage;
+    }
 }