package com.szpg.db.data;

import java.util.Date;

import com.szpg.util.NumberFormat;
import com.szpg.util.TimeFormat;

/**
 * 照明累计运行时长数据表
 * 
 * @author admin
 *
 */
public class PgZmRt implements java.io.Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2638260189687367747L;
	
	private Integer id;
	private Date logtime;
	private Date uptime;
	private Integer pgdeviceid;
	private Integer runsecond;
	private Integer runhour;

	public Integer getId() {
		return id;
	}

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

	public Date getLogtime() {
		return logtime;
	}

	public void setLogtime(Date logtime) {
		this.logtime = logtime;
	}

	public Date getUptime() {
		return uptime;
	}

	public void setUptime(Date uptime) {
		this.uptime = uptime;
	}
	
	public Integer getPgdeviceid() {
		return pgdeviceid;
	}

	public void setPgdeviceid(Integer pgdeviceid) {
		this.pgdeviceid = pgdeviceid;
	}
	
	public Integer getRunsecond() {
		return runsecond;
	}

	public void setRunsecond(Integer runsecond) {
		this.runsecond = runsecond;
	}

	public Integer getRunhour() {
		return runhour;
	}

	public void setRunhour(Integer runhour) {
		this.runhour = runhour;
	}

	public void setTm(Date tm) {
		this.logtime = tm;
		this.uptime = tm;
	}
	
	public String getTmStr() {
		if (null != this.logtime) {
			return TimeFormat.formatTimestamp(logtime);
		} else {
			return "";
		}
	}
	
	public String getTmStrGB() {
		if (null != this.logtime) {
			return TimeFormat.format(logtime, "yyyyMMddHHmmss");
		} else {
			return "";
		}
	}
	
	public String getAccRunTime() {
		return NumberFormat.format(runhour + runsecond / 3600, "0.00");
	}

	@Override
	public String toString() {
		return "PgZmRt[acc=" + getAccRunTime() + ", logtime=" + TimeFormat.formatTimestamp(logtime) + "]";
	}
}
