|
@@ -1283,33 +1283,34 @@ public class DashboardService extends BaseService {
|
|
|
int minutes = calendar.get(Calendar.MINUTE); // 分
|
|
|
calendar.set(Calendar.SECOND,0);
|
|
|
if(minutes > 00 && minutes <= 15){
|
|
|
- calendar.set(Calendar.MINUTE,15);
|
|
|
+ calendar.set(Calendar.MINUTE,00);
|
|
|
}else if(minutes > 15 && minutes <= 30){
|
|
|
- calendar.set(Calendar.MINUTE,30);
|
|
|
+ calendar.set(Calendar.MINUTE,15);
|
|
|
}else if(minutes > 30 && minutes <= 45){
|
|
|
- calendar.set(Calendar.MINUTE,45);
|
|
|
+ calendar.set(Calendar.MINUTE,30);
|
|
|
}else if(minutes > 45 && minutes <= 59){
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, calendar.get(calendar.HOUR_OF_DAY) + 1);
|
|
|
- calendar.set(Calendar.MINUTE,00);
|
|
|
+ calendar.set(Calendar.MINUTE,45);
|
|
|
}
|
|
|
- Date time = calendar.getTime();
|
|
|
|
|
|
- System.out.println( "time+++++++++++++++++"+time);
|
|
|
Date startTime = new Date(calendar.getTime().getTime() - 1000l);
|
|
|
Date endTime = new Date(calendar.getTime().getTime() + 60 * 1000l);
|
|
|
- long time1 = calendar.getTimeInMillis();
|
|
|
- System.out.println( "time11111111111111111111+++++++++++"+time1);
|
|
|
|
|
|
List<PowerStationStatusData> byTimeBetween = powerStationStatusDataRepository.findByTimeBetween(startTime, endTime);
|
|
|
PowerStationStatusData powerStationStatusData = new PowerStationStatusData();
|
|
|
if(byTimeBetween.size() > 0){
|
|
|
powerStationStatusData = byTimeBetween.get(0);
|
|
|
}
|
|
|
- ForecastPowerShortTermHis forecastPowerShortTermHis = forecastPowerShortTermHisRepository.findByForecastTime(calendar.getTime().getTime());
|
|
|
-
|
|
|
+ List<ForecastPowerShortTermHis> byForecastTimeBetween = forecastPowerShortTermHisRepository.findByForecastTimeBetween(startTime.getTime(), endTime.getTime());
|
|
|
+ ForecastPowerShortTermHis forecastPowerShortTermHis = new ForecastPowerShortTermHis();
|
|
|
+ if(byForecastTimeBetween.size() > 0){
|
|
|
+ forecastPowerShortTermHis = byForecastTimeBetween.get(0);
|
|
|
+ }
|
|
|
BigDecimal realValue = BigDecimal.ZERO;
|
|
|
BigDecimal ableValue = BigDecimal.ZERO;
|
|
|
- if(powerStationStatusData.getId() != null && forecastPowerShortTermHis.getId() != null){
|
|
|
+ if(powerStationStatusData.getAbleValue().compareTo(new BigDecimal(-99)) == 0 && forecastPowerShortTermHis.getAbleValue() == null){
|
|
|
+ // 对象不存在
|
|
|
+ boom = true;
|
|
|
+ }else{
|
|
|
realValue = powerStationStatusData.getRealValue();
|
|
|
ableValue = forecastPowerShortTermHis.getAbleValue();
|
|
|
}
|
|
@@ -1322,6 +1323,13 @@ public class DashboardService extends BaseService {
|
|
|
if(abs >= 20){
|
|
|
boom = true;
|
|
|
}
|
|
|
+
|
|
|
+ log.info("---------------------------实际功率与预测功率差值过大报警功能已开启---------------------------");
|
|
|
+ log.info("实际功率:"+ realValue);
|
|
|
+ log.info("预测功率:" + ableValue);
|
|
|
+ log.info("是否报警:" + boom);
|
|
|
+ log.info("------------------------------------------------------------------------");
|
|
|
+
|
|
|
map.put("boom", boom);
|
|
|
return map;
|
|
|
}
|