|
|
|
@ -427,62 +427,23 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId) { |
|
|
|
|
// 根据realId查找
|
|
|
|
|
if(StringUtil.isNotBlank(realId)){ |
|
|
|
|
// 查询站点
|
|
|
|
|
R<StationEntity> station = stationClient.getStationByCode(stationCode); |
|
|
|
|
if(station.isSuccess() && ObjectUtil.isNotEmpty(station)){ |
|
|
|
|
EmInfoEntity param = new EmInfoEntity(); |
|
|
|
|
param.setDepartment(station.getData().getRefDept()); |
|
|
|
|
// 查询设备
|
|
|
|
|
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(param); |
|
|
|
|
if(devices.isSuccess() && CollectionUtil.isNotEmpty(devices.getData())){ |
|
|
|
|
String deviceCodes = devices.getData().stream().parallel() |
|
|
|
|
.filter(this::isBandingVideoByEmCode) |
|
|
|
|
.filter(this::isDeviceCodeExist) |
|
|
|
|
.map(EmInfoEntity::getNumber) |
|
|
|
|
.filter(number -> this.isRealIdBanding(realId, number)) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
if(StringUtil.isNotBlank(deviceCodes)){ |
|
|
|
|
// 查询设备绑定视频点位
|
|
|
|
|
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCodes); |
|
|
|
|
if(videos.isSuccess() && CollectionUtil.isEmpty(videos.getData())){ |
|
|
|
|
return videos.getData().stream().distinct().map(video->{ |
|
|
|
|
AlarmVideoVo alarmVideo = new AlarmVideoVo(); |
|
|
|
|
alarmVideo.setVideoHost(video.getVideoHost()); |
|
|
|
|
alarmVideo.setVideoName(video.getVideoName()); |
|
|
|
|
alarmVideo.setVideoAppKey(video.getVideoAppKey()); |
|
|
|
|
alarmVideo.setVideoAppSecret(video.getVideoAppSecret()); |
|
|
|
|
alarmVideo.setPointCode(video.getPointCode()); |
|
|
|
|
return alarmVideo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
// FIXME 查询FDP设备编号
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 根据设备编号查找
|
|
|
|
|
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmSource) { |
|
|
|
|
// 步骤1、根据设备编号查询视频信息
|
|
|
|
|
if(StringUtil.isNotBlank(deviceCode)){ |
|
|
|
|
// 查询设备绑定视频点位
|
|
|
|
|
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCode); |
|
|
|
|
if(videos.isSuccess() && CollectionUtil.isNotEmpty(videos.getData())){ |
|
|
|
|
return videos.getData().stream().distinct().map(video->{ |
|
|
|
|
AlarmVideoVo alarmVideo = new AlarmVideoVo(); |
|
|
|
|
alarmVideo.setVideoHost(video.getVideoHost()); |
|
|
|
|
alarmVideo.setVideoName(video.getVideoName()); |
|
|
|
|
alarmVideo.setVideoAppKey(video.getVideoAppKey()); |
|
|
|
|
alarmVideo.setVideoAppSecret(video.getVideoAppSecret()); |
|
|
|
|
alarmVideo.setPointCode(video.getPointCode()); |
|
|
|
|
return alarmVideo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
return this.deviceVideos(stationCode,deviceCode); |
|
|
|
|
} |
|
|
|
|
// 步骤2、根据采集点查询视频信息
|
|
|
|
|
if(StringUtil.isNotBlank(realId)){ |
|
|
|
|
// 智能预警
|
|
|
|
|
if(AlarmConstants.EARLY.equals(alarmSource)){ |
|
|
|
|
this.earlyVideos(stationCode,realId); |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据站点编号查找
|
|
|
|
|
if(StringUtil.isNotBlank(stationCode)){ |
|
|
|
|
else if(StringUtil.isNotBlank(stationCode)){ |
|
|
|
|
List<StationVideoTypeEntity> videos = stationVideoTypeClient.listByStationId(stationCode); |
|
|
|
|
if(CollectionUtil.isNotEmpty(videos)){ |
|
|
|
|
return videos.stream().distinct().map(video->{ |
|
|
|
@ -494,10 +455,55 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
|
|
|
|
|
alarmVideo.setPointCode(video.getPointCode()); |
|
|
|
|
return alarmVideo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
}else{ |
|
|
|
|
// 站点不存在视频
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
throw new ServiceException("未查询到告警视频信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询设备绑定视频信息 |
|
|
|
|
* @param deviceCode |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<AlarmVideoVo> deviceVideos(String stationCode,String deviceCode) { |
|
|
|
|
// 查询设备绑定视频点位
|
|
|
|
|
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCode); |
|
|
|
|
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){ |
|
|
|
|
// 查询站点
|
|
|
|
|
R<StationEntity> station = stationClient.getStationByCode(stationCode); |
|
|
|
|
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){ |
|
|
|
|
throw new ServiceException("未查询到设备绑定视频信息!"); |
|
|
|
|
} |
|
|
|
|
// 查询设备
|
|
|
|
|
R<EmInfoEntity> device = emInfoClient.getEmInfoByEmCode(deviceCode); |
|
|
|
|
if(!device.isSuccess() || ObjectUtil.isEmpty(device.getData())){ |
|
|
|
|
throw new ServiceException("未查询到设备绑定视频信息!"); |
|
|
|
|
} |
|
|
|
|
throw new ServiceException("请在设备信息菜单绑定" + station.getData().getName() + "-" + device.getData().getName() + "视频信息!"); |
|
|
|
|
} |
|
|
|
|
return videos.getData().stream().distinct().map(video->{ |
|
|
|
|
AlarmVideoVo alarmVideo = new AlarmVideoVo(); |
|
|
|
|
alarmVideo.setVideoHost(video.getVideoHost()); |
|
|
|
|
alarmVideo.setVideoName(video.getVideoName()); |
|
|
|
|
alarmVideo.setVideoAppKey(video.getVideoAppKey()); |
|
|
|
|
alarmVideo.setVideoAppSecret(video.getVideoAppSecret()); |
|
|
|
|
alarmVideo.setPointCode(video.getPointCode()); |
|
|
|
|
return alarmVideo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询智能预警视频信息 |
|
|
|
|
* @param stationCode |
|
|
|
|
* @param realId |
|
|
|
|
*/ |
|
|
|
|
private void earlyVideos(String stationCode, String realId) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |