package com.casic.PgInterface.devData.dto;

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

import java.text.SimpleDateFormat;

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

    private String id;
    private String value;//sh
    private String upTime;
    private String logTime;
    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 getUpTime() {
        return upTime;
    }

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

    public String getLogTime() {
        return logTime;
    }

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

    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 PgShDto(PgSh pgSh) {

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

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

}
