diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java index d2988ee..4ebda2b 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java +++ b/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> 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)); } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java index 0bc7f77..e4cf0d6 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java @@ -23,5 +23,5 @@ public interface AlarmService extends BaseService { TextMessage majorAlarm(List depts); - List alarmVideos(String stationCode, String deviceCode, String realId); + List alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmSource); } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 51c8aa0..5f77527 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/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 * @return */ @Override - public List alarmVideos(String stationCode, String deviceCode, String realId) { - // 根据realId查找 - if(StringUtil.isNotBlank(realId)){ - // 查询站点 - R station = stationClient.getStationByCode(stationCode); - if(station.isSuccess() && ObjectUtil.isNotEmpty(station)){ - EmInfoEntity param = new EmInfoEntity(); - param.setDepartment(station.getData().getRefDept()); - // 查询设备 - R> 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> 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 alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmSource) { + // 步骤1、根据设备编号查询视频信息 if(StringUtil.isNotBlank(deviceCode)){ - // 查询设备绑定视频点位 - R> 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 videos = stationVideoTypeClient.listByStationId(stationCode); if(CollectionUtil.isNotEmpty(videos)){ return videos.stream().distinct().map(video->{ @@ -494,10 +455,55 @@ public class AlarmServiceImpl extends BaseServiceImpl alarmVideo.setPointCode(video.getPointCode()); return alarmVideo; }).collect(Collectors.toList()); + }else{ + // 站点不存在视频 } } throw new ServiceException("未查询到告警视频信息!"); } + /** + * 查询设备绑定视频信息 + * @param deviceCode + * @return + */ + private List deviceVideos(String stationCode,String deviceCode) { + // 查询设备绑定视频点位 + R> videos = emVideoClient.getEmBandingVideos(deviceCode); + if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){ + // 查询站点 + R station = stationClient.getStationByCode(stationCode); + if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){ + throw new ServiceException("未查询到设备绑定视频信息!"); + } + // 查询设备 + R 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) { + + + } + + } \ No newline at end of file