@ -566,6 +566,74 @@ public class RecordAlarmDataServiceImpl implements IRecordAlarmDataService {
}
}
}
}
@Override
public R < Boolean > dnthAlarmTask ( ) {
List < RecordAlarmRule > types = recordAlarmRuleMapper . selectEnergyTypes ( ) ;
for ( RecordAlarmRule rule : types ) {
System . out . println ( "kaishile" ) ;
Long timeRange = rule . getTimeRange ( ) ;
if ( timeRange = = 0 ) {
timeRange = 1L ;
}
Calendar instance = Calendar . getInstance ( ) ;
instance . add ( Calendar . MINUTE , - timeRange . intValue ( ) ) ;
Date time = instance . getTime ( ) ;
Long triggerNumber = rule . getTriggerNumber ( ) ;
if ( triggerNumber = = 0 ) {
triggerNumber = 1L ;
}
if ( rule . getEnergyType ( ) = = 4 ) {
List < RecordAlarmData > records = recordDnbInstantMapper . selectNoiseCount ( time , 50 ) ;
for ( RecordAlarmData record : records ) {
if ( record . getAlarmCount ( ) > triggerNumber ) {
RecordAlarmData alarmData = new RecordAlarmData ( ) ;
alarmData . setMonitorId ( record . getMonitorId ( ) ) ;
alarmData . setCollectTime ( new Date ( ) ) ;
alarmData . setAlarmType ( 3L ) ;
alarmData . setAlarmStatus ( 1L ) ;
alarmData . setAlarmData ( "超过噪声阈值" ) ;
recordAlarmDataMapper . insertRecordAlarmData ( alarmData ) ;
} else {
continue ;
}
}
} else if ( rule . getEnergyType ( ) = = 6 ) {
List < RecordAlarmData > records = recordDnbInstantMapper . selectDustCount ( time , 19 ) ;
for ( RecordAlarmData record : records ) {
if ( record . getAlarmCount ( ) > triggerNumber ) {
RecordAlarmData alarmData = new RecordAlarmData ( ) ;
alarmData . setMonitorId ( record . getMonitorId ( ) ) ;
alarmData . setCollectTime ( new Date ( ) ) ;
alarmData . setAlarmType ( 3L ) ;
alarmData . setAlarmStatus ( 1L ) ;
alarmData . setAlarmData ( "超过粉尘阈值" ) ;
recordAlarmDataMapper . insertRecordAlarmData ( alarmData ) ;
} else {
continue ;
}
}
} else if ( rule . getEnergyType ( ) = = 7 ) {
List < RecordAlarmData > records = recordDnbInstantMapper . selectTemAndHumCount ( time , 30 ) ;
for ( RecordAlarmData record : records ) {
if ( record . getAlarmCount ( ) > triggerNumber ) {
RecordAlarmData alarmData = new RecordAlarmData ( ) ;
alarmData . setMonitorId ( record . getMonitorId ( ) ) ;
alarmData . setCollectTime ( new Date ( ) ) ;
alarmData . setAlarmType ( 3L ) ;
alarmData . setAlarmStatus ( 1L ) ;
alarmData . setAlarmData ( "超过温湿度阈值" ) ;
recordAlarmDataMapper . insertRecordAlarmData ( alarmData ) ;
} else {
continue ;
}
}
}
}
return null ;
}
/ * *
/ * *
* 日 耗 量 告 警
* 日 耗 量 告 警
* @return
* @return