package com.casic.PgInterface.devData.dto;

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

import java.text.SimpleDateFormat;

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

    private String id;
    private String value;//ch4
    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 PgCh4Dto(PgCh4 pgCh4) {
        if(pgCh4==null)
            return;

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

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

}
