|
|
@ -20,9 +20,13 @@ import com.hnac.hzims.equipment.feign.IEmVideoClient; |
|
|
|
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.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.device.vo.DeviceInstanceEventVO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
@ -30,6 +34,7 @@ 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.Func; |
|
|
|
|
|
|
|
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; |
|
|
@ -59,10 +64,15 @@ 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; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询告警列表 |
|
|
|
* 查询告警列表 |
|
|
|
* @param alarm |
|
|
|
* @param alarm |
|
|
@ -274,9 +284,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.getSourceAttrSignage())); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -409,16 +430,71 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity> |
|
|
|
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId) { |
|
|
|
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId) { |
|
|
|
// 根据realId查找
|
|
|
|
// 根据realId查找
|
|
|
|
if(StringUtil.isNotBlank(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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 根据设备编号查找
|
|
|
|
// 根据设备编号查找
|
|
|
|
if(StringUtil.isNotBlank(deviceCode)){ |
|
|
|
if(StringUtil.isNotBlank(deviceCode)){ |
|
|
|
|
|
|
|
// 查询设备绑定视频点位
|
|
|
|
|
|
|
|
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCode); |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 根据站点编号查找
|
|
|
|
// 根据站点编号查找
|
|
|
|
if(StringUtil.isNotBlank(stationCode)){ |
|
|
|
if(StringUtil.isNotBlank(stationCode)){ |
|
|
|
|
|
|
|
List<StationVideoTypeEntity> videos = stationVideoTypeClient.listByStationId(stationCode); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(videos)){ |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
throw new ServiceException("未查询到告警视频信息!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |