Browse Source

#水电站发电量关联数据详情

zhongwei
yang_shj 11 months ago
parent
commit
38a1f1d2a7
  1. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  2. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -1242,7 +1242,7 @@ public class TargetServiceImpl implements TargetService {
detail.setElectric(Double.valueOf(mon.getPower()));
return detail;
}
detail.setElectric((double) (monMap.get(mon.getStrMonth()) + mon.getPower()));
detail.setElectric((double) (Optional.ofNullable(monMap.get(mon.getStrMonth())).orElse(0f) + mon.getPower()));
return detail;
}).collect(Collectors.toList());
}else if(HomePageConstant.MON.equals(type)){

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -178,7 +178,12 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
powerDay.setGenerate(0f);
return powerDay;
}
powerDay.setGenerate((float) records.stream().filter(record->record.getFillDate().equals(day)).mapToDouble(GenerateEntity::getGenerate).sum());
double sum = records.stream().filter(record->record.getFillDate().equals(day)).mapToDouble(GenerateEntity::getGenerate).sum();
if(Math.abs(sum) > 0){
powerDay.setGenerate((float)sum);
}else{
powerDay.setGenerate(0f);
}
return powerDay;
}).collect(Collectors.toList());
}
@ -231,7 +236,12 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
powerMonth.setPower(0f);
return powerMonth;
}
powerMonth.setPower((float) format.stream().filter(o->o.getFillDate().equals(mon)).mapToDouble(GenerateEntity::getGenerate).sum());
double sum = format.stream().filter(o->o.getFillDate().equals(mon)).mapToDouble(GenerateEntity::getGenerate).sum();
if(Math.abs(sum) > 0){
powerMonth.setPower((float)sum);
}else{
powerMonth.setPower(0f);
}
return powerMonth;
}).collect(Collectors.toList());
}

Loading…
Cancel
Save