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 db167b0..bd0cf92 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 @@ -1103,9 +1103,11 @@ public class RealTargetServiceImpl implements RealTargetService { * @return */ private Map getWaterLevelMap(String instanceCode, String signage) { - String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; - String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); - List datas = dataService.periodTargetData(beginTime, endTime,6, 2,instanceCode,signage); + // 开始日期 + String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 结束日期 + String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59"; + List datas = dataService.periodTargetData(start, end,6, 2,instanceCode,signage); if(CollectionUtil.isEmpty(datas)){ return new HashMap<>(); } @@ -1115,8 +1117,8 @@ public class RealTargetServiceImpl implements RealTargetService { return dateTime.getHours(); }, value -> { - if(StringUtil.isBlank(value.getVal())){ - return "0"; + if(StringUtil.isEmpty(value.getVal())){ + return ""; } return value.getVal(); }) @@ -1379,12 +1381,10 @@ public class RealTargetServiceImpl implements RealTargetService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - // 结束日期 - Calendar calendar = Calendar.getInstance(); - String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); // 开始日期 - calendar.set(Calendar.HOUR_OF_DAY, calendar.get(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_DATE) + " 23:59:59"; List records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { return new ArrayList<>(); @@ -1394,7 +1394,9 @@ public class RealTargetServiceImpl implements RealTargetService { Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); load.setHour(time.getHours()); - load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); + if(StringUtil.isNotBlank(record.getVal())){ + load.setActivePower(record.getVal()); + } return load; }).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList()); }