Browse Source

update 添加 空数据保护

dev
lucas 3 months ago
parent
commit
9a6fe84b39
  1. 10
      adaptors/安心云es主题特征to河北公路设施监测.go
  2. 2
      consumers/consumerHBJCAS.go

10
adaptors/安心云es主题特征to河北公路设施监测.go

@ -27,8 +27,14 @@ func (the Adaptor_AXYES_HBGL) Transform(structId int64, factorId int, rawMsg str
if err != nil {
return nil
}
Payload := the.EsAggTopToHBJCAS(structId, factorId, esAggDateHistogram)
if len(Payload) == 0 {
return needPush
}
needPush = append(needPush, NeedPush{
Payload: the.EsAggTopToHBJCAS(structId, factorId, esAggDateHistogram),
Payload: Payload,
})
return needPush
}
@ -64,10 +70,8 @@ func (the Adaptor_AXYES_HBGL) EsAggTopToHBJCAS(structId int64, factorId int, esA
UniqueCode: strconv.FormatInt(uniqueCode, 10), //乃积沟大桥
DataBody: the.EsAgg2StatisticData(factorId, monitorCode, dateBucket),
}
complexData.SensorData = append(complexData.SensorData, dataDefinition)
}
}
result, _ = proto.Marshal(complexData)

2
consumers/consumerHBJCAS.go

@ -106,7 +106,7 @@ func (the *consumerHBJCAS) getStructIds() []int64 {
func (the *consumerHBJCAS) getEsData() {
start, end := utils.GetTimeRangeByHour(-1)
log.Printf("查询数据时间范围 %s - %s", start, end)
hourFactorIds := []int{15, 20} //, "28"
hourFactorIds := []int{20} //, 15, 20 , 28
structIds := the.getStructIds()
for _, structId := range structIds {
for _, factorId := range hourFactorIds {

Loading…
Cancel
Save