DeviceAlarmMsgBean.java 1.8 KB
package com.myproject.bean.qisda;

import java.util.Date;

/**
 * Created by sunke on 2020/6/27.
 */
public class DeviceAlarmMsgBean {

    public DeviceAlarmMsgBean() {
    }

    public DeviceAlarmMsgBean(String name, String msgKey, String msgValue) {
        this.msgKey = msgKey;
        this.msgValue = msgValue;
        this.name = name;
    }

    /**
     * 类型:0为错误, 1为正常消息
     */
    private int type = 0;

    private String name;

    private String msgKey;

    private String msgValue;

    private Date startTime;

    private Date updateTime = new Date();

    public void updateMsg(DeviceAlarmMsgBean newBean){
        this.msgValue = newBean.getMsgValue();
        this.name = newBean.getName();
        this.updateTime = new Date();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMsgKey() {
        return msgKey;
    }

    public void setMsgKey(String msgKey) {
        this.msgKey = msgKey;
    }

    public String getMsgValue() {
        return msgValue;
    }

    public void setMsgValue(String msgValue) {
        this.msgValue = msgValue;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public boolean isTimeout(){
        return System.currentTimeMillis() - updateTime.getTime() > 10 * 1000;
    }

    public int getType() {
        return type;
    }

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

    public boolean isInfoMsg(){
        return type == 1;
    }
}