Browse Source

实际值与预测值差值大于百分之20报警修改

songhaodong 2 năm trước cách đây
mục cha
commit
90c1985f44

+ 1 - 1
ipfcst/ipfcst-reportquery/src/main/frontend/views/datav/index.vue

@@ -356,7 +356,7 @@
     this.init()
     this.getEl()
     this.test = setInterval(this.init,60*1000)
-    this.boom = setInterval(this.yesOrNoBoom,1000 * 60 * 15)
+    this.boom = setInterval(this.yesOrNoBoom,1000 * 60 * 15)//60 * 15
     this.windInfo()
   },
   methods: {

+ 20 - 12
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/DashboardService.java

@@ -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;
   }