Commit 94a897c6 authored by caotao's avatar caotao

监盘获取全国场站分类信息、获取区域长场站信息接口编写

parent 221c3aea
......@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "监盘地图接口")
......@@ -61,9 +62,22 @@ 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(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo(areaName));
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页地图-片区")
@GetMapping("/getStaitonListInfoByAreaName")
public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaitonListInfoByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-场站分类信息")
@GetMapping("/getStaionCategoryInfo")
public ResponseModel<List<Map<String,String>>> getStaionCategoryInfo(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaionCategoryInfo(areaName));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class HomeMapStationInfoDto {
//场站id
String stationId;
//当前功率
String currentPower = "0";
//风速辐照度
String speendOrirradiate;
//场站类型
String stationType;
//场站装机容量
String stationInstalledCapacity;
//场站经纬度
List<String> stationPosition;
}
......@@ -27,14 +27,4 @@ public class MapAreaInfoDto {
String installedCapacity = "0";
//当日发电量
String electricityGenerationOfDay = "0";
//当前功率
String currentPower = "0";
//风速辐照度
String speendOrirradiate;
//场站类型
String stationType;
//场站装机容量
String stationInstalledCapacity;
//场站经纬度
Map<String, String> stationPosition;
}
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
......@@ -65,9 +67,9 @@ public class MonitoringServiceImpl {
* @return
*/
public Double getStationCaPACITYL(String werks) {
Double installCapacity =0.0;
installCapacity=this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity)? 0.00:installCapacity;
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/**
......@@ -238,84 +240,91 @@ public class MonitoringServiceImpl {
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo(String areaName) {
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
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));
//获取片区下的省份名称
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);
}
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);
});
}
}
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);
});
return mapAreaInfoDtoList;
}
public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
//根据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);
}
if (!stationBasicListAll.isEmpty()) {
Map<String, String> map = new HashMap<>();
stationBasicListAll.forEach(stationBasic -> {
HomeMapStationInfoDto homeMapStationInfoDto = new HomeMapStationInfoDto();
//设置场站id
homeMapStationInfoDto.setStationId(String.valueOf(stationBasic.getSequenceNbr()));
//设置场站类型
homeMapStationInfoDto.setStationType(stationBasic.getStationType());
//设置装机容量
homeMapStationInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
//设置风速辐照度
String speendOrirradiate = "";
if (stationBasic.getStationType().equals("FDZ")) {
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
homeMapStationInfoDto.setSpeendOrirradiate(speendOrirradiate);
} else {
homeMapStationInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100));
}
StationCoordinate stationCoordinate = stationCoordinateMapper.selectOne(new QueryWrapper<StationCoordinate>().eq("station_id", stationBasic.getSequenceNbr()).eq("is_main_coordinate", 0));
//获取场站经纬度
List<String> list = new ArrayList<>();
list.add(stationCoordinate.getLongitude());
list.add(stationCoordinate.getLaitude());
homeMapStationInfoDto.setStationPosition(list);
//设置当前功率
homeMapStationInfoDto.setCurrentPower("0");
homeMapStationInfoDtoList.add(homeMapStationInfoDto);
});
}
return homeMapStationInfoDtoList;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
......@@ -344,5 +353,30 @@ public class MonitoringServiceImpl {
});
return String.format("%.2f", total.get());
}
public List<Map<String,String>> getStaionCategoryInfo(String areaName){
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String,String>> result = new ArrayList<>();
if(!ObjectUtils.isEmpty(areaName)){
//根据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()));
stationBasicListAll.addAll(stationBasicList);
}
}else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("name"));
}
Map<String,List<StationBasic>> listMap= stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key->{
Map<String,String> stringStringMap = new HashMap<>();
stringStringMap.put("name",key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
}
spring.application.name=AMOS-JXIOP-MONITOR
spring.application.name=AMOS-JXIOP-MONITOR-CT
server.servlet.context-path=/jxiop-monitor
server.port=33200
server.uri-encoding=UTF-8
......
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