修复心跳异常,支持通道列表,推流列表,拉流代理列表直接查看对应的云端录像,兼容大于INT的ssrc的格式化
This commit is contained in:
0
src/main/java/com/genersoft/iot/vmp/utils/Coordtransform.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/Coordtransform.java
Normal file → Executable file
5
src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
Normal file → Executable file
5
src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
Normal file → Executable file
@@ -1,6 +1,8 @@
|
||||
package com.genersoft.iot.vmp.utils;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -109,6 +111,9 @@ public class DateUtil {
|
||||
}
|
||||
|
||||
public static long getDifferenceForNow(String keepaliveTime) {
|
||||
if (ObjectUtils.isEmpty(keepaliveTime)) {
|
||||
return 0;
|
||||
}
|
||||
Instant beforeInstant = Instant.from(formatter.parse(keepaliveTime));
|
||||
return ChronoUnit.MILLIS.between(beforeInstant, Instant.now());
|
||||
}
|
||||
|
||||
0
src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java
Normal file → Executable file
100
src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java
Normal file → Executable file
100
src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java
Normal file → Executable file
@@ -1,50 +1,50 @@
|
||||
package com.genersoft.iot.vmp.utils;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @description:spring bean获取工厂,获取spring中的已初始化的bean
|
||||
* @author: swwheihei
|
||||
* @date: 2019年6月25日 下午4:51:52
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SpringBeanFactory implements ApplicationContextAware {
|
||||
|
||||
// Spring应用上下文环境
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* 实现ApplicationContextAware接口的回调方法,设置上下文环境
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext)
|
||||
throws BeansException {
|
||||
SpringBeanFactory.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对象 这里重写了bean方法,起主要作用
|
||||
*/
|
||||
public static <T> T getBean(String beanId) throws BeansException {
|
||||
if (applicationContext == null) {
|
||||
return null;
|
||||
}
|
||||
return (T) applicationContext.getBean(beanId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前环境
|
||||
*/
|
||||
public static String getActiveProfile() {
|
||||
return applicationContext.getEnvironment().getActiveProfiles()[0];
|
||||
}
|
||||
|
||||
}
|
||||
package com.genersoft.iot.vmp.utils;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @description:spring bean获取工厂,获取spring中的已初始化的bean
|
||||
* @author: swwheihei
|
||||
* @date: 2019年6月25日 下午4:51:52
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SpringBeanFactory implements ApplicationContextAware {
|
||||
|
||||
// Spring应用上下文环境
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* 实现ApplicationContextAware接口的回调方法,设置上下文环境
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext)
|
||||
throws BeansException {
|
||||
SpringBeanFactory.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对象 这里重写了bean方法,起主要作用
|
||||
*/
|
||||
public static <T> T getBean(String beanId) throws BeansException {
|
||||
if (applicationContext == null) {
|
||||
return null;
|
||||
}
|
||||
return (T) applicationContext.getBean(beanId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前环境
|
||||
*/
|
||||
public static String getActiveProfile() {
|
||||
return applicationContext.getEnvironment().getActiveProfiles()[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
0
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/UJson.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/UJson.java
Normal file → Executable file
90
src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java
Normal file → Executable file
90
src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java
Normal file → Executable file
@@ -1,45 +1,45 @@
|
||||
package com.genersoft.iot.vmp.utils.redis;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* @description:使用fastjson实现redis的序列化
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月6日 下午8:40:11
|
||||
*/
|
||||
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
|
||||
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
private Class<T> clazz;
|
||||
|
||||
public FastJsonRedisSerializer(Class<T> clazz) {
|
||||
super();
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(T t) throws SerializationException {
|
||||
if (t == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName, JSONWriter.Feature.WritePairAsJavaBean).getBytes(DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T deserialize(byte[] bytes) throws SerializationException {
|
||||
if (bytes == null || bytes.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
String str = new String(bytes, DEFAULT_CHARSET);
|
||||
return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.genersoft.iot.vmp.utils.redis;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* @description:使用fastjson实现redis的序列化
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月6日 下午8:40:11
|
||||
*/
|
||||
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
|
||||
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
private Class<T> clazz;
|
||||
|
||||
public FastJsonRedisSerializer(Class<T> clazz) {
|
||||
super();
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(T t) throws SerializationException {
|
||||
if (t == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName, JSONWriter.Feature.WritePairAsJavaBean).getBytes(DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T deserialize(byte[] bytes) throws SerializationException {
|
||||
if (bytes == null || bytes.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
String str = new String(bytes, DEFAULT_CHARSET);
|
||||
return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
94
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
Normal file → Executable file
94
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
Normal file → Executable file
@@ -1,47 +1,47 @@
|
||||
package com.genersoft.iot.vmp.utils.redis;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Redis工具类
|
||||
*
|
||||
* @author swwheihei
|
||||
* @date 2020年5月6日 下午8:27:29
|
||||
*/
|
||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
public class RedisUtil {
|
||||
|
||||
/**
|
||||
* 模糊查询
|
||||
*
|
||||
* @param query 查询参数
|
||||
* @return
|
||||
*/
|
||||
public static List<Object> scan(RedisTemplate redisTemplate, String query) {
|
||||
|
||||
Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||
ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build();
|
||||
Cursor<byte[]> scan = connection.scan(scanOptions);
|
||||
Set<String> keys = new HashSet<>();
|
||||
while (scan.hasNext()) {
|
||||
byte[] next = scan.next();
|
||||
keys.add(new String(next));
|
||||
}
|
||||
return keys;
|
||||
});
|
||||
|
||||
return Lists.newArrayList(resultKeys);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
package com.genersoft.iot.vmp.utils.redis;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Redis工具类
|
||||
*
|
||||
* @author swwheihei
|
||||
* @date 2020年5月6日 下午8:27:29
|
||||
*/
|
||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
public class RedisUtil {
|
||||
|
||||
/**
|
||||
* 模糊查询
|
||||
*
|
||||
* @param query 查询参数
|
||||
* @return
|
||||
*/
|
||||
public static List<Object> scan(RedisTemplate redisTemplate, String query) {
|
||||
|
||||
Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||
ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build();
|
||||
Cursor<byte[]> scan = connection.scan(scanOptions);
|
||||
Set<String> keys = new HashSet<>();
|
||||
while (scan.hasNext()) {
|
||||
byte[] next = scan.next();
|
||||
keys.add(new String(next));
|
||||
}
|
||||
return keys;
|
||||
});
|
||||
|
||||
return Lists.newArrayList(resultKeys);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
0
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil2.java
Normal file → Executable file
0
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil2.java
Normal file → Executable file
Reference in New Issue
Block a user