package com.casic.PgInterface.devData.dto;

import com.casic.PgInterface.devData.domain.PgO2;

import java.text.SimpleDateFormat;

/**
 * Created by yxw on 2017/11/28.
 */
public class PgO2Dto{

    private String id;
    private String value;//O2
    private String logTime;
    private String upTime;
    private String devCode;
    private String devName;

    public String getId() {
        return id;
    }

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

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getLogTime() {
        return logTime;
    }

    public void setLogTime(String logTime) {
        this.logTime = logTime;
    }

    public String getUpTime() {
        return upTime;
    }

    public void setUpTime(String upTime) {
        this.upTime = upTime;
    }

    public String getDevCode() {
        return devCode;
    }

    public void setDevCode(String devCode) {
        this.devCode = devCode;
    }

    public String getDevName() {
        return devName;
    }

    public void setDevName(String devName) {
        this.devName = devName;
    }

    public PgO2Dto (PgO2 pgO2) {
        if(pgO2==null)
            return;

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        this.setId(String.valueOf(pgO2.getId()));
        this.setValue(pgO2.getO2());
        if (pgO2.getUpTime() != null)
            this.setUpTime(sdf.format(pgO2.getUpTime()));
        else
            this.setUpTime("");
        if (pgO2.getLogTime() != null)
            this.setLogTime(sdf.format(pgO2.getLogTime()));
        else
            this.setLogTime("");
        this.setDevCode(pgO2.getPgDeviceId().getDevCode());
        this.setDevName(pgO2.getPgDeviceId().getAssetName());
    }

}
