Commit 363606d8453c027429ea66a6036c62b01ff8e06c

Authored by 648540858
1 parent 9ce22eba

优化级联目录发送

src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
... ... @@ -99,7 +99,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
99 99 }
100 100 if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
101 101 for (GbStream gbStream : event.getGbStreams()) {
102   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
  102 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
103 103 deviceChannelList.add(deviceChannelByStream);
104 104 }
105 105 }
... ... @@ -138,7 +138,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
138 138 }
139 139 if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
140 140 for (GbStream gbStream : event.getGbStreams()) {
141   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
  141 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
  142 + if (deviceChannelByStream.getParentId().length() <= 10) { // 父节点是行政区划,则设置CivilCode使用此行政区划
  143 + deviceChannelByStream.setCivilCode(deviceChannelByStream.getParentId());
  144 + }
142 145 deviceChannelList.add(deviceChannelByStream);
143 146 }
144 147 }
... ... @@ -159,7 +162,7 @@ public class CatalogEventLister implements ApplicationListener&lt;CatalogEvent&gt; {
159 162 deviceChannelList.add(deviceChannel);
160 163 GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId);
161 164 if(gbStream != null){
162   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId());
  165 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform);
163 166 deviceChannelList.add(deviceChannelByStream);
164 167 }
165 168 sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribeInfo, null);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
... ... @@ -259,28 +259,34 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
259 259 catalogXml.append("<Item>\r\n");
260 260 catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
261 261 catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
262   - catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
263 262 catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
264 263 if (channel.getParentId() != null) {
265 264 catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
266 265 }
267   - catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
268   - catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
269   - catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
270   - if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段
271   - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
272   - catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
273   - catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
274   - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
275   - catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
276   - catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
277   - catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
278   - catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
279   - catalogXml.append("<Info>\r\n");
280   - catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
281   - catalogXml.append("</Info>\r\n");
  266 + if (channel.getChannelId().length() == 20) {
  267 + if (Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段
  268 + catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
  269 + }
  270 + catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
  271 + catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
  272 + catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
  273 + if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段
  274 + catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
  275 + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
  276 + catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
  277 + catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
  278 + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
  279 + catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
  280 + catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
  281 + catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
  282 + catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
  283 + catalogXml.append("<Info>\r\n");
  284 + catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
  285 + catalogXml.append("</Info>\r\n");
  286 + }
282 287 }
283 288  
  289 +
284 290 catalogXml.append("</Item>\r\n");
285 291 }
286 292 }
... ... @@ -596,6 +602,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
596 602 catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
597 603 catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
598 604 catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
  605 + if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段
  606 + catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
  607 + }
599 608 if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性
600 609 catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
601 610 catalogXml.append("<Owner>0</Owner>\r\n");
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
... ... @@ -79,6 +79,11 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
79 79 deviceChannel.setParental(1);
80 80 deviceChannel.setParentId(catalog.getParentId());
81 81 deviceChannel.setRegisterWay(1);
  82 + if (catalog.getParentId() != null && catalog.getParentId().length() <= 10) {
  83 + deviceChannel.setCivilCode(catalog.getParentId());
  84 + }else {
  85 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  86 + }
82 87 deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
83 88 deviceChannel.setModel("live");
84 89 deviceChannel.setOwner("wvp-pro");
... ... @@ -95,7 +100,12 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
95 100 DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId());
96 101 deviceChannel.setParental(0);
97 102 deviceChannel.setParentId(channel.getCatalogId());
98   - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
  103 + if (channel.getCatalogId() != null && channel.getCatalogId().length() <= 10) {
  104 + channel.setCivilCode(channel.getCatalogId());
  105 + }else {
  106 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  107 + }
  108 +
99 109 allChannels.add(deviceChannel);
100 110 }
101 111 }
... ... @@ -116,7 +126,11 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
116 126 deviceChannel.setStatus(1);
117 127 deviceChannel.setParentId(gbStream.getCatalogId());
118 128 deviceChannel.setRegisterWay(1);
119   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  129 + if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() <= 10) {
  130 + deviceChannel.setCivilCode(gbStream.getCatalogId());
  131 + }else {
  132 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  133 + }
120 134 deviceChannel.setModel("live");
121 135 deviceChannel.setOwner("wvp-pro");
122 136 deviceChannel.setParental(0);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
... ... @@ -93,7 +93,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
93 93 deviceChannel.setParental(1);
94 94 deviceChannel.setParentId(catalog.getParentId());
95 95 deviceChannel.setRegisterWay(1);
96   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  96 + if (catalog.getParentId() != null && catalog.getParentId().length() < 10) {
  97 + deviceChannel.setCivilCode(catalog.getParentId());
  98 + }else {
  99 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  100 + }
