package com.zksy.base.telemetry.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zksy.base.telemetry.domain.TelemetryData;
import com.baomidou.mybatisplus.extension.service.IService;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【telemetry_data(平升遥测终端协议数据表)】的数据库操作Service
* @createDate 2026-01-16 15:43:42
*/
public interface TelemetryDataService extends IService<TelemetryData> {
    /**
     * 分页查询遥测终端数据
     */
    IPage<TelemetryData> queryPage(Page<TelemetryData> page, String deviceCode, LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 按设备统计流速/压力/温度等关键指标
     */
    List<Map<String, Object>> statTelemetryByDevice(LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 按小时统计设备流量/压力/温度趋势
     */
    List<Map<String, Object>> statTelemetryTrendByHour(String deviceCode, LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 查询异常数据（压力/温度/流速超阈值）
     */
    IPage<TelemetryData> queryAbnormalData(Page<TelemetryData> page, Double pressureThreshold, Double tempThreshold,
                                           Double speedThreshold, LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 获取设备最新监测数据
     */
    TelemetryData getLatestDataByDevice(String deviceCode);

    /**
     * 获取所有遥测终端设备编码
     */
    List<String> getAllDeviceCodes();
    List<String> getDeviceGroup();
}
