package com.casic.PgInterface.devTable.dto;

import com.casic.PgInterface.devTable.domain.PgAlarm;

import java.text.SimpleDateFormat;

/**
 * Created by yxw on 2017/10/30.
 */
public class PgAlarmDto{

    private String id;
    private String alarmType;//报警类型
    private String alarmValue;//报警值
    private String alarmDate;//报警时间
    private String description;//描述
    private String alarmDevName;//报警设备
    private String alarmLocation;//报警位置
    private String userName;//责任人
    private String phoneNumber;//联系电话
    private String active;//状态
    private String devType;//设备类型

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAlarmType() {
        return alarmType;
    }

    public void setAlarmType(String alarmType) {
        this.alarmType = alarmType;
    }

    public String getAlarmValue() {
        return alarmValue;
    }

    public void setAlarmValue(String alarmValue) {
        this.alarmValue = alarmValue;
    }

    public String getAlarmDate() {
        return alarmDate;
    }

    public void setAlarmDate(String alarmDate) {
        this.alarmDate = alarmDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAlarmDevName() {
        return alarmDevName;
    }

    public void setAlarmDevName(String alarmDevName) {
        this.alarmDevName = alarmDevName;
    }

    public String getAlarmLocation() {
        return alarmLocation;
    }

    public void setAlarmLocation(String alarmLocation) {
        this.alarmLocation = alarmLocation;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String getDevType() {
        return devType;
    }

    public void setDevType(String devType) {
        this.devType = devType;
    }

    public PgAlarmDto(PgAlarm pgAlarm) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        this.setId(String.valueOf(pgAlarm.getId()));
        if(pgAlarm.getAlarmTypeId()==null)
            this.setAlarmType("");
        else
            this.setAlarmType(pgAlarm.getAlarmTypeId().getAlarmType());
        this.setAlarmValue(pgAlarm.getAlarmValue());
        if (pgAlarm.getAlarmDate() != null)
            this.setAlarmDate(sdf.format(pgAlarm.getAlarmDate()));
        else
            this.setAlarmDate("");
        this.setDescription(pgAlarm.getDescription());
        this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName());
        this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition());
        this.setUserName(pgAlarm.getUserId().getUserName());
        this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber());
        this.setActive(String.valueOf(pgAlarm.getActive()));
        this.setDevType(pgAlarm.getAlarmDevId().getDevType());
    }

}