修复数据库语法兼容以及redis接收推流信息导入

This commit is contained in:
648540858
2024-09-14 15:19:07 +08:00
parent a36c427394
commit 800d6c926a
21 changed files with 120 additions and 274 deletions

View File

@@ -153,7 +153,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
log.warn("[多个通道离线] 通道数量为0更新失败");
return 0;
}
List<CommonGBChannel> onlineChannelList = commonGBChannelMapper.queryInListByStatus(commonGBChannelList, 1);
List<CommonGBChannel> onlineChannelList = commonGBChannelMapper.queryInListByStatus(commonGBChannelList, "ON");
if (onlineChannelList.isEmpty()) {
log.warn("[多个通道离线] 更新失败, 参数内通道已经离线");
return 0;
@@ -166,10 +166,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
if (i + limitCount > onlineChannelList.size()) {
toIndex = onlineChannelList.size();
}
result += commonGBChannelMapper.updateStatusForListById(onlineChannelList.subList(i, toIndex), 0);
result += commonGBChannelMapper.updateStatusForListById(onlineChannelList.subList(i, toIndex), "OFF");
}
} else {
result += commonGBChannelMapper.updateStatusForListById(onlineChannelList, 0);
result += commonGBChannelMapper.updateStatusForListById(onlineChannelList, "OFF");
}
if (result > 0) {
try {
@@ -207,7 +207,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
log.warn("[多个通道上线] 通道数量为0更新失败");
return 0;
}
List<CommonGBChannel> offlineChannelList = commonGBChannelMapper.queryInListByStatus(commonGBChannelList, 0);
List<CommonGBChannel> offlineChannelList = commonGBChannelMapper.queryInListByStatus(commonGBChannelList, "OFF");
if (offlineChannelList.isEmpty()) {
log.warn("[多个通道上线] 更新失败, 参数内通道已经上线线");
return 0;
@@ -221,10 +221,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
if (i + limitCount > offlineChannelList.size()) {
toIndex = offlineChannelList.size();
}
result += commonGBChannelMapper.updateStatusForListById(offlineChannelList.subList(i, toIndex), 1);
result += commonGBChannelMapper.updateStatusForListById(offlineChannelList.subList(i, toIndex), "ON");
}
} else {
result += commonGBChannelMapper.updateStatusForListById(offlineChannelList, 1);
result += commonGBChannelMapper.updateStatusForListById(offlineChannelList, "ON");
}
if (result > 0) {
try {
@@ -282,7 +282,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
} else {
result += commonGBChannelMapper.batchUpdate(commonGBChannels);
}
log.warn("[更新多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
log.info("[更新多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
// 发送通过更新通知
try {
// 发送通知

View File

@@ -376,19 +376,19 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
}
List<CommonGBChannel> channelList = new ArrayList<>();
// 是否包含平台信息
if (platform.getCatalogWithPlatform()) {
if (platform.getCatalogWithPlatform() > 0) {
CommonGBChannel channel = CommonGBChannel.build(platform);
channelList.add(channel);
}
// 关联的行政区划信息
if (platform.getCatalogWithRegion()) {
if (platform.getCatalogWithRegion() > 0) {
// 查询关联平台的行政区划信息
List<CommonGBChannel> regionChannelList = regionMapper.queryByPlatform(platform.getId());
if (!regionChannelList.isEmpty()) {
channelList.addAll(regionChannelList);
}
}
if (platform.getCatalogWithGroup()) {
if (platform.getCatalogWithGroup() > 0) {
// 关联的分组信息
List<CommonGBChannel> groupChannelList = groupMapper.queryForPlatform(platform.getId());
if (!groupChannelList.isEmpty()) {

View File

@@ -27,7 +27,6 @@ import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.service.ISendRtpServerService;
import com.genersoft.iot.vmp.service.bean.*;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -83,9 +82,6 @@ public class PlatformServiceImpl implements IPlatformService {
@Autowired
private SubscribeHolder subscribeHolder;
@Autowired
private GbStreamMapper gbStreamMapper;
@Autowired
private UserSetting userSetting;
@@ -457,27 +453,21 @@ public class PlatformServiceImpl implements IPlatformService {
SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId());
if (subscribe != null) {
// TODO 暂时只处理视频流的回复,后续增加对国标设备的支持
List<DeviceChannel> gbStreams = gbStreamMapper.queryGbStreamListInPlatform(platform.getServerGBId(), userSetting.isUsePushingAsStatus());
if (gbStreams.size() == 0) {
List<CommonGBChannel> channelList = platformChannelMapper.queryShare(platform.getId(), null);
if (channelList.isEmpty()) {
return;
}
for (DeviceChannel deviceChannel : gbStreams) {
String gbId = deviceChannel.getDeviceId();
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId);
for (CommonGBChannel channel : channelList) {
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbId());
// 无最新位置不发送
if (gpsMsgInfo != null) {
// 经纬度都为0不发送
if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
continue;
}
CommonGBChannel commonGBChannel = platformChannelMapper.queryShareChannel(platform.getId(), deviceChannel.getId());
if (commonGBChannel == null) {
continue;
}
// 发送GPS消息
try {
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, commonGBChannel, subscribe);
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe);
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
IllegalAccessException e) {
log.error("[命令发送失败] 国标级联 移动位置通知: {}", e.getMessage());