diff --git a/adaptors/知物云es主题特征to中交华联.go b/adaptors/知物云es主题特征to中交华联.go index 4897232..2397c14 100644 --- a/adaptors/知物云es主题特征to中交华联.go +++ b/adaptors/知物云es主题特征to中交华联.go @@ -35,7 +35,7 @@ func (the Adaptor_ZWYES_ZJHL) Transform(structId int64, factorId int, rawMsg str } Payload := the.EsAggTopToHBJCAS(structId, factorId, esAggDateHistogram) - if len(Payload) >= 0 { + if len(Payload) == 0 { return needPush } @@ -72,7 +72,7 @@ func (the Adaptor_ZWYES_ZJHL) EsAggTopToHBJCAS(structId int64, factorId int, esA } monitorCode := the.getPointCodeFromLabel(station.Labels) if monitorCode == 0 { - log.Printf("redis 获取[s:%d,f:%d]测点[%d]标签[%s],信息转换int64异常,跳过", structId, factorId, sensorId, station.Labels) + log.Printf("redis 获取[s:%d,f:%d]测点[%d],标签信息[%s]转换int64异常,跳过", structId, factorId, sensorId, station.Labels) continue } @@ -167,9 +167,9 @@ func (the Adaptor_ZWYES_ZJHL) EsAgg2StatisticData(factorId int, monitorCode int6 }} case 7: //车流量(车载称重) x->load y->overload dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_zjhl_v3.StatisticData_Hsd{Hsd: &protoFiles_zjhl_v3.HSDStatistic{ - TrafficFlow: int32(dateBucket.X.Count), - MaxTotalLoad: int32(maxAbsoluteValueX), - //MaxAxleLoad: 0, //目前无法支持统计 字符串类型,先不上传 + TrafficFlow: int32(dateBucket.X.Count), + MaxTotalLoad: int32(maxAbsoluteValueX), + MaxAxleLoad: 0, //目前无法支持统计 字符串类型, 和李晓敏确认 按0上报 OverLoadCount: int32(dateBucket.Y.Sum), AvgLoad: float32(avgValueX), }} @@ -212,6 +212,17 @@ func (the Adaptor_ZWYES_ZJHL) EsAgg2StatisticData(factorId int, monitorCode int6 MaxAbsoluteValue: float32(maxAbsoluteValueX), RootMeanSquare: float32(rootMeanSquareY), }} + case 883: //湿度 ->最终拼接为 温湿度 + dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_zjhl_v3.StatisticData_Rhs{Rhs: &protoFiles_zjhl_v3.RHSStatistic{ + //MaxTemperature: float32(dateBucket.X.Max), + //MinTemperature: float32(dateBucket.X.Min), + //AvgTemperature: float32(avgValueX), + //MaxTemperatureDifference: float32(dateBucket.X.Max - dateBucket.X.Min), + MaxHumidity: float32(dateBucket.X.Max), + MinHumidity: float32(dateBucket.X.Min), + AvgHumidity: float32(avgValueX), + HumidityExceedDuration: 0, + }} case 935: //gnss dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_zjhl_v3.StatisticData_Gnss{Gnss: &protoFiles_zjhl_v3.GNSSStatistic{ // 统计时间范围内的空间变形X绝对最大值 diff --git a/consumers/consumerGZG2ZJHL.go b/consumers/consumerGZG2ZJHL.go index 1e64059..98e2ed3 100644 --- a/consumers/consumerGZG2ZJHL.go +++ b/consumers/consumerGZG2ZJHL.go @@ -129,9 +129,13 @@ func (the *consumerGZG2ZJHL) getStructIds() []int64 { return structIds } func (the *consumerGZG2ZJHL) getEs1HourAggData() { - start, end := utils.GetTimeRangeByHour(-1) + start, end := utils.GetTimeRangeByHour(-5) log.Printf("查询数据时间范围 %s - %s", start, end) - hourFactorIds := []int{7, 935, 4, 6, 11} //Gnss 935 ,4(温度),6索力, 15, 18, 20 + //hourFactorIds := []int{883, 2, 7, 935, 4, 6, 11} + hourFactorIds := []int{935} + //湿度883 -> 要当作温湿度处理,合并温度监测中的3个有相同label的测点数据,组合成虚拟温湿度数据 + //温湿度2(要温度和湿度数据拼接), 源于温度测点和湿度测点 特殊的3个label测点算温湿度 6500030003,6500030004,6500030005 + //Gnss 935 ,4(温度),6索力, 15, 18, 20 structIds := the.getStructIds() for _, structId := range structIds { for _, factorId := range hourFactorIds { @@ -414,6 +418,15 @@ func getEsAggSubSqlByZwyFactorId(factorId int) string { "field": "data.trms" } } +}` + case 883: //湿度 (后期需要合并3个温度 拼成 温湿度) + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.humidity" + } + } }` case 935: subAggSQl = `