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