package com.casic.PgInterface.devData.dto;

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

import java.text.SimpleDateFormat;

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

    private String id;
    private String value;//co
    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 PgCoDto(PgCo pgCo) {

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

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

}
