GpsEntity.java 6.29 KB
package com.bsth.data.gpsdata;

import com.bsth.data.gpsdata.arrival.entity.StationRoute;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 
 * @ClassName: GpsRealData
 * @Description: TODO(HTTP接口的实时GPS数据)
 * @author PanZhao
 * @date 2016年5月11日 下午4:32:07
 *
 */
public class GpsEntity implements Cloneable{

	/** 公司代码 */
	private Short companyCode;

	/** 线路编码 */
	private String lineId;

	/** 设备编码 */
	private String deviceId;

	/** 停车场编码 */
	private String carparkNo;

	/** 站点编码 */
	private String stopNo;
	
	/** 站点名称 */
	private String stationName;
	
	/** 到站时间  */
	private long arrTime;

	/** 经度 */
	private Float lon;

	/** 纬度 */
	private Float lat;

	/** GPS发送时间戳 */
	private Long timestamp;

	/** 网关收到时间 */
	private Long serverTimestamp;

	/** 速度 */
	private Float speed;

	/** 方向(角度) */
	private float direction;

	/** 营运状态( 0 营运 ,1 非营运, -1 无效) */
	private Integer state;

	/** 上下行(0 上行 , 1 下行 , -1 无效) */
	private Byte upDown;
	
	/** 车辆内部编码 */
	private String nbbm;
	
	/** 预计到达终点时间 */
	private Float expectStopTime;

	/** 当前执行班次ID */
	private Long schId;
	
	/** 是否是不完整的数据 */
	private boolean incomplete;

	private int version;

	/** 0: 站外 1:站内 2:场内 */
	private int instation;

	/** 站点信息,站内时有值 */
	@JsonIgnore
	private StationRoute station;

	/** 状态 */
	private String signalState = "normal";

	/** 异常状态 */
	private String abnormalStatus;

	/** 越界距离 */
	private double outOfBoundDistance;

	/** gps是否有效 设备端发送的状态 */
	private int valid;

	/**
	 * 数据来源
	 * 1:网关
	 * 0:转发
	 */
	private int source = -1;

	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			return null;
		}
	}

	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}

	public String getCarparkNo() {
		return carparkNo;
	}

	public void setCarparkNo(String carparkNo) {
		this.carparkNo = carparkNo;
	}

	public String getStopNo() {
		return stopNo;
	}

	public void setStopNo(String stopNo) {
		this.stopNo = stopNo;
	}

	public Float getLon() {
		return lon;
	}

	public void setLon(Float lon) {
		this.lon = lon;
	}

	public Float getLat() {
		return lat;
	}

	public void setLat(Float lat) {
		this.lat = lat;
	}

	public Long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}


	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getNbbm() {
		return nbbm;
	}

	public void setNbbm(String nbbm) {
		this.nbbm = nbbm;
	}

	public String getStationName() {
		return stationName;
	}

	public void setStationName(String stationName) {
		this.stationName = stationName;
	}

	public long getArrTime() {
		return arrTime;
	}

	public void setArrTime(long arrTime) {
		this.arrTime = arrTime;
	}

	public Float getExpectStopTime() {
		return expectStopTime;
	}

	public void setExpectStopTime(Float expectStopTime) {
		this.expectStopTime = expectStopTime;
	}

	public String getLineId() {
		return lineId;
	}

	public void setLineId(String lineId) {
		this.lineId = lineId;
	}

	public Long getSchId() {
		return schId;
	}

	public void setSchId(Long schId) {
		this.schId = schId;
	}


	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public StationRoute getStation() {
		return station;
	}

	public void setStation(StationRoute station) {
		this.station = station;
	}

	public String getSignalState() {
		return signalState;
	}

	public void setSignalState(String signalState) {
		this.signalState = signalState;
	}

	public int getInstation() {
		return instation;
	}

	public void setInstation(int instation) {
		this.instation = instation;
	}

	public String getAbnormalStatus() {
		return abnormalStatus;
	}

	public void setAbnormalStatus(String abnormalStatus) {
		this.abnormalStatus = abnormalStatus;
	}

	public boolean isIncomplete() {
		return incomplete;
	}

	public void setIncomplete(boolean incomplete) {
		this.incomplete = incomplete;
	}

	public double getOutOfBoundDistance() {
		return outOfBoundDistance;
	}

	public void setOutOfBoundDistance(double outOfBoundDistance) {
		this.outOfBoundDistance = outOfBoundDistance;
	}

	public int getValid() {
		return valid;
	}

	public void setValid(int valid) {
		this.valid = valid;
	}



	public short getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(short companyCode) {
		this.companyCode = companyCode;
	}

	public Byte getUpDown() {
		return upDown;
	}

	public void setUpDown(Byte upDown) {
		this.upDown = upDown;
	}


	public float getDirection() {
		return direction;
	}

	public void setDirection(float direction) {
		this.direction = direction;
	}

	public Float getSpeed() {
		return speed;
	}

	public void setSpeed(Float speed) {
		this.speed = speed;
	}

	public int getSource() {
		return source;
	}

	public void setSource(int source) {
		this.source = source;
	}

	public void offline(){
		this.setAbnormalStatus("offline");
	}

/*	public boolean isOnline(){
		if(isOffline())
			return false;

		long t = System.currentTimeMillis();

		if((t - this.getServerTimestamp()) > 1000 * 60 * 2){
			return false;
		}

		if((this.getServerTimestamp() - t) > 1000 * 60 * 3){
			return false;
		}
		return true;
	}*/

	/**
	 * 是否营运
	 * @return
	 */
	public boolean isService(){
		return state!=null && state==0;
	}

	public boolean isOffline(){
		return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline");
	}

	public Long getServerTimestamp() {
		return serverTimestamp;
	}

	public void setServerTimestamp(Long serverTimestamp) {
		this.serverTimestamp = serverTimestamp;
	}
}