Commit b1e6554e authored by caotao's avatar caotao

更新监盘数据接口

parent b21f7a28
......@@ -238,7 +238,7 @@ public class MonitorFanIdxController extends BaseController {
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title",String.format("%.2f",Double.parseDouble(columnMap.get("日发电量").toString())/ (Double.parseDouble(columnMap.get("装机容量").toString())*1000)));
data7.put("title",String.format("%.2f",((Double.parseDouble(columnMap.get("日发电量").toString())*10)/ (Double.parseDouble(columnMap.get("装机容量").toString())))));
objects.add(data7);
IPage<Map<String,Object>> result = new Page<>();
......@@ -589,7 +589,7 @@ public class MonitorFanIdxController extends BaseController {
//日-月-年-发电量需要保留四位小数问题修改
for (String column : columnList) {
Double result = commonService.getTotalByIndicatior(mapList, column);
columnMap.put(column, String.format("%.4f",result));
columnMap.put(column, String.format("%.4f",result/10000));
}
for (String column : syLists) {
Double result = commonService.getNumByIndicatior(boosterGatewayId, column);
......@@ -607,10 +607,6 @@ public class MonitorFanIdxController extends BaseController {
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
//装机容量保留两位小数
columnMap.put("装机容量",String.format("%.2f",capacityl));
List<Map<String,Object>> objects = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
data.put("title",columnMap.get("装机容量").toString());
......@@ -642,8 +638,6 @@ public class MonitorFanIdxController extends BaseController {
Map<String, Object> data9 = new HashMap<>();
data9.put("title","0.00%");//综合效率
objects.add(data9);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(objects);
result.setCurrent(1);
......
......@@ -302,22 +302,26 @@ public class CommonServiceImpl {
//二氧化硫贡献度
SocialContributionDto so2 = new SocialContributionDto();
/** 社会贡献原始计算公式,后边的数据已经经过处理
//二氧化碳计算公式 *10000*832/10000/1000/1000
//标准煤计算公式 *10000*304.9/10000/1000/1000
//碳粉尘计算公式 *10000*0.032/1000/1000
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
发电量完成率=(月/年)发电量/(月/年)发电量指标
小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
二氧化碳减排量(万t)=发电量(万kW·h)*0.79
节约标准煤(万t)=发电量(万kW·h)*0.29
炭粉尘减排量(t)=发电量(万kW·h)*0.30
二氧化硫减排量(t)=发电量(万kW·h)*1.51
氮氧化物减排量(t)=发电量(万kW·h)*1.69
*/
co2.setUnit("二氧化碳减排量(万t)");
co2.setTitle(String.format("%.2f",totalSocialContribution * 0.000832));
co2.setTitle(String.format("%.2f",totalSocialContribution * 0.79));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(万t)");
coal.setTitle(String.format("%.2f",totalSocialContribution * 0.0003049));
coal.setTitle(String.format("%.2f",(totalSocialContribution * 0.29)/10000));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(万t)");
toner.setTitle(String.format("%.2f",totalSocialContribution * 0.00032));
toner.setTitle(String.format("%.2f",(totalSocialContribution * 0.30)/10000));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(万t)");
so2.setTitle(String.format("%.2f",totalSocialContribution * 0.0016));
so2.setTitle(String.format("%.2f",(totalSocialContribution * 1.51)/10000));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......
......@@ -223,7 +223,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format("%.2f", new BigDecimal(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"))));
completionOfPowerIndicatorsDto.setAnnualPower(String.format("%.2f", new BigDecimal(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量") / 1000)));
}
......@@ -279,9 +279,15 @@ public class MonitoringServiceImpl {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
if ("FDZ".equals(stationBasic.getStationType())) {
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
} else {
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量") / 10000);
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量") / 10000);
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量") / 10000);
}
installCapacity.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
......@@ -459,7 +465,12 @@ public class MonitoringServiceImpl {
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
if ("FDZ".equals(stationBasic.getStationType())) {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} else {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量") / 10000);
}
} catch (Exception e) {
}
......@@ -565,14 +576,18 @@ public class MonitoringServiceImpl {
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
Double total = 0.00;
String finalIndicator = "月发电量";
if (stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v -> v + total);
Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal);
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
......@@ -600,18 +615,24 @@ public class MonitoringServiceImpl {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
if("FDZ".equals(stationBasic.getStationType())){
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
}else {
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量")/10000);
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量")/10000);
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量")/10000);
}
});
HashMap<String, String> dayHashMap = new HashMap<>();
dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
HashMap<String, String> monthHashMap = new HashMap<>();
monthHashMap.put("title", String.format("%.2f", monthlyPower.get()) + "KWh");
monthHashMap.put("title", String.format("%.2f", monthlyPower.get()) + "KWh");
HashMap<String, String> annualHashMap = new HashMap<>();
annualHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
annualHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
HashMap<String, String> totalHashMap = new HashMap<>();
totalHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
totalHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
hashMapList.add(dayHashMap);
hashMapList.add(monthHashMap);
hashMapList.add(annualHashMap);
......@@ -744,9 +765,9 @@ public class MonitoringServiceImpl {
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total));
if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f", (total * 10) / install));
stationBasic.setAddress(String.format("%.2f", (total / 1000) / install));
} else {
stationBasic.setAddress(String.format("%.2f", total / 10000 / install));
stationBasic.setAddress(String.format("%.2f", (total * 10) / install));
}
if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00");
......@@ -974,7 +995,7 @@ public class MonitoringServiceImpl {
// ]
// };
public HashMap<String, Object> getTheStationPowerCurve(String stationId,String date) {
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
......@@ -988,28 +1009,28 @@ public class MonitoringServiceImpl {
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
Random random =new Random();
currentPowerYdata.add(String.format("%.2f", random.nextDouble()*30));
shortPowerYdata.add(String.format("%.2f", random.nextDouble()*40));
superPowerShortYdata.add(String.format("%.2f", random.nextDouble()*50));
Random random = new Random();
currentPowerYdata.add(String.format("%.2f", random.nextDouble() * 30));
shortPowerYdata.add(String.format("%.2f", random.nextDouble() * 40));
superPowerShortYdata.add(String.format("%.2f", random.nextDouble() * 50));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " +date);
currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 "+date);
shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", shortPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 "+ date);
superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", superPowerShortYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f",currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f",shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f",superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String currentMin = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
......@@ -1019,9 +1040,9 @@ public class MonitoringServiceImpl {
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f",currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f",shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f",superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String currentMax = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
......@@ -1030,7 +1051,7 @@ public class MonitoringServiceImpl {
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg =String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
String currentAvg = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
String shortAvg = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
String supreAvg = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
List<String> pjz = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment