Commit 8b3fb102 authored by caotao's avatar caotao

监盘接口调整

parent d4b7462b
......@@ -127,7 +127,7 @@ public class MonitoringMapController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电top5")
@GetMapping("/getPowerGenerationTrendsOfCompletionTopFive")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false)String areaName) {
public ResponseModel<Page<HashMap<String,String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopFive(areaName));
}
......
......@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.unbescape.css.CssIdentifierEscapeLevel;
import java.math.BigDecimal;
import java.net.URLDecoder;
......@@ -211,7 +212,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
} else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')");
mapList1 = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getBoosterGatewayId() + " where equipmentIndexName='WTX-801_25_WTX-801_总辐射'");
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
......@@ -265,11 +266,18 @@ public class MonitoringServiceImpl {
//年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId());
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
useHours.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日工作时间"));
List<Map<String, Object>> mapList =new ArrayList<>();
if(stationBasic.getStationType().equals("FDZ")){
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
useHours.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日工作时间"));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format("%.2f", dailyPower.get()));
......@@ -528,7 +536,15 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
List<Map<String, Object>> mapListData=new ArrayList<>();
String finalIndicator = "年发电量";
if(stationBasic.getStationType().equals("FDZ")){
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )");
}
Double total1 = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
total.updateAndGet(v -> v + total1);
});
return commonServiceImpl.getSocialContributionDtoList(total.get());
}
......@@ -543,7 +559,15 @@ public class MonitoringServiceImpl {
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量"));
List<Map<String, Object>> mapListData=new ArrayList<>();
String finalIndicator = "月发电量";
if(stationBasic.getStationType().equals("FDZ")){
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v->v+total);
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
......@@ -564,10 +588,16 @@ public class MonitoringServiceImpl {
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId());
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
List<Map<String, Object>> mapList =new ArrayList<>();
if(stationBasic.getStationType().equals("FDZ")){
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
});
HashMap<String, String> dayHashMap = new HashMap<>();
dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
......@@ -610,7 +640,15 @@ public class MonitoringServiceImpl {
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量"));
List<Map<String, Object>> mapListData=new ArrayList<>();
String finalIndicator = "月发电量";
if(!stationBasic.getStationType().equals("FDZ")){
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v->v+total);
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
......@@ -621,7 +659,9 @@ public class MonitoringServiceImpl {
}
public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
public Page<HashMap<String,String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String,String>> hashMapPage =new Page<>(1,5);
List<HashMap<String,String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
......@@ -632,18 +672,27 @@ public class MonitoringServiceImpl {
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
String finalIndicator = "月发电量";
stationBasicListAll.forEach(stationBasic -> {
stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量") % 100));
List<Map<String, Object>> mapListData=new ArrayList<>();
if(!stationBasic.getStationType().equals("FDZ")){
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total % 100));
});
List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
xList.add(stationBasic.getStationName());
yList.add(stationBasic.getAddress());
HashMap<String,String> hashMap1 = new HashMap<>();
hashMap1.put("stationName",stationBasic.getStationName());
hashMap1.put("value",stationBasic.getAddress());
hashMap1.put("value1",stationBasic.getAddress());
mapList.add(hashMap1);
});
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
hashMapPage.setRecords(mapList);
return hashMapPage;
}
......@@ -672,21 +721,27 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
String indicator = "日发电量";
if (tabValue.equals(1)) {
if (tabValue.equals("1")) {
indicator = "月发电量";
} else if(tabValue.equals(2)){
} else if(tabValue.equals("2")){
indicator = "年发电量";
}
//填写发电小时数
String finalIndicator = indicator;
stationBasicListAll.forEach(stationBasic -> {
Double install = getStationCaPACITYL(stationBasic.getStationNumber());
Double total = commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), finalIndicator);
List<Map<String, Object>> mapListData=new ArrayList<>();
if(!stationBasic.getStationType().equals("FDZ")){
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total));
if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f", total / 100 / install));
stationBasic.setAddress(String.format("%.2f", (total*10) / install));
} else {
stationBasic.setAddress(String.format("%.2f", total / 1000000 / install));
stationBasic.setAddress(String.format("%.2f", total / 10000 / install));
}
if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00");
......@@ -773,14 +828,14 @@ public class MonitoringServiceImpl {
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
});
gfList.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
......
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