AlarmDSMVo.java 6.52 KB
package com.bsth.message.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.ArrayList;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class AlarmDSMVo implements AlarmVo {

    private String clientId;

    /**
     * 车辆编码(内部编码)
     */
    private String vehicleCode;

    /**
     * 设备号
     */
    private String deviceId;

    /**
     * 车牌号
     */
    private String vehiclePlate;

    /**
     * 报警ID
     */
    private String alarmId;

    /**
     * 报警/事件类型
     * 0x01:疲劳驾驶报警
     * 0x02:接打电话报警
     * 0x03:抽烟报警
     * 0x04:分神驾驶报警
     * 0x05:驾驶员异常报警
     * 0x06~0x0F:用户自定义
     * 0x10:自动抓拍事件
     * 0x11:驾驶员变更事件
     * 0x12~0x1F:用户自定义
     */
    private int type;

    /**
     * 报警级别
     * 0x01 一级报警
     * 0x02 二级报警
     */
    private int level;

    /**
     * 疲劳程度
     */
    private int fatigueDegree;

    /**
     * 预留
     */
    private int reserves;

    /**
     * 车速
     */
    private int speed;

    /**
     * 高程
     */
    private int altitude;

    /**
     * 纬度
     */
    private int latitude;

    /**
     * 经度
     */
    private int longitude;

    /**
     * 警报开始时间
     */
    private long alarmTimeBegin;

    /**
     * 警报结束时间
     */
    private long alarmTimeEnd;

    /**
     * 车辆状态
     */
    private int statusBit;

    /**
     * 附件path
     */
    private List<String> paths = new ArrayList<>();

    private String lineCode;

    /**
     * 限速值(0.01km/h)
     */
    private int speedLimit;

    /**
     * 超速速度峰值(0.01km/h)
     */
    private int speedPeak;

    /**
     * 超速持续时长(S)
     */
    private int duration;

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getVehicleCode() {
        return vehicleCode;
    }

    public void setVehicleCode(String vehicleCode) {
        this.vehicleCode = vehicleCode;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getVehiclePlate() {
        return vehiclePlate;
    }

    public void setVehiclePlate(String vehiclePlate) {
        this.vehiclePlate = vehiclePlate;
    }

    public List<String> getPaths() {
        return paths;
    }

    public void setPaths(List<String> paths) {
        this.paths = paths;
    }

    public String getAlarmId() {
        return alarmId;
    }

    public void setAlarmId(String alarmId) {
        this.alarmId = alarmId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getFatigueDegree() {
        return fatigueDegree;
    }

    public void setFatigueDegree(int fatigueDegree) {
        this.fatigueDegree = fatigueDegree;
    }

    public int getReserves() {
        return reserves;
    }

    public void setReserves(int reserves) {
        this.reserves = reserves;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getAltitude() {
        return altitude;
    }

    public void setAltitude(int altitude) {
        this.altitude = altitude;
    }

    public int getLatitude() {
        return latitude;
    }

    public void setLatitude(int latitude) {
        this.latitude = latitude;
    }

    public int getLongitude() {
        return longitude;
    }

    public void setLongitude(int longitude) {
        this.longitude = longitude;
    }

    public long getAlarmTimeBegin() {
        return alarmTimeBegin;
    }

    public void setAlarmTimeBegin(long alarmTimeBegin) {
        this.alarmTimeBegin = alarmTimeBegin;
    }

    public long getAlarmTimeEnd() {
        return alarmTimeEnd;
    }

    public void setAlarmTimeEnd(long alarmTimeEnd) {
        this.alarmTimeEnd = alarmTimeEnd;
    }

    public int getStatusBit() {
        return statusBit;
    }

    public void setStatusBit(int statusBit) {
        this.statusBit = statusBit;
    }

    public String getAlarmType() {
        return "dsm";
    }

    public String getLineCode() {
        return lineCode;
    }

    @Override
    public void setLineCode(String lineCode) {
        this.lineCode = lineCode;
    }

    public int getSpeedLimit() {
        return speedLimit;
    }

    public void setSpeedLimit(int speedLimit) {
        this.speedLimit = speedLimit;
    }

    public int getSpeedPeak() {
        return speedPeak;
    }

    public void setSpeedPeak(int speedPeak) {
        this.speedPeak = speedPeak;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public String getAttach() {
        return String.format("峰值(km/h):%d[%d],持续(s):%d", speedPeak / 100,  speedLimit/ 100, duration);
    }

    @Override
    public int hashCode() {
        return String.format("%s_%d_%d", this.clientId, this.alarmTimeBegin, this.type).hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        AlarmDSMVo other = (AlarmDSMVo) obj;

        return this.clientId.equals(other.getClientId()) && this.alarmTimeBegin == other.getAlarmTimeBegin() && this.type == other.getType();
    }

    @Override
    public String toString() {
        return "AlarmDSMVo{" +
                "clientId='" + clientId + '\'' +
                ", vehicleCode='" + vehicleCode + '\'' +
                ", deviceId='" + deviceId + '\'' +
                ", vehiclePlate='" + vehiclePlate + '\'' +
                ", alarmId='" + alarmId + '\'' +
                ", type=" + type +
                ", level=" + level +
                ", fatigueDegree=" + fatigueDegree +
                ", reserves=" + reserves +
                ", speed=" + speed +
                ", altitude=" + altitude +
                ", latitude=" + latitude +
                ", longitude=" + longitude +
                ", alarmTimeBegin=" + alarmTimeBegin +
                ", alarmTimeEnd=" + alarmTimeEnd +
                ", statusBit=" + statusBit +
                ", paths=" + paths +
                '}';
    }
}