z332406259 4 anos atrás
pai
commit
48d65aa55e

+ 1 - 1
app/schedule/updateData.js

@@ -55,7 +55,7 @@ class UpdateData extends Subscription {
     this.isRunningTask = true;
 
     // 更新历史时间段数据 => 修改createBaseData的参数做循环请求即可
-    const satrtMoment = this.ctx.helper.momentDate('2019-01-01');
+    const satrtMoment = this.ctx.helper.momentDate('2018-01-01');
 
     // const satrtMoment = this.ctx.helper.momentDate('2020-06-01');
     // const endTime = this.ctx.helper.parse('2019-06-17');

+ 3 - 3
app/service/carService.js

@@ -65,7 +65,7 @@ class CarService extends Service {
   async listWithTravel({ vin, startTime, endTime, pageNumber = 1, pageSize = 10 }) {
     const { ctx, service } = this;
     const agg = [
-      { $match: { vin, start_time: { $gte: startTime, $lt: endTime } } },
+      { $match: { start_time: { $gte: startTime, $lt: endTime }, vin } },
       { $unwind: '$mileage_list' },
       ...ctx.helper.getPageMongo(pageNumber, pageSize),
     ];
@@ -88,7 +88,7 @@ class CarService extends Service {
   async indexTrip({ vin, startTime, endTime }) {
     const { ctx } = this;
     const agg = [
-      { $match: { vin, start_time: { $gte: startTime, $lt: endTime } } },
+      { $match: { start_time: { $gte: startTime, $lt: endTime }, vin } },
       { $unwind: '$mileage_list' },
       { $group: { _id: { $hour: { $toDate: '$mileage_list.start_time' } },
         dsmCount: { $sum: { $cond: [{ $eq: [ '$mileage_list.dsm_status', '1' ] }, 1, 0 ] } },
@@ -102,7 +102,7 @@ class CarService extends Service {
   async indexSingle({ startTime, endTime, vin }) {
     const { ctx } = this;
     const agg = [
-      { $match: { vin, start_time: { $gte: startTime, $lt: endTime } } },
+      { $match: { start_time: { $gte: startTime, $lt: endTime }, vin } },
       { $addFields: {
         week: { $dayOfWeek: { $toDate: '$start_time' } },
       } },

+ 4 - 4
config/config.default.js

@@ -51,19 +51,19 @@ module.exports = appInfo => {
     },
     clients: {
       etlDB: {// 原始数据库
-        url: 'mongodb://127.0.0.1/faw-etl', //
+        // url: 'mongodb://127.0.0.1/faw-etl', //
         // url: 'mongodb://faw-etl-readonly:faw-etl-readonly@10.6.222.37:27017/faw-etl',//dev
         // url: 'mongodb://faw-etl-admin:faw-etl-admin%40123@10.112.16.11:27017/faw-etl', // sit
-        // url: 'mongodb://faw-etl:faw-etl123@uat.dbaas.private:27028/faw-etl', // uat
+        url: 'mongodb://faw-etl:faw-etl123@uat.dbaas.private:27028/faw-etl', // uat
         options: {
           useUnifiedTopology: true,
         },
       },
       etlLocalDB: {// 本地清洗后的数据库
-        url: 'mongodb://127.0.0.1/faw-etl-local', //
+        // url: 'mongodb://127.0.0.1/faw-etl-local', //
         // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.6.222.37:27017/faw-etl-local', // dev
         // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.112.16.11:27017/faw-etl-local', // sit
-        // url: 'mongodb://local3:local3%40123@uat.dbaas.private:27028/faw-etl-local3', // uat
+        url: 'mongodb://local3:local3%40123@uat.dbaas.private:27028/faw-etl-local3', // uat
         options: {
           useUnifiedTopology: true,
         },