a-tuoheng-device/src/main/java/com/ruoyi/device/service/FlightService.java

93 lines
2.3 KiB
Java
Raw Normal View History

2026-02-25 13:06:56 +08:00
package com.ruoyi.device.service;
import com.ruoyi.device.mapper.entity.FlightEntity;
2026-03-10 14:56:42 +08:00
import com.ruoyi.task.api.enums.StatusEnum;
2026-02-25 13:06:56 +08:00
import java.util.Map;
/**
* 飞行服务接口
*
* @author ruoyi
* @date 2026-02-25
*/
public interface FlightService
{
2026-03-10 14:56:42 +08:00
public Long createClickTakeOffTask(String sn, String url);
2026-03-10 10:47:15 +08:00
2026-02-25 13:06:56 +08:00
/**
* 获取或创建飞行记录通过messageID匹配
* 如果存在相同messageID的飞行记录返回该记录
* 如果不存在或messageID不同创建新记录
*
* @param deviceSn 设备SN号
* @param messageId 消息ID对应flightIdExternal
* @return 飞行记录
*/
2026-03-10 14:56:42 +08:00
// FlightEntity getOrCreateFlightByMessageId(String deviceSn, String messageId);
2026-02-25 13:06:56 +08:00
2026-03-10 10:47:15 +08:00
// /**
// * 获取最新的飞行记录(包括已返航的)
// * 用于WebSocket推送
// *
// * @param deviceSn 设备SN号
// * @return 飞行记录
// */
// FlightEntity getLatestFlight(String deviceSn);
2026-02-25 13:06:56 +08:00
2026-03-10 10:47:15 +08:00
// /**
// * 更新飞行ID外部ID
// *
// * @param flightId 飞行ID
// * @param flightIdExternal 外部飞行ID
// */
// void updateFlightIdExternal(Long flightId, String flightIdExternal);
2026-02-25 13:06:56 +08:00
/**
* 更新飞行状态
*
* @param flightId 飞行ID
* @param status 状态自检中飞行中已返航
*/
2026-03-10 14:56:42 +08:00
void updateFlightStatus(Long flightId, StatusEnum status);
2026-02-25 13:06:56 +08:00
2026-03-10 10:47:15 +08:00
// /**
// * 更新返航时间
// *
// * @param flightId 飞行ID
// */
// void updateReturnTime(Long flightId);
2026-02-25 13:06:56 +08:00
/**
* 获取飞行记录和日志用于WebSocket推送
*
* @param deviceSn 设备SN号
* @return 飞行记录和日志
*/
Map<String, Object> getLatestFlightWithLogs(String deviceSn);
/**
* 保存自检日志
*
* @param logEntity 自检日志实体
*/
void insertPreCheckLog(com.ruoyi.device.mapper.entity.PreCheckLogEntity logEntity);
/**
* 保存飞行日志
*
* @param logEntity 飞行日志实体
*/
void insertFlightLog(com.ruoyi.device.mapper.entity.FlightLogEntity logEntity);
2026-02-27 15:30:09 +08:00
/**
* 检查飞行记录是否有飞行日志
*
* @param flightId 飞行ID
* @return true=有飞行日志已起飞false=无飞行日志未起飞
*/
boolean hasFlightLog(Long flightId);
2026-02-25 13:06:56 +08:00
}