Browse Source

#定时任务修改

zhongwei
yang_shj 2 months ago
parent
commit
ffe9e4480b
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java
  2. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  3. 31
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

3
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 REAL_TIME_DATA = "realTimeData";
String LOAD_STATION_ON_LINE = "loadStationOnLine";
// 光伏站-机组指标数据 // 光伏站-机组指标数据
String LOAD_PHOTOVOLTAIC_TARGET = "loadPhotovoltaicTarget"; String LOAD_PHOTOVOLTAIC_TARGET = "loadPhotovoltaicTarget";

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -57,7 +57,7 @@ public class MonitorScheduledTask {
* 站点在线状态同步 * 站点在线状态同步
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(REAL_TIME_DATA) @XxlJob(LOAD_STATION_ON_LINE)
//@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadStationOnLine(String param) { public ReturnT<String> loadStationOnLine(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {

31
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.setStartupDurationYear(-1.0);
device.setShutDownDurationYear(-1.0); device.setShutDownDurationYear(-1.0);
} }
// 开停机数据 if(CollectionUtil.isEmpty(startStopTimes)){
Optional<StartStopTimeVO> startStop = startStopTimes.stream().filter(o->iter.getEmCode().equals(o.getDeviceCode())).findFirst(); device.setStartDownTime("-1");
if(startStop.isPresent()){ device.setStartupDownDuration(-1.0);
if(startStop.get().getQuality() == 0){ }else{
Date time; // 开停机数据
if(startStop.get().getTime().contains(".000")){ Optional<StartStopTimeVO> startStop = startStopTimes.stream().filter(o->iter.getEmCode().equals(o.getDeviceCode())).findFirst();
time = DateUtil.parse(startStop.get().getTime(), "yyyy-MM-dd HH:mm:ss.sss"); 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{ }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{ }else{
device.setStartDownTime("-1"); device.setStartDownTime("-1");
device.setStartupDownDuration(-1.0); device.setStartupDownDuration(-1.0);
} }
}else{
device.setStartDownTime("-1");
device.setStartupDownDuration(-1.0);
} }
return device; return device;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));

Loading…
Cancel
Save