liusuyi
2026-06-11 b097f7539a7429a85cdda7959c9ecb83a37a2918
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.ard.work.domain.entity;
 
import com.ard.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
 
import java.util.Date;
 
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ArdFlightTask extends BaseEntity {
 
    private Integer taskId;             // 任务ID
    private String boxSn;               // 飞行器序列号
    private String boxName;             // 飞行器名称
    private String taskName;            // 任务名称
    private Integer photoCount;         // 图片数量
    private Integer videoCount;         // 录像数量
    private String videoPath;           // 视频路径
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;             // 任务开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;               // 任务结束时间
    private Long duration;              // 持续时长(单位:秒)
    private Integer flightDuration;     // 飞行时长(单位:秒)
    private Integer flightMileage;      // 飞行里程
    private Float aveSpeed;             // 平均速度
    private Float maxSpeed;             // 最大速度
    private String serverId;            // 服务器ID
    private Integer flightMode;         // 飞行模式(来自飞控遥测)
    private String routeId;             // 关联航线ID(ard_route_info.id),非空即为航线飞行
 
    /**
     * 判断是否为航线飞行
     */
    public boolean isRouteFlight() {
        return routeId != null && !routeId.isEmpty();
    }
 
    // 计算持续时长,单位:秒
    public Long getDuration() {
        if (startTime != null && endTime != null) {
            // 计算时间差(毫秒)
            long durationMillis = endTime.getTime() - startTime.getTime();
            // 将毫秒转换为秒
            return durationMillis / 1000;
        }
        return null;
    }
}