|
|
@ -26,9 +26,13 @@ type Adaptor_ZWYES_ZJHL struct { |
|
|
|
Redis *dbOperate.RedisHelper |
|
|
|
//果子沟特殊处理 缓存与湿度关联的温度测点数据
|
|
|
|
cacheTemp map[int64]*protoFiles_zjhl_v3.DataDefinition_StatisticData |
|
|
|
//果子沟特殊处理 缓存与风向关联的风速测点数据
|
|
|
|
cacheSpeed map[int64]*protoFiles_zjhl_v3.DataDefinition_StatisticData |
|
|
|
} |
|
|
|
|
|
|
|
var wsdMonitorCodeMap = map[int64]int64{ |
|
|
|
6500030001: 0, |
|
|
|
6500030002: 0, |
|
|
|
6500030003: 0, |
|
|
|
6500030004: 0, |
|
|
|
6500030005: 0} |
|
|
@ -101,7 +105,22 @@ func (the *Adaptor_ZWYES_ZJHL) EsAggTopToHBJCAS(structId int64, factorId int, es |
|
|
|
log.Printf("缓存关联label[%d]的温度数据 => %s", monitorCode, string(tempStr)) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if factorId == 156 { //风速156 // 关联风向的 风速测点 只缓存
|
|
|
|
if _, exists := wsdMonitorCodeMap[monitorCode]; exists { |
|
|
|
if the.cacheSpeed == nil { |
|
|
|
the.cacheSpeed = make(map[int64]*protoFiles_zjhl_v3.DataDefinition_StatisticData) |
|
|
|
} |
|
|
|
if monitorCode == 6500030002 { //6500030002 有多个风速 只选测点72183
|
|
|
|
if sensorId != 72183 { |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
the.cacheSpeed[monitorCode] = dataBody |
|
|
|
tempStr, _ := json.Marshal(dataBody) |
|
|
|
log.Printf("缓存关联label[%d]的风速数据 => %s", monitorCode, string(tempStr)) |
|
|
|
} |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
dataDefinition := &protoFiles_zjhl_v3.DataDefinition{ |
|
|
@ -114,11 +133,16 @@ func (the *Adaptor_ZWYES_ZJHL) EsAggTopToHBJCAS(structId int64, factorId int, es |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//湿度处理后 清理之前的缓存温度
|
|
|
|
//湿度883处理后 清理之前的缓存温度
|
|
|
|
if factorId == 883 { |
|
|
|
the.cacheTemp = make(map[int64]*protoFiles_zjhl_v3.DataDefinition_StatisticData) |
|
|
|
} |
|
|
|
|
|
|
|
//风向225处理后 清理之前的缓存风速
|
|
|
|
if factorId == 225 { |
|
|
|
the.cacheSpeed = make(map[int64]*protoFiles_zjhl_v3.DataDefinition_StatisticData) |
|
|
|
} |
|
|
|
|
|
|
|
v, _ := json.Marshal(complexData) |
|
|
|
log.Printf("[struct:%d,factor:%d] 特征数据=> %s", structId, factorId, v) |
|
|
|
result, _ = proto.Marshal(complexData) |
|
|
@ -126,7 +150,7 @@ func (the *Adaptor_ZWYES_ZJHL) EsAggTopToHBJCAS(structId int64, factorId int, es |
|
|
|
return result |
|
|
|
} |
|
|
|
func (the *Adaptor_ZWYES_ZJHL) getMonitorTypeByFactorId(factorId int) protoFiles_zjhl_v3.MonitoryType { |
|
|
|
//结构温度4 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592
|
|
|
|
//结构温度4 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 风速156 加速度三项监测592
|
|
|
|
switch factorId { |
|
|
|
case 4: |
|
|
|
return protoFiles_zjhl_v3.MonitoryType_TMP |
|
|
@ -146,6 +170,8 @@ func (the *Adaptor_ZWYES_ZJHL) getMonitorTypeByFactorId(factorId int) protoFiles |
|
|
|
return protoFiles_zjhl_v3.MonitoryType_DIS |
|
|
|
case 28: |
|
|
|
return protoFiles_zjhl_v3.MonitoryType_VIB |
|
|
|
case 156: //风速测点 需要合并 同标签的风向测点 组成风速风向
|
|
|
|
return protoFiles_zjhl_v3.MonitoryType_UAN |
|
|
|
case 883: //湿度测点 需要合并 同标签的温度测点 组成温湿度
|
|
|
|
return protoFiles_zjhl_v3.MonitoryType_RHS |
|
|
|
case 935: |
|
|
@ -243,6 +269,21 @@ func (the *Adaptor_ZWYES_ZJHL) EsAgg2StatisticData(factorId int, monitorCode int |
|
|
|
MaxAbsoluteValue: float32(maxAbsoluteValueX), |
|
|
|
RootMeanSquare: float32(rootMeanSquareY), |
|
|
|
}} |
|
|
|
case 156: //风速
|
|
|
|
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_zjhl_v3.StatisticData_Uan{Uan: &protoFiles_zjhl_v3.UANStatistic{ |
|
|
|
AvgVelocity: float32(avgValueX), |
|
|
|
//AvgDirection: float32(0),
|
|
|
|
}} |
|
|
|
case 225: //风向
|
|
|
|
statisticDataUan := &protoFiles_zjhl_v3.StatisticData_Uan{Uan: &protoFiles_zjhl_v3.UANStatistic{ |
|
|
|
//AvgVelocity: float32(0),
|
|
|
|
AvgDirection: float32(avgValueX), |
|
|
|
}} |
|
|
|
|
|
|
|
if relatedSpeed, ok := the.cacheSpeed[monitorCode]; ok { |
|
|
|
statisticDataUan.Uan.AvgVelocity = relatedSpeed.StatisticData.GetUan().GetAvgVelocity() |
|
|
|
} |
|
|
|
dataDefinitionStatisticData.StatisticData.DataBody = statisticDataUan |
|
|
|
case 883: //湿度 ->最终拼接为 温湿度
|
|
|
|
statisticDataRhs := &protoFiles_zjhl_v3.StatisticData_Rhs{Rhs: &protoFiles_zjhl_v3.RHSStatistic{ |
|
|
|
//MaxTemperature: float32(dateBucket.X.Max),
|
|
|
|