package com.mortals.xhx.module.device.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.vo.DeviceVo;
import lombok.Data;
/**
 * 设备实体对象
 *
 * @author zxfei
 * @date 2023-12-08
 */
@Data
public class DeviceEntity extends DeviceVo {
    private static final long serialVersionUID = 1L;

    /**
     * 设备id
     */
    private Long deviceId;
    /**
     * 设备名称
     */
    private String deviceName;
    /**
     * 设备编码
     */
    private String deviceCode;
    /**
     * 设备的MAC地址
     */
    private String deviceMac;
    /**
     * 站点Id
     */
    private Long siteId;
    /**
     * 站点编号，来源基础服务平台
     */
    private String siteCode;
    /**
     * 站点名称
     */
    private String siteName;
    /**
     * 设备生产厂商ID
     */
    private Long deviceFirmId;
    /**
     * 设备生产厂商名称
     */
    private String deviceFirmname;
    /**
     * 设备访问ip
     */
    private String ip;
    /**
     * 端口
     */
    private String port;
    /**
     * 启用状态 (0.停止，1.启用)
     */
    private Integer enabled;
    /**
     * 产品编码
     */
    private String productCode;
    /**
     * 产品名称
     */
    private String productName;
    /**
     * 设备来源(0.子设备，1.网关设备，2.直连设备)
     */
    private Integer deviceSrc;
    /**
     * 经度
     */
    private String lon;
    /**
     * 纬度
     */
    private String lati;
    /**
     * 负责人
     */
    private String leadingOfficial;
    /**
     * 联系电话
     */
    private String leadingOfficialTelephone;
    /**
     * 设备状态 (0.未激活，1.离线,2.在线)
     */
    private Integer deviceStatus;
    /**
     * 备注
     */
    private String deviceRemark;
    /**
     * 所属机构
     */
    private String belong;
    /**
     * 最近上线时间
     */
    private Date onlineTime;
    /**
     * 最近离线时间
     */
    private Date offlineTime;
    /**
     * 设备来源(0.旧设备，1.新设备)
     */
    private Integer source;
    @Override
    public int hashCode() {
        return this.getId().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (obj instanceof DeviceEntity) {
            DeviceEntity tmp = (DeviceEntity) obj;
            if (this.getId() == tmp.getId()) {
                return true;
            }
        }
        return false;
    }

    public void initAttrValue(){
        this.deviceId = null;
        this.deviceName = "";
        this.deviceCode = "";
        this.deviceMac = "";
        this.siteId = null;
        this.siteCode = "";
        this.siteName = "";
        this.deviceFirmId = null;
        this.deviceFirmname = "";
        this.ip = "";
        this.port = "";
        this.enabled = 0;
        this.productCode = "";
        this.productName = "";
        this.deviceSrc = 2;
        this.lon = "";
        this.lati = "";
        this.leadingOfficial = "";
        this.leadingOfficialTelephone = "";
        this.deviceStatus = 0;
        this.deviceRemark = "";
        this.belong = "";
        this.onlineTime = new Date();
        this.offlineTime = new Date();
        this.source = 1;
    }
}