Commit 94a897c6 authored by caotao's avatar caotao

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

parent 221c3aea
...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@Api(tags = "监盘地图接口") @Api(tags = "监盘地图接口")
...@@ -61,9 +62,22 @@ public class MonitoringMapController extends BaseController { ...@@ -61,9 +62,22 @@ public class MonitoringMapController extends BaseController {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId)); return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页地图") @ApiOperation(value = "监盘首页地图-全国")
@GetMapping("/getAreaInfo") @GetMapping("/getAreaInfo")
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo(@RequestParam(required = false)String areaName) { public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo(areaName)); 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 { ...@@ -27,14 +27,4 @@ public class MapAreaInfoDto {
String installedCapacity = "0"; String installedCapacity = "0";
//当日发电量 //当日发电量
String electricityGenerationOfDay = "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; ...@@ -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.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,6 +24,7 @@ import java.util.HashMap; ...@@ -23,6 +24,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service @Service
...@@ -65,9 +67,9 @@ public class MonitoringServiceImpl { ...@@ -65,9 +67,9 @@ public class MonitoringServiceImpl {
* @return * @return
*/ */
public Double getStationCaPACITYL(String werks) { public Double getStationCaPACITYL(String werks) {
Double installCapacity =0.0; Double installCapacity = 0.0;
installCapacity=this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks); installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity)? 0.00:installCapacity; return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
} }
/** /**
...@@ -238,84 +240,91 @@ public class MonitoringServiceImpl { ...@@ -238,84 +240,91 @@ public class MonitoringServiceImpl {
return tabDtoList; return tabDtoList;
} }
public List<MapAreaInfoDto> getAreaInfo(String areaName) { public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>(); List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>(); List<StationBasic> stationBasicListAll = new ArrayList<>();
if (ObjectUtils.isEmpty(areaName)) { List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); mapRegionList.forEach(mapRegion -> {
mapRegionList.forEach(mapRegion -> { MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
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(); ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) { for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(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())); List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stringArrayList.set(i, region.getRegionName()); stringArrayList.set(i, region.getRegionName());
stationBasicListAll.addAll(stationBasicList); stationBasicListAll.addAll(stationBasicList);
} }
if (!stationBasicListAll.isEmpty()) { mapAreaInfoDto.setProvince(stringArrayList);
Map<String, String> map = new HashMap<>(); // --------------------省份名称处理结束----------------------------
stationBasicListAll.forEach(stationBasic -> { //设置片区名称
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto(); mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置场站类型 //设置片区code
mapAreaInfoDto.setStationType(stationBasic.getStationType()); mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//设置装机容量 //风电站数量
mapAreaInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber()))); mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//设置风速辐照度 //集中式光伏电站数量
String speendOrirradiate = ""; mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
if (stationBasic.getStationType().equals("FDZ")) { //分布式光伏电站数量
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速")); mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
mapAreaInfoDto.setSpeendOrirradiate(speendOrirradiate); //储能光伏电站数量
} else { mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
mapAreaInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100)); //获取装机容量
} mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
StationCoordinate stationCoordinate = stationCoordinateMapper.selectOne(new QueryWrapper<StationCoordinate>().eq("station_id", stationBasic.getSequenceNbr()).eq("is_main_coordinate", 0)); //获取当日发电量
map.put("lng", stationCoordinate.getLongitude()); mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
map.put("lat", stationCoordinate.getLaitude()); mapAreaInfoDto.setPosition(mapRegion.getPosition());
//获取场站经纬度 mapAreaInfoDtoList.add(mapAreaInfoDto);
mapAreaInfoDto.setStationPosition(map); });
//设置当前功率
mapAreaInfoDto.setCurrentPower("0");
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
}
}
return mapAreaInfoDtoList; 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) { public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0); AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> { stationBasicList.forEach(stationBasic -> {
...@@ -344,5 +353,30 @@ public class MonitoringServiceImpl { ...@@ -344,5 +353,30 @@ public class MonitoringServiceImpl {
}); });
return String.format("%.2f", total.get()); 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.servlet.context-path=/jxiop-monitor
server.port=33200 server.port=33200
server.uri-encoding=UTF-8 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