临时提交

This commit is contained in:
lin
2025-04-25 18:04:51 +08:00
parent 1dc65330fc
commit e2678f39e3
7 changed files with 174 additions and 5 deletions

View File

@@ -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 + '\'' +
'}';
}
}

View File

@@ -23,7 +23,7 @@ import java.nio.file.Files;
*/
@Slf4j
@Configuration
@Order(value=14)
@Order(value=15)
public class CivilCodeFileConf implements CommandLineRunner {
@Autowired

View File

@@ -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");
}
}

View File

@@ -1048,8 +1048,8 @@ public class PlayServiceImpl implements IPlayService {
null);
return;
}
log.info("[录像下载] deviceId: {}, channelId: {}, 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}({}), SSRC校验{}",
device.getDeviceId(), channel.getDeviceId(), downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(),
log.info("[录像下载] deviceId: {}, channelId: {}, 开始时间: {}, 结束时间: {} 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}({}), SSRC校验{}",
device.getDeviceId(), channel.getDeviceId(), startTime, endTime, downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(),
ssrcInfo.getSsrc(), String.format("%08x", Long.parseLong(ssrcInfo.getSsrc())).toUpperCase(),
device.isSsrcCheck());

View File

@@ -189,6 +189,8 @@ public class ZLMHttpHookListener {
JSONObject ret = new JSONObject();
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("close", close);
return ret;

View File

@@ -81,7 +81,6 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
public void execution() {
log.info("[录制计划] 执行");
// 查询现在需要录像的通道Id
List<Integer> startChannelIdList = queryCurrentChannelRecord();
@@ -221,7 +220,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
}
// TODO 更新录像队列
}
@Override

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.DigestUtils;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.GlobalMemory;
@@ -9,6 +10,7 @@ import oshi.hardware.NetworkIF;
import oshi.software.os.OperatingSystem;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -142,4 +144,19 @@ public class SystemInfoUtils {
}
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));
}
}