diff --git a/adaptors/知物云es主题特征to中交华联.go b/adaptors/知物云es主题特征to中交华联.go index c753e8b..1bc74b3 100644 --- a/adaptors/知物云es主题特征to中交华联.go +++ b/adaptors/知物云es主题特征to中交华联.go @@ -168,7 +168,7 @@ func (the *Adaptor_ZWYES_ZJHL) getMonitorTypeByFactorId(factorId int) protoFiles return protoFiles_zjhl_v3.MonitoryType_HPT case 20, 24: return protoFiles_zjhl_v3.MonitoryType_DIS - case 28: + case 28, 756: return protoFiles_zjhl_v3.MonitoryType_VIB case 156: //风速测点 需要合并 同标签的风向测点 组成风速风向 return protoFiles_zjhl_v3.MonitoryType_UAN @@ -284,6 +284,11 @@ func (the *Adaptor_ZWYES_ZJHL) EsAgg2StatisticData(factorId int, monitorCode int statisticDataUan.Uan.AvgVelocity = relatedSpeed.StatisticData.GetUan().GetAvgVelocity() } dataDefinitionStatisticData.StatisticData.DataBody = statisticDataUan + case 756: //加速度 + dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_zjhl_v3.StatisticData_Vib{Vib: &protoFiles_zjhl_v3.VIBStatistic{ + MaxAbsoluteValue: float32(maxAbsoluteValueX), + RootMeanSquare: float32(rootMeanSquareX), + }} case 883: //湿度 ->最终拼接为 温湿度 statisticDataRhs := &protoFiles_zjhl_v3.StatisticData_Rhs{Rhs: &protoFiles_zjhl_v3.RHSStatistic{ //MaxTemperature: float32(dateBucket.X.Max), diff --git a/consumers/consumerGZG2ZJHL.go b/consumers/consumerGZG2ZJHL.go index 27f1473..62888f9 100644 --- a/consumers/consumerGZG2ZJHL.go +++ b/consumers/consumerGZG2ZJHL.go @@ -165,7 +165,7 @@ func (the *consumerGZG2ZJHL) getEs10minAggData() { start, end := utils.GetTimeRangeBy10minByOffset(-20) //start, end := "2025-02-28T15:30:00.000+08:00", "2025-02-28T15:40:00.000+08:00" log.Printf("查询10min数据时间范围 %s - %s", start, end) - factorIds := []int{156, 225} //监测因素 风速156 风向225 需要合并风向 + factorIds := []int{756, 156, 225} //监测因素 加速度756 风速156 风向225 需要合并风向 structIds := the.getStructIds() for _, structId := range structIds { adaptor := the.getAdaptor() @@ -242,7 +242,8 @@ func (the *consumerGZG2ZJHL) getESQueryStrByHour(structureId int64, factorId int "aggs": { "groupSensor": { "terms": { - "field": "sensor" + "field": "sensor", + "size": 100 }, "aggs": { "groupDate": { @@ -299,7 +300,8 @@ func (the *consumerGZG2ZJHL) getESQueryStrBy10min(structureId int64, factorId in "aggs": { "groupSensor": { "terms": { - "field": "sensor" + "field": "sensor", + "size": 100 }, "aggs": { "groupDate": { @@ -321,7 +323,7 @@ func (the *consumerGZG2ZJHL) getESQueryStrBy10min(structureId int64, factorId in } func getEsAggSubSqlByZwyFactorId(factorId int) string { - //桥墩倾斜 15 裂缝 18 支座位移20 挠度19 桥面振动28 Gnss935 + //桥墩倾斜 15 裂缝 18 支座位移20 挠度19 桥面振动28 加速度756 Gnss935 subAggSQl := "" switch factorId { case 4: //结构温度 @@ -437,6 +439,15 @@ func getEsAggSubSqlByZwyFactorId(factorId int) string { "field": "data.direction" } } +}` + case 756: //加速度 m/s² + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.acceler" + } + } }` case 883: //湿度 (后期需要合并3个温度 拼成 温湿度) subAggSQl = `