Commit 8f3d0436 authored by tangwei's avatar tangwei

解决日月年发电量

parent a86055cb
......@@ -77,7 +77,7 @@ public class LargeScreenImpl {
map.put("equipmentIndexName.keyword", value);
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
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) {
Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
......@@ -234,7 +234,7 @@ public class LargeScreenImpl {
map.put("gatewayId.keyword", ids);
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) {
Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
......
......@@ -86,29 +86,20 @@ public class PowerGenerationImpl {
}else{
//增加系数转化
//"日发电量"
if("日发电量".equals(value)){
//"日发电量"
flags= CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay;
value= CommonConstans.taiHeGenIndicatorDay;
}else if("月发电量".equals(value)){
//"月发电量"
flags= CommonConstans.pvGenPoweActorYear;
value= CommonConstans.taiHeGenIndicatorMonth;
}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);
}
......@@ -137,6 +128,10 @@ public class PowerGenerationImpl {
switch (type) {
case "day":
List<ESDailyPowerGeneration> listd= this.getESDailyPowerGeneration(stationCacheInfoDto,indexDto,daty,String.valueOf(day),monthy,flags);
dailyPowerGenerationRepository.saveAll(listd);
break;
......@@ -165,6 +160,14 @@ public class PowerGenerationImpl {
if(flags!=null){
value=value*flags;
}
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorDay.equals(dto.getEquipmentIndexName())){
//"日发电量"
equipmentIndexName= "日发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESDailyPowerGeneration dailyPowerGeneration=new ESDailyPowerGeneration(
daty+"_"+dto.getAddress(),
......@@ -177,7 +180,7 @@ public class PowerGenerationImpl {
dto.getGatewayId(),
new Date(),
value,
dto.getEquipmentIndexName(),
equipmentIndexName,
dto.getEquipmentNumber(),
dto.getAddress(),
month
......@@ -191,12 +194,20 @@ public class PowerGenerationImpl {
List<ESMoonPowerGeneration> list=new ArrayList<>();
if(indexDto!=null&&!indexDto.isEmpty()){
for (IndicatorData dto : indexDto) {
double value=dto.getValueF()!=null?(double)dto.getValueF():0.0;
if(flags!=null){
value=value*flags;
}
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorMonth.equals(dto.getEquipmentIndexName())){
equipmentIndexName= "月发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESMoonPowerGeneration moonPowerGeneration=new ESMoonPowerGeneration(
daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(),
......@@ -208,14 +219,12 @@ public class PowerGenerationImpl {
dto.getGatewayId(),
new Date(),
value,
dto.getEquipmentIndexName(),
equipmentIndexName,
dto.getEquipmentNumber(),
dto.getAddress(),
year
);
list.add(moonPowerGeneration);
}
}
return list;
......@@ -229,6 +238,13 @@ public class PowerGenerationImpl {
if(flags!=null){
value=value*flags;
}
String equipmentIndexName="";
if(CommonConstans.taiHeGenIndicatorYear.equals(dto.getEquipmentIndexName())){
equipmentIndexName= "年发电量";
}else{
equipmentIndexName=dto.getEquipmentIndexName();
}
ESYearPowerGeneration yearPowerGeneration=new ESYearPowerGeneration(
daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(),
......@@ -240,7 +256,7 @@ public class PowerGenerationImpl {
dto.getGatewayId(),
new Date(),
value,
dto.getEquipmentIndexName(),
equipmentIndexName,
dto.getEquipmentNumber(),
dto.getAddress()
);
......
......@@ -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 ")
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);
}
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