GpsEntity.java
7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
package com.bsth.entity;
import com.bsth.client.pd.protocol.BasicInfo;
import com.bsth.data.schedule.entity.ScheduleRealInfo;
import com.bsth.util.geo.Point;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
/**
* @author PanZhao
* @ClassName: GpsRealData
* @Description: TODO(HTTP接口的实时GPS数据)
* @date 2016年5月11日 下午4:32:07
*/
public class GpsEntity implements Serializable {
private static final long serialVersionUID = 123456789L;
/*** 线路编码 */
private String lineId;
/*** 设备编码 */
private String deviceId;
/*** 经度 */
private Float lon;
/*** 纬度 */
private Float lat;
/*** 发送时间戳 */
private Long timestamp;
/*** 速度 */
private Float speed;
/*** 方向(角度) */
private float direction;
/*** 营运状态( 0 营运 ,1 非营运, -1 无效) */
private Integer state;
/*** 上下行(0 上行 , 1 下行 , -1 无效) */
private Byte upDown;
/**
* 当前站点编码
*/
private String stationCode;
private String stationName;
private int stationNo;
/**
* 0: 站外 1: 站内 2:场内
*/
private int inOut;
/**
* 停车场编码
*/
private String parkCode;
/**
* 进站距离
*/
private Double inStationDistance;
/**
* 出站距离
*/
private Double outStationDistance;
private int version;
/*** gps是否有效 设备端发送的状态*/
private int valid;
/**
* 网关收到时间
*/
private Long serverTimestamp;
/**
* 越界距离
*/
private double overstepDistance;
private String nbbm;
/**
* 班次信息
*/
private ScheduleRealInfo sch;
/**
* 无信号,系统平滑过渡的时间
*/
private Long transitionTime;
/**
* 到下一站的距离
*/
private Double distance;
/**
* 到下一站的时间,秒
*/
private int seconds;
/**
* 是否对外发布
*/
private boolean release = true;
public String getCode() {
return lineId + "_" + upDown;
}
public static GpsEntity getInstance(BasicInfo basicInfo, int version) {
if (StringUtils.isBlank(basicInfo.getDeviceId()))
return null;
GpsEntity gps = new GpsEntity();
gps.setDeviceId(basicInfo.getDeviceId());
gps.setTimestamp(basicInfo.getTimestamp());
gps.setLat(basicInfo.getLat());
gps.setLon(basicInfo.getLon());
gps.setDirection((float) basicInfo.getDirection() / 10);
gps.setValid(basicInfo.getGpsValid());
gps.setUpDown(basicInfo.getUpOrDown());
gps.setSpeed((float) basicInfo.getSpeedGps() / 10);
gps.setLineId(String.valueOf(basicInfo.getLineId()));
gps.setVersion(version);
gps.setServerTimestamp(System.currentTimeMillis());
gps.setState((int) basicInfo.getService());
return gps;
}
public Point getPoint(){
return new Point(lon, lat);
}
public String getLineId() {
return lineId;
}
public void setLineId(String lineId) {
this.lineId = lineId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
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 Float getSpeed() {
return speed;
}
public void setSpeed(Float speed) {
this.speed = speed;
}
public float getDirection() {
return direction;
}
public void setDirection(float direction) {
this.direction = direction;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Byte getUpDown() {
return upDown;
}
public void setUpDown(Byte upDown) {
this.upDown = upDown;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public int getValid() {
return valid;
}
public void setValid(int valid) {
this.valid = valid;
}
public Long getServerTimestamp() {
return serverTimestamp;
}
public void setServerTimestamp(Long serverTimestamp) {
this.serverTimestamp = serverTimestamp;
}
public double getOverstepDistance() {
return overstepDistance;
}
public void setOverstepDistance(double overstepDistance) {
this.overstepDistance = overstepDistance;
}
public ScheduleRealInfo getSch() {
return sch;
}
public void setSch(ScheduleRealInfo sch) {
this.sch = sch;
}
public Long getTransitionTime() {
return transitionTime;
}
public void setTransitionTime(Long transitionTime) {
this.transitionTime = transitionTime;
}
public String getNbbm() {
return nbbm;
}
public void setNbbm(String nbbm) {
this.nbbm = nbbm;
}
public String getStationCode() {
return stationCode;
}
public void setStationCode(String stationCode) {
this.stationCode = stationCode;
}
public int getInOut() {
return inOut;
}
public void setInOut(int inOut) {
this.inOut = inOut;
}
public String getParkCode() {
return parkCode;
}
public void setParkCode(String parkCode) {
this.parkCode = parkCode;
}
public Double getInStationDistance() {
return inStationDistance;
}
public void setInStationDistance(Double inStationDistance) {
this.inStationDistance = inStationDistance;
}
public Double getOutStationDistance() {
return outStationDistance;
}
public void setOutStationDistance(Double outStationDistance) {
this.outStationDistance = outStationDistance;
}
public Double getDistance() {
return distance;
}
public void setDistance(Double distance) {
this.distance = distance;
}
public int getSeconds() {
return seconds;
}
public void setSeconds(int seconds) {
this.seconds = seconds;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public int getStationNo() {
return stationNo;
}
public void setStationNo(int stationNo) {
this.stationNo = stationNo;
}
public boolean isRelease() {
return release;
}
public void setRelease(boolean release) {
this.release = release;
}
}