'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlDB'); // 在线车辆实时分布 数据结构 const TVehicleOnlineInfoSchema = new Schema({ _id: { type: String }, // 车辆VIN update_time: { type: Number }, // 数据更新时间 series_code: { type: String }, // 车系编码 series_name: { type: String }, // 车系名称 online_status: { type: Number }, // 在线状态,1在线 0离线 online_time: { type: Number }, // 在线状态变更时间 last_online_time: { type: Number }, // 最后一次上线时间 last_offline_time: { type: Number }, // 最后一次离线时间 longitude: { type: Number }, // 84坐标系经度值 latitude: { type: Number }, // 84坐标系纬度值 location_time: { type: Number }, // GPS定位时间 // 在线车辆 如果数据来源是TBOX 这个时候GPS 经纬值和纬度值 数值存在 地区,省份,城市,区县有可能不存在,解析不出来。 // area_code: { type: String }, // 地区编码 // area_name: { type: String }, // 地区名称 // province_code: { type: String }, // 省份编码 // province_name: { type: String }, // 省份名称 // city_code: { type: String }, // 城市编码 // city_name: { type: String }, // 城市名称 // county_code: { type: String }, // 区县编码 // county_name: { type: String }, // 区县名称 real_speed: { type: Number }, // 实时车速 }); TVehicleOnlineInfoSchema.index({ online_status: -1 }); TVehicleOnlineInfoSchema.index({ vin: -1, online_status: -1 }); return conn.model('TVehicleOnlineInfo', TVehicleOnlineInfoSchema, 't_vehicle_online_info'); };