From d94135c9cd8b12fc511055af4398ad3a584a44d6 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期一, 11 一月 2021 17:46:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java |   91 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
index e11c141..ee7ccec 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -3,17 +3,21 @@
 import java.util.*;
 
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
+import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
 import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
+import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
+import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
-import org.springframework.util.StringUtils;
+import org.springframework.transaction.annotation.Transactional;
 
 /**    
  * @Description:瑙嗛璁惧鏁版嵁瀛樺偍-jdbc瀹炵幇
@@ -28,6 +32,14 @@
 
 	@Autowired
     private DeviceChannelMapper deviceChannelMapper;
+
+	@Autowired
+    private ParentPlatformMapper platformMapper;
+
+	@Autowired
+    private IRedisCatchStorage redisCatchStorage;
+
+
 
 
 	/**
@@ -107,7 +119,7 @@
 	@Override
 	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
 		// 鑾峰彇鍒版墍鏈夋鍦ㄦ挱鏀剧殑娴�
-		PageHelper.startPage(page, count);
+		PageHelper.startPage(page+1, count);
 		List<DeviceChannel> all = deviceChannelMapper.queryChannelsByDeviceId(deviceId, null, query, hasSubChannel, online);
 		return new PageInfo<>(all);
 	}
@@ -119,7 +131,7 @@
 
 	@Override
 	public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, String online, int page, int count) {
-		PageHelper.startPage(page, count);
+		PageHelper.startPage(page+1, count);
 		List<DeviceChannel> all = deviceChannelMapper.queryChannelsByDeviceId(deviceId, parentChannelId, null, null, null);
 		return new PageInfo<>(all);
 	}
@@ -139,7 +151,7 @@
 	 */
 	@Override
 	public PageInfo<Device> queryVideoDeviceList(int page, int count) {
-		PageHelper.startPage(page, count);
+		PageHelper.startPage(page+1, count);
 		List<Device> all = deviceMapper.getDevices();
 		return new PageInfo<>(all);
 	}
@@ -206,5 +218,74 @@
 		int result = deviceChannelMapper.cleanChannelsByDeviceId(deviceId);
 	}
 
+	@Override
+	public boolean addParentPlatform(ParentPlatform parentPlatform) {
+		int result = platformMapper.addParentPlatform(parentPlatform);
+		return result > 0;
+	}
 
+	@Override
+	public boolean updateParentPlatform(ParentPlatform parentPlatform) {
+		int result = 0;
+		ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getDeviceGBId());
+		if ( platformMapper.getParentPlatById(parentPlatform.getDeviceGBId()) == null) {
+			result = platformMapper.addParentPlatform(parentPlatform);
+
+			if (parentPlatformCatch == null) {
+				parentPlatformCatch = new ParentPlatformCatch();
+				parentPlatformCatch.setParentPlatform(parentPlatform);
+				parentPlatformCatch.setId(parentPlatform.getDeviceGBId());
+			}
+		}else {
+			result = platformMapper.updateParentPlatform(parentPlatform);
+		}
+		// 鏇存柊缂撳瓨
+		parentPlatformCatch.setParentPlatform(parentPlatform);
+		redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
+		return result > 0;
+	}
+
+	@Override
+	public boolean deleteParentPlatform(ParentPlatform parentPlatform) {
+		int result = platformMapper.delParentPlatform(parentPlatform);
+		return result > 0;
+	}
+
+	@Override
+	public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count) {
+		PageHelper.startPage(page, count);
+		List<ParentPlatform> all = platformMapper.getParentPlatformList();
+		return new PageInfo<>(all);
+	}
+
+	@Override
+	public ParentPlatform queryParentPlatById(String platformGbId) {
+		return platformMapper.getParentPlatById(platformGbId);
+	}
+
+	@Override
+	public List<ParentPlatform> queryEnableParentPlatformList(boolean enable) {
+		return platformMapper.getEnableParentPlatformList(enable);
+	}
+
+	@Override
+	public void outlineForAllParentPlatform() {
+		platformMapper.outlineForAllParentPlatform();
+	}
+
+
+	@Override
+	public PageInfo<ChannelReduce> queryChannelListInAll(int page, int count, String query, Boolean online,
+														 Boolean channelType, String parentChannelId) {
+		PageHelper.startPage(page, count);
+		List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, parentChannelId);
+		return new PageInfo<>(all);
+	}
+
+
+	@Transactional
+	@Override
+	public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces) {
+		return 0;
+	}
 }

--
Gitblit v1.8.0