临时提交

This commit is contained in:
648540858
2024-07-10 14:43:22 +08:00
parent bb609b7e09
commit b843958ed7
31 changed files with 361 additions and 302 deletions

View File

@@ -184,7 +184,7 @@ public class DeviceChannel extends CommonGBChannel {
private String streamId;
@Schema(description = "是否含有音频")
private Boolean hasAudio;
private boolean hasAudio;
@Schema(description = "GPS的更新时间")
private String gpsTime;

View File

@@ -162,13 +162,11 @@ public interface DeviceChannelMapper {
" coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" from " +
" wvp_device_channel dc " +
" left join wvp_device d on d.id=dc.device_db_id" +
" WHERE " +
" d.device_id = #{deviceId} " +
" dc.device_db_id = #{deviceDbId} " +
" <if test='query != null'> AND (" +
"dc.device_id LIKE concat('%',#{query},'%') " +
"OR dc.name LIKE concat('%',#{query},'%') " +
"OR dc.custom_name LIKE concat('%',#{query},'%')" +
"coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
"OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') " +
")</if> " +
" <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status= true</if>" +
@@ -180,7 +178,7 @@ public interface DeviceChannelMapper {
"</foreach> </if>" +
"ORDER BY dc.device_id " +
" </script>"})
List<DeviceChannel> queryChannels(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
List<DeviceChannel> queryChannels(@Param("deviceDbId") int deviceDbId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Select("select\n" +
@@ -607,7 +605,7 @@ public interface DeviceChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where device_db_id=#{deviceDbId}" +
" <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
@@ -636,4 +634,103 @@ public interface DeviceChannelMapper {
"</script>"})
void batchUpdatePosition(List<DeviceChannel> channelList);
@Select(value = {" <script>" +
"SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where id=#{id}" +
" </script>"})
DeviceChannel getOne(@Param("id") int id);
@Select(value = {" <script>" +
"SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where device_db_id=#{deviceDbId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" </script>"})
DeviceChannel getOneByDeviceId(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
}

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -300,4 +301,45 @@ public interface DeviceMapper {
@Select("select * FROM wvp_device where as_message_channel = true")
List<Device> queryDeviceWithAsMessageChannel();
@Select(" <script>" +
"SELECT " +
"id, " +
"device_id, " +
"coalesce(custom_name, name) as name, " +
"password, " +
"manufacturer, " +
"model, " +
"firmware, " +
"transport," +
"stream_mode," +
"ip,"+
"sdp_ip,"+
"local_ip,"+
"port,"+
"host_address,"+
"expires,"+
"register_time,"+
"keepalive_time,"+
"create_time,"+
"update_time,"+
"charset,"+
"subscribe_cycle_for_catalog,"+
"subscribe_cycle_for_mobile_position,"+
"mobile_position_submission_interval,"+
"subscribe_cycle_for_alarm,"+
"ssrc_check,"+
"as_message_channel,"+
"broadcast_push_after_ack,"+
"geo_coord_sys,"+
"on_line,"+
"media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
" FROM wvp_device de" +
" where 1 = 1 "+
" <if test='status != null'> AND de.on_line=${status}</if>"+
" <if test='query != null'> AND coalesce(custom_name, name) as name LIKE '%${query}%'</if> " +
" order by create_time desc "+
" </script>")
List<Device> getDeviceList(@Param("query") String query, @Param("status") Boolean status);
}

View File

@@ -491,7 +491,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr;
int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null,
device.isSsrcCheck(), true, 0,false,!channel.getHasAudio(), false, tcpMode);
device.isSsrcCheck(), true, 0,false,!channel.isHasAudio(), false, tcpMode);
sendRtpItem.setStream(stream);
// 写入redis 超时时回复
redisCatchStorage.updateSendRTPSever(sendRtpItem);
@@ -522,7 +522,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
sendRtpItem.setPlayType(InviteStreamType.DOWNLOAD);
int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,!channel.getHasAudio(), false, tcpMode);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null,
device.isSsrcCheck(), true, 0, false,!channel.isHasAudio(), false, tcpMode);
sendRtpItem.setStream(ssrcInfo.getStream());
// 写入redis 超时时回复
redisCatchStorage.updateSendRTPSever(sendRtpItem);

View File

@@ -182,7 +182,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
log.info("[增加通道] 已存在,不发送通知只更新,设备: {}, 通道 {}", device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId());
DeviceChannel channel = catalogChannelEvent.getChannel();
channel.setId(deviceChannel.getId());
channel.setHasAudio(deviceChannel.getHasAudio());
channel.setHasAudio(deviceChannel.isHasAudio());
channel.setUpdateTime(DateUtil.getNow());
updateChannelMap.put(catalogChannelEvent.getChannel().getDeviceId(), channel);
} else {
@@ -211,7 +211,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
if (deviceChannelForUpdate != null) {
DeviceChannel channel = catalogChannelEvent.getChannel();
channel.setId(deviceChannelForUpdate.getId());
channel.setHasAudio(deviceChannelForUpdate.getHasAudio());
channel.setHasAudio(deviceChannelForUpdate.isHasAudio());
channel.setUpdateTime(DateUtil.getNow());
updateChannelMap.put(catalogChannelEvent.getChannel().getDeviceId(), channel);
} else {

View File

@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
@@ -49,7 +50,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
private IInviteStreamService inviteStreamService;
@Autowired
private IVideoManagerStorage storager;
private IDeviceService deviceService;
@Autowired
private SIPCommander cmder;
@@ -113,7 +114,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
responseAck(request, Response.NOT_FOUND, "stream " + streamId + " not found");
return;
}
Device device1 = storager.queryVideoDevice(inviteInfo.getDeviceId());
Device device1 = deviceService.getDevice(inviteInfo.getDeviceId());
if (inviteInfo.getStreamInfo() != null) {
cmder.playbackControlCmd(device1,inviteInfo.getStreamInfo(),new String(evt.getRequest().getRawContent()),eventResult -> {
// 失败的回复