|
|
|
@ -98,7 +98,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<AlarmCountVo> counts() { |
|
|
|
|
public List<AlarmCountVo> counts(AlarmEntity alarm) { |
|
|
|
|
// 站点查询
|
|
|
|
|
List<StationEntity> stations = this.stations(); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
@ -114,13 +114,22 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
QueryWrapper wrapper = new QueryWrapper<>(); |
|
|
|
|
wrapper.eq("IS_RIGHT_TABULATION",0); |
|
|
|
|
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getStationId())){ |
|
|
|
|
wrapper.eq("STATION_ID",alarm.getStationId()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmSource())){ |
|
|
|
|
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmType())){ |
|
|
|
|
wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); |
|
|
|
|
} |
|
|
|
|
// 查询告警数据
|
|
|
|
|
List<AlarmEntity> alarms = this.list(wrapper); |
|
|
|
|
// 查询数量
|
|
|
|
|
return AlarmConstants.ALARAM_SOURCE.stream().map(source->{ |
|
|
|
|
AlarmCountVo count = new AlarmCountVo(); |
|
|
|
|
count.setType(source); |
|
|
|
|
if(CollectionUtil.isNotEmpty(alarms)){ |
|
|
|
|
if(CollectionUtil.isEmpty(alarms)){ |
|
|
|
|
count.setCount(0L); |
|
|
|
|
}else{ |
|
|
|
|
count.setCount(alarms.stream().filter(o->o.getAlarmSource().equals(source)).count()); |
|
|
|
|