From 2cba5205c2cc7552ccc4c9a9ed0f3a75e4a0a00f Mon Sep 17 00:00:00 2001 From: lucas Date: Wed, 30 Apr 2025 13:15:08 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E5=B9=BF=E4=B8=9C?= =?UTF-8?q?=E7=89=B9=E5=BE=81=E6=95=B0=E6=8D=AE=E4=B8=8A=E6=8A=A5=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...心云es主题特征to广东省平台.go | 20 ++++++++++--------- consumers/consumerAXYES2GDJKJC.go | 3 ++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/adaptors/安心云es主题特征to广东省平台.go b/adaptors/安心云es主题特征to广东省平台.go index ecaf6ea..11ddfbb 100644 --- a/adaptors/安心云es主题特征to广东省平台.go +++ b/adaptors/安心云es主题特征to广东省平台.go @@ -2,10 +2,12 @@ package adaptors import ( "encoding/json" + "fmt" "goInOut/consumers/GDJKJC" "goInOut/consumers/HBJCAS" "goInOut/consumers/HBJCAS/protoFiles_hb" "goInOut/dbOperate" + "goInOut/models" "log" "math" @@ -64,16 +66,16 @@ func (the Adaptor_AXYES_GDJKJC) EsAggTopToGDJKJC(structId int64, factorId int, e sensorId := sensorBucket.Key for _, dateBucket := range sensorBucket.GroupDate.Buckets { //优先redis获取 - //station := models.Station{} - //k1 := fmt.Sprintf("station:%d", sensorId) - //errRedis := the.Redis.GetObj(k1, &station) - //if errRedis != nil { - // log.Printf("redis 获取[s:%d,f:%d]测点[%d]标签异常", structId, factorId, sensorId) - // continue - //} - monitorCode := "LJ-VIB-P01-004-01" //the.getPointCodeFromLabel(station.Labels) + station := models.Station{} + k1 := fmt.Sprintf("station:%d", sensorId) + errRedis := the.Redis.GetObj(k1, &station) + if errRedis != nil { + log.Printf("redis 获取[s:%d,f:%d]测点[%d]异常", structId, factorId, sensorId) + continue + } + monitorCode := station.Name if monitorCode == "" { - log.Printf("redis 获取[s:%d,f:%d]测点[%d]信息,异常,跳过", structId, factorId, sensorId) + log.Printf("redis 获取[s:%d,f:%d]测点[%d] 无信息,跳过", structId, factorId, sensorId) continue } diff --git a/consumers/consumerAXYES2GDJKJC.go b/consumers/consumerAXYES2GDJKJC.go index b73691c..3e47df4 100644 --- a/consumers/consumerAXYES2GDJKJC.go +++ b/consumers/consumerAXYES2GDJKJC.go @@ -103,6 +103,7 @@ func (the *consumerAXYES2GDJKJC) Work() { "sign": utils.GetSign(string(push.Payload), rnd, appKey, appSecret), } + log.Printf("推送数据=%s", push.Payload) _, err := the.outHttp.PublishWithHeader(push.Payload, Header) if err != nil { log.Printf("数据推送异常=> %s", err.Error()) @@ -132,7 +133,7 @@ func (the *consumerAXYES2GDJKJC) getStructIds() []int64 { func (the *consumerAXYES2GDJKJC) getEs1HourAggData() { start, end := utils.GetTimeRangeByHour(-1) log.Printf("查询数据时间范围 %s - %s", start, end) - hourFactorIds := []int{63} //[]int{11, 15, 18, 20} //应变11 桥墩倾斜15 裂缝监测18 桥面振动28 支护结构变形63 + hourFactorIds := []int{15} //[]int{11, 15, 18, 20} //应变11 桥墩倾斜15 裂缝监测18 支护结构变形63 structIds := the.getStructIds() for _, structId := range structIds { for _, factorId := range hourFactorIds {