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