Ver código fonte

Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0

# Conflicts:
#	sql/mysql.sql
648540858 3 anos atrás
pai
commit
c5b16e058d

+ 1 - 2
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: 刚增加了这个名单,肯定遗漏了一些大佬,欢迎大佬联系我添加。
 

+ 1 - 0
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`),

+ 1 - 0
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 {
 

+ 22 - 5
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<DeviceChannel> channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2);
             if (!onlyCatalog) {
                 List<DeviceChannel> 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<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channelsForCivilCode, parentId);
             return trees;

+ 5 - 3
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@@ -71,7 +71,7 @@ public interface DeviceChannelMapper {
             "WHERE " +
             "dc.deviceId = #{deviceId} " +
             " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
-            " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
+            " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
             " <if test='online == true' > AND dc.status=1</if>" +
             " <if test='online == false' > AND dc.status=0</if>" +
             " <if test='hasSubChannel == true' >  AND dc.subCount > 0 </if>" +
@@ -309,8 +309,10 @@ public interface DeviceChannelMapper {
             "select * " +
             "from device_channel " +
             "where deviceId=#{deviceId}" +
-            " <if test='parentId != null' > and left(channelId, ${parentId.length()}) = #{parentId}</if>" +
-            " <if test='length != null' > and length(channelId)=${length}</if>" +
+            " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" +
+            " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" +
+            " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +
+            " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" +
             " </script>"})
     List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
 

+ 17 - 5
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){