From cb5afce55eec2badda5090c27564e43f201ac9af Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 12 三月 2024 23:55:00 +0800
Subject: [PATCH] 优化语音对讲定时任务的删除
---
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
old mode 100644
new mode 100755
index 73adf2e..55fa5e9
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.service.impl;
+import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.gb28181.bean.Device;
@@ -11,12 +12,13 @@
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
-import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
@@ -27,6 +29,7 @@
* @author lin
*/
@Service
+@DS("master")
public class DeviceChannelServiceImpl implements IDeviceChannelService {
private final static Logger logger = LoggerFactory.getLogger(DeviceChannelServiceImpl.class);
@@ -49,8 +52,6 @@
if (device == null) {
device = deviceMapper.getDeviceByDeviceId(deviceChannel.getDeviceId());
}
-
-
if ("WGS84".equals(device.getGeoCoordSys())) {
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
@@ -143,7 +144,7 @@
}
}
}
- int limitCount = 300;
+ int limitCount = 50;
if (addChannels.size() > 0) {
if (addChannels.size() > limitCount) {
for (int i = 0; i < addChannels.size(); i += limitCount) {
@@ -175,8 +176,12 @@
}
@Override
- public ResourceBaceInfo getOverview() {
- return channelMapper.getOverview();
+ public ResourceBaseInfo getOverview() {
+
+ int online = channelMapper.getOnlineCount();
+ int total = channelMapper.getAllChannelCount();
+
+ return new ResourceBaseInfo(total, online);
}
@@ -197,7 +202,7 @@
deviceChannel.setUpdateTime(now);
result.add(updateGps(deviceChannel, device));
});
- int limitCount = 300;
+ int limitCount = 50;
if (result.size() > limitCount) {
for (int i = 0; i < result.size(); i += limitCount) {
int toIndex = i + limitCount;
@@ -241,6 +246,10 @@
@Override
public void batchUpdateChannel(List<DeviceChannel> channels) {
+ String now = DateUtil.getNow();
+ for (DeviceChannel channel : channels) {
+ channel.setUpdateTime(now);
+ }
channelMapper.batchUpdate(channels);
for (DeviceChannel channel : channels) {
if (channel.getParentId() != null) {
@@ -258,4 +267,17 @@
}
}
}
+
+ @Override
+ public void updateChannelStreamIdentification(DeviceChannel channel) {
+ assert !ObjectUtils.isEmpty(channel.getDeviceId());
+ assert !ObjectUtils.isEmpty(channel.getStreamIdentification());
+ if (ObjectUtils.isEmpty(channel.getStreamIdentification())) {
+ logger.info("[閲嶇疆閫氶亾鐮佹祦绫诲瀷] 璁惧: {}, 鐮佹祦锛� {}", channel.getDeviceId(), channel.getStreamIdentification());
+ }else {
+ logger.info("[鏇存柊閫氶亾鐮佹祦绫诲瀷] 璁惧: {}, 閫氶亾锛歿}锛� 鐮佹祦锛� {}", channel.getDeviceId(), channel.getChannelId(),
+ channel.getStreamIdentification());
+ }
+ channelMapper.updateChannelStreamIdentification(channel);
+ }
}
--
Gitblit v1.8.0