97 101 allChannels.add(deviceChannel);
98 102 }
99 103 }
... ... @@ -108,7 +112,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
108 112 deviceChannel.setChannelType(0);
109 113 deviceChannel.setParental(0);
110 114 deviceChannel.setParentId(channel.getCatalogId());
111   - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
  115 + if (channel.getCatalogId() != null && channel.getCatalogId().length() < 10) {
  116 + deviceChannel.setCivilCode(channel.getCatalogId());
  117 + }else {
  118 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  119 + }
112 120 allChannels.add(deviceChannel);
113 121 }
114 122 }
... ... @@ -131,7 +139,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
131 139 deviceChannel.setStatus(1);
132 140 deviceChannel.setParentId(gbStream.getCatalogId());
133 141 deviceChannel.setRegisterWay(1);
134   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  142 + if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() < 10) {
  143 + deviceChannel.setCivilCode(gbStream.getCatalogId());
  144 + }else {
  145 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  146 + }
135 147 deviceChannel.setModel("live");
136 148 deviceChannel.setOwner("wvp-pro");
137 149 deviceChannel.setParental(0);
... ...
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 4 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  5 +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 6 import com.github.pagehelper.PageInfo;
6 7  
7 8 import java.util.List;
... ... @@ -40,7 +41,7 @@ public interface IGbStreamService {
40 41 */
41 42 boolean delPlatformInfo(String platformId, List<GbStream> gbStreams);
42 43  
43   - DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId);
  44 + DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform);
44 45  
45 46 void sendCatalogMsg(GbStream gbStream, String type);
46 47 void sendCatalogMsgs(List<GbStream> gbStreams, String type);
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
... ... @@ -78,7 +78,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
78 78 gbStream.setPlatformId(platformId);
79 79 // TODO 修改为批量提交
80 80 platformGbStreamMapper.add(gbStream);
81   - DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform.getDeviceGBId());
  81 + DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform);
82 82 deviceChannelList.add(deviceChannelListByStream);
83 83 }
84 84 dataSourceTransactionManager.commit(transactionStatus); //手动提交
... ... @@ -92,19 +92,23 @@ public class GbStreamServiceImpl implements IGbStreamService {
92 92 }
93 93  
94 94 @Override
95   - public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId) {
  95 + public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
96 96 DeviceChannel deviceChannel = new DeviceChannel();
97 97 deviceChannel.setChannelId(gbStream.getGbId());
98 98 deviceChannel.setName(gbStream.getName());
99 99 deviceChannel.setLongitude(gbStream.getLongitude());
100 100 deviceChannel.setLatitude(gbStream.getLatitude());
101   - deviceChannel.setDeviceId(deviceGBId);
  101 + deviceChannel.setDeviceId(platform.getDeviceGBId());
102 102 deviceChannel.setManufacture("wvp-pro");
103 103 // deviceChannel.setStatus(gbStream.isStatus()?1:0);
104 104 deviceChannel.setStatus(1);
105 105 deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
106 106 deviceChannel.setRegisterWay(1);
107   - deviceChannel.setCivilCode(deviceGBId.substring(0, 6));
  107 + if (catalogId.length() <= 10) { // 父节点是行政区划,则设置CivilCode使用此行政区划
  108 + deviceChannel.setCivilCode(catalogId);
  109 + }else {
  110 + deviceChannel.setCivilCode(platform.getAdministrativeDivision());
  111 + }
108 112 deviceChannel.setModel("live");
109 113 deviceChannel.setOwner("wvp-pro");
110 114 deviceChannel.setParental(0);
... ...
web_src/src/components/channelList.vue
... ... @@ -40,6 +40,7 @@
40 40 <el-table-column label="快照" width="80" align="center">
41 41 <template slot-scope="scope">
42 42 <img style="max-height: 3rem;max-width: 4rem;"
  43 + v-if="scope.row.subCount === 0 && scope.row.parental === 0"
43 44 :id="scope.row.deviceId + '_' + scope.row.channelId"
44 45 :src="getSnap(scope.row)"
45 46 @error="getSnapErrorEvent($event.target.id)"
... ... @@ -89,7 +90,7 @@
89 90 <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId"
90 91 @click="stopDevicePush(scope.row)">停止
91 92 </el-button>
92   - <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0"
  93 + <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
93 94 @click="changeSubchannel(scope.row)">查看
94 95 </el-button>
95 96 <el-button size="mini" icon="el-icon-video-camera" type="primary" @click="queryRecords(scope.row)">设备录象
... ...
web_src/src/components/common/DeviceTree.vue
... ... @@ -109,7 +109,7 @@ export default {
109 109 let nodeList = []
110 110 for (let i = 0; i < data.length; i++) {
111 111 let type = 3;
112   - if (data[i].subCount > 0) {
  112 + if (data[i].subCount > 0 || data[i].parental === 1) {
113 113 type = 2;
114 114 }else if (data[i].ptztype === 1 ) { // 1-球机;2-半球;3-固定枪机;4-遥控枪机
115 115 type = 4;
... ...