Commit 9ce22eba3c561d353e12c66c509fb91ca241409f
1 parent
6c719556
行政区划作为级联数据的处理,修复设备树的显示
Showing
7 changed files
with
57 additions
and
25 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
| @@ -204,6 +204,7 @@ public class XmlUtil { | @@ -204,6 +204,7 @@ public class XmlUtil { | ||
| 204 | deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); | 204 | deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); |
| 205 | deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); | 205 | deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); |
| 206 | deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); | 206 | deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); |
| 207 | + String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID"); | ||
| 207 | if (XmlUtil.getText(itemDevice, "Parental") == null | 208 | if (XmlUtil.getText(itemDevice, "Parental") == null |
| 208 | || XmlUtil.getText(itemDevice, "Parental") == "") { | 209 | || XmlUtil.getText(itemDevice, "Parental") == "") { |
| 209 | deviceChannel.setParental(0); | 210 | deviceChannel.setParental(0); |
| @@ -212,11 +213,27 @@ public class XmlUtil { | @@ -212,11 +213,27 @@ public class XmlUtil { | ||
| 212 | } | 213 | } |
| 213 | deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); | 214 | deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); |
| 214 | String parentId = XmlUtil.getText(itemDevice, "ParentID"); | 215 | String parentId = XmlUtil.getText(itemDevice, "ParentID"); |
| 215 | - if (parentId != null && parentId.contains("/")) { | ||
| 216 | - String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1); | ||
| 217 | - deviceChannel.setParentId(lastParentId); | 216 | + if (parentId != null) { |
| 217 | + if (parentId.contains("/")) { | ||
| 218 | + String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1); | ||
| 219 | + deviceChannel.setParentId(lastParentId); | ||
| 220 | + }else { | ||
| 221 | + deviceChannel.setParentId(parentId); | ||
| 222 | + } | ||
| 218 | }else { | 223 | }else { |
| 219 | - deviceChannel.setParentId(parentId); | 224 | + if (deviceChannel.getChannelId().length() <= 10) { // 此时为行政区划, 上下级行政区划使用DeviceId关联 |
| 225 | + deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2)); | ||
| 226 | + }else if (deviceChannel.getChannelId().length() == 20) { | ||
| 227 | + if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织 | ||
| 228 | + deviceChannel.setParentId(businessGroupID); | ||
| 229 | + }else if (deviceChannel.getCivilCode() != null) { | ||
| 230 | + // 设备, 无parentId的20位是使用CivilCode表示上级的设备, | ||
| 231 | + // 注:215 业务分组是需要有parentId的 | ||
| 232 | + deviceChannel.setParentId(deviceChannel.getCivilCode()); | ||
| 233 | + } | ||
| 234 | + }else { | ||
| 235 | + deviceChannel.setParentId(deviceChannel.getDeviceId()); | ||
| 236 | + } | ||
| 220 | } | 237 | } |
| 221 | 238 | ||
| 222 | if (XmlUtil.getText(itemDevice, "SafetyWay") == null | 239 | if (XmlUtil.getText(itemDevice, "SafetyWay") == null |
| @@ -277,4 +294,4 @@ public class XmlUtil { | @@ -277,4 +294,4 @@ public class XmlUtil { | ||
| 277 | deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC | 294 | deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC |
| 278 | return deviceChannel; | 295 | return deviceChannel; |
| 279 | } | 296 | } |
| 280 | -} | 297 | +} |
| 281 | \ No newline at end of file | 298 | \ No newline at end of file |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| @@ -89,7 +89,7 @@ public interface IVideoManagerStorage { | @@ -89,7 +89,7 @@ public interface IVideoManagerStorage { | ||
| 89 | * @param count 每页数量 | 89 | * @param count 每页数量 |
| 90 | * @return | 90 | * @return |
| 91 | */ | 91 | */ |
| 92 | - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count); | 92 | + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count); |
| 93 | 93 | ||
| 94 | public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); | 94 | public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); |
| 95 | 95 |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| @@ -340,10 +340,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -340,10 +340,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | @Override | 342 | @Override |
| 343 | - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) { | 343 | + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) { |
| 344 | // 获取到所有正在播放的流 | 344 | // 获取到所有正在播放的流 |
| 345 | PageHelper.startPage(page, count); | 345 | PageHelper.startPage(page, count); |
| 346 | - List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online); | 346 | + List<DeviceChannel> all; |
| 347 | + if (catalogUnderDevice != null && catalogUnderDevice) { | ||
| 348 | + all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online); | ||
| 349 | + }else { | ||
| 350 | + all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online); | ||
| 351 | + } | ||
| 347 | return new PageInfo<>(all); | 352 | return new PageInfo<>(all); |
| 348 | } | 353 | } |
| 349 | 354 |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -128,12 +128,14 @@ public class DeviceQuery { | @@ -128,12 +128,14 @@ public class DeviceQuery { | ||
| 128 | @ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class), | 128 | @ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class), |
| 129 | @ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class), | 129 | @ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class), |
| 130 | @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class), | 130 | @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class), |
| 131 | + @ApiImplicitParam(name="catalogUnderDevice", value = "是否直属与设备的目录" ,dataTypeClass = Boolean.class), | ||
| 131 | }) | 132 | }) |
| 132 | public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, | 133 | public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, |
| 133 | int page, int count, | 134 | int page, int count, |
| 134 | @RequestParam(required = false) String query, | 135 | @RequestParam(required = false) String query, |
| 135 | @RequestParam(required = false) Boolean online, | 136 | @RequestParam(required = false) Boolean online, |
| 136 | - @RequestParam(required = false) Boolean channelType) { | 137 | + @RequestParam(required = false) Boolean channelType, |
| 138 | + @RequestParam(required = false) Boolean catalogUnderDevice) { | ||
| 137 | // if (logger.isDebugEnabled()) { | 139 | // if (logger.isDebugEnabled()) { |
| 138 | // logger.debug("查询视频设备通道API调用"); | 140 | // logger.debug("查询视频设备通道API调用"); |
| 139 | // } | 141 | // } |
| @@ -141,7 +143,7 @@ public class DeviceQuery { | @@ -141,7 +143,7 @@ public class DeviceQuery { | ||
| 141 | query = null; | 143 | query = null; |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | - PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count); | 146 | + PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count); |
| 145 | return new ResponseEntity<>(pageResult,HttpStatus.OK); | 147 | return new ResponseEntity<>(pageResult,HttpStatus.OK); |
| 146 | } | 148 | } |
| 147 | 149 |
web_src/src/components/common/DeviceTree.vue
| @@ -89,8 +89,8 @@ export default { | @@ -89,8 +89,8 @@ export default { | ||
| 89 | }) | 89 | }) |
| 90 | } | 90 | } |
| 91 | if (node.level === 1) { | 91 | if (node.level === 1) { |
| 92 | - this.deviceService.getAllChannel(true, node.data.id, (catalogData) => { | ||
| 93 | - this.deviceService.getAllChannel(false, node.data.id, (channelData) => { | 92 | + this.deviceService.getAllChannel(true, true, node.data.id, (catalogData) => { |
| 93 | + this.deviceService.getAllChannel(false, true, node.data.id, (channelData) => { | ||
| 94 | let data = catalogData.concat(channelData) | 94 | let data = catalogData.concat(channelData) |
| 95 | this.channelDataHandler(data, resolve) | 95 | this.channelDataHandler(data, resolve) |
| 96 | }) | 96 | }) |
web_src/src/components/devicePosition.vue
| @@ -14,13 +14,14 @@ | @@ -14,13 +14,14 @@ | ||
| 14 | <div ref="infobox" v-if="channel != null " > | 14 | <div ref="infobox" v-if="channel != null " > |
| 15 | <div v-if="channel != null" class="infobox-content"> | 15 | <div v-if="channel != null" class="infobox-content"> |
| 16 | <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" > | 16 | <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" > |
| 17 | - <el-descriptions-item label="生产厂商">{{channel.manufacture}}</el-descriptions-item> | 17 | + <el-descriptions-item label="编号" >{{channel.channelId}}</el-descriptions-item> |
| 18 | <el-descriptions-item label="型号">{{channel.model}}</el-descriptions-item> | 18 | <el-descriptions-item label="型号">{{channel.model}}</el-descriptions-item> |
| 19 | - <el-descriptions-item label="设备归属" >{{channel.owner}}</el-descriptions-item> | 19 | + <el-descriptions-item label="经纬度" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item> |
| 20 | + <el-descriptions-item label="生产厂商">{{channel.manufacture}}</el-descriptions-item> | ||
| 20 | <el-descriptions-item label="行政区域" >{{channel.civilCode}}</el-descriptions-item> | 21 | <el-descriptions-item label="行政区域" >{{channel.civilCode}}</el-descriptions-item> |
| 22 | + <el-descriptions-item label="设备归属" >{{channel.owner}}</el-descriptions-item> | ||
| 21 | <el-descriptions-item label="安装地址" >{{channel.address == null?'未知': channel.address}}</el-descriptions-item> | 23 | <el-descriptions-item label="安装地址" >{{channel.address == null?'未知': channel.address}}</el-descriptions-item> |
| 22 | <el-descriptions-item label="云台类型" >{{channel.ptztypeText}}</el-descriptions-item> | 24 | <el-descriptions-item label="云台类型" >{{channel.ptztypeText}}</el-descriptions-item> |
| 23 | - <el-descriptions-item label="经纬度" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item> | ||
| 24 | <el-descriptions-item label="状态"> | 25 | <el-descriptions-item label="状态"> |
| 25 | <el-tag size="small" v-if="channel.status === 1">在线</el-tag> | 26 | <el-tag size="small" v-if="channel.status === 1">在线</el-tag> |
| 26 | <el-tag size="small" type="info" v-if="channel.status === 0">离线</el-tag> | 27 | <el-tag size="small" type="info" v-if="channel.status === 0">离线</el-tag> |
| @@ -75,7 +76,7 @@ export default { | @@ -75,7 +76,7 @@ export default { | ||
| 75 | console.log(this.$route.query.deviceId) | 76 | console.log(this.$route.query.deviceId) |
| 76 | // this.$refs.deviceTree.openByDeivceId(this.$route.query.deivceId) | 77 | // this.$refs.deviceTree.openByDeivceId(this.$route.query.deivceId) |
| 77 | setTimeout(()=>{ // 延迟以等待地图加载完成 TODO 后续修改为通过是实际这;状态加回调完成 | 78 | setTimeout(()=>{ // 延迟以等待地图加载完成 TODO 后续修改为通过是实际这;状态加回调完成 |
| 78 | - this.deviceService.getAllChannel(false, this.$route.query.deviceId, this.channelsHandler) | 79 | + this.deviceService.getAllChannel(false, false, this.$route.query.deviceId, this.channelsHandler) |
| 79 | }, 1000) | 80 | }, 1000) |
| 80 | 81 | ||
| 81 | } | 82 | } |
| @@ -141,7 +142,13 @@ export default { | @@ -141,7 +142,13 @@ export default { | ||
| 141 | zIndex: 3000, // 菜单样式 z-index | 142 | zIndex: 3000, // 菜单样式 z-index |
| 142 | }); | 143 | }); |
| 143 | } else { | 144 | } else { |
| 144 | - this.deviceOrSubChannelMenu(event, data) | 145 | + if (typeof data.channelId === "undefined") { |
| 146 | + this.deviceOrSubChannelMenu(event, data) | ||
| 147 | + }else { | ||
| 148 | + // TODO 子目录暂时不支持查询他下面所有设备, 支持支持查询直属于这个目录的设备 | ||
| 149 | + this.deviceOrSubChannelMenu(event, data) | ||
| 150 | + } | ||
| 151 | + | ||
| 145 | } | 152 | } |
| 146 | 153 | ||
| 147 | }, | 154 | }, |
| @@ -155,7 +162,7 @@ export default { | @@ -155,7 +162,7 @@ export default { | ||
| 155 | disabled: false, | 162 | disabled: false, |
| 156 | onClick: () => { | 163 | onClick: () => { |
| 157 | if (!data.channelId) { | 164 | if (!data.channelId) { |
| 158 | - this.deviceService.getAllChannel(false, data.deviceId, this.channelsHandler) | 165 | + this.deviceService.getAllChannel(false, false, data.deviceId, this.channelsHandler) |
| 159 | } | 166 | } |
| 160 | if (data.channelId && data.subCount > 0) { | 167 | if (data.channelId && data.subCount > 0) { |
| 161 | // 点击子目录 | 168 | // 点击子目录 |
web_src/src/components/service/DeviceService.js
| @@ -45,20 +45,20 @@ class DeviceService{ | @@ -45,20 +45,20 @@ class DeviceService{ | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | - getAllChannel(isCatalog, deviceId, callback, errorCallback) { | 48 | + getAllChannel(isCatalog, catalogUnderDevice, deviceId, callback, errorCallback) { |
| 49 | let currentPage = 1; | 49 | let currentPage = 1; |
| 50 | let count = 100; | 50 | let count = 100; |
| 51 | let catalogList = [] | 51 | let catalogList = [] |
| 52 | - this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback) | 52 | + this.getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback) |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | - getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback) { | ||
| 56 | - this.getChanel(isCatalog, deviceId, currentPage, count, (data) => { | 55 | + getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback) { |
| 56 | + this.getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, (data) => { | ||
| 57 | if (data.list) { | 57 | if (data.list) { |
| 58 | catalogList = catalogList.concat(data.list); | 58 | catalogList = catalogList.concat(data.list); |
| 59 | if (catalogList.length < data.total) { | 59 | if (catalogList.length < data.total) { |
| 60 | currentPage ++ | 60 | currentPage ++ |
| 61 | - this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback) | 61 | + this.getAllChannelIteration(isCatalog,catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback) |
| 62 | }else { | 62 | }else { |
| 63 | console.log(1) | 63 | console.log(1) |
| 64 | if (typeof (callback) == "function") callback(catalogList) | 64 | if (typeof (callback) == "function") callback(catalogList) |
| @@ -66,7 +66,7 @@ class DeviceService{ | @@ -66,7 +66,7 @@ class DeviceService{ | ||
| 66 | } | 66 | } |
| 67 | }, errorCallback) | 67 | }, errorCallback) |
| 68 | } | 68 | } |
| 69 | - getChanel(isCatalog, deviceId, currentPage, count, callback, errorCallback) { | 69 | + getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, callback, errorCallback) { |
| 70 | this.$axios({ | 70 | this.$axios({ |
| 71 | method: 'get', | 71 | method: 'get', |
| 72 | url: `/api/device/query/devices/${deviceId}/channels`, | 72 | url: `/api/device/query/devices/${deviceId}/channels`, |
| @@ -75,7 +75,8 @@ class DeviceService{ | @@ -75,7 +75,8 @@ class DeviceService{ | ||
| 75 | count: count, | 75 | count: count, |
| 76 | query: "", | 76 | query: "", |
| 77 | online: "", | 77 | online: "", |
| 78 | - channelType: isCatalog | 78 | + channelType: isCatalog, |
| 79 | + catalogUnderDevice: catalogUnderDevice | ||
| 79 | } | 80 | } |
| 80 | }).then((res) =>{ | 81 | }).then((res) =>{ |
| 81 | if (typeof (callback) == "function") callback(res.data) | 82 | if (typeof (callback) == "function") callback(res.data) |