From b56d7eb5674843a54d7507d6ef1cd115b641c9e3 Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 29 Apr 2025 18:19:33 +0800 Subject: [PATCH] =?UTF-8?q?add=20=20=E5=AE=89=E5=BF=83=E4=BA=91=E7=89=B9?= =?UTF-8?q?=E5=BE=81=E6=95=B0=E6=8D=AE=E5=88=B0=20=E5=B9=BF=E4=B8=9C?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...云测点特征数据_广东省平台.yaml | 27 +++ .../config_江苏农村公路桥梁.json | 49 ----- .../config_江苏农村公路桥梁.json | 53 ++++++ consumers/GDJKJC/bodyTemplate.go | 175 ++++++++++++++++++ consumers/HBJCAS/config.go | 2 +- consumers/consumerHBJCAS.go | 94 +--------- utils/anxinyunEsAggQuery.go | 92 +++++++++ 7 files changed, 350 insertions(+), 142 deletions(-) create mode 100644 configFiles/config_安心云测点特征数据_广东省平台.yaml delete mode 100644 configFiles/config_江苏农村公路桥梁.json create mode 100644 configFiles/弃用备份/config_江苏农村公路桥梁.json create mode 100644 consumers/GDJKJC/bodyTemplate.go create mode 100644 utils/anxinyunEsAggQuery.go diff --git a/configFiles/config_安心云测点特征数据_广东省平台.yaml b/configFiles/config_安心云测点特征数据_广东省平台.yaml new file mode 100644 index 0000000..0a4a2f4 --- /dev/null +++ b/configFiles/config_安心云测点特征数据_广东省平台.yaml @@ -0,0 +1,27 @@ +consumer: consumerAXYES2GDJKJC +ioConfig: + in: + http: + url: https://esproxy.anxinyun.cn/anxincloud_themes/_search + out: + http: + url: https://bmsapi.gdjkjc.cn:13579/Data/AddStatData + method: "post" +monitor: + #振动是触发式,数据迟缓 cron10min也改成1小时一次 最多上报6条,不进行10min实时上报 + cron10min: 22 0/1 * * * #6/10 * * * * + #普通类型 特征数据 + cron1hour: 20 0/1 * * * +info: + rc4key: sK3kJttzZyf7aZI94zSYgytBYCrfZRt6yil2 +queryComponent: + redis: + address: 10.8.30.160:30379 +#结构物id对应 +structInfo: + 5450: G0000000000001 + 5452: G0000000000002 + 5455: G0000000000003 + 5456: G0000000000004 + + diff --git a/configFiles/config_江苏农村公路桥梁.json b/configFiles/config_江苏农村公路桥梁.json deleted file mode 100644 index 8916539..0000000 --- a/configFiles/config_江苏农村公路桥梁.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "consumer": "consumerJSNCGLQL", - "ioConfig": { - "in": { - "mqtt": { - "host": "127.0.0.1", - "port": 1883, - "userName": "goInOut", - "password": "", - "clientId": "goInOut_JSNCGLQL", - "Topics": [ - "upload/daas/+" - ] - } - }, - "out": { - "mqtt": { - "host": "127.0.0.1", - "port": 1883, - "userName": "upload", - "password": "", - "clientId": "goInOut", - "Topics": [ - "data/{{.bridgeCode}}/{{.sensorCode}}" - ] - } - } - }, - "info": { - "bridgeCode": "G2LR0670320804" - }, - "sensorInfo": { - "ZDsensorMap": { - "31323_1": "SGQ-RSG-G02-002-01", - "31323_2": "SGQ-RSG-G02-002-02", - "31323_3": "SGQ-RSG-G02-002-03", - "31323_4": "SGQ-RSG-G02-002-04", - "31323_5": "SGQ-RSG-G02-002-05", - "31323_6": "SGQ-RSG-G02-002-06", - "31323_7": "SGQ-RSG-G02-002-07", - "31323_8": "SGQ-RSG-G02-002-08", - "61226_1": "SGQ-RSG-G02-002-09", - "61226_2": "SGQ-RSG-G02-002-10", - "61226_3": "SGQ-RSG-G02-002-11", - "61226_4": "SGQ-RSG-G02-002-12", - "61226_5": "SGQ-RSG-G02-002-13" - } - } -} \ No newline at end of file diff --git a/configFiles/弃用备份/config_江苏农村公路桥梁.json b/configFiles/弃用备份/config_江苏农村公路桥梁.json new file mode 100644 index 0000000..ef541ca --- /dev/null +++ b/configFiles/弃用备份/config_江苏农村公路桥梁.json @@ -0,0 +1,53 @@ +{ + "consumer": "consumerJSNCGLQL", + "ioConfig": { + "in": { + "mqtt": { + "host": "127.0.0.1", + "port": 1883, + "userName": "goInOut", + "password": "", + "clientId": "goInOut_JSNCGLQL", + "Topics": [ + "upload/daas/+" + ] + } + }, + "out": { + "mqtt": { + "host": "127.0.0.1", + "port": 1883, + "userName": "upload", + "password": "", + "clientId": "goInOut", + "Topics": [ + "data/{{.bridgeCode}}/{{.sensorCode}}" + ] + } + } + }, + "info": { + "bridgeCode": "G2513LR0470320324" + }, + "sensorInfo": { + "ZDsensorMap": { + "30000_1": "XHH-RSG-G03-002-06", + "30000_2": "XHH-RSG-G03-002-05", + "30000_3": "XHH-RSG-G03-002-04", + "30000_4": "XHH-RSG-G03-002-03", + "30000_5": "XHH-RSG-G03-002-02", + "30000_6": "XHH-RSG-G03-002-01", + "30000_7": "XHH-RSG-G03-002-12", + "30000_8": "XHH-RSG-G03-002-11", + "40000_1": "XHH-RSG-G03-002-10", + "40000_2": "XHH-RSG-G03-002-09", + "40000_3": "XHH-RSG-G03-002-08", + "40000_4": "XHH-RSG-G03-002-07", + "40000_5": "XHH-RSG-G03-002-02", + "40000_6": "XHH-RSG-G03-002-04", + "40000_7": "XHH-RSG-G03-002-01", + "40000_8": "XHH-RSG-G03-002-03", + "50000_5": "XHH-RSG-G03-002-05" + } + } +} \ No newline at end of file diff --git a/consumers/GDJKJC/bodyTemplate.go b/consumers/GDJKJC/bodyTemplate.go new file mode 100644 index 0000000..5c66129 --- /dev/null +++ b/consumers/GDJKJC/bodyTemplate.go @@ -0,0 +1,175 @@ +package GDJKJC + +type CommonConeigen struct { + FactorId int + ItemsConeigen map[string]ItemCommonConeigen +} + +// CommonConeigen 通用特征数据 +type ItemCommonConeigen struct { + Max float64 + Mean float64 + Min float64 + RootMeanSquare float64 + //绝对值累积量 -数据波动特征- 时间段内的支座位移时程曲线,将后一时刻的支座位移减去前一时刻的支座位移即差分,再取绝对值,再累加 + AbsDiff float64 +} + +// 车载称重特征数据 +type CarLoadConeigen struct { + FactorId int + Total int64 + MaxWeight float64 + MaxWeight1 float64 + OverWeightCount int64 +} + +type CommonBody struct { + ThirdChannelCode string `json:"ThirdChannelCode"` //测点通道编号(根据部里文件命名规则) + DataTimeUnix int64 `json:"DataTimeUnix"` //时间时间戳毫秒 +} + +type A32WsdBody struct { + CommonBody + TempMax float64 `json:"TempMax"` //温度最大值 + TempMin float64 `json:"TempMin"` //温度最小值 + TempAvg float64 `json:"TempAvg"` //温度平均值 + TempDiff float64 `json:"TempDiff"` //最大温差 + HumMax float64 `json:"HumMax"` //湿度最大值 + HumMin float64 `json:"HumMin"` //湿度最小值 + HumAvg float64 `json:"HumAvg"` //湿度平均值 + WaringDuration float64 `json:"WaringDuration"` //超限持续时间 +} + +type A33IceBody struct { + CommonBody + Max float64 `json:"Max"` //最大值 + Min float64 `json:"Min"` //最小值 + Avg float64 `json:"Avg"` //平均值 +} + +type A34RainBody struct { + CommonBody + Avg float64 `json:"Avg"` //平均值 +} + +type A35CarloadsBody struct { + CommonBody + Total int64 `json:"Total"` //车流量 + MaxWeight float64 `json:"MaxWeight"` //最大总负荷 + MaxWeight1 float64 `json:"MaxWeight1"` //最大轴重 + OverWeightCount int64 `json:"OverWeightCount"` //超载车数量 +} + +// A36WindBody 风速风向 10分钟一次 +type A36WindBody struct { + CommonBody + AvgSpeed float64 `json:"AvgSpeed"` //风速平均值 + AvgDirection float64 `json:"AvgDirection"` //风向平均值 + AvgDirectionZ float64 `json:"AvgDirectionZ"` //风攻角平均值 +} + +// A37WindPressBody 风压 +type A37WindPressBody struct { + CommonBody + Avg float64 `json:"Avg"` //风压平均值 + Rms float64 `json:"Rms"` //均方根值 +} + +type A38TemperatureBody struct { + CommonBody + Max float64 `json:"Max"` + Min float64 `json:"Min"` + Avg float64 `json:"Avg"` + Diff float64 `json:"Diff"` //最大温差 +} + +// A40DisplacementBody 位移(主梁、塔顶、主缆、高墩墩顶、拱顶) +// 10分钟一次 +type A40DisplacementBody struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` + Rms float64 `json:"Rms"` //均方根值 +} + +type A41GnssBody struct { + CommonBody + XAvg float64 `json:"XAvg"` //横桥向平均值 + YAvg float64 `json:"YAvg"` //纵桥向平均值 + ZAvg float64 `json:"ZAvg"` //竖向平均值 + XMax float64 `json:"XMax"` //横桥向绝对最大值 + YMax float64 `json:"YMax"` //纵桥向绝对最大值 + ZMax float64 `json:"ZMax"` //竖向绝对最大值 + XRms float64 `json:"XRms"` //横桥向均方根值 + YRms float64 `json:"YRms"` //纵桥向均方根值 + ZRms float64 `json:"ZRms"` //竖向均方根值 +} + +// A42DisplacementBody 位移(支座位移、梁端纵向位移) +type A42DisplacementBody struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` + Rms float64 `json:"Rms"` + AbsDiff float64 `json:"AbsDiff"` //绝对值累积量 +} + +// A43AngleBody 梁端转角 +type A43AngleBody struct { + CommonBody + XAvg float64 `json:"XAvg"` + XMax float64 `json:"XMax"` + XRms float64 `json:"XRms"` + YAvg float64 `json:"YAvg"` + YMax float64 `json:"YMax"` + YRms float64 `json:"YRms"` +} + +// A44Strain 应变 +type A44Strain struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` +} + +// A45CableForce 索力 +type A45CableForce struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` + Min float64 `json:"Min"` + Rms float64 `json:"Rms"` //均方根值 +} + +// A48Acc 振动(主梁、索塔、拱圈) 10分钟一次 +type A48Acc struct { + CommonBody + Max float64 `json:"Max"` //绝对最大值 + Rms float64 `json:"Rms"` //均方根值 +} + +// A50DisplacementBody 位移(支座位移、梁端纵向位移) +type A50DisplacementBody struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` //绝对最大值 + Rms float64 `json:"Rms"` //均方根值 +} + +// A51Crack 裂缝 +type A51Crack struct { + CommonBody + Avg float64 `json:"Avg"` + Max float64 `json:"Max"` +} + +type A52Corrosion struct { + CommonBody + ChlorineMax float64 `json:"ChlorineMax"` //氯离子浓度最大值 + ChlorineAvg float64 `json:"ChlorineAvg"` //氯离子浓度平均值 + ChlorineMin float64 `json:"ChlorineMin"` //氯离子浓度最小值 + CorrosionMax float64 `json:"CorrosionMax"` //侵蚀深度最大值 + CorrosionAvg float64 `json:"CorrosionAvg"` //侵蚀深度平均值 + CorrosionMin float64 `json:"CorrosionMin"` //侵蚀深度最小值 +} diff --git a/consumers/HBJCAS/config.go b/consumers/HBJCAS/config.go index 30f18fe..fa0fba9 100644 --- a/consumers/HBJCAS/config.go +++ b/consumers/HBJCAS/config.go @@ -19,7 +19,7 @@ type In struct { } type Out struct { - Mqtt config.MqttConfig `yaml:"mqtt"` + Http config.HttpConfig `yaml:"http"` } type queryComponent struct { diff --git a/consumers/consumerHBJCAS.go b/consumers/consumerHBJCAS.go index f400144..8babaa7 100644 --- a/consumers/consumerHBJCAS.go +++ b/consumers/consumerHBJCAS.go @@ -203,7 +203,7 @@ func (the *consumerHBJCAS) crc16rc4(transBytes []byte) []byte { } func (the *consumerHBJCAS) getESQueryStrByHour(structureId int64, factorId int, start, end string) string { - aggSubSql := getEsAggSubSqlByAxyFactorId(factorId) + aggSubSql := utils.GetEsAggSubSqlByAxyFactorId(factorId) esQuery := fmt.Sprintf(` { "size": 0, @@ -260,7 +260,7 @@ func (the *consumerHBJCAS) getESQueryStrByHour(structureId int64, factorId int, } func (the *consumerHBJCAS) getESQueryStrBy10min(structureId int64, factorId int, start, end string) string { - aggSubSql := getEsAggSubSqlByAxyFactorId(factorId) + aggSubSql := utils.GetEsAggSubSqlByAxyFactorId(factorId) esQuery := fmt.Sprintf(` { "size": 0, @@ -316,96 +316,6 @@ func (the *consumerHBJCAS) getESQueryStrBy10min(structureId int64, factorId int, return esQuery } -func getEsAggSubSqlByAxyFactorId(factorId int) string { - //桥墩倾斜 15 裂缝 18 支座位移20 桥面振动28 加速度三项监测592(承德隧道专用) - subAggSQl := "" - switch factorId { - case 4: //结构温度 - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.temperature" - } - } -}` - case 6: // 索力 - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.cableForce" - } - } -}` - case 11: //应变 - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.strain" - } - } -}` - case 15: - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.x" - } - }, - "y": { - "extended_stats": { - "field": "data.y" - } - } -}` - case 18: - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.crack" - } - } -}` - case 20: - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.displacement" - } - } -}` - case 28: - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.pv" - } - }, - "y": { - "extended_stats": { - "field": "data.trms" - } - } -}` - case 592: - subAggSQl = ` -{ - "x": { - "extended_stats": { - "field": "data.z_acc_speed" - } - } -}` - } - return subAggSQl -} - func (the *consumerHBJCAS) getStructureId() string { structureId, ok := the.Info.OtherInfo["structureId"] if !ok { diff --git a/utils/anxinyunEsAggQuery.go b/utils/anxinyunEsAggQuery.go new file mode 100644 index 0000000..086a674 --- /dev/null +++ b/utils/anxinyunEsAggQuery.go @@ -0,0 +1,92 @@ +package utils + +// 安心云es 主题数据,聚集查询 +func GetEsAggSubSqlByAxyFactorId(factorId int) string { + //桥墩倾斜 15 裂缝 18 支座位移20 桥面振动28 加速度三项监测592(承德隧道专用) + subAggSQl := "" + switch factorId { + case 4: //结构温度 + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.temperature" + } + } +}` + case 6: // 索力 + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.cableForce" + } + } +}` + case 11: //应变 + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.strain" + } + } +}` + case 15: + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.x" + } + }, + "y": { + "extended_stats": { + "field": "data.y" + } + } +}` + case 18: + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.crack" + } + } +}` + case 20: + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.displacement" + } + } +}` + case 28: + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.pv" + } + }, + "y": { + "extended_stats": { + "field": "data.trms" + } + } +}` + case 592: + subAggSQl = ` +{ + "x": { + "extended_stats": { + "field": "data.z_acc_speed" + } + } +}` + } + return subAggSQl +}