行政区划作为级联数据的处理,修复设备树的显示
This commit is contained in:
@@ -204,6 +204,7 @@ public class XmlUtil {
|
||||
deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode"));
|
||||
deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
|
||||
deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
|
||||
String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
|
||||
if (XmlUtil.getText(itemDevice, "Parental") == null
|
||||
|| XmlUtil.getText(itemDevice, "Parental") == "") {
|
||||
deviceChannel.setParental(0);
|
||||
@@ -212,11 +213,27 @@ public class XmlUtil {
|
||||
}
|
||||
deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID"));
|
||||
String parentId = XmlUtil.getText(itemDevice, "ParentID");
|
||||
if (parentId != null && parentId.contains("/")) {
|
||||
String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
|
||||
deviceChannel.setParentId(lastParentId);
|
||||
if (parentId != null) {
|
||||
if (parentId.contains("/")) {
|
||||
String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
|
||||
deviceChannel.setParentId(lastParentId);
|
||||
}else {
|
||||
deviceChannel.setParentId(parentId);
|
||||
}
|
||||
}else {
|
||||
deviceChannel.setParentId(parentId);
|
||||
if (deviceChannel.getChannelId().length() <= 10) { // 此时为行政区划, 上下级行政区划使用DeviceId关联
|
||||
deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
|
||||
}else if (deviceChannel.getChannelId().length() == 20) {
|
||||
if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织
|
||||
deviceChannel.setParentId(businessGroupID);
|
||||
}else if (deviceChannel.getCivilCode() != null) {
|
||||
// 设备, 无parentId的20位是使用CivilCode表示上级的设备,
|
||||
// 注:215 业务分组是需要有parentId的
|
||||
deviceChannel.setParentId(deviceChannel.getCivilCode());
|
||||
}
|
||||
}else {
|
||||
deviceChannel.setParentId(deviceChannel.getDeviceId());
|
||||
}
|
||||
}
|
||||
|
||||
if (XmlUtil.getText(itemDevice, "SafetyWay") == null
|
||||
@@ -277,4 +294,4 @@ public class XmlUtil {
|
||||
deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC
|
||||
return deviceChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public interface IVideoManagerStorage {
|
||||
* @param count 每页数量
|
||||
* @return
|
||||
*/
|
||||
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count);
|
||||
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
|
||||
|
||||
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
||||
|
||||
|
||||
@@ -340,10 +340,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
|
||||
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) {
|
||||
// 获取到所有正在播放的流
|
||||
PageHelper.startPage(page, count);
|
||||
List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
|
||||
List<DeviceChannel> all;
|
||||
if (catalogUnderDevice != null && catalogUnderDevice) {
|
||||
all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online);
|
||||
}else {
|
||||
all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
|
||||
}
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +128,14 @@ public class DeviceQuery {
|
||||
@ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="catalogUnderDevice", value = "是否直属与设备的目录" ,dataTypeClass = Boolean.class),
|
||||
})
|
||||
public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
|
||||
int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean channelType) {
|
||||
@RequestParam(required = false) Boolean channelType,
|
||||
@RequestParam(required = false) Boolean catalogUnderDevice) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询视频设备通道API调用");
|
||||
// }
|
||||
@@ -141,7 +143,7 @@ public class DeviceQuery {
|
||||
query = null;
|
||||
}
|
||||
|
||||
PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
|
||||
PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count);
|
||||
return new ResponseEntity<>(pageResult,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user