From 5d901b5e3f033e8b04e53420d68626cbd87431c8 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 06 五月 2022 10:12:34 +0800
Subject: [PATCH] 使用阿里代码规范。规范代码写法

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
index 6d680bc..2dc88f8 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -13,8 +13,6 @@
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.storager.dao.*;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
-import com.genersoft.iot.vmp.utils.node.ForestNodeMerger;
-import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -342,10 +340,15 @@
 	}
 
 	@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);
 	}
 
@@ -354,10 +357,6 @@
 		return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, null, query, hasSubChannel, online, start, limit);
 	}
 
-	@Override
-	public List<DeviceChannelTree> tree(String deviceId) {
-		return ForestNodeMerger.merge(deviceChannelMapper.tree(deviceId));
-	}
 
 	@Override
 	public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
@@ -365,9 +364,9 @@
 	}
 
 	@Override
-	public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, String online, int page, int count) {
+	public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
 		PageHelper.startPage(page, count);
-		List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, null, null, null);
+		List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online);
 		return new PageInfo<>(all);
 	}
 
@@ -461,7 +460,9 @@
 	public synchronized boolean outline(String deviceId) {
 		logger.info("鏇存柊璁惧绂荤嚎: " + deviceId);
 		Device device = deviceMapper.getDeviceByDeviceId(deviceId);
-		if (device == null) return false;
+		if (device == null) {
+			return false;
+		}
 		device.setOnline(0);
 		redisCatchStorage.updateDevice(device);
 		return deviceMapper.update(device) > 0;
@@ -504,8 +505,8 @@
 	 * @param endTime
 	 */
 	@Override
-	public synchronized List<MobilePosition> queryMobilePositions(String deviceId, String startTime, String endTime) {
-		return deviceMobilePositionMapper.queryPositionByDeviceIdAndTime(deviceId, startTime, endTime);
+	public synchronized List<MobilePosition> queryMobilePositions(String deviceId, String channelId, String startTime, String endTime) {
+		return deviceMobilePositionMapper.queryPositionByDeviceIdAndTime(deviceId, channelId, startTime, endTime);
 	}
 
 	@Override
@@ -524,7 +525,7 @@
 			parentPlatform.setCatalogGroup(1);
 		}
 		if (parentPlatform.getAdministrativeDivision() == null) {
-			parentPlatform.setAdministrativeDivision(parentPlatform.getDeviceGBId().substring(0,6));
+			parentPlatform.setAdministrativeDivision(parentPlatform.getAdministrativeDivision());
 		}
 		ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
 		if (parentPlatform.getId() == null ) {
@@ -715,6 +716,7 @@
 	 * 鍒犻櫎鎸囧畾璁惧鐨勬墍鏈夌Щ鍔ㄤ綅缃�
 	 * @param deviceId
 	 */
+	@Override
 	public int clearMobilePositionsByDeviceId(String deviceId) {
 		return deviceMobilePositionMapper.clearMobilePositionsByDeviceId(deviceId);
 	}
@@ -860,7 +862,9 @@
 
 	@Override
 	public void updateMediaList(List<StreamPushItem> streamPushItems) {
-		if (streamPushItems == null || streamPushItems.size() == 0) return;
+		if (streamPushItems == null || streamPushItems.size() == 0) {
+			return;
+		}
 		logger.info("updateMediaList:  " + streamPushItems.size());
 		streamPushMapper.addAll(streamPushItems);
 		// TODO 寰呬紭鍖�
@@ -1081,7 +1085,7 @@
 		deviceChannel.setParentId(catalog.getParentId());
 		deviceChannel.setRegisterWay(1);
 		// 琛屾斂鍖哄垝搴旇鏄疍omain鐨勫墠鍏綅
-		deviceChannel.setCivilCode(parentPlatByServerGBId.getDeviceGBId().substring(0,6));
+		deviceChannel.setCivilCode(parentPlatByServerGBId.getAdministrativeDivision());
 		deviceChannel.setModel("live");
 		deviceChannel.setOwner("wvp-pro");
 		deviceChannel.setSecrecy("0");

--
Gitblit v1.8.0