|
@@ -1278,37 +1278,48 @@ public class DashboardService extends BaseService {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("mm");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("mm");
|
|
Calendar calendar = Calendar.getInstance();
|
|
Calendar calendar = Calendar.getInstance();
|
|
calendar.setTime(sysDate);
|
|
calendar.setTime(sysDate);
|
|
|
|
+ calendar.set(Calendar.SECOND,0);
|
|
|
|
+ calendar.set(Calendar.MILLISECOND,0);
|
|
int minutes = calendar.get(Calendar.MINUTE); // 分
|
|
int minutes = calendar.get(Calendar.MINUTE); // 分
|
|
- calendar.set(Calendar.SECOND,00);
|
|
|
|
|
|
+ calendar.set(Calendar.SECOND,0);
|
|
if(minutes > 00 && minutes <= 15){
|
|
if(minutes > 00 && minutes <= 15){
|
|
- calendar.set(Calendar.MINUTE,00);
|
|
|
|
- }else if(minutes > 15 && minutes <= 30){
|
|
|
|
calendar.set(Calendar.MINUTE,15);
|
|
calendar.set(Calendar.MINUTE,15);
|
|
- }else if(minutes > 30 && minutes <= 45){
|
|
|
|
|
|
+ }else if(minutes > 15 && minutes <= 30){
|
|
calendar.set(Calendar.MINUTE,30);
|
|
calendar.set(Calendar.MINUTE,30);
|
|
- }else if(minutes > 45 && minutes <= 59){
|
|
|
|
|
|
+ }else if(minutes > 30 && minutes <= 45){
|
|
calendar.set(Calendar.MINUTE,45);
|
|
calendar.set(Calendar.MINUTE,45);
|
|
|
|
+ }else if(minutes > 45 && minutes <= 59){
|
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, calendar.get(calendar.HOUR_OF_DAY) + 1);
|
|
|
|
+ calendar.set(Calendar.MINUTE,00);
|
|
|
|
+ }
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
- PowerStationStatusData powerStationStatusData = powerStationStatusDataRepository.findByTime(calendar.getTime());
|
|
|
|
- ForecastPowerShortTermHis forecastPowerShortTermHis = forecastPowerShortTermHisRepository.findByGenDate(calendar.getTime());
|
|
|
|
|
|
+ ForecastPowerShortTermHis forecastPowerShortTermHis = forecastPowerShortTermHisRepository.findByForecastTime(calendar.getTime().getTime());
|
|
|
|
+
|
|
BigDecimal realValue = BigDecimal.ZERO;
|
|
BigDecimal realValue = BigDecimal.ZERO;
|
|
BigDecimal ableValue = BigDecimal.ZERO;
|
|
BigDecimal ableValue = BigDecimal.ZERO;
|
|
- if(powerStationStatusData != null && forecastPowerShortTermHis != null){
|
|
|
|
|
|
+ if(powerStationStatusData.getId() != null && forecastPowerShortTermHis.getId() != null){
|
|
realValue = powerStationStatusData.getRealValue();
|
|
realValue = powerStationStatusData.getRealValue();
|
|
ableValue = forecastPowerShortTermHis.getAbleValue();
|
|
ableValue = forecastPowerShortTermHis.getAbleValue();
|
|
}
|
|
}
|
|
|
|
|
|
float abs = 0f;
|
|
float abs = 0f;
|
|
- if(realValue.compareTo(ableValue) > 0){
|
|
|
|
- if(realValue.compareTo(BigDecimal.ZERO) != 0 && ableValue.compareTo(BigDecimal.ZERO) !=0 ){
|
|
|
|
- abs = Math.abs(ableValue.subtract(realValue).divide(realValue).floatValue());
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- if(realValue.compareTo(BigDecimal.ZERO) != 0 && ableValue.compareTo(BigDecimal.ZERO) !=0 ) {
|
|
|
|
- abs = ableValue.subtract(realValue).divide(realValue).floatValue();
|
|
|
|
- }
|
|
|
|
|
|
+ if(realValue.compareTo(BigDecimal.ZERO) == 1 && ableValue.compareTo(BigDecimal.ZERO) ==1 ){
|
|
|
|
+ abs = Math.abs(ableValue.subtract(realValue).divide(realValue).multiply(new BigDecimal(100)).floatValue());
|
|
}
|
|
}
|
|
- if(abs > 20){
|
|
|
|
|
|
+
|
|
|
|
+ if(abs >= 20){
|
|
boom = true;
|
|
boom = true;
|
|
}
|
|
}
|
|
map.put("boom", boom);
|
|
map.put("boom", boom);
|