diff --git a/README.md b/README.md index 45b1964d..050c1386 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,6 @@ QQ私信一般不回, 精力有限.欢迎大家在群里讨论.觉得项目对 # 授权协议 本项目自有代码使用宽松的MIT协议,在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除; 由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。 在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议 - # 致谢 感谢作者[夏楚](https://github.com/xia-chu) 提供这么棒的开源流媒体服务框架,并在开发过程中给予支持与帮助。 感谢作者[dexter langhuihui](https://github.com/langhuihui) 开源这么好用的WEB播放器。 @@ -166,7 +165,7 @@ QQ私信一般不回, 精力有限.欢迎大家在群里讨论.觉得项目对 [hotcoffie](https://github.com/hotcoffie) [xiaomu](https://github.com/nikmu) [TristingChen](https://github.com/TristingChen) [chenparty](https://github.com/chenparty) [Hotleave](https://github.com/hotleave) [ydwxb](https://github.com/ydwxb) [ydpd](https://github.com/ydpd) [szy833](https://github.com/szy833) [ydwxb](https://github.com/ydwxb) [Albertzhu666](https://github.com/Albertzhu666) -[mk1990](https://github.com/mk1990) +[mk1990](https://github.com/mk1990) [SaltFish001](https://github.com/SaltFish001) ps: 刚增加了这个名单,肯定遗漏了一些大佬,欢迎大佬联系我添加。 diff --git a/sql/mysql.sql b/sql/mysql.sql index 6b937e5c..e3e9e234 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -48,6 +48,7 @@ CREATE TABLE `device` ( `ssrcCheck` int DEFAULT '0', `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'auto', `custom_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`), diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java index f8d64853..18dd1519 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java @@ -6,6 +6,7 @@ import java.util.Properties; /** * sip日志格式化 + * 暂不使用 */ public class SipLoggerPass implements StackLogger { diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index 7ba2c4ef..23a342b7 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -118,6 +118,7 @@ public class DeviceServiceImpl implements IDeviceService { } sync(device); }else { + if(device.getOnline() == 0){ device.setOnline(1); device.setCreateTime(now); @@ -132,6 +133,11 @@ public class DeviceServiceImpl implements IDeviceService { sync(device); // TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台 }else { + if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) { + logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId()); + sync(device); + } + deviceMapper.update(device); redisCatchStorage.updateDevice(device); } @@ -362,10 +368,10 @@ public class DeviceServiceImpl implements IDeviceService { return null; } // 使用行政区划展示树 - if (parentId.length() > 10) { - // TODO 可能是行政区划与业务分组混杂的情形 - return null; - } +// if (parentId.length() > 10) { +// // TODO 可能是行政区划与业务分组混杂的情形 +// return null; +// } if (parentId.length() == 10 ) { if (onlyCatalog) { @@ -380,7 +386,18 @@ public class DeviceServiceImpl implements IDeviceService { List channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2); if (!onlyCatalog) { List channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId); - channelsForCivilCode.addAll(channels); + + for(DeviceChannel channel : channels) { + boolean flag = false; + for(DeviceChannel deviceChannel : channelsForCivilCode) { + if(channel.getChannelId().equals(deviceChannel.getChannelId())) { + flag = true; + } + } + if(!flag) { + channelsForCivilCode.add(channel); + } + } } List> trees = transportChannelsToTree(channelsForCivilCode, parentId); return trees; diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index 3ef412d6..9b2a099d 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -71,7 +71,7 @@ public interface DeviceChannelMapper { "WHERE " + "dc.deviceId = #{deviceId} " + " AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%') " + - " AND dc.parentId=#{parentChannelId} " + + " AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) " + " AND dc.status=1" + " AND dc.status=0" + " AND dc.subCount > 0 " + @@ -309,8 +309,10 @@ public interface DeviceChannelMapper { "select * " + "from device_channel " + "where deviceId=#{deviceId}" + - " and left(channelId, ${parentId.length()}) = #{parentId}" + - " and length(channelId)=${length}" + + " and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} " + + " and parentId = #{parentId} or length(channelId)=${length} " + + " and parentId = #{parentId} " + + " and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} " + " "}) List getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); diff --git a/web_src/src/components/CloudRecord.vue b/web_src/src/components/CloudRecord.vue index 4784e05c..b046fc91 100644 --- a/web_src/src/components/CloudRecord.vue +++ b/web_src/src/components/CloudRecord.vue @@ -109,15 +109,26 @@ that.mediaServerList = data.data; if (that.mediaServerList.length > 0) { that.mediaServerId = that.mediaServerList[0].id - let port = that.mediaServerList[0].httpPort; - if (location.protocol === "https:" && that.mediaServerList[0].httpSSlPort) { - port = that.mediaServerList[0].httpSSlPort - } - that.mediaServerPath = location.protocol + "//" + that.mediaServerList[0].streamIp + ":" + port + that.setMediaServerPath(that.mediaServerId); that.getRecordList(); } }) }, + setMediaServerPath: function (serverId) { + let that = this; + let i; + for (i = 0; i < that.mediaServerList.length; i++) { + if (serverId === that.mediaServerList[i].id) { + break; + } + } + let port = that.mediaServerList[i].httpPort; + if (location.protocol === "https:" && that.mediaServerList[i].httpSSlPort) { + port = that.mediaServerList[i].httpSSlPort + } + that.mediaServerPath = location.protocol + "//" + that.mediaServerList[i].streamIp + ":" + port + console.log(that.mediaServerPath) + }, getRecordList: function (){ let that = this; this.$axios({ @@ -146,6 +157,7 @@ console.log(val) this.total = 0; this.recordList = []; + this.setMediaServerPath(val); this.getRecordList(); }, showRecordDetail(row){