123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlLocalDB');
- // 驾驶行为数据结构 本地清洗 数据结构
- const DrivingBehaviorInfoSchema2 = new Schema({
- create_date: { type: Number }, // 统计的数据是哪一天的
- year: { type: Number }, // 年 统计的数据
- month: { type: Number }, // 月 统计的数据
- day: { type: Number }, // 日 统计的数据
- dateString: { type: String }, // 时间字符串 yyyy-MM-dd
- start_time: { type: Date }, // 开始统计时间
- end_time: { type: Date, default: Date.now }, // 结束统计时间
- data: [
- {
- _id: {
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系
- count: { type: Number }, // 有几辆车
- batterySoc: { type: Number }, // 蓄电池电量%
- engineSpeed: { type: Number }, // 发动机转速rpm
- insideTemperature: { type: Number }, // 室内温度°
- outsideTemperature: { type: Number }, // 室外温度°
- powerBatterySoc: { type: Number }, // 动力电池%
- chargeDuration: { type: Number }, // 充电时长h
- chargeCnt: { type: Number }, // 充电次数
- skyDuration: { type: Number }, // 天窗时长min
- headlightCnt: { type: Number }, // 近光次数
- highBeamCnt: { type: Number }, // 远光次数
- headlightDuration: { type: Number }, // 近光时长min
- highBeamDuration: { type: Number }, // 远光时长min
- airDuration: { type: Number }, // 空调使用时长(毫秒)
- onCompressorDuration: { type: Number }, // 空调状态和压缩机均打开使用时长(毫秒)
- offCompressorDuration: { type: Number }, // 空调状态开压缩机关使用时长(毫秒)
- onAutoDuration: { type: Number }, // 激活且空调开启时长(毫秒)
- offAutoDuration: { type: Number }, // 关闭且空调开启时长(毫秒)
- blowerRatingOneDuration: { type: Number }, // 吹风等级1时长(毫秒)
- blowerRatingTwoDuration: { type: Number }, // 吹风等级2时长(毫秒)
- blowerRatingThreeDuration: { type: Number }, // 吹风等级3时长(毫秒)
- blowerRatingFourDuration: { type: Number }, // 吹风等级4时长(毫秒)
- blowerRatingOtherDuration: { type: Number }, // 吹风等级其他时长(毫秒)
- dsmCnt: { type: Number }, // 疲劳驾驶次数
- atNightDriveCnt: { type: Number }, // 深夜出行次数
- atNightDriveDuration: { type: Number }, // 深夜出行时长h
- atNightDriveMileage: { type: Number }, // 深夜出行里程km
- morningPeakDuration: { type: Number }, // 早高峰时长h
- morningPeakMileage: { type: Number }, // 早高峰里程km
- eveningPeakDuration: { type: Number }, // 晚高峰时长h
- eveningPeakMileage: { type: Number }, // 晚高峰里程km
- },
- ],
- oilProvince: [{
- _id: {
- _id: { type: String }, // 省code
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- name: { type: String }, // 省名称
- oil: { type: Number }, // 总油耗
- mileage: { type: Number }, // 总公里
- }], // 油耗分布
- oilCity: [{
- _id: {
- _id: { type: String }, // 市code
- fid: { type: String }, // 省code
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- name: { type: String }, // 市名称
- oil: { type: Number }, // 总油耗
- mileage: { type: Number }, // 总公里
- }], // 油耗分布
- driveDuration: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 驾驶时长
- avgSpeed: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 平均车速
- mileageCnt2: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆行程次数 用于 周末和工作日统计
- mileage2: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 日行驶里程
- mileageAvg: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 平均行驶里程
- supplementaryCnt: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 补传次数
- batterySoc: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 蓄电池电量
- engineSpeed: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 发动机转速
- insideTemperature: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 室内温度
- outsideTemperature: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 室外温度
- powerBatterySoc: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 动力电池
- chargeDuration: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电时长
- chargeStartSoc: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电初始SOC
- chargeEndSoc: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电结束SOC
- chargePreStartMileage: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电时车辆可行驶里程
- chargeStartTime: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电初始时刻
- chargeType: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电模式分布
- chargeMileage: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 两次充电间行驶里程分布
- avgSpeedPower: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 不同车速区间耗电占比
- actualMileage: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 实际续航里程分布
- mileageCnt: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆行程次数
- mileageCntMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆行程月次数
- mileageCntYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆行程年次数
- mileage: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 行驶里程
- mileageMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 月行驶里程
- mileageYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 年行驶里程
- chargeCnt: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电次数占比分布
- chargeCntMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电次数月占比分布
- chargeCntYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 充电次数年占比分布
- skyDuration: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆天窗时长占比分布
- skyDurationMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆天窗时长月占比分布
- skyDurationYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 车辆天窗时长年占比分布
- headlightCnt: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用次数占比分布
- headlightCntMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用次数月占比分布
- headlightCntYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用次数年占比分布
- highBeamCnt: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用次数占比分布
- highBeamCntMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用次数月占比分布
- highBeamCntYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用次数年占比分布
- headlightDuration: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用时长占比分布
- headlightDurationMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用时长月占比分布
- headlightDurationYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 近光使用时长年占比分布
- highBeamDuration: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用时长占比分布
- highBeamDurationMonth: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用时长月占比分布
- highBeamDurationYear: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 远光使用时长年占比分布
- mileageStartTimeAndDsm: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- dsmCount: { type: Number }, // 疲劳数量
- },
- ], // 用户出行时间/用户疲劳驾驶次数 占比
- mileageSingle: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 单次行驶里程统计
- maxAcce: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 单次行程中最大加速度
- maxDece: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 单次行程中最大减速度
- sideAcce: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 单次行程最大侧向加速度
- continuousDrive: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 持续驾驶
- driveStyle: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 驾驶风格
- drivingSafetyScore: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 驾驶安全得分
- energyConservationScore: [
- {
- _id: {
- _id: { type: String },
- series_code: { type: String }, model_code: { type: String },
- }, // 分组 车型 车系 和分段
- count: { type: Number }, // 数量
- },
- ], // 日驾驶行为节能平均得分
- });
- DrivingBehaviorInfoSchema2.index({ create_date: -1 });
- return conn.model('DrivingBehaviorInfo2', DrivingBehaviorInfoSchema2, 'lc_driving_behavior_info');
- };
|