Commit 37eb7d0a authored by caotao's avatar caotao

运行监盘接口-全国地图接口调整支持gis,station切换

运行监盘接口-新增全国地图获取发电量接口
parent 3649634f
...@@ -47,11 +47,17 @@ public class MonitoringMapController extends BaseController { ...@@ -47,11 +47,17 @@ public class MonitoringMapController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图数据") @ApiOperation(value = "获取监盘全国地图数据")
@GetMapping("/nationwide") @GetMapping("/nationwide")
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName) { public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName)); return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName,type));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图-发电量数据")
@GetMapping("/getNationalPowerGenerationData")
public ResponseModel<List<HashMap<String,Object>>> getNationalPowerGenerationData() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationalPowerGenerationData());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取区域电量指标完成情况") @ApiOperation(value = "获取区域电量指标完成情况")
@GetMapping("/getCompletionOfPowerIndicatorsByProvinceName") @GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) { public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.enums.TitleEnum;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion; import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region; import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
...@@ -88,13 +89,14 @@ public class MonitoringServiceImpl { ...@@ -88,13 +89,14 @@ public class MonitoringServiceImpl {
* @param provinceName * @param provinceName
* @return * @return
*/ */
public List<RegionNationWideDto> getNationWideInfo(String provinceName) { public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>(); List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area")); List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1)); List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
List<StationBasic> list = new ArrayList<>(); List<StationBasic> list = new ArrayList<>();
//如果 provinceName 为空则表示当前为全国地图 否则则为省份地图 //如果 provinceName 为空则表示当前为全国地图 否则则为省份地图
if (ObjectUtils.isEmpty(provinceName) || provinceName.equals("")) { // if (ObjectUtils.isEmpty(provinceName) || provinceName.equals("")) {
if ((!ObjectUtils.isEmpty(type) && type.equals("gis")) && (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
for (int i = 0; i < regionList.size(); i++) { for (int i = 0; i < regionList.size(); i++) {
RegionNationWideDto regionNationWideDto = new RegionNationWideDto(); RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
AtomicReference<Double> guangfuMW = new AtomicReference<>(0.0); AtomicReference<Double> guangfuMW = new AtomicReference<>(0.0);
...@@ -129,7 +131,7 @@ public class MonitoringServiceImpl { ...@@ -129,7 +131,7 @@ public class MonitoringServiceImpl {
regionNationWideDtoList.add(regionNationWideDto); regionNationWideDtoList.add(regionNationWideDto);
} }
} else { } else {
if (provinceName.contains("%")) { if (!ObjectUtils.isEmpty(provinceName) && provinceName.contains("%")) {
try { try {
provinceName = URLDecoder.decode(provinceName, "UTF-8"); provinceName = URLDecoder.decode(provinceName, "UTF-8");
} catch (Exception e) { } catch (Exception e) {
...@@ -137,8 +139,12 @@ public class MonitoringServiceImpl { ...@@ -137,8 +139,12 @@ public class MonitoringServiceImpl {
} }
} }
String finalProvinceName = provinceName; String finalProvinceName = provinceName;
Region region = regionList.stream().filter(region1 -> region1.getRegionName().equals(finalProvinceName)).collect(Collectors.toList()).get(0); if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())) && stationBasic.getFanGatewayId() != null).collect(Collectors.toList()); list = stationBasicList;
} else {
Region region = regionList.stream().filter(region1 -> region1.getRegionName().equals(finalProvinceName)).collect(Collectors.toList()).get(0);
list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())) && stationBasic.getFanGatewayId() != null).collect(Collectors.toList());
}
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0)); List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
HashMap<String, Double> hashMap = new HashMap<>(); HashMap<String, Double> hashMap = new HashMap<>();
...@@ -218,7 +224,7 @@ public class MonitoringServiceImpl { ...@@ -218,7 +224,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率"))); completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"))); completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(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, "年发电量"))));
} }
...@@ -266,10 +272,10 @@ public class MonitoringServiceImpl { ...@@ -266,10 +272,10 @@ public class MonitoringServiceImpl {
//年利用小时数 //年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.0); AtomicReference<Double> useHours = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> { stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList =new ArrayList<>(); List<Map<String, Object>> mapList = new ArrayList<>();
if(stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )"); mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}else { } else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )"); mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
} }
List<Map<String, Object>> finalMapList = mapList; List<Map<String, Object>> finalMapList = mapList;
...@@ -536,12 +542,12 @@ public class MonitoringServiceImpl { ...@@ -536,12 +542,12 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData=new ArrayList<>(); List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "年发电量"; String finalIndicator = "年发电量";
if(stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else { } else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
} }
Double total1 = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator); Double total1 = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
total.updateAndGet(v -> v + total1); total.updateAndGet(v -> v + total1);
...@@ -559,15 +565,15 @@ public class MonitoringServiceImpl { ...@@ -559,15 +565,15 @@ public class MonitoringServiceImpl {
//月发电量 //月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData=new ArrayList<>(); List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "月发电量"; String finalIndicator = "月发电量";
if(stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else { } else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
} }
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator); Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v->v+total); monthlyPower.updateAndGet(v -> v + total);
}); });
HashMap<String, List<String>> hashMap = new HashMap<>(); HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear(); List<String> xList = getXListofRecentOneYear();
...@@ -588,10 +594,10 @@ public class MonitoringServiceImpl { ...@@ -588,10 +594,10 @@ public class MonitoringServiceImpl {
//年发电量 //年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0); AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> { stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList =new ArrayList<>(); List<Map<String, Object>> mapList = new ArrayList<>();
if(stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )"); mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}else { } else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )"); mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + "where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
} }
List<Map<String, Object>> finalMapList = mapList; List<Map<String, Object>> finalMapList = mapList;
...@@ -640,15 +646,15 @@ public class MonitoringServiceImpl { ...@@ -640,15 +646,15 @@ public class MonitoringServiceImpl {
//月发电量 //月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData=new ArrayList<>(); List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "月发电量"; String finalIndicator = "月发电量";
if(!stationBasic.getStationType().equals("FDZ")){ if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else { } else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
} }
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator); Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v->v+total); monthlyPower.updateAndGet(v -> v + total);
}); });
HashMap<String, List<String>> hashMap = new HashMap<>(); HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear(); List<String> xList = getXListofRecentOneYear();
...@@ -659,9 +665,9 @@ public class MonitoringServiceImpl { ...@@ -659,9 +665,9 @@ public class MonitoringServiceImpl {
} }
public Page<HashMap<String,String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) { public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String,String>> hashMapPage =new Page<>(1,5); Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
List<HashMap<String,String>> mapList = new ArrayList<>(); List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>(); List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
...@@ -674,21 +680,21 @@ public class MonitoringServiceImpl { ...@@ -674,21 +680,21 @@ public class MonitoringServiceImpl {
//月发电量 //月发电量
String finalIndicator = "月发电量"; String finalIndicator = "月发电量";
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData=new ArrayList<>(); List<Map<String, Object>> mapListData = new ArrayList<>();
if(!stationBasic.getStationType().equals("FDZ")){ if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else { } else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
} }
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator); Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total % 100)); 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()); List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> { sorted.forEach(stationBasic -> {
HashMap<String,String> hashMap1 = new HashMap<>(); HashMap<String, String> hashMap1 = new HashMap<>();
hashMap1.put("stationName",stationBasic.getStationName()); hashMap1.put("stationName", stationBasic.getStationName());
hashMap1.put("value",stationBasic.getAddress()); hashMap1.put("value", stationBasic.getAddress());
hashMap1.put("value1",stationBasic.getAddress()); hashMap1.put("value1", stationBasic.getAddress());
mapList.add(hashMap1); mapList.add(hashMap1);
}); });
hashMapPage.setRecords(mapList); hashMapPage.setRecords(mapList);
...@@ -723,23 +729,23 @@ public class MonitoringServiceImpl { ...@@ -723,23 +729,23 @@ public class MonitoringServiceImpl {
String indicator = "日发电量"; String indicator = "日发电量";
if (tabValue.equals("1")) { if (tabValue.equals("1")) {
indicator = "月发电量"; indicator = "月发电量";
} else if(tabValue.equals("2")){ } else if (tabValue.equals("2")) {
indicator = "年发电量"; indicator = "年发电量";
} }
//填写发电小时数 //填写发电小时数
String finalIndicator = indicator; String finalIndicator = indicator;
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
Double install = getStationCaPACITYL(stationBasic.getStationNumber()); Double install = getStationCaPACITYL(stationBasic.getStationNumber());
List<Map<String, Object>> mapListData=new ArrayList<>(); List<Map<String, Object>> mapListData = new ArrayList<>();
if(!stationBasic.getStationType().equals("FDZ")){ if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else { } else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='"+finalIndicator +"' )"); mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
} }
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator); Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total)); stationBasic.setAddress(String.format("%.2f", total));
if (stationBasic.getStationType().equals("FDZ")) { if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f", (total*10) / install)); stationBasic.setAddress(String.format("%.2f", (total * 10) / install));
} else { } else {
stationBasic.setAddress(String.format("%.2f", total / 10000 / install)); stationBasic.setAddress(String.format("%.2f", total / 10000 / install));
} }
...@@ -863,10 +869,10 @@ public class MonitoringServiceImpl { ...@@ -863,10 +869,10 @@ public class MonitoringServiceImpl {
stringHashMap10.put("title", String.format("%.2f", powerOfMonthFD.get() + powerOfMonthGF.get())); stringHashMap10.put("title", String.format("%.2f", powerOfMonthFD.get() + powerOfMonthGF.get()));
list2.add(stringHashMap10); list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>(); HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format("%.2f",powerOfAnnualFD .get() + powerOfAnnualGF.get())); stringHashMap11.put("title", String.format("%.2f", powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11); list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>(); HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format("%.2f", (powerOfAnnualFD.get()%200 + powerOfAnnualGF.get()%200)/2 )); stringHashMap12.put("title", String.format("%.2f", (powerOfAnnualFD.get() % 200 + powerOfAnnualGF.get() % 200) / 2));
list2.add(stringHashMap12); list2.add(stringHashMap12);
page2.setRecords(list2); page2.setRecords(list2);
HashMap<String, String> stringHashMap13 = new HashMap<>(); HashMap<String, String> stringHashMap13 = new HashMap<>();
...@@ -887,12 +893,47 @@ public class MonitoringServiceImpl { ...@@ -887,12 +893,47 @@ public class MonitoringServiceImpl {
list3.add(stringHashMap16); list3.add(stringHashMap16);
page3.setRecords(list3); page3.setRecords(list3);
try { try {
emqKeeper.getMqttClient().publish("total_zjrl_topic",JSON.toJSON(page).toString().getBytes("UTF-8"),1,true); emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic",JSON.toJSON(page1).toString().getBytes("UTF-8"),1,true); emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic",JSON.toJSON(page2).toString().getBytes("UTF-8"),1,true); emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zshgx_topic",JSON.toJSON(page3).toString().getBytes("UTF-8"),1,true); emqKeeper.getMqttClient().publish("total_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
} catch (Exception ex) { } catch (Exception ex) {
} }
} }
public List<HashMap<String, Object>> getNationalPowerGenerationData() {
List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
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='年发电量' )");
}
stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
});
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
resultHashMap.add(getTableByStationListAndTitle("风电年发电量 (万kWh)",fdzList));
resultHashMap.add(getTableByStationListAndTitle("分布式光伏年发电量 (万kWh)",fbsgfdzList));
resultHashMap.add(getTableByStationListAndTitle("集中式光伏年发电量 (万kWh)",jzsgfdzList));
return resultHashMap;
}
public HashMap<String,Object> getTableByStationListAndTitle(String title,List<StationBasic> stationBasicList){
HashMap<String,Object> hashMap =new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> {
xData.add(stationBasic.getStationName());
yData.add(stationBasic.getAddress());
});
hashMap.put("title", title);
hashMap.put("xData", xData);
hashMap.put("yData", yData);
return hashMap;
}
} }
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