Commit c5b16e058dd1d517abea9a475897d9333c6e2e2e

Authored by 648540858
2 parents 5327a857 7bfa8542

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

# Conflicts:
#	sql/mysql.sql
README.md
... ... @@ -156,7 +156,6 @@ QQ蝘縑銝銝, 蝎曉.甈Z之摰嗅蝢日悄霈.閫★撖嫣
156 156  
157 157 # 悅
158 158 憿寧誨蝙摰賣IT悅嚗靽縑銝隞亥摨鈭★ 雿憿寧銋蝣蝙鈭鈭隞皞誨銝窈銵隞嚗 鈭蝙憿寧漣熒噩蛹銝璁憿寧嚗窈銵 雿輻憿寧隞嚗砲悅銝剖銵冽憿寧靘洵銝摨悅
159   -
160 159 # 靚
161 160 陝雿憭(https://github.com/xia-chu) 皞獢,撟嗅撘葉蝏葬
162 161 陝雿dexter langhuihui](https://github.com/langhuihui) 撘皞末EB
... ... @@ -166,7 +165,7 @@ QQ蝘縑銝銝, 蝎曉.甈Z之摰嗅蝢日悄霈.閫★撖嫣
166 165 [hotcoffie](https://github.com/hotcoffie) [xiaomu](https://github.com/nikmu) [TristingChen](https://github.com/TristingChen)
167 166 [chenparty](https://github.com/chenparty) [Hotleave](https://github.com/hotleave) [ydwxb](https://github.com/ydwxb)
168 167 [ydpd](https://github.com/ydpd) [szy833](https://github.com/szy833) [ydwxb](https://github.com/ydwxb) [Albertzhu666](https://github.com/Albertzhu666)
169   -[mk1990](https://github.com/mk1990)
  168 +[mk1990](https://github.com/mk1990) [SaltFish001](https://github.com/SaltFish001)
170 169  
171 170 ps: 葵摰鈭之雿穿洽餈之雿祈頂溶
172 171  
... ...
sql/mysql.sql
... ... @@ -48,6 +48,7 @@ CREATE TABLE `device` (
48 48 `ssrcCheck` int DEFAULT '0',
49 49 `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
50 50 `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  51 + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'auto',
51 52 `custom_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
52 53 `password` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
53 54 PRIMARY KEY (`id`),
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java
... ... @@ -6,6 +6,7 @@ import java.util.Properties;
6 6  
7 7 /**
8 8 * sip日志格式化
  9 + * 暂不使用
9 10 */
10 11 public class SipLoggerPass implements StackLogger {
11 12  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
... ... @@ -118,6 +118,7 @@ public class DeviceServiceImpl implements IDeviceService {
118 118 }
119 119 sync(device);
120 120 }else {
  121 +
121 122 if(device.getOnline() == 0){
122 123 device.setOnline(1);
123 124 device.setCreateTime(now);
... ... @@ -132,6 +133,11 @@ public class DeviceServiceImpl implements IDeviceService {
132 133 sync(device);
133 134 // TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
134 135 }else {
  136 + if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
  137 + logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId());
  138 + sync(device);
  139 + }
  140 +
135 141 deviceMapper.update(device);
136 142 redisCatchStorage.updateDevice(device);
137 143 }
... ... @@ -362,10 +368,10 @@ public class DeviceServiceImpl implements IDeviceService {
362 368 return null;
363 369 }
364 370 // 使用行政区划展示树
365   - if (parentId.length() > 10) {
366   - // TODO 可能是行政区划与业务分组混杂的情形
367   - return null;
368   - }
  371 +// if (parentId.length() > 10) {
  372 +// // TODO 可能是行政区划与业务分组混杂的情形
  373 +// return null;
  374 +// }
369 375  
370 376 if (parentId.length() == 10 ) {
371 377 if (onlyCatalog) {
... ... @@ -380,7 +386,18 @@ public class DeviceServiceImpl implements IDeviceService {
380 386 List<DeviceChannel> channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2);
381 387 if (!onlyCatalog) {
382 388 List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
383   - channelsForCivilCode.addAll(channels);
  389 +
  390 + for(DeviceChannel channel : channels) {
  391 + boolean flag = false;
  392 + for(DeviceChannel deviceChannel : channelsForCivilCode) {
  393 + if(channel.getChannelId().equals(deviceChannel.getChannelId())) {
  394 + flag = true;
  395 + }
  396 + }
  397 + if(!flag) {
  398 + channelsForCivilCode.add(channel);
  399 + }
  400 + }
384 401 }
385 402 List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channelsForCivilCode, parentId);
386 403 return trees;
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -71,7 +71,7 @@ public interface DeviceChannelMapper {
71 71 "WHERE " +
72 72 "dc.deviceId = #{deviceId} " +
73 73 " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
74   - " <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
  74 + " <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " +
75 75 " <if test='online == true' > AND dc.status=1</if>" +
76 76 " <if test='online == false' > AND dc.status=0</if>" +
77 77 " <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
... ... @@ -309,8 +309,10 @@ public interface DeviceChannelMapper {
309 309 "select * " +
310 310 "from device_channel " +
311 311 "where deviceId=#{deviceId}" +
312   - " <if test='parentId != null' > and left(channelId, ${parentId.length()}) = #{parentId}</if>" +
313   - " <if test='length != null' > and length(channelId)=${length}</if>" +
  312 + " <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} and length(channelId)=${length} </if>" +
  313 + " <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=${length} </if>" +
  314 + " <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" +
  315 + " <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, ${parentId.length()}) = #{parentId} </if>" +
314 316 " </script>"})
315 317 List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
316 318  
... ...
web_src/src/components/CloudRecord.vue
... ... @@ -109,15 +109,26 @@
109 109 that.mediaServerList = data.data;
110 110 if (that.mediaServerList.length > 0) {
111 111 that.mediaServerId = that.mediaServerList[0].id
112   - let port = that.mediaServerList[0].httpPort;
113   - if (location.protocol === "https:" && that.mediaServerList[0].httpSSlPort) {
114   - port = that.mediaServerList[0].httpSSlPort
115   - }
116   - that.mediaServerPath = location.protocol + "//" + that.mediaServerList[0].streamIp + ":" + port
  112 + that.setMediaServerPath(that.mediaServerId);
117 113 that.getRecordList();
118 114 }
119 115 })
120 116 },
  117 + setMediaServerPath: function (serverId) {
  118 + let that = this;
  119 + let i;
  120 + for (i = 0; i < that.mediaServerList.length; i++) {
  121 + if (serverId === that.mediaServerList[i].id) {
  122 + break;
  123 + }
  124 + }
  125 + let port = that.mediaServerList[i].httpPort;
  126 + if (location.protocol === "https:" && that.mediaServerList[i].httpSSlPort) {
  127 + port = that.mediaServerList[i].httpSSlPort
  128 + }
  129 + that.mediaServerPath = location.protocol + "//" + that.mediaServerList[i].streamIp + ":" + port
  130 + console.log(that.mediaServerPath)
  131 + },
121 132 getRecordList: function (){
122 133 let that = this;
123 134 this.$axios({
... ... @@ -146,6 +157,7 @@
146 157 console.log(val)
147 158 this.total = 0;
148 159 this.recordList = [];
  160 + this.setMediaServerPath(val);
149 161 this.getRecordList();
150 162 },
151 163 showRecordDetail(row){
... ...