| | |
| | | import com.ard.gb28181.api.utils.DateUtil; |
| | | import com.ard.gb28181.common.ErrorCode; |
| | | import com.ard.gb28181.config.UserSetting; |
| | | import com.ard.gb28181.domain.GbChannel; |
| | | import com.ard.gb28181.domain.GbDevice; |
| | | import com.ard.gb28181.service.IDeviceService; |
| | | import com.ard.gb28181.service.IGbChannelService; |
| | | import com.ard.gb28181.service.IGbDeviceService; |
| | | import com.ard.gb28181.service.IRedisCatchStorage; |
| | | import com.ard.gb28181.service.ISIPCommander; |
| | | import com.ard.gb28181.session.SipInviteSessionManager; |
| | |
| | | |
| | | @Autowired |
| | | private RemoteQsDeviceService remoteQsDeviceService; |
| | | |
| | | @Autowired |
| | | private IGbDeviceService gbDeviceService; |
| | | |
| | | @Autowired |
| | | private IGbChannelService gbChannelService; |
| | | |
| | | /** |
| | | * 查询设备信息 |
| | |
| | | } catch (Exception e) { |
| | | log.error("[同步设备状态] 设备上线,同步到 QS 模块失败:{}", device.getDeviceId(), e); |
| | | } |
| | | |
| | | // 设备注册成功时,自动在 ard_gb_device 表中创建设备记录(若不存在) |
| | | try { |
| | | GbDevice existingDevice = gbDeviceService.selectGbDeviceByGbDeviceId(device.getDeviceId()); |
| | | if (existingDevice == null) { |
| | | GbDevice gbDevice = new GbDevice(); |
| | | gbDevice.setGbDeviceId(device.getDeviceId()); |
| | | gbDevice.setDeviceName(device.getName() != null ? device.getName() : device.getDeviceId()); |
| | | gbDevice.setDeviceCode(device.getDeviceId()); |
| | | gbDevice.setStreamMode(device.getStreamMode() != null ? device.getStreamMode() : "TCP-PASSIVE"); |
| | | gbDevice.setEnableMp4("0"); |
| | | gbDeviceService.insertGbDevice(gbDevice); |
| | | log.info("[GbDevice自动创建] deviceId: {}, id: {}", device.getDeviceId(), gbDevice.getId()); |
| | | |
| | | // 同时创建默认通道(设备自身) |
| | | GbChannel gbChannel = new GbChannel(); |
| | | gbChannel.setGbDeviceId(device.getDeviceId()); |
| | | gbChannel.setGbChannelId(device.getDeviceId()); |
| | | gbChannel.setChannelName(device.getName() != null ? device.getName() : device.getDeviceId()); |
| | | gbChannel.setDeviceCode(device.getDeviceId()); |
| | | gbChannel.setStreamMode(device.getStreamMode() != null ? device.getStreamMode() : "TCP-PASSIVE"); |
| | | gbChannel.setEnableMp4("0"); |
| | | gbChannelService.insertGbChannel(gbChannel); |
| | | log.info("[GbChannel默认创建] deviceId: {}, channelId: {}, id: {}", |
| | | device.getDeviceId(), device.getDeviceId(), gbChannel.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("[GbDevice自动创建] 设备上线,自动创建失败:{}", device.getDeviceId(), e); |
| | | } |
| | | } |
| | | |
| | | @Override |