临时提交
parent
bf3f141fe3
commit
e62d106a1f
|
@ -195,4 +195,7 @@ public class Device {
|
||||||
|
|
||||||
@Schema(description = "控制语音对讲流程,释放收到ACK后发流")
|
@Schema(description = "控制语音对讲流程,释放收到ACK后发流")
|
||||||
private boolean broadcastPushAfterAck;
|
private boolean broadcastPushAfterAck;
|
||||||
|
|
||||||
|
@Schema(description = "所属服务Id")
|
||||||
|
private String serverId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,12 @@ public class PlayController {
|
||||||
Assert.notNull(channelId, "通道国标编号不可为NULL");
|
Assert.notNull(channelId, "通道国标编号不可为NULL");
|
||||||
// 获取可用的zlm
|
// 获取可用的zlm
|
||||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
|
||||||
Assert.notNull(deviceId, "设备不存在");
|
Assert.notNull(deviceId, "设备不存在");
|
||||||
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
|
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
|
||||||
Assert.notNull(channel, "通道不存在");
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
|
||||||
|
|
||||||
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
|
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
|
||||||
|
|
||||||
RequestMessage requestMessage = new RequestMessage();
|
RequestMessage requestMessage = new RequestMessage();
|
||||||
|
|
|
@ -78,6 +78,7 @@ public interface DeviceMapper {
|
||||||
"as_message_channel,"+
|
"as_message_channel,"+
|
||||||
"broadcast_push_after_ack,"+
|
"broadcast_push_after_ack,"+
|
||||||
"geo_coord_sys,"+
|
"geo_coord_sys,"+
|
||||||
|
"server_id,"+
|
||||||
"on_line"+
|
"on_line"+
|
||||||
") VALUES (" +
|
") VALUES (" +
|
||||||
"#{deviceId}," +
|
"#{deviceId}," +
|
||||||
|
@ -108,6 +109,7 @@ public interface DeviceMapper {
|
||||||
"#{asMessageChannel}," +
|
"#{asMessageChannel}," +
|
||||||
"#{broadcastPushAfterAck}," +
|
"#{broadcastPushAfterAck}," +
|
||||||
"#{geoCoordSys}," +
|
"#{geoCoordSys}," +
|
||||||
|
"#{serverId}," +
|
||||||
"#{onLine}" +
|
"#{onLine}" +
|
||||||
")")
|
")")
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||||
|
@ -130,6 +132,7 @@ public interface DeviceMapper {
|
||||||
"<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" +
|
"<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" +
|
||||||
"<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" +
|
"<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" +
|
||||||
"<if test=\"expires != null\">, expires=#{expires}</if>" +
|
"<if test=\"expires != null\">, expires=#{expires}</if>" +
|
||||||
|
"<if test=\"serverId != null\">, server_id=#{serverId}</if>" +
|
||||||
"WHERE device_id=#{deviceId}"+
|
"WHERE device_id=#{deviceId}"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int update(Device device);
|
int update(Device device);
|
||||||
|
@ -207,9 +210,43 @@ public interface DeviceMapper {
|
||||||
"as_message_channel,"+
|
"as_message_channel,"+
|
||||||
"broadcast_push_after_ack,"+
|
"broadcast_push_after_ack,"+
|
||||||
"geo_coord_sys,"+
|
"geo_coord_sys,"+
|
||||||
|
"server_id,"+
|
||||||
"on_line"+
|
"on_line"+
|
||||||
" FROM wvp_device WHERE on_line = true")
|
" FROM wvp_device WHERE on_line = true")
|
||||||
List<Device> getOnlineDevices();
|
List<Device> getOnlineDevices();
|
||||||
|
@Select("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,"+
|
||||||
|
"server_id,"+
|
||||||
|
"on_line"+
|
||||||
|
" FROM wvp_device WHERE on_line = true and server_id = #{serverId}")
|
||||||
|
List<Device> getOnlineDevicesByServerId(@Param("serverId") String serverId);
|
||||||
|
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
"id,"+
|
"id,"+
|
||||||
|
@ -269,6 +306,7 @@ public interface DeviceMapper {
|
||||||
"geo_coord_sys,"+
|
"geo_coord_sys,"+
|
||||||
"on_line,"+
|
"on_line,"+
|
||||||
"stream_mode," +
|
"stream_mode," +
|
||||||
|
"server_id," +
|
||||||
"media_server_id"+
|
"media_server_id"+
|
||||||
") VALUES (" +
|
") VALUES (" +
|
||||||
"#{deviceId}," +
|
"#{deviceId}," +
|
||||||
|
@ -284,6 +322,7 @@ public interface DeviceMapper {
|
||||||
"#{geoCoordSys}," +
|
"#{geoCoordSys}," +
|
||||||
"#{onLine}," +
|
"#{onLine}," +
|
||||||
"#{streamMode}," +
|
"#{streamMode}," +
|
||||||
|
"#{serverId}," +
|
||||||
"#{mediaServerId}" +
|
"#{mediaServerId}" +
|
||||||
")")
|
")")
|
||||||
void addCustomDevice(Device device);
|
void addCustomDevice(Device device);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public interface IDeviceService {
|
||||||
* 获取所有在线设备
|
* 获取所有在线设备
|
||||||
* @return 设备列表
|
* @return 设备列表
|
||||||
*/
|
*/
|
||||||
List<Device> getAllOnlineDevice();
|
List<Device> getAllOnlineDevice(String serverId);
|
||||||
|
|
||||||
List<Device> getAllByStatus(Boolean status);
|
List<Device> getAllByStatus(Boolean status);
|
||||||
|
|
||||||
|
|
|
@ -353,8 +353,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Device> getAllOnlineDevice() {
|
public List<Device> getAllOnlineDevice(String serverId) {
|
||||||
return deviceMapper.getOnlineDevices();
|
return deviceMapper.getOnlineDevicesByServerId(serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.task;
|
package com.genersoft.iot.vmp.gb28181.task;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||||
|
@ -60,9 +61,12 @@ public class SipRunner implements CommandLineRunner {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISendRtpServerService sendRtpServerService;
|
private ISendRtpServerService sendRtpServerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) throws Exception {
|
public void run(String... args) throws Exception {
|
||||||
List<Device> deviceList = deviceService.getAllOnlineDevice();
|
List<Device> deviceList = deviceService.getAllOnlineDevice(userSetting.getServerId());
|
||||||
|
|
||||||
for (Device device : deviceList) {
|
for (Device device : deviceList) {
|
||||||
if (deviceService.expire(device)){
|
if (deviceService.expire(device)){
|
||||||
|
@ -86,7 +90,8 @@ public class SipRunner implements CommandLineRunner {
|
||||||
deviceMapInDb.put(device.getDeviceId(), device);
|
deviceMapInDb.put(device.getDeviceId(), device);
|
||||||
});
|
});
|
||||||
devicesInRedis.parallelStream().forEach(device -> {
|
devicesInRedis.parallelStream().forEach(device -> {
|
||||||
if (deviceMapInDb.get(device.getDeviceId()) == null) {
|
if (deviceMapInDb.get(device.getDeviceId()) == null
|
||||||
|
&& userSetting.getServerId().equals(device.getServerId())) {
|
||||||
redisCatchStorage.removeDevice(device.getDeviceId());
|
redisCatchStorage.removeDevice(device.getDeviceId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||||
device.setGeoCoordSys("WGS84");
|
device.setGeoCoordSys("WGS84");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
device.setServerId(userSetting.getServerId());
|
||||||
device.setIp(remoteAddressInfo.getIp());
|
device.setIp(remoteAddressInfo.getIp());
|
||||||
device.setPort(remoteAddressInfo.getPort());
|
device.setPort(remoteAddressInfo.getPort());
|
||||||
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||||
|
|
Loading…
Reference in New Issue