修复数据库语法兼容以及redis接收推流信息导入
This commit is contained in:
@@ -51,7 +51,7 @@ public class CommonGBChannel {
|
||||
|
||||
// 2016
|
||||
@Schema(description = "国标-证书序列号")
|
||||
private Integer gbCertNum;
|
||||
private String gbCertNum;
|
||||
|
||||
// 2016
|
||||
@Schema(description = "国标-证书有效标识")
|
||||
@@ -63,7 +63,7 @@ public class CommonGBChannel {
|
||||
|
||||
// 2016
|
||||
@Schema(description = "国标-证书终止有效期(有证书且证书无效的设备必选)")
|
||||
private Integer gbEndTime;
|
||||
private String gbEndTime;
|
||||
|
||||
// 2022
|
||||
@Schema(description = "国标-摄像机安全能力等级代码")
|
||||
|
||||
@@ -97,14 +97,14 @@ public class Platform {
|
||||
@Schema(description = "是否自动推送通道变化")
|
||||
private Boolean autoPushChannel;
|
||||
|
||||
@Schema(description = "目录信息包含平台信息")
|
||||
private Boolean catalogWithPlatform;
|
||||
@Schema(description = "目录信息包含平台信息, 0:关闭,1:打开")
|
||||
private int catalogWithPlatform;
|
||||
|
||||
@Schema(description = "目录信息包含分组信息")
|
||||
private Boolean catalogWithGroup;
|
||||
@Schema(description = "目录信息包含分组信息, 0:关闭,1:打开")
|
||||
private int catalogWithGroup;
|
||||
|
||||
@Schema(description = "目录信息包含行政区划")
|
||||
private Boolean catalogWithRegion;
|
||||
@Schema(description = "目录信息包含行政区划, 0:关闭,1:打开")
|
||||
private int catalogWithRegion;
|
||||
|
||||
@Schema(description = "行政区划")
|
||||
private String civilCode;
|
||||
|
||||
@@ -154,13 +154,13 @@ public interface CommonGBChannelMapper {
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_status = #{gbStatus} WHERE id = #{item.gbId}" +
|
||||
"UPDATE wvp_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
int updateStatusForListById(List<CommonGBChannel> commonGBChannels, @Param("status") int status);
|
||||
int updateStatusForListById(List<CommonGBChannel> commonGBChannels, @Param("status") String status);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryInListByStatus")
|
||||
List<CommonGBChannel> queryInListByStatus(List<CommonGBChannel> commonGBChannelList, @Param("status") int status);
|
||||
List<CommonGBChannel> queryInListByStatus(List<CommonGBChannel> commonGBChannelList, @Param("status") String status);
|
||||
|
||||
|
||||
@Insert(" <script>" +
|
||||
@@ -411,7 +411,7 @@ public interface CommonGBChannelMapper {
|
||||
", gb_download_speed=#{item.gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}" +
|
||||
" WHERE id=#{item.id}" +
|
||||
" WHERE id=#{item.gbId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdate(List<CommonGBChannel> commonGBChannels);
|
||||
|
||||
@@ -612,7 +612,7 @@ public interface DeviceChannelMapper {
|
||||
int batchOffline(List<DeviceChannel> channels);
|
||||
|
||||
|
||||
@Select("select count(1) from wvp_device_channel where status = true")
|
||||
@Select("select count(1) from wvp_device_channel where status = 'ON'")
|
||||
int getOnlineCount();
|
||||
|
||||
@Select("select count(1) from wvp_device_channel")
|
||||
|
||||
@@ -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 {
|
||||
// 发送通知
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user