diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 169fe70..a7a0deb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/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)){ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index 8ed3a73..cd315be 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -178,7 +178,12 @@ public class GenerateServiceImpl extends BaseServiceImplrecord.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 BaseServiceImplo.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()); }