diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 640af35..70bd210 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -1123,9 +1123,7 @@ public class RealTargetServiceImpl implements RealTargetService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.HOUR_OF_DAY,-24); - String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); + String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index f8b4c12..30f77cf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -272,7 +272,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { return new ArrayList<>(); } List actives = new ArrayList<>(); - targetList.stream().filter(o->o.getDeptId().equals(refDept)).map(HydropowerUnitTargetVo::getActivePowerVoList).collect(Collectors.toList()).forEach(actives::addAll); + targetList.stream().filter(o-> CollectionUtil.isNotEmpty(o.getActivePowerVoList()) && ObjectUtil.isNotEmpty(o.getDeptId()) && o.getDeptId().equals(refDept)).map(HydropowerUnitTargetVo::getActivePowerVoList).collect(Collectors.toList()).forEach(actives::addAll); if(CollectionUtil.isEmpty(actives)){ return new ArrayList<>(); } @@ -282,7 +282,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { activePower.setHour(entry.getKey()); activePower.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o->Double.parseDouble(o.getActivePower())).sum())); return activePower; - }).collect(Collectors.toList()); + }).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); } /**