|
|
|
@ -9,9 +9,11 @@ import com.hnac.hzims.alarm.config.entity.AlarmEntity;
|
|
|
|
|
import com.hnac.hzims.alarm.show.mapper.AlarmMapper; |
|
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmHandleService; |
|
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
|
import com.hnac.hzims.alarm.show.vo.ShowQueryVo; |
|
|
|
|
import com.hnac.hzims.alarm.source.service.MessageService; |
|
|
|
|
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; |
|
|
|
|
import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; |
|
|
|
|
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo; |
|
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
|
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; |
|
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
@ -31,6 +33,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
@ -66,13 +69,13 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询告警列表 |
|
|
|
|
* @param alarm |
|
|
|
|
* @param showQuery |
|
|
|
|
* @param page |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page) { |
|
|
|
|
List<StationEntity> stations = this.stations(); |
|
|
|
|
public IPage<AlarmEntity> alarms(ShowQueryVo showQuery, IPage<AlarmEntity> page) { |
|
|
|
|
List<StationEntity> stations = this.stations(showQuery.getServeType()); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
@ -83,14 +86,14 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
wrapper.eq("IS_RIGHT_TABULATION",0); |
|
|
|
|
wrapper.eq("STATUS",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(showQuery.getStationId())){ |
|
|
|
|
wrapper.eq("STATION_ID",showQuery.getStationId()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmSource())){ |
|
|
|
|
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); |
|
|
|
|
if(!StringUtil.isEmpty(showQuery.getAlarmSource())){ |
|
|
|
|
wrapper.eq("ALARM_SOURCE",showQuery.getAlarmSource()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmType())){ |
|
|
|
|
wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); |
|
|
|
|
if(!StringUtil.isEmpty(showQuery.getAlarmType())){ |
|
|
|
|
wrapper.eq("ALARM_TYPE",showQuery.getAlarmType()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 处理告警过滤 :当天处理告警
|
|
|
|
@ -107,9 +110,11 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
* 获取权限站点 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<StationEntity> stations() { |
|
|
|
|
private List<StationEntity> stations(Integer serveType) { |
|
|
|
|
StationEntity station = new StationEntity(); |
|
|
|
|
//station.setServeType("2");
|
|
|
|
|
if(ObjectUtil.isNotEmpty(serveType)){ |
|
|
|
|
station.setServeType(String.valueOf(serveType)); |
|
|
|
|
} |
|
|
|
|
station.setType(0); |
|
|
|
|
R<List<StationEntity>> result = stationClient.list(station); |
|
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
@ -123,9 +128,9 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<AlarmCountVo> counts(AlarmEntity alarm) { |
|
|
|
|
public List<AlarmCountVo> counts(ShowQueryVo showCount) { |
|
|
|
|
// 站点查询
|
|
|
|
|
List<StationEntity> stations = this.stations(); |
|
|
|
|
List<StationEntity> stations = this.stations(showCount.getServeType()); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
return AlarmConstants.ALARAM_SOURCE.stream().map(source->{ |
|
|
|
|
AlarmCountVo count = new AlarmCountVo(); |
|
|
|
@ -140,14 +145,14 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
wrapper.eq("IS_RIGHT_TABULATION",0); |
|
|
|
|
wrapper.eq("STATUS",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(showCount.getStationId())){ |
|
|
|
|
wrapper.eq("STATION_ID",showCount.getStationId()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmSource())){ |
|
|
|
|
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); |
|
|
|
|
if(!StringUtil.isEmpty(showCount.getAlarmSource())){ |
|
|
|
|
wrapper.eq("ALARM_SOURCE",showCount.getAlarmSource()); |
|
|
|
|
} |
|
|
|
|
if(!StringUtil.isEmpty(alarm.getAlarmType())){ |
|
|
|
|
wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); |
|
|
|
|
if(!StringUtil.isEmpty(showCount.getAlarmType())){ |
|
|
|
|
wrapper.eq("ALARM_TYPE",showCount.getAlarmType()); |
|
|
|
|
} |
|
|
|
|
// 处理告警过滤 :当天处理告警
|
|
|
|
|
List<String> handles = alarmHandleService.handles(); |
|
|
|
@ -177,9 +182,9 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<AlarmEntity> broadcast(String startTime, String endTime) { |
|
|
|
|
public List<AlarmEntity> broadcast(String startTime, String endTime,Integer serveType) { |
|
|
|
|
// 站点查询
|
|
|
|
|
List<StationEntity> stations = this.stations(); |
|
|
|
|
List<StationEntity> stations = this.stations(serveType); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
@ -197,17 +202,17 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 弹框告警 |
|
|
|
|
* @param depts |
|
|
|
|
* @param param |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public TextMessage majorAlarm(List<Long> depts) { |
|
|
|
|
public TextMessage majorAlarm(AlartParamVo param) { |
|
|
|
|
// 站点查询
|
|
|
|
|
List<StationEntity> stations = this.stations(); |
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
List<StationEntity> stations = this.stations(param.getServeType()); |
|
|
|
|
if(CollectionUtil.isEmpty(stations) || CollectionUtil.isEmpty(param.getDepts())){ |
|
|
|
|
return new TextMessage(new ArrayList().toString()); |
|
|
|
|
} |
|
|
|
|
List<String> effectives = stations.stream().filter(station->depts.contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList()); |
|
|
|
|
List<String> effectives = stations.stream().filter(station->param.getDepts().contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(effectives)){ |
|
|
|
|
return new TextMessage(new ArrayList().toString()); |
|
|
|
|
} |
|
|
|
@ -245,8 +250,8 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
String emCodes = emInfoList.stream().parallel() |
|
|
|
|
.filter(this::isBandingVideoByEmCode) |
|
|
|
|
.filter(this::isDeviceCodeExist) |
|
|
|
|
.filter(em -> this.isRealIdBanding(realId, em.getNumber())) |
|
|
|
|
.map(EmInfoEntity::getNumber) |
|
|
|
|
.filter(number -> this.isRealIdBanding(realId, number)) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
Assert.isTrue(StringUtil.isNotBlank(emCodes) && Func.isNotEmpty(emCodes), () -> { |
|
|
|
|
throw new ServiceException("未获取到设备!"); |
|
|
|
|