diff --git a/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml b/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml index fc5675d..5acc086 100644 --- a/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml +++ b/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml @@ -13,8 +13,9 @@ ioConfig: topics: - t/province/1307 monitor: - #由于振动是触发式,数据迟缓 cron10min也改成1小时一次 上报多条 - cron10min: 30 0/1 * * * #6/10 * * * * + #振动是触发式,数据迟缓 cron10min也改成1小时一次 上报多条,不进行实时上报 + cron10min: 40 0/1 * * * #6/10 * * * * + #普通类型 特征数据 cron1hour: 11 0/1 * * * info: rc4key: sK3kJttzZyf7aZI94zSYgytBYCrfZRt6yil2 @@ -28,7 +29,9 @@ pointInfo: #裂缝 crack 68397: 1301100001 68398: 1301100002 - 68399: 1301100001 + 68399: 1301100003 + #振动 + 68400: 1301100004 5016: #河北承德乃积沟大桥 #桥墩倾斜 68384: 13010900001 diff --git a/consumers/consumerHBJCAS.go b/consumers/consumerHBJCAS.go index ce28470..dc1d0da 100644 --- a/consumers/consumerHBJCAS.go +++ b/consumers/consumerHBJCAS.go @@ -49,18 +49,19 @@ func (the *consumerHBJCAS) InputInitial() error { the.monitor = &monitors.CommonMonitor{ MonitorHelper: &monitors.MonitorHelper{}, } + + the.monitor.Start() for taskName, cron := range the.Info.Monitor { switch taskName { case "cron10min": - the.monitor.RegisterTask(cron, the.getEs1HourAggData) - case "cron1hour": the.monitor.RegisterTask(cron, the.getEs10minAggData) + case "cron1hour": + the.monitor.RegisterTask(cron, the.getEs1HourAggData) default: log.Printf("定时任务[%s],cron=[%s] 无匹配", taskName, cron) } } - the.monitor.Start() return nil } func (the *consumerHBJCAS) OutputInitial() error { @@ -141,7 +142,8 @@ func (the *consumerHBJCAS) getEs1HourAggData() { } func (the *consumerHBJCAS) getEs10minAggData() { - start, end := utils.GetTimeRangeBy10min() + //utils.GetTimeRangeBy10min() 由于振动数据 + start, end := utils.GetTimeRangeByHour(-1) log.Printf("查询数据时间范围 %s - %s", start, end) factorIds := []int{28} structIds := the.getStructIds() diff --git a/consumers/consumerSinoGnssMySQL.go b/consumers/consumerSinoGnssMySQL.go index 2c4ff97..58b2eee 100644 --- a/consumers/consumerSinoGnssMySQL.go +++ b/consumers/consumerSinoGnssMySQL.go @@ -48,10 +48,10 @@ func (the *consumerSinoGnssMySQL) InputInitial() error { the.Info.IoConfig.In.Db.Type, the.Info.IoConfig.In.Db.ConnStr) the.monitor = &monitors.CommonMonitor{ - MonitorHelper: &monitors.MonitorHelper{CronStr: the.Info.IoConfig.In.CronStr}, + MonitorHelper: &monitors.MonitorHelper{}, } the.monitor.Start() - the.monitor.RegisterFun(the.onData) + the.monitor.RegisterTask(the.Info.IoConfig.In.CronStr, the.onData) return nil } func (the *consumerSinoGnssMySQL) OutputInitial() error { diff --git a/utils/timeRange.go b/utils/timeRange.go index 9db1e08..f6eaf55 100644 --- a/utils/timeRange.go +++ b/utils/timeRange.go @@ -24,7 +24,7 @@ func GetTimeRangeBy10min() (start, stop string) { m := time.Now().Minute() % 10 log.Println(m) startTime := time.Now().Add(time.Minute * -1 * time.Duration(m)) - start = startTime.Add(time.Minute * -10).Format("2006-01-02T15:04:00+08:00") - stop = startTime.Format("2006-01-02T15:04:00+08:00") + start = startTime.Add(time.Minute * -10).Format("2006-01-02T15:04:00.000+08:00") + stop = startTime.Format("2006-01-02T15:04:00.000+08:00") return }