临时提交
parent
1538ad358d
commit
7200e56d59
|
@ -298,6 +298,11 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchUpdate(List<CommonGbChannel> commonGbChannels) {
|
public void batchUpdate(List<CommonGbChannel> commonGbChannels) {
|
||||||
|
for (CommonGbChannel commonGbChannel : commonGbChannels) {
|
||||||
|
if (commonGbChannel.getCommonGbDeviceID().equals("34020000001310000002")) {
|
||||||
|
System.out.println("34020000001310000002====" + commonGbChannel.getCommonGbStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (commonGbChannels.isEmpty()) {
|
if (commonGbChannels.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,7 +592,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
});
|
});
|
||||||
if (!addChannelList.isEmpty()) {
|
if (!addChannelList.isEmpty()) {
|
||||||
addChannelList.stream().forEach(channel ->{
|
addChannelList.stream().forEach(channel ->{
|
||||||
channel.setCommonGbChannelId(commonChannelDeviceAndIdMap.get(channel.getChannelId()));
|
Integer commonGbChannelId = commonChannelDeviceAndIdMap.get(channel.getChannelId());
|
||||||
|
if (commonGbChannelId != null) {
|
||||||
|
channel.setCommonGbChannelId(commonGbChannelId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
addChannelHandler(addChannelList);
|
addChannelHandler(addChannelList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
device.setCreateTime(now);
|
device.setCreateTime(now);
|
||||||
deviceMapper.update(device);
|
deviceMapper.update(device);
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
|
List<Integer> ids = deviceChannelMapper.getCommonChannelIdList(device.getDeviceId(), true);
|
||||||
|
if (!ids.isEmpty()) {
|
||||||
|
commonGbChannelService.onlineForList(ids);
|
||||||
|
}
|
||||||
if (userSetting.getSyncChannelOnDeviceOnline()) {
|
if (userSetting.getSyncChannelOnDeviceOnline()) {
|
||||||
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||||
try {
|
try {
|
||||||
|
@ -155,10 +159,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
}
|
}
|
||||||
sync(device);
|
sync(device);
|
||||||
}
|
}
|
||||||
List<Integer> ids = deviceChannelMapper.getCommonChannelIdList(device.getDeviceId());
|
|
||||||
if (!ids.isEmpty()) {
|
|
||||||
commonGbChannelService.onlineForList(ids);
|
|
||||||
}
|
|
||||||
// 上线添加订阅
|
// 上线添加订阅
|
||||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||||
// 查询在线设备那些开启了订阅,为设备开启定时的目录订阅
|
// 查询在线设备那些开启了订阅,为设备开启定时的目录订阅
|
||||||
|
@ -216,7 +216,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
// 发送redis消息
|
// 发送redis消息
|
||||||
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, false);
|
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, false);
|
||||||
}
|
}
|
||||||
List<Integer> ids = deviceChannelMapper.getCommonChannelIdList(device.getDeviceId());
|
// 设备离线则其下的全部通用通道设置为离线
|
||||||
|
List<Integer> ids = deviceChannelMapper.getCommonChannelIdList(device.getDeviceId(), null);
|
||||||
if (!ids.isEmpty()) {
|
if (!ids.isEmpty()) {
|
||||||
commonGbChannelService.offlineForList(ids);
|
commonGbChannelService.offlineForList(ids);
|
||||||
}
|
}
|
||||||
|
@ -588,7 +589,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean delete(String deviceId) {
|
public boolean delete(String deviceId) {
|
||||||
List<Integer> commonChannelIdList = deviceChannelMapper.getCommonChannelIdList(deviceId);
|
List<Integer> commonChannelIdList = deviceChannelMapper.getCommonChannelIdList(deviceId, null);
|
||||||
if (!commonChannelIdList.isEmpty()) {
|
if (!commonChannelIdList.isEmpty()) {
|
||||||
commonGbChannelService.deleteByIdList(commonChannelIdList);
|
commonGbChannelService.deleteByIdList(commonChannelIdList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -816,43 +816,43 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
/**
|
/**
|
||||||
* 检查拉流代理状态
|
* 检查拉流代理状态
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "* 0/10 * * * ?")
|
// @Scheduled(cron = "* 0/10 * * * ?")
|
||||||
@Transactional
|
// @Transactional
|
||||||
public void asyncCheckStreamProxyStatus() {
|
// public void asyncCheckStreamProxyStatus() {
|
||||||
|
//
|
||||||
List<MediaServerItem> all = mediaServerService.getAllOnline();
|
// List<MediaServerItem> all = mediaServerService.getAllOnline();
|
||||||
if (CollectionUtils.isEmpty(all)){
|
// if (CollectionUtils.isEmpty(all)){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
Map<String, MediaServerItem> serverItemMap = all.stream().collect(
|
// Map<String, MediaServerItem> serverItemMap = all.stream().collect(
|
||||||
Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1));
|
// Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1));
|
||||||
List<StreamProxy> list = getAllForEnable();
|
// List<StreamProxy> list = getAllForEnable();
|
||||||
|
//
|
||||||
if (CollectionUtils.isEmpty(list)){
|
// if (CollectionUtils.isEmpty(list)){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
for (StreamProxy streamProxyItem : list) {
|
// for (StreamProxy streamProxyItem : list) {
|
||||||
MediaServerItem mediaServerItem = serverItemMap.get(streamProxyItem.getMediaServerId());
|
// MediaServerItem mediaServerItem = serverItemMap.get(streamProxyItem.getMediaServerId());
|
||||||
JSONObject mediaInfo = zlmresTfulUtils.isMediaOnline(mediaServerItem, streamProxyItem.getApp(),
|
// JSONObject mediaInfo = zlmresTfulUtils.isMediaOnline(mediaServerItem, streamProxyItem.getApp(),
|
||||||
streamProxyItem.getStream(), "rtsp");
|
// streamProxyItem.getStream(), "rtsp");
|
||||||
if (mediaInfo == null){
|
// if (mediaInfo == null){
|
||||||
if (streamProxyItem.isStatus()) {
|
// if (streamProxyItem.isStatus()) {
|
||||||
updateStatusById(streamProxyItem, false);
|
// updateStatusById(streamProxyItem, false);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
|
// if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
|
||||||
if (!streamProxyItem.isStatus()) {
|
// if (!streamProxyItem.isStatus()) {
|
||||||
updateStatusById(streamProxyItem, true);
|
// updateStatusById(streamProxyItem, true);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
if (streamProxyItem.isStatus()) {
|
// if (streamProxyItem.isStatus()) {
|
||||||
updateStatusById(streamProxyItem, false);
|
// updateStatusById(streamProxyItem, false);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList) {
|
public void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList) {
|
||||||
|
|
|
@ -64,8 +64,8 @@ public interface CommonChannelMapper {
|
||||||
|
|
||||||
|
|
||||||
@Delete(value = "<script>" +
|
@Delete(value = "<script>" +
|
||||||
"<foreach collection='channels' item='item' separator=';'>" +
|
"<foreach collection='channels' item='item' separator=';'> " +
|
||||||
"delete from wvp_common_channel WHERE common_gb_id=#{item.commonGbId}" +
|
" delete from wvp_common_channel WHERE common_gb_id=#{item.commonGbId}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int removeChannelsForGroup(List<CommonGbChannel> channels);
|
int removeChannelsForGroup(List<CommonGbChannel> channels);
|
||||||
|
|
|
@ -530,8 +530,9 @@ public interface DeviceChannelMapper {
|
||||||
"select common_gb_channel_id " +
|
"select common_gb_channel_id " +
|
||||||
"from wvp_device_channel " +
|
"from wvp_device_channel " +
|
||||||
"where device_id=#{deviceId}" +
|
"where device_id=#{deviceId}" +
|
||||||
|
"<if test='online != null'> and status = #{online} </if>" +
|
||||||
" </script>"})
|
" </script>"})
|
||||||
List<Integer> getCommonChannelIdList(@Param("deviceId") String deviceId);
|
List<Integer> getCommonChannelIdList(@Param("deviceId") String deviceId, @Param("online") Boolean online);
|
||||||
|
|
||||||
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.common_gb_channel_id=#{commonGbId}")
|
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.common_gb_channel_id=#{commonGbId}")
|
||||||
Device getDeviceByChannelCommonGbId(@Param("commonGbId") int commonGbId);
|
Device getDeviceByChannelCommonGbId(@Param("commonGbId") int commonGbId);
|
||||||
|
|
Loading…
Reference in New Issue