diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index f37ce48..538331c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -88,6 +88,9 @@ public interface MainConstants { // 站点实时数据 String REAL_TIME_DATA = "realTimeData"; + + String LOAD_STATION_ON_LINE = "loadStationOnLine"; + // 光伏站-机组指标数据 String LOAD_PHOTOVOLTAIC_TARGET = "loadPhotovoltaicTarget"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java index df48d92..fb9ae7b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -57,7 +57,7 @@ public class MonitorScheduledTask { * 站点在线状态同步 * @return ReturnT */ - @XxlJob(REAL_TIME_DATA) + @XxlJob(LOAD_STATION_ON_LINE) //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT loadStationOnLine(String param) { if (Func.isBlank(param)) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java index cea1f3e..8b6aca3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java @@ -168,25 +168,30 @@ public class HydroelectricServiceImpl implements HydroelectricService { device.setStartupDurationYear(-1.0); device.setShutDownDurationYear(-1.0); } - // 开停机数据 - Optional startStop = startStopTimes.stream().filter(o->iter.getEmCode().equals(o.getDeviceCode())).findFirst(); - if(startStop.isPresent()){ - if(startStop.get().getQuality() == 0){ - Date time; - if(startStop.get().getTime().contains(".000")){ - time = DateUtil.parse(startStop.get().getTime(), "yyyy-MM-dd HH:mm:ss.sss"); + if(CollectionUtil.isEmpty(startStopTimes)){ + device.setStartDownTime("-1"); + device.setStartupDownDuration(-1.0); + }else{ + // 开停机数据 + Optional startStop = startStopTimes.stream().filter(o->iter.getEmCode().equals(o.getDeviceCode())).findFirst(); + if(startStop.isPresent()){ + if(startStop.get().getQuality() == 0){ + Date time; + if(startStop.get().getTime().contains(".000")){ + time = DateUtil.parse(startStop.get().getTime(), "yyyy-MM-dd HH:mm:ss.sss"); + }else{ + time = DateUtil.parse(startStop.get().getTime(), DateUtil.PATTERN_DATETIME); + } + device.setStartDownTime(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); + device.setStartupDownDuration(BigDecimal.valueOf((System.currentTimeMillis() - time.getTime()) / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue()); }else{ - time = DateUtil.parse(startStop.get().getTime(), DateUtil.PATTERN_DATETIME); + device.setStartDownTime("-1"); + device.setStartupDownDuration(-1.0); } - device.setStartDownTime(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); - device.setStartupDownDuration(BigDecimal.valueOf((System.currentTimeMillis() - time.getTime()) / (1000 * 60 * 60.00)).setScale(2, RoundingMode.HALF_UP).doubleValue()); }else{ device.setStartDownTime("-1"); device.setStartupDownDuration(-1.0); } - }else{ - device.setStartDownTime("-1"); - device.setStartupDownDuration(-1.0); } return device; }).collect(Collectors.toList()));