feat(event): 添加暂态事件波形查看与导出功能

- 新增 getTransientEventWave 接口用于查看暂态事件波形
- 新增 exportTransientEventWaves 接口用于批量导出暂态事件波形
- 添加 EventWaveExportParam 参数类支持波形导出
- 在 EventListMapper 中增加 selectTransientDetailsByIds 查询方法
- 更新事件列表查询参数支持毫秒级时间格式
- 移除事件描述模糊查询条件优化查询性能
- 添加波形导出相关的常量和工具类集成
This commit is contained in:
2026-05-18 08:45:05 +08:00
parent 90219a3daf
commit 38f910fccd
67 changed files with 1203 additions and 1760 deletions

View File

@@ -11,6 +11,7 @@ import com.njcn.gather.systemmonitor.disk.pojo.po.DiskMonitorJob;
import com.njcn.gather.systemmonitor.disk.pojo.po.DiskMonitorNotifyLog;
import com.njcn.gather.systemmonitor.disk.pojo.po.DiskMonitorResult;
import com.njcn.gather.systemmonitor.disk.pojo.po.DiskMonitorTarget;
import com.njcn.gather.systemmonitor.disk.util.GeneratedFileNameUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -102,7 +103,7 @@ public class DiskMonitorNotificationComponent {
String fileName = String.format("disk-monitor-%s-%s-%s.json",
job.getJobNo(), target.getDriveLetter().replace(":", ""),
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
Path filePath = directoryPath.resolve(fileName);
Path filePath = directoryPath.resolve(GeneratedFileNameUtil.appendToday(fileName));
Map<String, Object> payload = buildNotifyPayload(job, target, usedPercent, currentStatus, notifyReason, notifyLevel, scanTime, message);
Files.write(filePath, objectMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(payload));
notifyLog.setSendStatus(DiskMonitorConstant.SEND_STATUS_SUCCESS);

View File

@@ -0,0 +1,32 @@
package com.njcn.gather.systemmonitor.disk.util;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* 生成文件名处理工具。
*/
public final class GeneratedFileNameUtil {
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
private GeneratedFileNameUtil() {
}
public static String appendToday(String fileName) {
return appendDate(fileName, LocalDate.now());
}
public static String appendDate(String fileName, LocalDate date) {
if (fileName == null || date == null) {
return fileName;
}
String dateText = DATE_FORMATTER.format(date);
int separatorIndex = Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\'));
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex > separatorIndex) {
return fileName.substring(0, dotIndex) + "_" + dateText + fileName.substring(dotIndex);
}
return fileName + "_" + dateText;
}
}