tVehicleOnlineInfoModel.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlDB');
  6. // 在线车辆实时分布 数据结构
  7. const TVehicleOnlineInfoSchema = new Schema({
  8. _id: { type: String }, // 车辆VIN
  9. update_time: { type: Number }, // 数据更新时间
  10. series_code: { type: String }, // 车系编码
  11. series_name: { type: String }, // 车系名称
  12. online_status: { type: Number }, // 在线状态,1在线 0离线
  13. online_time: { type: Number }, // 在线状态变更时间
  14. last_online_time: { type: Number }, // 最后一次上线时间
  15. last_offline_time: { type: Number }, // 最后一次离线时间
  16. longitude: { type: Number }, // 84坐标系经度值
  17. latitude: { type: Number }, // 84坐标系纬度值
  18. location_time: { type: Number }, // GPS定位时间
  19. // 在线车辆 如果数据来源是TBOX 这个时候GPS 经纬值和纬度值 数值存在 地区,省份,城市,区县有可能不存在,解析不出来。
  20. // area_code: { type: String }, // 地区编码
  21. // area_name: { type: String }, // 地区名称
  22. // province_code: { type: String }, // 省份编码
  23. // province_name: { type: String }, // 省份名称
  24. // city_code: { type: String }, // 城市编码
  25. // city_name: { type: String }, // 城市名称
  26. // county_code: { type: String }, // 区县编码
  27. // county_name: { type: String }, // 区县名称
  28. real_speed: { type: Number }, // 实时车速
  29. });
  30. TVehicleOnlineInfoSchema.index({ online_status: -1 });
  31. TVehicleOnlineInfoSchema.index({ vin: -1, online_status: -1 });
  32. return conn.model('TVehicleOnlineInfo', TVehicleOnlineInfoSchema, 't_vehicle_online_info');
  33. };