Newer
Older
newfiber-data-adapter / src / main / java / org / springnewfiber / dataadapter / xf / entity / monitor / MonitorDataHistoryMongo.java
@silver silver on 29 Jun 2022 2 KB 讯飞历史数据接入
package org.springnewfiber.dataadapter.xf.entity.monitor;

import java.util.Date;
import java.util.HashMap;
import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * @program: newwater-data-engine
 * @description:
 * @author: djt
 * @create: 2021-12-24 15:54
 **/
@Data
public class MonitorDataHistoryMongo extends HashMap<String, Object> {
	/**
	 * 站点编号
	 */
	private String st;
	/**
	 * 观测时间
	 */
	private Date tt;

	/**
	 * 上报时间
	 */
	private Date ut;

	private Date createTime;

	public void setTt(Date tt) {
		this.tt = tt;
		this.put(MonitorDataKeyConstant.TT, tt);
	}

	public void setSt(String st) {
		this.st = st;
		this.put(MonitorDataKeyConstant.ST, st);
	}

	public void setUt(Date ut) {
		this.ut = ut;
		this.put(MonitorDataKeyConstant.UT, ut);
	}

	public void setCreateTime(Date date) {
		this.createTime = date;
		this.put(MonitorDataKeyConstant.CRAETETIME, date);
	}

	public String getSt() {
		if (StringUtils.isEmpty(this.get(MonitorDataKeyConstant.ST))) {
			return null;
		}
		return this.get(MonitorDataKeyConstant.ST).toString();
	}

	public Date getTt() {
		if (this.get(MonitorDataKeyConstant.TT) == null) {
			return null;
		}
		return (Date) this.get(MonitorDataKeyConstant.TT);
	}

	public Date getUt() {
		if (this.get(MonitorDataKeyConstant.UT) == null) {
			return null;
		}
		return (Date) this.get(MonitorDataKeyConstant.UT);
	}

	public Date getCreateTime() {
		if (this.get(MonitorDataKeyConstant.CRAETETIME) == null) {
			return null;
		}
		return (Date) this.get(MonitorDataKeyConstant.CRAETETIME);
	}

	public String getCoverLastValue(MonitorDataHistoryMongo objMap, String lowerCaseMonitorCode) {
		return "0";
	}

	interface MonitorDataKeyConstant {
		/**
		 * 观测时间
		 */
		public String TT = "tt";
		/**
		 * 上报时间
		 */
		public String UT = "ut";
		/**
		 * 创建时间
		 */
		public String CRAETETIME = "createTime";
		/**
		 * st号(站点编号)
		 */
		public String ST = "st";
		/**
		 * sn(rtu编号)
		 */
		public String SN = "sn";
		/**
		 * 传感器key
		 */
		public String MONITORKEY = "key";
		/**
		 * 传感器值
		 */
		public String MONITORVALUE = "value";
		/**
		 * 修改时间
		 */
		public String UPDATETIME = "updateTime";
		/**
		 * mongo ID
		 */
		public String MONGOID="_id";
		/**
		 * mongo hour 节点key
		 */
		public String DATE="date";
		/**
		 * mongo hour 节点key
		 */
		public String FACTOR="factor";


		/**
		 * mongo hour 节点key
		 */
		public String AVERAGE="average";

	}

}