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. 110
      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 = "站点")
public R<List<AlarmVideoVo>> alarmVideos(@ApiParam("站点编号") @RequestParam(required = false) String stationCode,
@ApiParam("设备编号") @RequestParam(required = false) String deviceCode,
@ApiParam("监测点ID") @RequestParam(required = false) String realId) {
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId));
@ApiParam("监测点ID") @RequestParam(required = false) String 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);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmSource);
}

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

@ -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) {
}
}
Loading…
Cancel
Save