123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- package com.tidecloud.dataacceptance.entity;
- import java.io.Serializable;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import com.tidecloud.dataacceptance.common.DateUtil;
- /**
- * @author: chudk
- * @date: 2017年9月18日 上午11:04:09
- */
- public class YiTongGPSDevice implements Serializable{
- private static final long serialVersionUID = 684382625782853174L;
-
- private String deviceId;
- private String date;
- private Byte gpsCount;
- private Integer lat;
- private Integer lng;
- private Byte speedbyte;
- private String speed;
- private Short courseStatus;
- private Short mcc;
- private Byte mnc;
- private Short lac;
- private Integer cellId;
- private Byte acc;
- private Double mileage;
- private Byte reportModel;
- private Byte ismendMsg;
- private Double voltage;
- private Integer dataType;
-
- public YiTongGPSDevice() {
- }
- public YiTongGPSDevice(String deviceId, String date, Byte gpsCount, Integer lat, Integer lng, Byte speedbyte,
- String speed, Short courseStatus, Short mcc, Byte mnc, Short lac, Integer cellId, Byte acc, Double mileage,
- Byte reportModel, Byte ismendMsg, Double voltage, Integer dataType) {
- super();
- this.deviceId = deviceId;
- this.date = date;
- this.gpsCount = gpsCount;
- this.lat = lat;
- this.lng = lng;
- this.speedbyte = speedbyte;
- this.speed = speed;
- this.courseStatus = courseStatus;
- this.mcc = mcc;
- this.mnc = mnc;
- this.lac = lac;
- this.cellId = cellId;
- this.acc = acc;
- this.mileage = mileage;
- this.reportModel = reportModel;
- this.ismendMsg = ismendMsg;
- this.voltage = voltage;
- this.dataType = dataType;
- }
- public String getDeviceId() {
- return deviceId;
- }
- public void setDeviceId(String deviceId) {
- this.deviceId = deviceId;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
- public Byte getGpsCount() {
- return gpsCount;
- }
- public void setGpsCount(Byte gpsCount) {
- this.gpsCount = gpsCount;
- }
- public Integer getLat() {
- return lat;
- }
- public void setLat(Integer lat) {
- this.lat = lat;
- }
- public Integer getLng() {
- return lng;
- }
- public void setLng(Integer lng) {
- this.lng = lng;
- }
- public Byte getSpeedbyte() {
- return speedbyte;
- }
- public void setSpeedbyte(Byte speedbyte) {
- this.speedbyte = speedbyte;
- }
- public String getSpeed() {
- return speed;
- }
- public void setSpeed(String speed) {
- this.speed = speed;
- }
- public Short getCourseStatus() {
- return courseStatus;
- }
- public void setCourseStatus(Short courseStatus) {
- this.courseStatus = courseStatus;
- }
- public Short getMcc() {
- return mcc;
- }
- public void setMcc(Short mcc) {
- this.mcc = mcc;
- }
- public Byte getMnc() {
- return mnc;
- }
- public void setMnc(Byte mnc) {
- this.mnc = mnc;
- }
- public Short getLac() {
- return lac;
- }
- public void setLac(Short lac) {
- this.lac = lac;
- }
- public Integer getCellId() {
- return cellId;
- }
- public void setCellId(Integer cellId) {
- this.cellId = cellId;
- }
- public Byte getAcc() {
- return acc;
- }
- public void setAcc(Byte acc) {
- this.acc = acc;
- }
- public Double getMileage() {
- return mileage;
- }
- public void setMileage(Double mileage) {
- this.mileage = mileage;
- }
- public Byte getReportModel() {
- return reportModel;
- }
- public void setReportModel(Byte reportModel) {
- this.reportModel = reportModel;
- }
- public Byte getIsmendMsg() {
- return ismendMsg;
- }
- public void setIsmendMsg(Byte ismendMsg) {
- this.ismendMsg = ismendMsg;
- }
- public Double getVoltage() {
- return voltage;
- }
- public void setVoltage(Double voltage) {
- this.voltage = voltage;
- }
- public Integer getDataType() {
- return dataType;
- }
- public void setDataType(Integer dataType) {
- this.dataType = dataType;
- }
- public static String buildDeviceStr(YiTongGPSDevice device){
- // [设备号] [日期] [gpsCount] [经度] [维度] [速度] [里程] [是否补传] [数据上报模式] [移动基站] [LAC] [MCC] [信息类型 1代表location, 0代表电压] [电压]
- SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
- Date date = new Date();
- try {
- date = sdf.parse(device.getDate());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- date = DateUtil.calculateByHour(date, 8);
- String dateStr = sdf.format(date);
- StringBuilder builder = new StringBuilder();
- builder.append(checkoutNullObject(device.getDeviceId())).append(",");
- builder.append(checkoutNullObject(dateStr)).append(",");
- builder.append(checkoutNullObject(device.getGpsCount())).append(",");
- builder.append(checkoutNullObject(device.getLng())).append(",");
- builder.append(checkoutNullObject(device.getLat())).append(",");
- builder.append(checkoutNullObject(device.getSpeedbyte())).append(",");
- builder.append(checkoutNullObject(device.getMileage())).append(",");
- builder.append(checkoutNullObject(device.getIsmendMsg())).append(",");
- builder.append(checkoutNullObject(device.getReportModel())).append(",");
- builder.append(checkoutNullObject(device.getAcc())).append(",");
- builder.append(checkoutNullObject(device.getLac())).append(",");
- builder.append(checkoutNullObject(device.getMcc())).append(",");
- builder.append(checkoutNullObject(device.getDataType())).append(",");
- builder.append(checkoutNullObject(device.getVoltage()));
- return builder.toString();
- }
-
- private static String checkoutNullObject(Object t){
- if (t == null) {
- return "";
- }
- return String.valueOf(t);
- }
- }
|