Commit bed3355f authored by caotao's avatar caotao

大屏监盘风电、光伏场站运行指标数据接口调整。

parent 74977b0f
......@@ -7,7 +7,11 @@ public class BuDunStationDetailInfo {
private String station_name;
private Double actual_installed_capacity;
private Double year;
private Double year_complete;
private Double year_hours;
private Double month;
private Double month_hours;
private Double day;
private Double day_hours;
private Double wind_as_irradiance;
}
......@@ -174,4 +174,9 @@ public class StationBasic extends BaseEntity {
*/
@TableField("installed_capacity")
private Double installedCapacity=0.0;
/**
* 装机容量
*/
@TableField("equip_numbers")
private Integer equipNumbers=0;
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.HashMap;
import java.util.List;
......@@ -78,4 +79,17 @@ public interface MonitorService {
* @return
*/
Page<Map<String, Object>> stationRanking(String day,String type,String areaCode );
/**
* @Descritpion 根据入参动态获取风电站数据
* @param stationId
* @return
*/
IPage<Map> getStationOverViewFanByStationId( String stationId);
/**
* @Descritpion 根据入参动态获取光伏站数据
* @param stationId
* @return
*/
IPage<Map> getStationOverViewPVByStationId( String stationId);
}
......@@ -23,24 +23,25 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.IOUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedAvg;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.io.IOException;;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
@Service
@RequiredArgsConstructor
public class MonitorServiceImpl implements MonitorService {
......@@ -50,6 +51,10 @@ public class MonitorServiceImpl implements MonitorService {
private final EmqKeeper emqKeeper;
private final HttpRequestUtil httpRequestUtil;
private final CoreCommonService coreCommonService;
@Value("classpath:/json/overview.json")
private Resource overview;
@Value("classpath:/json/overviewGF.json")
private Resource overviewGF;
@Override
public IPage<Map<String, Object>> operationData(String areaCode) {
......@@ -396,6 +401,128 @@ public class MonitorServiceImpl implements MonitorService {
return socialContributionDtoPage;
}
@Override
public IPage<Map> getStationOverViewFanByStationId(String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<CoreValuesDto> coreValuesDtoList = new ArrayList<>();
List<String> stringNames = Arrays.asList(stationBasic.getStationCoreName(), stationBasic.getBoosterCoreName());
coreValuesDtoList = coreCommonService.getValuesByStationNamesAndPointsNames(stringNames.stream().collect(Collectors.joining(",")), CommonConstans.ACTIVE_POWER);
// 获取风场详情信息
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&stationId=" + stationId;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream().filter(buDunStationDetailInfo1 -> stationBasic.getStationName().contains(buDunStationDetailInfo1.getStation_name().replace("电场", "").replace("电站", ""))).findFirst().orElse(null);
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("日发电量", 0.0);
columnMap.put("月发电量", 0.0);
columnMap.put("年发电量", 0.0);
columnMap.put("30秒平均风速", 0.0);
columnMap.put("有功功率", 0.0);
columnMap.put("风机台数", 0);
columnMap.put("装机容量", 0.0);
columnMap.put("年发电量完成率(%)", 0.0);
columnMap.put("日利用小时(h)", 0.0);
if (!ObjectUtils.isEmpty(buDunStationDetailInfo)) {
columnMap.put("日发电量", buDunStationDetailInfo.getDay());
columnMap.put("月发电量", buDunStationDetailInfo.getMonth());
columnMap.put("年发电量", buDunStationDetailInfo.getYear());
columnMap.put("30秒平均风速", buDunStationDetailInfo.getWind_as_irradiance());
columnMap.put("风机台数", stationBasic.getEquipNumbers());
columnMap.put("装机容量", buDunStationDetailInfo.getActual_installed_capacity());
columnMap.put("年发电量完成率(%)", buDunStationDetailInfo.getYear_complete());
columnMap.put("日利用小时(h)", buDunStationDetailInfo.getDay_hours());
}
if (coreValuesDtoList.size() > 0) {
columnMap.put("有功功率", coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.ACTIVE_POWER));
}
String json = null;
try {
json = IOUtils.toString(overview.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> list = parseArray(json, Map.class);
for (Map map : list) {
String key = map.get("title").toString();
map.put("title", columnMap.get(key) == null ? 0.00 : columnMap.get(key));
map.put("title2", map.get("title"));
}
IPage<Map> result = new Page<>();
result.setRecords(list);
result.setCurrent(1);
result.setTotal(list.size());
return result;
}
@Override
public IPage<Map> getStationOverViewPVByStationId(String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<CoreValuesDto> coreValuesDtoList = new ArrayList<>();
List<String> stringNames = Arrays.asList(stationBasic.getStationCoreName(), stationBasic.getBoosterCoreName());
coreValuesDtoList = coreCommonService.getValuesByStationNamesAndPointsNames(stringNames.stream().collect(Collectors.joining(",")), CommonConstans.ACTIVE_POWER+","+CommonConstans.TOTAL_RADIATION_SUM);
// 获取风场详情信息
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&stationId=" + stationId;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream().filter(buDunStationDetailInfo1 -> stationBasic.getStationName().contains(buDunStationDetailInfo1.getStation_name().replace("电场", "").replace("电站", ""))).findFirst().orElse(null);
Map<String, Object> columnMap = new HashMap<>();
//日 月 年发电量同仅统计逆变器数据
List<Map<String, Object>> mapList;
columnMap.put("日发电量", 0.0);
columnMap.put("月发电量", 0.0);
columnMap.put("年发电量", 0.0);
columnMap.put("辐照强度", 0.0);
columnMap.put("有功功率", 0.0);
columnMap.put("逆变器台数", 0);
columnMap.put("装机容量", 0.0);
columnMap.put("年发电量完成率(%)", 0.0);
columnMap.put("日利用小时(h)", 0.0);
columnMap.put("综合效率", 0.0);
columnMap.put("总辐射累计", 0.0);
if (!ObjectUtils.isEmpty(buDunStationDetailInfo)) {
columnMap.put("日发电量", buDunStationDetailInfo.getDay());
columnMap.put("月发电量", buDunStationDetailInfo.getMonth());
columnMap.put("年发电量", buDunStationDetailInfo.getYear());
columnMap.put("辐照强度", buDunStationDetailInfo.getWind_as_irradiance());
columnMap.put("风机台数", stationBasic.getEquipNumbers());
columnMap.put("装机容量", buDunStationDetailInfo.getActual_installed_capacity());
columnMap.put("年发电量完成率(%)", buDunStationDetailInfo.getYear_complete());
columnMap.put("日利用小时(h)", buDunStationDetailInfo.getDay_hours());
}
if (coreValuesDtoList.size() > 0) {
columnMap.put("有功功率", coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.ACTIVE_POWER));
columnMap.put("总辐射累计", coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.TOTAL_RADIATION_SUM));
//综合效率 = 发电量/理论发电量
//理论发电量 = 峰值日照数 * 总装机容量
//峰值日照数 = 累计辐照度/3.6
Double todayPower = Double.valueOf(columnMap.get("日发电量").toString());
Double total = Double.valueOf(columnMap.get("总辐射累计").toString());
if (todayPower > 0 && total > 0) {
Double overallEfficiency = todayPower * CommonConstans.wkwhToMv / ((total / 3.6) * Double.valueOf(columnMap.get("装机容量").toString()));
columnMap.put("综合效率", String.format("%.2f", overallEfficiency * 100) + "%");//综合效率
}
}
String json = null;
try {
json = IOUtils.toString(overviewGF.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> list = parseArray(json, Map.class);
for (Map map : list) {
String key = map.get("title").toString();
map.put("title", columnMap.get(key) == null ? 0.00 : columnMap.get(key));
map.put("title2", map.get("title"));
}
IPage<Map> result = new Page<>();
result.setRecords(list);
result.setCurrent(1);
result.setTotal(list.size());
return result;
}
/**
* 获取qg数据并将其发布到MQTT服务器
......@@ -455,14 +582,14 @@ public class MonitorServiceImpl implements MonitorService {
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
List<StationCacheInfoDto> stationCacheInfoDtoList = getListStationCacheInfoDto();
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion ->{
mapRegionList.forEach(mapRegion -> {
if (!ObjectUtils.isEmpty(mapRegion.getName())) {
List<StationCacheInfoDto> stationCacheInfoDtoListTemp = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(mapRegion.getAreaCode()) && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null).collect(Collectors.toList());
List<String> stationNames = new ArrayList<>();
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getStationCoreName).collect(Collectors.toList()));
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getBoosterCoreName).collect(Collectors.toList()));
List<CoreValuesDto> coreValuesDtosTemp = coreValuesDtos.stream().filter(coreValuesDto -> stationNames.contains(coreValuesDto.getName())).collect(Collectors.toList());
getqy(mapRegion,coreValuesDtosTemp);
getqy(mapRegion, coreValuesDtosTemp);
}
});
}
......
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