Commit a19c60a3 authored by tangwei's avatar tangwei

解决冲突

parents 16c73517 cfe940d8
...@@ -12,10 +12,10 @@ public enum ElectricQuantity { ...@@ -12,10 +12,10 @@ public enum ElectricQuantity {
FXYGZ("反向总有功","fxzyg"), FXYGZ("反向总有功","fxzyg"),
ZXWGZ("正向总无功","zxzwg"), ZXWGZ("正向总无功","zxzwg"),
FXWGZ("反向总无功","fxzwg"), FXWGZ("反向总无功","fxzwg"),
ZGXWG("总感性无功","zgxwg"), ZGXWG("总感性无功电度","zgxwg"),
ZZXYG("总正向有功","zzxwg"), ZZXYG("总正向有功电度","zzxwg"),
ZRXWG("总容性无功","zrxwg"), ZRXWG("总容性无功电度","zrxwg"),
ZFXYG("总反向有功","zfxyg"); ZFXYG("总反向有功电度","zfxyg");
......
...@@ -28,11 +28,17 @@ private static final long serialVersionUID = 1L; ...@@ -28,11 +28,17 @@ private static final long serialVersionUID = 1L;
@TableField("station_basic_id") @TableField("station_basic_id")
private String stationBasicId; private String stationBasicId;
@TableField("station_type")
private String stationType;
/** /**
* 月份 * 月份
*/ */
@TableField("monthly") @TableField("monthly")
private String monthly; private String monthly;
@TableField("year")
private String year;
/** /**
* 计划值kw.h * 计划值kw.h
* *
......
...@@ -157,7 +157,7 @@ public class LargeScreenImpl { ...@@ -157,7 +157,7 @@ public class LargeScreenImpl {
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
private void sendQYYXZBMqtt(){ private void sendQYYXZBMqtt(){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea)); Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
for (String s : belongAreaList.keySet()) { for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList()); List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
getqy(ids,s); getqy(ids,s);
......
...@@ -19,8 +19,8 @@ public class CommonConstans { ...@@ -19,8 +19,8 @@ public class CommonConstans {
// 发电量完成率=(月/年)发电量/(月/年)发电量指标 // 发电量完成率=(月/年)发电量/(月/年)发电量指标
// 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标 // 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
// 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW) // 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
// 二氧化碳减排量(万t)=发电量(万kW·h)*0.79 // 二氧化碳减排量(万t)=发电量(万kW·h)*0.997 * 10 / 10000
public static final Double carbonDioxide = 0.79; public static final Double carbonDioxide = 0.997 * 10 / 10000;
// 节约标准煤(万t)=发电量(万kW·h)*0.29 // 节约标准煤(万t)=发电量(万kW·h)*0.29
public static final Double standardCoal = 0.29; public static final Double standardCoal = 0.29;
// 炭粉尘减排量(t)=发电量(万kW·h)*0.30 // 炭粉尘减排量(t)=发电量(万kW·h)*0.30
...@@ -81,10 +81,11 @@ public class CommonConstans { ...@@ -81,10 +81,11 @@ public class CommonConstans {
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword"; public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es gatewayId 查绚关键字 //es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword"; public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule"; public static final String QueryStringFrontMoudle = "frontModule.keyword";
public static final String QueryStringSystemType = "systemType"; public static final String QueryStringSystemType = "systemType";
public static final String QueryStringEquipmentNumber = "equipmentNumber"; public static final String QueryStringEquipmentNumber = "equipmentNumber";
public static final String QueryStringValue = "value"; public static final String QueryStringValue = "value";
public static final String QueryStringValueKeyword = "value.keyword";
public static final String QueryStringDataType = "dataType"; public static final String QueryStringDataType = "dataType";
public static final String QueryStringDisplayName = "displayName"; public static final String QueryStringDisplayName = "displayName";
public static final String QueryStringIsAlarm = "isAlarm"; public static final String QueryStringIsAlarm = "isAlarm";
......
...@@ -219,7 +219,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -219,7 +219,7 @@ public class MonitorFanIdxController extends BaseController {
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result));
} }
String num = monitorFanIndicator.getFJCount(gatewayId); String num = monitorFanIndicator.getEquipCount(gatewayId,"FDZ");
columnMap.put("风机台数",num); columnMap.put("风机台数",num);
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber()); Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
...@@ -499,8 +499,9 @@ public class MonitorFanIdxController extends BaseController { ...@@ -499,8 +499,9 @@ public class MonitorFanIdxController extends BaseController {
resultsData = monitorFanIndicatorImpl.getAlarmEventList(current, size, stationId); resultsData = monitorFanIndicatorImpl.getAlarmEventList(current, size, stationId);
}else if (type.equals("1")){ }else if (type.equals("1")){
resultsData = monitorFanIndicatorImpl.getLsNationWideInfo(current, size, stationId,null); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String fanGatewayId = stationBasic.getFanGatewayId();
resultsData=monitorFanIndicatorImpl.getNationWideInfo( current, size, fanGatewayId, null);
} }
return ResponseHelper.buildResponse(resultsData); return ResponseHelper.buildResponse(resultsData);
} }
...@@ -614,7 +615,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -614,7 +615,7 @@ public class MonitorFanIdxController extends BaseController {
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result));
} }
String num = monitorFanIndicator.getFJCount(gatewayId); String num = monitorFanIndicator.getEquipCount(gatewayId,"GF");
columnMap.put("风机台数",num); columnMap.put("风机台数",num);
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber()); Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
......
...@@ -11,7 +11,7 @@ public interface AlarmEventMapper extends BaseMapper<AlarmEvent> { ...@@ -11,7 +11,7 @@ public interface AlarmEventMapper extends BaseMapper<AlarmEvent> {
String getLastDataBySort(String gatewayId); String getLastDataBySort(String gatewayId);
List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId,int current, int size); List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId);
List<String> getOldAlarmsBySort(String gatewayId, String sort); List<String> getOldAlarmsBySort(String gatewayId, String sort);
......
...@@ -19,7 +19,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper; ...@@ -19,7 +19,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository; import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil; import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchPhraseQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.WildcardQueryBuilder;
import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.Aggregations;
...@@ -217,11 +219,15 @@ public class CommonServiceImpl { ...@@ -217,11 +219,15 @@ public class CommonServiceImpl {
* @deprecated 获取指标值总和 * @deprecated 获取指标值总和
*/ */
public Double getTotalByIndicatior(String gatewayId, String indicator) { public Double getTotalByIndicatior(String gatewayId, String indicator) {
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
//用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Double totalvalue = 0.00; Double totalvalue = 0.00;
try { try {
List<Map<String, Object>> mapList = influxdbUtil.query(sql); totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueDouble())).mapToDouble(l -> Double.parseDouble(l.getValueDouble().toString())).sum();
totalvalue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
} catch (Exception e) { } catch (Exception e) {
return totalvalue; return totalvalue;
} }
...@@ -471,6 +477,53 @@ public class CommonServiceImpl { ...@@ -471,6 +477,53 @@ public class CommonServiceImpl {
} }
return null; return null;
} }
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @param likeMap 模糊字段查询
* @return
*/
public <T> List<T> getListDataByCondtionsAndLike(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass, Map<String, String> likeMap) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
if (!ObjectUtils.isEmpty(likeMap)) {
for (String key : likeMap.keySet()) {
MatchPhraseQueryBuilder queryBuilder1 = QueryBuilders.matchPhraseQuery(key, "*" + likeMap.get(key) + "*");
queryBuilder.must(queryBuilder1);
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
}
public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Map<String, String> notMustQuerCondtion, Class<T> tClass) { public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Map<String, String> notMustQuerCondtion, Class<T> tClass) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) { if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -8,9 +9,11 @@ import com.netflix.loadbalancer.RetryRule; ...@@ -8,9 +9,11 @@ import com.netflix.loadbalancer.RetryRule;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
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;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper; 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.StationPlanMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments; import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans; import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
...@@ -53,6 +56,9 @@ public class MonitoringServiceIMQTTmpl { ...@@ -53,6 +56,9 @@ public class MonitoringServiceIMQTTmpl {
private final String fanCurrentDataCron = "0 0/1 * * * *"; private final String fanCurrentDataCron = "0 0/1 * * * *";
@Value("${fan.statuts.stattuspath}") @Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix; private String fanStatusImagePathPrefix;
@Autowired
StationPlanMapper stationPlanMapper;
/** /**
* 场站mapper * 场站mapper
*/ */
...@@ -125,6 +131,14 @@ public class MonitoringServiceIMQTTmpl { ...@@ -125,6 +131,14 @@ public class MonitoringServiceIMQTTmpl {
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>(); List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", "江西省")); Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", "江西省"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()).isNotNull("fan_gateway_id")); List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()).isNotNull("fan_gateway_id"));
int year = Calendar.getInstance().get(Calendar.YEAR);
List<Long> fdz = stationBasicList.stream().map(StationBasic::getSequenceNbr).collect(Collectors.toList());
LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationPlan::getYear,String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId,fdz);
List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
//日发电量 //日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0); AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量 //月发电量
...@@ -132,7 +146,6 @@ public class MonitoringServiceIMQTTmpl { ...@@ -132,7 +146,6 @@ public class MonitoringServiceIMQTTmpl {
//年发电量 //年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0); AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例 //年发电量完成比例
String completionRatio = "23.11";
stationBasicList.forEach(stationBasic -> { stationBasicList.forEach(stationBasic -> {
if ("FDZ".equals(stationBasic.getStationType())) { if ("FDZ".equals(stationBasic.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
...@@ -154,6 +167,9 @@ public class MonitoringServiceIMQTTmpl { ...@@ -154,6 +167,9 @@ public class MonitoringServiceIMQTTmpl {
annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")*CommonConstans.pvGenPoweActor); annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")*CommonConstans.pvGenPoweActor);
} }
}); });
String completionRatio = String.format("%.2f",annualPower.get() / value);
SocialContributionDto dailyPowerdto = new SocialContributionDto(); SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format("%.2f", dailyPower.get())); dailyPowerdto.setTitle(String.format("%.2f", dailyPower.get()));
dailyPowerdto.setUnit("万kWh"); dailyPowerdto.setUnit("万kWh");
......
...@@ -3,16 +3,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; ...@@ -3,16 +3,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.jxiop.api.entity.MapRegion; import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region; import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
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.ESDto.ESEquipments; import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans; import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
...@@ -49,6 +44,8 @@ public class MonitoringServiceImpl { ...@@ -49,6 +44,8 @@ public class MonitoringServiceImpl {
*/ */
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired
StationPlanMapper stationPlanMapper;
/** /**
* 场站坐标mapper * 场站坐标mapper
*/ */
...@@ -198,10 +195,10 @@ public class MonitoringServiceImpl { ...@@ -198,10 +195,10 @@ public class MonitoringServiceImpl {
if (stationCacheInfoDto.getStationType().equals("FDZ")) { if (stationCacheInfoDto.getStationType().equals("FDZ")) {
//用于组装-es查询条件 //用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "有功功率", "日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("瞬时风速", "有功功率", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"))); completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "瞬时风速")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率"))); completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
...@@ -819,6 +816,26 @@ public class MonitoringServiceImpl { ...@@ -819,6 +816,26 @@ public class MonitoringServiceImpl {
} }
public void getTotalData() { public void getTotalData() {
//计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear,String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
//查询风电站年计划完成量
//
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
// LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(StationPlan::getYear,String.valueOf(year));
// queryWrapper.in(StationPlan::getStationBasicId,fdz);
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); 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> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
...@@ -897,7 +914,7 @@ public class MonitoringServiceImpl { ...@@ -897,7 +914,7 @@ public class MonitoringServiceImpl {
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor)); stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor));
list1.add(stringHashMap6); list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>(); HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() % 200) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() % 200)); stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()/fdzValue ) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()*CommonConstans.pvGenPoweActor/gfvalue));
list1.add(stringHashMap7); list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>(); HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor * CommonConstans.wkwhToMv) / gfInstall.doubleValue())); stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
...@@ -913,7 +930,7 @@ public class MonitoringServiceImpl { ...@@ -913,7 +930,7 @@ public class MonitoringServiceImpl {
stringHashMap11.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor)); stringHashMap11.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor));
list2.add(stringHashMap11); list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>(); HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() % 200 + powerOfAnnualGF.get() % 200) / 2)); stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()*CommonConstans.pvGenPoweActor) /yearValue));
list2.add(stringHashMap12); list2.add(stringHashMap12);
page2.setRecords(list2); page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor); Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
station_id = #{stationId} station_id = #{stationId}
</if> </if>
</where> </where>
order by sort desc limit #{current},#{size} order by event_time desc
</select> </select>
......
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