Browse Source

#告警关联视频查询

zhongwei
yang_shj 7 months ago
parent
commit
9036bf5556
  1. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  2. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  3. 102
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java

@ -60,8 +60,9 @@ public class ShowAlarmController extends BladeController {
@ApiOperation(value = "站点") @ApiOperation(value = "站点")
public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam(required = false) String stationCode, public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam(required = false) String stationCode,
@ApiParam("设备编号") @RequestParam(required = false) String deviceCode, @ApiParam("设备编号") @RequestParam(required = false) String deviceCode,
@ApiParam("监测点ID") @RequestParam(required = false) String realId) { @ApiParam("监测点ID") @RequestParam(required = false) String realId,
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId)); @ApiParam("告警类型") @RequestParam Integer alarmSource) {
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId,alarmSource));
} }
} }

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -23,5 +23,5 @@ public interface AlarmService extends BaseService<AlarmEntity> {
TextMessage majorAlarm(List<Long> depts); TextMessage majorAlarm(List<Long> depts);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId); List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmSource);
} }

102
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

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

Loading…
Cancel
Save