Commit 8f3d0436 authored by tangwei's avatar tangwei

解决日月年发电量

parent a86055cb
...@@ -77,7 +77,7 @@ public class LargeScreenImpl { ...@@ -77,7 +77,7 @@ public class LargeScreenImpl {
map.put("equipmentIndexName.keyword", value); map.put("equipmentIndexName.keyword", value);
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupavg(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class); List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupavg(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.00");
for (Terms.Bucket bucket : lidate) { for (Terms.Bucket bucket : lidate) {
Aggregations aggregation = bucket.getAggregations(); Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null; List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
...@@ -234,7 +234,7 @@ public class LargeScreenImpl { ...@@ -234,7 +234,7 @@ public class LargeScreenImpl {
map.put("gatewayId.keyword", ids); map.put("gatewayId.keyword", ids);
List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupavg(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class); List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupavg(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.00");
for (Terms.Bucket bucket : lidate) { for (Terms.Bucket bucket : lidate) {
Aggregations aggregation = bucket.getAggregations(); Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null; List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
......
...@@ -86,29 +86,20 @@ public class PowerGenerationImpl { ...@@ -86,29 +86,20 @@ public class PowerGenerationImpl {
}else{ }else{
//增加系数转化 //增加系数转化
//"日发电量" //"日发电量"
if("日发电量".equals(value)){ if("日发电量".equals(value)){
//"日发电量" //"日发电量"
flags= CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay; value= CommonConstans.taiHeGenIndicatorDay;
}else if("月发电量".equals(value)){ }else if("月发电量".equals(value)){
//"月发电量" //"月发电量"
flags= CommonConstans.pvGenPoweActorYear; value= CommonConstans.taiHeGenIndicatorMonth;
}else{ }else{
//"年发电量" //"年发电量"
flags= CommonConstans.pvGenPoweActorYear; value= CommonConstans.taiHeGenIndicatorYear;
} }
indexDto= indicatorDataMapper.selectlastgf(value, stationCacheInfoDto.getBoosterGatewayId(), startTime, endTime);
// if("日发电量".equals(value)){
// //"日发电量"
// // value= CommonConstans.taiHeGenIndicatorDay;
// }else if("月发电量".equals(value)){
// //"月发电量"
// value= CommonConstans.taiHeGenIndicatorMonth;
// }else{
// //"年发电量"
// value= CommonConstans.taiHeGenIndicatorYear;
// }
indexDto= indicatorDataMapper.selectlastgf(value, stationCacheInfoDto.getFanGatewayId(), startTime, endTime);
// //indexDto= this.getlastgf(gatewayId,value,datyvalue); // //indexDto= this.getlastgf(gatewayId,value,datyvalue);
} }
...@@ -137,6 +128,10 @@ public class PowerGenerationImpl { ...@@ -137,6 +128,10 @@ public class PowerGenerationImpl {
switch (type) { switch (type) {
case "day": case "day":
List<ESDailyPowerGeneration> listd= this.getESDailyPowerGeneration(stationCacheInfoDto,indexDto,daty,String.valueOf(day),monthy,flags); List<ESDailyPowerGeneration> listd= this.getESDailyPowerGeneration(stationCacheInfoDto,indexDto,daty,String.valueOf(day),monthy,flags);
dailyPowerGenerationRepository.saveAll(listd); dailyPowerGenerationRepository.saveAll(listd);
break; break;
...@@ -165,6 +160,14 @@ public class PowerGenerationImpl { ...@@ -165,6 +160,14 @@ public class PowerGenerationImpl {
if(flags!=null){ if(flags!=null){
value=value*flags; value=value*flags;
} }
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorDay.equals(dto.getEquipmentIndexName())){
//"日发电量"
equipmentIndexName= "日发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESDailyPowerGeneration dailyPowerGeneration=new ESDailyPowerGeneration( ESDailyPowerGeneration dailyPowerGeneration=new ESDailyPowerGeneration(
daty+"_"+dto.getAddress(), daty+"_"+dto.getAddress(),
...@@ -177,7 +180,7 @@ public class PowerGenerationImpl { ...@@ -177,7 +180,7 @@ public class PowerGenerationImpl {
dto.getGatewayId(), dto.getGatewayId(),
new Date(), new Date(),
value, value,
dto.getEquipmentIndexName(), equipmentIndexName,
dto.getEquipmentNumber(), dto.getEquipmentNumber(),
dto.getAddress(), dto.getAddress(),
month month
...@@ -191,12 +194,20 @@ public class PowerGenerationImpl { ...@@ -191,12 +194,20 @@ public class PowerGenerationImpl {
List<ESMoonPowerGeneration> list=new ArrayList<>(); List<ESMoonPowerGeneration> list=new ArrayList<>();
if(indexDto!=null&&!indexDto.isEmpty()){ if(indexDto!=null&&!indexDto.isEmpty()){
for (IndicatorData dto : indexDto) { for (IndicatorData dto : indexDto) {
double value=dto.getValueF()!=null?(double)dto.getValueF():0.0; double value=dto.getValueF()!=null?(double)dto.getValueF():0.0;
if(flags!=null){ if(flags!=null){
value=value*flags; value=value*flags;
} }
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorMonth.equals(dto.getEquipmentIndexName())){
equipmentIndexName= "月发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESMoonPowerGeneration moonPowerGeneration=new ESMoonPowerGeneration( ESMoonPowerGeneration moonPowerGeneration=new ESMoonPowerGeneration(
daty+"_"+dto.getAddress(), daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(), stationCacheInfoDto.getStationId(),
...@@ -208,14 +219,12 @@ public class PowerGenerationImpl { ...@@ -208,14 +219,12 @@ public class PowerGenerationImpl {
dto.getGatewayId(), dto.getGatewayId(),
new Date(), new Date(),
value, value,
dto.getEquipmentIndexName(), equipmentIndexName,
dto.getEquipmentNumber(), dto.getEquipmentNumber(),
dto.getAddress(), dto.getAddress(),
year year
); );
list.add(moonPowerGeneration); list.add(moonPowerGeneration);
} }
} }
return list; return list;
...@@ -229,6 +238,13 @@ public class PowerGenerationImpl { ...@@ -229,6 +238,13 @@ public class PowerGenerationImpl {
if(flags!=null){ if(flags!=null){
value=value*flags; value=value*flags;
} }
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorYear.equals(dto.getEquipmentIndexName())){
equipmentIndexName= "年发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESYearPowerGeneration yearPowerGeneration=new ESYearPowerGeneration( ESYearPowerGeneration yearPowerGeneration=new ESYearPowerGeneration(
daty+"_"+dto.getAddress(), daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(), stationCacheInfoDto.getStationId(),
...@@ -240,7 +256,7 @@ public class PowerGenerationImpl { ...@@ -240,7 +256,7 @@ public class PowerGenerationImpl {
dto.getGatewayId(), dto.getGatewayId(),
new Date(), new Date(),
value, value,
dto.getEquipmentIndexName(), equipmentIndexName,
dto.getEquipmentNumber(), dto.getEquipmentNumber(),
dto.getAddress() dto.getAddress()
); );
......
...@@ -15,7 +15,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -15,7 +15,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ") @Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ")
List<IndicatorData> selectlastfd(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime); List<IndicatorData> selectlastfd(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);
@Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_specific_name like '%逆变器%' and equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ") @Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ")
List<IndicatorData> selectlastgf(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime); List<IndicatorData> selectlastgf(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);
} }
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