Commit af537682 authored by caotao's avatar caotao

监盘片区接口编写

parent ad6c3cfa
......@@ -61,15 +61,9 @@ public class MonitoringMapController extends BaseController {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "首页地图-获取片区信息")
@ApiOperation(value = "监盘首页地图")
@GetMapping("/getAreaInfo")
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo(areaName));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "地图首页接口")
// @GetMapping("/getMapInfoByAreaName")
// public ResponseModel<List<RegionNationWideDto>> getMapInfo(@RequestParam (value = "areaName", required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName));
// }
}
......@@ -3,19 +3,38 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class MapAreaInfoDto {
//片区省份
List<String> province;
//经纬度
List<String> position;
//片区名称
String areaName;
//片区code
String areaCode;
//风电站数量
String windPowerStationCount = "0";
//集中式光伏电站数量
String centralizedPhotovoltaicStationCount = "0";
//分布式光伏电站数量
String distributedPhotovoltaicStationCount = "0";
//储能电站数量
String energyStorageStationCount = "0";
//装机容量
String installedCapacity = "0";
//当日发电量
String electricityGenerationOfDay = "0";
//当前功率
String currentPower = "0";
//风速辐照度
String speendOrirradiate;
//场站类型
String stationType;
//场站装机容量
String stationInstalledCapacity;
//场站经纬度
Map<String, String> stationPosition;
}
......@@ -16,10 +16,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.naming.Name;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
......@@ -63,7 +65,9 @@ public class MonitoringServiceImpl {
* @return
*/
public Double getStationCaPACITYL(String werks) {
return this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
Double installCapacity =0.0;
installCapacity=this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity)? 0.00:installCapacity;
}
/**
......@@ -234,42 +238,81 @@ public class MonitoringServiceImpl {
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo() {
public List<MapAreaInfoDto> getAreaInfo(String areaName) {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (ObjectUtils.isEmpty(areaName)) {
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stringArrayList.set(i, region.getRegionName());
stationBasicListAll.addAll(stationBasicList);
}
mapAreaInfoDto.setProvince(stringArrayList);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
} else {
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stringArrayList.set(i, region.getRegionName());
stationBasicListAll.addAll(stationBasicList);
}
mapAreaInfoDto.setProvince(stringArrayList);
System.out.println(stationBasicListAll);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
if (!stationBasicListAll.isEmpty()) {
Map<String, String> map = new HashMap<>();
stationBasicListAll.forEach(stationBasic -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//设置场站类型
mapAreaInfoDto.setStationType(stationBasic.getStationType());
//设置装机容量
mapAreaInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
//设置风速辐照度
String speendOrirradiate = "";
if (stationBasic.getStationType().equals("FDZ")) {
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
mapAreaInfoDto.setSpeendOrirradiate(speendOrirradiate);
} else {
mapAreaInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100));
}
StationCoordinate stationCoordinate = stationCoordinateMapper.selectOne(new QueryWrapper<StationCoordinate>().eq("station_id", stationBasic.getSequenceNbr()).eq("is_main_coordinate", 0));
map.put("lng", stationCoordinate.getLongitude());
map.put("lat", stationCoordinate.getLaitude());
//获取场站经纬度
mapAreaInfoDto.setStationPosition(map);
//设置当前功率
mapAreaInfoDto.setCurrentPower("0");
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
}
}
return mapAreaInfoDtoList;
}
......@@ -284,7 +327,7 @@ public class MonitoringServiceImpl {
}
}
});
return String.format("%.2f",total.get());
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
......@@ -299,7 +342,7 @@ public class MonitoringServiceImpl {
}
});
return String.format("%.2f",total.get());
return String.format("%.2f", total.get());
}
}
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