|
|
@ -2,10 +2,12 @@ package adaptors |
|
|
|
|
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"goInOut/consumers/GDJKJC" |
|
|
|
"goInOut/consumers/HBJCAS" |
|
|
|
"goInOut/consumers/HBJCAS/protoFiles_hb" |
|
|
|
"goInOut/dbOperate" |
|
|
|
"goInOut/models" |
|
|
|
|
|
|
|
"log" |
|
|
|
"math" |
|
|
@ -64,16 +66,16 @@ func (the Adaptor_AXYES_GDJKJC) EsAggTopToGDJKJC(structId int64, factorId int, e |
|
|
|
sensorId := sensorBucket.Key |
|
|
|
for _, dateBucket := range sensorBucket.GroupDate.Buckets { |
|
|
|
//优先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)
|
|
|
|
// continue
|
|
|
|
//}
|
|
|
|
monitorCode := "LJ-VIB-P01-004-01" //the.getPointCodeFromLabel(station.Labels)
|
|
|
|
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) |
|
|
|
continue |
|
|
|
} |
|
|
|
monitorCode := station.Name |
|
|
|
if monitorCode == "" { |
|
|
|
log.Printf("redis 获取[s:%d,f:%d]测点[%d]信息,异常,跳过", structId, factorId, sensorId) |
|
|
|
log.Printf("redis 获取[s:%d,f:%d]测点[%d] 无信息,跳过", structId, factorId, sensorId) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
@ -90,7 +92,7 @@ func (the Adaptor_AXYES_GDJKJC) EsAggTopToGDJKJC(structId int64, factorId int, e |
|
|
|
return result |
|
|
|
} |
|
|
|
func (the Adaptor_AXYES_GDJKJC) getMonitorTypeByFactorId(factorId int) protoFiles_hb.MonitoryType { |
|
|
|
//桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592
|
|
|
|
//应变11 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592
|
|
|
|
switch factorId { |
|
|
|
case 15: |
|
|
|
return protoFiles_hb.MonitoryType_INC |
|
|
@ -124,6 +126,12 @@ func (the Adaptor_AXYES_GDJKJC) EsAgg2StatisticData(factorId int, monitorCode st |
|
|
|
} |
|
|
|
var destStruct any |
|
|
|
switch factorId { |
|
|
|
case 11, 18: //应变11 裂缝18
|
|
|
|
destStruct = GDJKJC.A44Strain{ |
|
|
|
CommonBody: commonBody, |
|
|
|
Avg: avgValueX, |
|
|
|
Max: dateBucket.X.Max, |
|
|
|
} |
|
|
|
case 15: //倾角
|
|
|
|
destStruct = GDJKJC.A43AngleBody{ |
|
|
|
CommonBody: commonBody, |
|
|
@ -140,6 +148,13 @@ func (the Adaptor_AXYES_GDJKJC) EsAgg2StatisticData(factorId int, monitorCode st |
|
|
|
Max: maxAbsoluteValueX / 100, //省平台 加速度单位 m/s² 实际设备单位 cm/s²
|
|
|
|
Rms: rootMeanSquareX / 100, //均方根
|
|
|
|
} |
|
|
|
case 63: //支护结构变形(主梁位移)
|
|
|
|
destStruct = GDJKJC.A40DisplacementBody{ |
|
|
|
CommonBody: commonBody, |
|
|
|
Avg: avgValueY, |
|
|
|
Max: maxAbsoluteValueY, |
|
|
|
Rms: rootMeanSquareY, |
|
|
|
} |
|
|
|
} |
|
|
|
if destStruct != nil { |
|
|
|
dataBytes, _ = json.Marshal(destStruct) |
|
|
|