lucas 3 months ago
parent
commit
f80c3dddd6
  1. 22
      adaptors/安心云es数据to南京智行.go
  2. 16
      configFiles/config_安心云加依尔2号隧道_南京智行.yaml
  3. 10
      consumers/JYES_NJZX/dataModel.go
  4. 3
      consumers/consumerJYESNJZX.go

22
adaptors/安心云es数据to南京智行.go

@ -31,6 +31,7 @@ func (the *Adaptor_AXYES_NJZX) Transform(structId int64, factorId int, rawMsg st
err := json.Unmarshal([]byte(rawMsg), &esAggDateHistogram)
if err != nil {
fmt.Println("Error unmarshalling JSON:", err)
return nil
}
@ -50,19 +51,19 @@ func (the *Adaptor_AXYES_NJZX) EsDataValueChangeToNJZX(structId int64, factorId
//数据汇总
complexData := &protoDataFiles.ComplexData{}
for _, sensorBucket := range buckets {
sensorId := sensorBucket.Source.SensorName //安心云de测点id
sensorId := sensorBucket.Source.Sensor //安心云de测点id
//优先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)
log.Printf("redis 获取[s:%d,f:%d]测点[%d]标签异常: %v", structId, factorId, sensorId, errRedis)
continue
}
monitorCodeStr := the.getPointCodeFromLabel(station.Labels)
if monitorCodeStr == "" {
log.Printf("redis 获取[s:%d,f:%d]测点[%d],标签信息[%s]转换int64异常,跳过", structId, factorId, sensorId, station.Labels)
log.Printf("redis 获取[s:%d,f:%d]测点[%d],标签信息[%s]转换异常,跳过", structId, factorId, sensorId, station.Labels)
continue
}
@ -142,23 +143,20 @@ func (the *Adaptor_AXYES_NJZX) ChangeToNJZXData(factorId int, monitorCodeStr str
CrackWidth: []float32{float32(dateBucket.Source.Data["crack"])},
}}
case 103: //净空收敛//123456789
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Rhs{Rhs: &protoDataFiles.RHSRealTime{
Temperature: []float32{float32(dateBucket.Source.Data["crack"])},
Humidity: []float32{float32(dateBucket.Source.Data["crack"])},
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Disr{Disr: &protoDataFiles.DISRRealTime{
Displacement: []float32{float32(dateBucket.Source.Data["displacement"])},
}}
case 102: //拱顶沉降//123456789
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Rhs{Rhs: &protoDataFiles.RHSRealTime{
Temperature: []float32{float32(dateBucket.Source.Data["crack"])},
Humidity: []float32{float32(dateBucket.Source.Data["crack"])},
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Disr{Disr: &protoDataFiles.DISRRealTime{
Displacement: []float32{float32(dateBucket.Source.Data["displacement"])},
}}
case 96: //二次衬彻应变
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Rsg{Rsg: &protoDataFiles.RSGRealTime{
Strain: []float32{float32(dateBucket.Source.Data["strain"])},
}}
case 107: //道床及拱腰结构沉降//123456789
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Rhs{Rhs: &protoDataFiles.RHSRealTime{
Temperature: []float32{float32(dateBucket.Source.Data["crack"])},
Humidity: []float32{float32(dateBucket.Source.Data["crack"])},
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Disr{Disr: &protoDataFiles.DISRRealTime{
Displacement: []float32{float32(dateBucket.Source.Data["displacement"])},
}}
case 156: //风速
dataDefinitionData.DataBody = &protoDataFiles.SensorData_Wds{Wds: &protoDataFiles.WDSRealTime{

16
configFiles/弃用备份/config_安心云加依尔2号隧道_南京智行.yaml → configFiles/config_安心云加依尔2号隧道_南京智行.yaml

@ -2,18 +2,18 @@ consumer: consumerJYESNJZX
ioConfig:
in:
http:
url: https://esproxy.anxinyun.cn/savoir_themes/_search
url: https://esproxy.anxinyun.cn/anxincloud_themes-2025/_search
out:
mqtt:
host: 120.205.24.17
host: 120.205.24.27
port: 1883
userName:
password:
clientId: bridge_goinout
userName: xjjyrsd
password: xjjyrsd@2024
clientId: jyrsdxjjyrsd
topics:
t/t6540000001/rt
- t/t6540000001/rt
monitor:
cron10min: 8/10 * * * * #31 0/1 * * * #
cron10min: 2/1 * * * *
info:
rc4key: t/gzgyy0219
queryComponent:
@ -22,7 +22,7 @@ queryComponent:
#结构物id对应
structInfo:
#加依尔4983 -> 映射对方平台id
4983: 56232
4983: 5623
#点位id对应信息
pointInfo: #监测因素 2温湿度 4温度 18裂缝检测 103净空收敛 102拱顶沉降 96二次衬彻应变 107道床及拱腰结构沉降 156风速 578风向

10
consumers/JYES_NJZX/dataModel.go

@ -16,11 +16,11 @@ type EsThemeDateValue struct {
} `json:"hits"`
}
type Hits struct {
Index string `json:"_index"`
Type int `json:"_type"`
Id string `json:"_id"`
Score int `json:"_score"`
Source Source `json:"_source"`
Index string `json:"_index"`
Type string `json:"_type"`
Id string `json:"_id"`
Score float64 `json:"_score"`
Source Source `json:"_source"`
}
type Source struct {
SensorName string `json:"sensor_name"`

3
consumers/consumerJYESNJZX.go

@ -101,6 +101,7 @@ func (the *consumerJYESNJZX) getEsAggData() {
adaptor.StructInfo = the.Info.StructInfo
for _, factorId := range factorIds {
esQuery := the.getESQueryStr(structId, factorId, start, end)
//log.Printf("esQuery[%s]", esQuery)
auth := map[string]string{"Authorization": "Bear 85a441d4-022b-4613-abba-aaa8e2693bf7"}
esAggResultStr := the.InHttp.HttpGetWithHeader(esQuery, auth)
log.Printf("esAggResultStr[%s]", esAggResultStr)
@ -171,7 +172,7 @@ func (the *consumerJYESNJZX) getESQueryStr(structureId int64, factorId int, star
}
]
}
},
}
}
`, structureId, factorId, start, end)

Loading…
Cancel
Save