|
|
@ -1,44 +1,49 @@ |
|
|
|
package com.hnac.hzims.alarm.show.service.impl; |
|
|
|
package com.hnac.hzims.alarm.show.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.hnac.hzims.alarm.config.service.AlarmConfigService; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmConstants; |
|
|
|
import com.hnac.hzims.alarm.config.constants.AlarmConstants; |
|
|
|
import com.hnac.hzims.alarm.config.entity.AlarmEntity; |
|
|
|
import com.hnac.hzims.alarm.config.entity.AlarmEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.service.AlarmConfigService; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; |
|
|
|
import com.hnac.hzims.alarm.show.mapper.AlarmMapper; |
|
|
|
import com.hnac.hzims.alarm.show.mapper.AlarmMapper; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmHandleService; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmHandleService; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
import com.hnac.hzims.alarm.show.service.AlarmService; |
|
|
|
|
|
|
|
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo; |
|
|
|
import com.hnac.hzims.alarm.show.vo.ShowQueryVo; |
|
|
|
import com.hnac.hzims.alarm.show.vo.ShowQueryVo; |
|
|
|
import com.hnac.hzims.alarm.source.service.MessageService; |
|
|
|
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.business.ws.alart.vo.AlartParamVo; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmVideoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmVideoClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.fdp.util.HttpRequestUtil; |
|
|
|
import com.hnac.hzims.message.dto.MailMessageDTO; |
|
|
|
import com.hnac.hzims.message.dto.MailMessageDTO; |
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
|
|
|
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceEventVO; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
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.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
import org.springframework.web.socket.TextMessage; |
|
|
|
import org.springframework.web.socket.TextMessage; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
@ -47,7 +52,7 @@ import java.util.stream.Collectors; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author ysj |
|
|
|
* @author ysj |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@AllArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> implements AlarmService { |
|
|
|
public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> implements AlarmService { |
|
|
@ -63,10 +68,18 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
private final IStationClient stationClient; |
|
|
|
private final IStationClient stationClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IMessageClient messageClient; |
|
|
|
private final IMessageClient messageClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IEmInfoClient emInfoClient; |
|
|
|
private final IEmInfoClient emInfoClient; |
|
|
|
|
|
|
|
|
|
|
|
private final DeviceClient deviceClient; |
|
|
|
private final DeviceClient deviceClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IEmVideoClient emVideoClient; |
|
|
|
private final IEmVideoClient emVideoClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IStationVideoTypeClient stationVideoTypeClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.url.getFaultGraphInfo}") |
|
|
|
|
|
|
|
private String FAULTGRAPH_INFO_PATH; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询告警列表 |
|
|
|
* 查询告警列表 |
|
|
|
* @param showQuery |
|
|
|
* @param showQuery |
|
|
@ -234,7 +247,8 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); |
|
|
|
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
|
|
|
|
/* @Override |
|
|
|
public List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode, String realId) { |
|
|
|
public List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode, String realId) { |
|
|
|
R<StationEntity> stationR = stationClient.getStationByCode(stationCode); |
|
|
|
R<StationEntity> stationR = stationClient.getStationByCode(stationCode); |
|
|
|
Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData()), () -> { |
|
|
|
Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData()), () -> { |
|
|
@ -250,8 +264,8 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
String emCodes = emInfoList.stream().parallel() |
|
|
|
String emCodes = emInfoList.stream().parallel() |
|
|
|
.filter(this::isBandingVideoByEmCode) |
|
|
|
.filter(this::isBandingVideoByEmCode) |
|
|
|
.filter(this::isDeviceCodeExist) |
|
|
|
.filter(this::isDeviceCodeExist) |
|
|
|
|
|
|
|
.filter(em -> this.isRealIdBanding(realId, em.getNumber())) |
|
|
|
.map(EmInfoEntity::getNumber) |
|
|
|
.map(EmInfoEntity::getNumber) |
|
|
|
.filter(number -> this.isRealIdBanding(realId, number)) |
|
|
|
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
Assert.isTrue(StringUtil.isNotBlank(emCodes) && Func.isNotEmpty(emCodes), () -> { |
|
|
|
Assert.isTrue(StringUtil.isNotBlank(emCodes) && Func.isNotEmpty(emCodes), () -> { |
|
|
|
throw new ServiceException("未获取到设备!"); |
|
|
|
throw new ServiceException("未获取到设备!"); |
|
|
@ -261,7 +275,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
throw new ServiceException("获取设备绑定视频列表失败!"); |
|
|
|
throw new ServiceException("获取设备绑定视频列表失败!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return videoListR.getData().stream().distinct().collect(Collectors.toList()); |
|
|
|
return videoListR.getData().stream().distinct().collect(Collectors.toList()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 验证设备编号是否绑定视频 |
|
|
|
* 验证设备编号是否绑定视频 |
|
|
@ -279,9 +293,20 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
* @return 绑定结果 |
|
|
|
* @return 绑定结果 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Boolean isRealIdBanding(String realId,String emCode) { |
|
|
|
private Boolean isRealIdBanding(String realId,String emCode) { |
|
|
|
R<List<DeviceInstanceAttrVO>> deviceAttrR = deviceClient.getOnlineAttr(emCode); |
|
|
|
// 属性
|
|
|
|
if(deviceAttrR.isSuccess() && CollectionUtil.isNotEmpty(deviceAttrR.getData())) { |
|
|
|
R<List<DeviceInstanceAttrVO>> attrs = deviceClient.getOnlineAttr(emCode); |
|
|
|
return deviceAttrR.getData().stream().anyMatch(attr -> realId.equals(attr.getFacDeviceAttrId())); |
|
|
|
if(attrs.isSuccess() && CollectionUtil.isNotEmpty(attrs.getData())) { |
|
|
|
|
|
|
|
return attrs.getData().stream().anyMatch(attr -> realId.equals(attr.getFacDeviceAttrId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 事件
|
|
|
|
|
|
|
|
R<List<DeviceInstanceEventVO>> events = deviceClient.getOnlineEvent(emCode); |
|
|
|
|
|
|
|
if(events.isSuccess() && CollectionUtil.isNotEmpty(events.getData())) { |
|
|
|
|
|
|
|
return events.getData().stream().anyMatch(event -> realId.equals(event.getFacDeviceEventId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 功能
|
|
|
|
|
|
|
|
R<List<DeviceInstanceFuncVO>> funcs = deviceClient.getOnlineFunc(emCode); |
|
|
|
|
|
|
|
if(funcs.isSuccess() && CollectionUtil.isNotEmpty(funcs.getData())) { |
|
|
|
|
|
|
|
return funcs.getData().stream().anyMatch(func -> realId.equals(func.getFacDeviceFuncId())); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -402,4 +427,164 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取告警视频信息 |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
* @param deviceCode |
|
|
|
|
|
|
|
* @param realId |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType) { |
|
|
|
|
|
|
|
// 步骤1、根据设备编号查询视频信息
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(deviceCode)){ |
|
|
|
|
|
|
|
return this.deviceVideos(stationCode,deviceCode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 步骤2、根据采集点查询视频信息
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(realId)){ |
|
|
|
|
|
|
|
// 智能预警
|
|
|
|
|
|
|
|
if(AlarmConstants.EARLY.equals(alarmType)){ |
|
|
|
|
|
|
|
return this.earlyVideos(stationCode,realId); |
|
|
|
|
|
|
|
// 通讯中断、通讯异常查询站点视频
|
|
|
|
|
|
|
|
}else if(AlarmConstants.INTERRUPT.equals(alarmType) || AlarmConstants.ABNORMAL.equals(alarmType)){ |
|
|
|
|
|
|
|
return this.stationVideos(stationCode); |
|
|
|
|
|
|
|
// 其他告警
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return this.realIdVideos(stationCode,realId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 步骤3.根据站点编号查询视频信息
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(stationCode)){ |
|
|
|
|
|
|
|
return this.stationVideos(stationCode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
throw new ServiceException("未查询到告警视频信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
*查询站点绑定视频信息 |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<AlarmVideoVo> stationVideos(String stationCode) { |
|
|
|
|
|
|
|
List<StationVideoTypeEntity> videos = stationVideoTypeClient.listByStationId(stationCode); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(videos)){ |
|
|
|
|
|
|
|
throw new ServiceException("站点暂无视频信息!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return videos.stream().distinct().map(video->{ |
|
|
|
|
|
|
|
AlarmVideoVo alarmVideo = new AlarmVideoVo(); |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 查询设备绑定视频信息 |
|
|
|
|
|
|
|
* @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 faultId |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<AlarmVideoVo> earlyVideos(String stationCode, String faultId) { |
|
|
|
|
|
|
|
// 调用FDP接口查询设备编号
|
|
|
|
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
param.put("faultId", faultId); |
|
|
|
|
|
|
|
String result = HttpRequestUtil.postCall(param, FAULTGRAPH_INFO_PATH, "POST"); |
|
|
|
|
|
|
|
if (StringUtil.isBlank(result)) { |
|
|
|
|
|
|
|
throw new ServiceException("未查询到智能预警设备信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, Object> map = JSONObject.parseObject(result, new TypeReference<HashMap<String, Object>>() { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(map)) { |
|
|
|
|
|
|
|
throw new ServiceException("未查询到智能预警设备信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<HashMap<String, Object>> data = JSONObject.parseObject(MapUtils.getString(map, "data"), new TypeReference<List<HashMap<String, Object>>>() { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(data)) { |
|
|
|
|
|
|
|
throw new ServiceException("未查询到智能预警设备信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String deviceCode = (String) data.get(0).get("TAOS_INSTANCE"); |
|
|
|
|
|
|
|
if(StringUtil.isBlank(deviceCode)){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到智能预警设备信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.deviceVideos(stationCode,deviceCode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 查询采集点绑定视频信息 |
|
|
|
|
|
|
|
* @param stationCode |
|
|
|
|
|
|
|
* @param realId |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<AlarmVideoVo> realIdVideos(String stationCode, String realId) { |
|
|
|
|
|
|
|
// 查询站点
|
|
|
|
|
|
|
|
R<StationEntity> station = stationClient.getStationByCode(stationCode); |
|
|
|
|
|
|
|
if(!station.isSuccess() || ObjectUtil.isEmpty(station)){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到告警采集点绑定视频信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
EmInfoEntity param = new EmInfoEntity(); |
|
|
|
|
|
|
|
param.setDepartment(station.getData().getRefDept()); |
|
|
|
|
|
|
|
// 查询设备
|
|
|
|
|
|
|
|
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(param); |
|
|
|
|
|
|
|
if(!devices.isSuccess() || CollectionUtil.isEmpty(devices.getData())){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到告警采集点绑定视频信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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.isEmpty(deviceCodes)){ |
|
|
|
|
|
|
|
throw new ServiceException("未查询到告警采集点绑定视频信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 查询设备绑定视频点位
|
|
|
|
|
|
|
|
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCodes); |
|
|
|
|
|
|
|
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){ |
|
|
|
|
|
|
|
throw new ServiceException("请在设备信息菜单绑定" + station.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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |