liusuyi
2025-11-25 a59876cd161a994712e98b1439d75ce17d00064b
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
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 String serverId;            // 服务器ID
 
    // 计算持续时长,单位:秒
    public Long getDuration() {
        if (startTime != null && endTime != null) {
            // 计算时间差(毫秒)
            long durationMillis = endTime.getTime() - startTime.getTime();
            // 将毫秒转换为秒
            return durationMillis / 1000;
        }
        return null;
    }
}