|
@@ -19,6 +19,7 @@ import com.gyee.runeconomy.util.DateUtils;
|
|
|
import com.gyee.runeconomy.util.StringUtils;
|
|
|
import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
@@ -27,6 +28,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : WindturbinegoodnessService
|
|
@@ -1079,38 +1081,68 @@ 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();
|
|
|
+ public Map<String, Page<InverterAnalysis>> inverterAnalysis(String companys, String type, String wpid, long pageSize, long pageNum, String target, String sort) throws Exception {
|
|
|
+ Map<String, Page<InverterAnalysis>> resultMap = new HashMap<>();
|
|
|
+ if ("-1".equals(type)) {
|
|
|
+ resultMap.put("list", new Page<>());
|
|
|
+ resultMap.put("chanrt", new Page<>());
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
- PointData realSrgData = edosUtil.getRealData(srgl);
|
|
|
- ia.setInputPower(realSrgData.getPointValueInDouble());
|
|
|
+ List<InverterAnalysis> lias = new ArrayList<>();
|
|
|
|
|
|
- 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();
|
|
|
+ List<ProBasicEquipmentPoint> srg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG010".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProBasicEquipmentPoint> scg = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG007".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProBasicEquipmentPoint> srd = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "DIHW050".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
+ if (srd.size() == 0) {
|
|
|
+ srd = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> "AIG019".equals(pbep.getUniformCode()) && wpid.equals(pbep.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
}
|
|
|
- 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();
|
|
|
+ //所有逆变器的输入功率测点
|
|
|
+ List<String> srgCollect = srg.stream().map(epp -> epp.getNemCode()).collect(Collectors.toList());
|
|
|
+ //输入功率测点,输入功率测点实时值
|
|
|
+ Map<String, Double> srgRealDataMap = edosUtil.getRealDataMap(srgCollect);
|
|
|
+ //逆变器的id,输入功率测点
|
|
|
+ Map<String, String> srgEquipmentIdMap = srg.stream().collect(Collectors.toMap(ProBasicEquipmentPoint::getWindturbineId, ProBasicEquipmentPoint::getNemCode));
|
|
|
+
|
|
|
+ //所有逆变器的输出功率测点
|
|
|
+ List<String> scgCollect = scg.stream().map(epp -> epp.getNemCode()).collect(Collectors.toList());
|
|
|
+ //输出功率测点,输出功率测点实时值
|
|
|
+ Map<String, Double> scgRealDataMap = edosUtil.getRealDataMap(scgCollect);
|
|
|
+ //逆变器的id,输出功率测点
|
|
|
+ Map<String, String> scgEquipmentIdMap = srg.stream().collect(Collectors.toMap(ProBasicEquipmentPoint::getWindturbineId, ProBasicEquipmentPoint::getNemCode));
|
|
|
+
|
|
|
+ //所有逆变器的输出电压测点
|
|
|
+ List<String> srdCollect = srd.stream().map(epp -> epp.getNemCode()).collect(Collectors.toList());
|
|
|
+ //输出电压测点,输出电压测点实时值
|
|
|
+ Map<String, Double> srdRealDataMap = edosUtil.getRealDataMap(srdCollect);
|
|
|
+ //逆变器的id,输出电压测点
|
|
|
+ Map<String, String> srdEquipmentIdMap = srg.stream().collect(Collectors.toMap(ProBasicEquipmentPoint::getWindturbineId, ProBasicEquipmentPoint::getNemCode));
|
|
|
+
|
|
|
+ for (String epid : srgEquipmentIdMap.keySet()) {
|
|
|
+ InverterAnalysis ia = new InverterAnalysis();
|
|
|
+ ia.setInverterId(epid);
|
|
|
+ ia.setInverterName(CacheContext.proBasicOrganizeTreesMap.get(epid).getNemName());
|
|
|
+ ia.setInputPower(srgRealDataMap.get(srgEquipmentIdMap.get(epid)));
|
|
|
+ ia.setOutputPower(scgRealDataMap.get(scgEquipmentIdMap.get(epid)));
|
|
|
+ ia.setInputVoltage(srdRealDataMap.get(srdEquipmentIdMap.get(epid)));
|
|
|
+ if (srgRealDataMap.get(srgEquipmentIdMap.get(epid)) == 0.0) {
|
|
|
+ ia.setConversionRate(0.0);
|
|
|
+ } else {
|
|
|
+ ia.setConversionRate(scgRealDataMap.get(scgEquipmentIdMap.get(epid)) / srgRealDataMap.get(srgEquipmentIdMap.get(epid)) * 100);
|
|
|
+ }
|
|
|
+ lias.add(ia);
|
|
|
}
|
|
|
- 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);
|
|
|
+ Page<InverterAnalysis> analysisPage = new Page<>();
|
|
|
+ analysisPage.setRecords(lias);
|
|
|
+ analysisPage.setTotal(lias.size());
|
|
|
+ analysisPage.setCurrent(pageNum);
|
|
|
+ analysisPage.setSize(pageSize);
|
|
|
+
|
|
|
+ resultMap.put("list", analysisPage);
|
|
|
+ resultMap.put("chanrt", analysisPage);
|
|
|
|
|
|
return resultMap;
|
|
|
}
|