Browse Source

update 更新广东特征数据上报部分代码

dev
lucas 1 month ago
parent
commit
2cba5205c2
  1. 20
      adaptors/安心云es主题特征to广东省平台.go
  2. 3
      consumers/consumerAXYES2GDJKJC.go

20
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
}

3
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 {

Loading…
Cancel
Save