|
@ -14,6 +14,7 @@ import ( |
|
|
// Adaptor_ZD_JSNCGLQL 数据 转换 江苏农村公路桥梁监测系统
|
|
|
// Adaptor_ZD_JSNCGLQL 数据 转换 江苏农村公路桥梁监测系统
|
|
|
type Adaptor_ZD_JSNCGLQL struct { |
|
|
type Adaptor_ZD_JSNCGLQL struct { |
|
|
IdMap map[string]string |
|
|
IdMap map[string]string |
|
|
|
|
|
BridgeCode string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (the Adaptor_ZD_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush { |
|
|
func (the Adaptor_ZD_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush { |
|
@ -36,9 +37,7 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//todo 桥梁编码
|
|
|
topic := fmt.Sprintf("data/%s/%s", the.BridgeCode, sensorCode) |
|
|
bridgeCode := sensorCode |
|
|
|
|
|
topic := fmt.Sprintf("data/%s/%s", bridgeCode, sensorCode) |
|
|
|
|
|
//数据秒数
|
|
|
//数据秒数
|
|
|
seconds := len(zd.AccValues) / zd.Frequency |
|
|
seconds := len(zd.AccValues) / zd.Frequency |
|
|
|
|
|
|
|
@ -50,6 +49,9 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
|
|
|
|
|
startIndex := (0 + i) * zd.Frequency |
|
|
startIndex := (0 + i) * zd.Frequency |
|
|
endIndex := (1 + i) * zd.Frequency |
|
|
endIndex := (1 + i) * zd.Frequency |
|
|
|
|
|
if endIndex > len(sensorDataList) { |
|
|
|
|
|
endIndex = len(sensorDataList) |
|
|
|
|
|
} |
|
|
subDataList := sensorDataList[startIndex:endIndex] |
|
|
subDataList := sensorDataList[startIndex:endIndex] |
|
|
|
|
|
|
|
|
for _, sensorData := range subDataList { |
|
|
for _, sensorData := range subDataList { |
|
|