From f6893cf95b15531dfc45950fea7e780e045ba2ae Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 11 五月 2022 18:37:24 +0800
Subject: [PATCH] 优化设备在线状态

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 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 2dc88f8..b72671a 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,6 +13,7 @@
 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.DateUtil;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -26,7 +27,6 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**    
@@ -91,9 +91,6 @@
 	@Autowired
     private ParentPlatformMapper parentPlatformMapper;
 
-	private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-
 	/**
 	 * 鏍规嵁璁惧ID鍒ゆ柇璁惧鏄惁瀛樺湪
 	 *
@@ -127,7 +124,7 @@
 	 */
 	@Override
 	public synchronized boolean updateDevice(Device device) {
-		String now = this.format.format(System.currentTimeMillis());
+		String now = DateUtil.getNow();
 		device.setUpdateTime(now);
 		Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId());
 		device.setCharset(device.getCharset().toUpperCase());
@@ -140,8 +137,6 @@
 
 			return deviceMapper.update(device) > 0;
 		}
-
-
 	}
 
 	@Override
@@ -152,7 +147,7 @@
 		if (streamInfo != null) {
 			channel.setStreamId(streamInfo.getStream());
 		}
-		String now = this.format.format(System.currentTimeMillis());
+		String now = DateUtil.getNow();
 		channel.setUpdateTime(now);
 		DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
 		if (deviceChannel == null) {
@@ -178,7 +173,7 @@
 					if (streamInfo != null) {
 						channel.setStreamId(streamInfo.getStream());
 					}
-					String now = this.format.format(System.currentTimeMillis());
+					String now = DateUtil.getNow();
 					channel.setUpdateTime(now);
 					channel.setCreateTime(now);
 					addChannels.add(channel);
@@ -193,7 +188,7 @@
 					if (streamInfo != null) {
 						channel.setStreamId(streamInfo.getStream());
 					}
-					String now = this.format.format(System.currentTimeMillis());
+					String now = DateUtil.getNow();
 					channel.setUpdateTime(now);
 					if (channelsInStore.get(channel.getChannelId()) != null) {
 						updateChannels.add(channel);
@@ -732,7 +727,7 @@
 		boolean result = false;
 		streamProxyItem.setStreamType("proxy");
 		streamProxyItem.setStatus(true);
-		String now = this.format.format(System.currentTimeMillis());
+		String now = DateUtil.getNow();
 		streamProxyItem.setCreateTime(now);
 		streamProxyItem.setCreateStamp(System.currentTimeMillis());
 		try {

--
Gitblit v1.8.0