临时提交
This commit is contained in:
@@ -0,0 +1,97 @@
|
|||||||
|
package com.genersoft.iot.vmp.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsInfo {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分支
|
||||||
|
*/
|
||||||
|
private String branch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* git提交版本ID
|
||||||
|
*/
|
||||||
|
private String gitCommitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* git地址
|
||||||
|
*/
|
||||||
|
private String gitUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建版本
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统名称
|
||||||
|
*/
|
||||||
|
private String osName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是docker环境
|
||||||
|
*/
|
||||||
|
private Boolean docker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 架构
|
||||||
|
*/
|
||||||
|
private String arch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jdk版本
|
||||||
|
*/
|
||||||
|
private String jdkVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis版本
|
||||||
|
*/
|
||||||
|
private String redisVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql数据库版本
|
||||||
|
*/
|
||||||
|
private String sqlVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql数据库类型, mysql/postgresql/金仓等
|
||||||
|
*/
|
||||||
|
private String sqlType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "StatisticsInfo{" +
|
||||||
|
"id=" + id +
|
||||||
|
", deviceId='" + deviceId + '\'' +
|
||||||
|
", branch='" + branch + '\'' +
|
||||||
|
", gitCommitId='" + gitCommitId + '\'' +
|
||||||
|
", gitUrl='" + gitUrl + '\'' +
|
||||||
|
", version='" + version + '\'' +
|
||||||
|
", osName='" + osName + '\'' +
|
||||||
|
", docker=" + docker +
|
||||||
|
", arch='" + arch + '\'' +
|
||||||
|
", jdkVersion='" + jdkVersion + '\'' +
|
||||||
|
", redisVersion='" + redisVersion + '\'' +
|
||||||
|
", sqlVersion='" + sqlVersion + '\'' +
|
||||||
|
", sqlType='" + sqlType + '\'' +
|
||||||
|
", time='" + time + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ import java.nio.file.Files;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
@Order(value=14)
|
@Order(value=15)
|
||||||
public class CivilCodeFileConf implements CommandLineRunner {
|
public class CivilCodeFileConf implements CommandLineRunner {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.StatisticsInfo;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
|
import com.genersoft.iot.vmp.utils.SystemInfoUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnection;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Order(value=100)
|
||||||
|
public class StatisticsInfoTask implements CommandLineRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GitUtil gitUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
StatisticsInfo statisticsInfo = new StatisticsInfo();
|
||||||
|
statisticsInfo.setDeviceId(SystemInfoUtils.getHardwareId());
|
||||||
|
statisticsInfo.setBranch(gitUtil.getBranch());
|
||||||
|
statisticsInfo.setGitCommitId(gitUtil.getGitCommitId());
|
||||||
|
statisticsInfo.setGitUrl(gitUtil.getGitUrl());
|
||||||
|
|
||||||
|
statisticsInfo.setOsName(System.getProperty("os.name"));
|
||||||
|
statisticsInfo.setArch(System.getProperty("os.arch"));
|
||||||
|
statisticsInfo.setJdkVersion(System.getProperty("java.version"));
|
||||||
|
|
||||||
|
statisticsInfo.setDocker(new File("/.dockerenv").exists());
|
||||||
|
|
||||||
|
statisticsInfo.setRedisVersion(getRedisVersion());
|
||||||
|
|
||||||
|
// statisticsInfo.setSqlVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRedisVersion() {
|
||||||
|
if (redisTemplate.getConnectionFactory() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
RedisConnection connection = redisTemplate.getConnectionFactory().getConnection();
|
||||||
|
if (connection.info() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return connection.info().getProperty("redis_version");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1048,8 +1048,8 @@ public class PlayServiceImpl implements IPlayService {
|
|||||||
null);
|
null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("[录像下载] deviceId: {}, channelId: {}, 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}({}), SSRC校验:{}",
|
log.info("[录像下载] deviceId: {}, channelId: {}, 开始时间: {}, 结束时间: {}, 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}({}), SSRC校验:{}",
|
||||||
device.getDeviceId(), channel.getDeviceId(), downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(),
|
device.getDeviceId(), channel.getDeviceId(), startTime, endTime, downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(),
|
||||||
ssrcInfo.getSsrc(), String.format("%08x", Long.parseLong(ssrcInfo.getSsrc())).toUpperCase(),
|
ssrcInfo.getSsrc(), String.format("%08x", Long.parseLong(ssrcInfo.getSsrc())).toUpperCase(),
|
||||||
device.isSsrcCheck());
|
device.isSsrcCheck());
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ public class ZLMHttpHookListener {
|
|||||||
|
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
boolean close = mediaService.closeStreamOnNoneReader(param.getMediaServerId(), param.getApp(), param.getStream(), param.getSchema());
|
boolean close = mediaService.closeStreamOnNoneReader(param.getMediaServerId(), param.getApp(), param.getStream(), param.getSchema());
|
||||||
|
log.info("[ZLM HOOK]流无人观看是否触发关闭:{}, {}->{}->{}/{}", close, param.getMediaServerId(), param.getSchema(),
|
||||||
|
param.getApp(), param.getStream());
|
||||||
ret.put("code", 0);
|
ret.put("code", 0);
|
||||||
ret.put("close", close);
|
ret.put("close", close);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
|
|||||||
|
|
||||||
@Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
|
@Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
|
||||||
public void execution() {
|
public void execution() {
|
||||||
log.info("[录制计划] 执行");
|
|
||||||
// 查询现在需要录像的通道Id
|
// 查询现在需要录像的通道Id
|
||||||
List<Integer> startChannelIdList = queryCurrentChannelRecord();
|
List<Integer> startChannelIdList = queryCurrentChannelRecord();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.utils;
|
package com.genersoft.iot.vmp.utils;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
import oshi.hardware.CentralProcessor;
|
import oshi.hardware.CentralProcessor;
|
||||||
import oshi.hardware.GlobalMemory;
|
import oshi.hardware.GlobalMemory;
|
||||||
@@ -9,6 +10,7 @@ import oshi.hardware.NetworkIF;
|
|||||||
import oshi.software.os.OperatingSystem;
|
import oshi.software.os.OperatingSystem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -142,4 +144,19 @@ public class SystemInfoUtils {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getHardwareId(){
|
||||||
|
SystemInfo systemInfo = new SystemInfo();
|
||||||
|
HardwareAbstractionLayer hardware = systemInfo.getHardware();
|
||||||
|
// CPU ID
|
||||||
|
String cpuId = hardware.getProcessor().getProcessorIdentifier().getProcessorID();
|
||||||
|
// 主板序号
|
||||||
|
String serialNumber = hardware.getComputerSystem().getSerialNumber();
|
||||||
|
|
||||||
|
return DigestUtils.md5DigestAsHex(
|
||||||
|
(
|
||||||
|
DigestUtils.md5DigestAsHex(cpuId.getBytes(StandardCharsets.UTF_8)) +
|
||||||
|
DigestUtils.md5DigestAsHex(serialNumber.getBytes(StandardCharsets.UTF_8))
|
||||||
|
).getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user