18045010223
2025-07-07 0d3a683a0c97154b1f2e6657398664537e4e3e82
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.yzh.web.model.entity;
 
import io.github.yezhihao.protostar.util.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.yzh.protocol.commons.MessageId;
import org.yzh.protocol.t808.T0200;
 
import java.util.Objects;
 
@Data
@Accessors(chain = true)
public class DeviceDO {
 
    @Schema(description = "设备id")
    private String deviceId;
    @Schema(description = "设备手机号")
    private String mobileNo;
    @Schema(description = "车牌号")
    private String plateNo;
    @Schema(description = "机构id")
    protected int agencyId;
    @Schema(description = "司机id(人脸识别)")
    protected int driverId;
    @Schema(description = "协议版本号")
    private int protocolVersion;
    @Schema(description = "实时状态")
    private T0200 location;
 
    public void updateLocation(T0200 location) {
        if (this.location == null) {
            this.location = location;
        } else if (this.location.getDeviceTime().isBefore(location.getDeviceTime())) {
            this.location = location;
        }
    }
 
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DeviceDO other = (DeviceDO) that;
        return Objects.equals(this.deviceId, other.deviceId);
    }
 
    @Override
    public int hashCode() {
        return ((deviceId == null) ? 0 : deviceId.hashCode());
    }
 
 
    protected StringBuilder toStringHead() {
        final StringBuilder sb = new StringBuilder(768);
        sb.append('[');
        sb.append("deviceId=").append(deviceId);
        sb.append(",mobileNo=").append(mobileNo);
        sb.append(",plateNo=").append(plateNo);
        sb.append(",agencyId=").append(agencyId);
        sb.append(",driverId=").append(driverId);
        sb.append(",protocolVersion=").append(protocolVersion);
        sb.append(",location=").append(location);
        sb.append(']');
        sb.append(',');
        return sb;
    }
 
    @Override
    public String toString() {
        String result = ToStringBuilder.toString(toStringHead(), this, false, "messageId", "clientId", "protocolVersion", "serialNo", "properties", "packageTotal", "packageNo");
        return result;
    }
}