commit
eefe6f4c8d
|
@ -143,6 +143,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||||
device.setGeoCoordSys("WGS84");
|
device.setGeoCoordSys("WGS84");
|
||||||
device.setTreeType("CivilCode");
|
device.setTreeType("CivilCode");
|
||||||
device.setDeviceId(deviceId);
|
device.setDeviceId(deviceId);
|
||||||
|
device.setOnline(0);
|
||||||
}
|
}
|
||||||
device.setIp(received);
|
device.setIp(received);
|
||||||
device.setPort(rPort);
|
device.setPort(rPort);
|
||||||
|
|
|
@ -86,10 +86,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
|
redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
|
||||||
}
|
}
|
||||||
device.setUpdateTime(now);
|
device.setUpdateTime(now);
|
||||||
device.setOnline(1);
|
|
||||||
|
|
||||||
// 第一次上线
|
// 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
|
||||||
if (device.getCreateTime() == null) {
|
if (device.getCreateTime() == null) {
|
||||||
|
device.setOnline(1);
|
||||||
device.setCreateTime(now);
|
device.setCreateTime(now);
|
||||||
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||||
deviceMapper.add(device);
|
deviceMapper.add(device);
|
||||||
|
@ -97,8 +97,19 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
commander.deviceInfoQuery(device);
|
commander.deviceInfoQuery(device);
|
||||||
sync(device);
|
sync(device);
|
||||||
}else {
|
}else {
|
||||||
|
if(device.getOnline() == 0){
|
||||||
|
device.setOnline(1);
|
||||||
|
device.setCreateTime(now);
|
||||||
|
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||||
deviceMapper.update(device);
|
deviceMapper.update(device);
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
|
commander.deviceInfoQuery(device);
|
||||||
|
sync(device);
|
||||||
|
}else {
|
||||||
|
deviceMapper.update(device);
|
||||||
|
redisCatchStorage.updateDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上线添加订阅
|
// 上线添加订阅
|
||||||
|
@ -125,6 +136,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
device.setOnline(0);
|
device.setOnline(0);
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
deviceMapper.update(device);
|
deviceMapper.update(device);
|
||||||
|
//进行通道离线
|
||||||
|
deviceChannelMapper.offlineByDeviceId(deviceId);
|
||||||
// 离线释放所有ssrc
|
// 离线释放所有ssrc
|
||||||
List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(deviceId, null, null, null);
|
List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(deviceId, null, null, null);
|
||||||
if (ssrcTransactions != null && ssrcTransactions.size() > 0) {
|
if (ssrcTransactions != null && ssrcTransactions.size() > 0) {
|
||||||
|
|
|
@ -140,6 +140,9 @@ public interface DeviceChannelMapper {
|
||||||
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
|
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
|
||||||
void offline(String deviceId, String channelId);
|
void offline(String deviceId, String channelId);
|
||||||
|
|
||||||
|
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"})
|
||||||
|
void offlineByDeviceId(String deviceId);
|
||||||
|
|
||||||
@Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
|
@Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
|
||||||
void online(String deviceId, String channelId);
|
void online(String deviceId, String channelId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue