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