|
|
@ -20,7 +20,7 @@ type Adaptor_ZD_JSNCGLQL struct { |
|
|
|
} |
|
|
|
|
|
|
|
func (the Adaptor_ZD_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush { |
|
|
|
zd := models.ZD{} |
|
|
|
zd := models.ZDnew{} |
|
|
|
err := json.Unmarshal([]byte(rawMsg), &zd) |
|
|
|
if err != nil { |
|
|
|
return nil |
|
|
@ -34,12 +34,12 @@ func (the Adaptor_ZD_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush { |
|
|
|
return the.ZDtoJSNCGLQL(zd) |
|
|
|
} |
|
|
|
|
|
|
|
func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZDnew) (result []NeedPush) { |
|
|
|
Atime := time.UnixMilli(zd.Ticks) |
|
|
|
|
|
|
|
sensorDataList := zd.AccValues |
|
|
|
//获取对方系统 id
|
|
|
|
sensorCode := the.getSensorCode(zd.Module) |
|
|
|
sensorCode := the.getSensorCode(strconv.Itoa(zd.SensorId)) |
|
|
|
if sensorCode == "" { |
|
|
|
log.Printf("振动 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 测点id,请检查配置文件", zd.Module) |
|
|
|
return |
|
|
@ -47,7 +47,7 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
|
|
|
|
topic := fmt.Sprintf("data/%s/%s", the.BridgeCode, sensorCode) |
|
|
|
//数据秒数
|
|
|
|
seconds := len(zd.AccValues) / zd.Frequency |
|
|
|
seconds := len(zd.AccValues) / int(zd.Frequency) |
|
|
|
|
|
|
|
for i := 0; i < seconds; i++ { |
|
|
|
var transBytes []byte |
|
|
@ -55,8 +55,8 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
//1.添加时间段
|
|
|
|
transBytes = append(transBytes, the.getTimeBytes(onceTime)...) |
|
|
|
|
|
|
|
startIndex := (0 + i) * zd.Frequency |
|
|
|
endIndex := (1 + i) * zd.Frequency |
|
|
|
startIndex := (0 + i) * int(zd.Frequency) |
|
|
|
endIndex := (1 + i) * int(zd.Frequency) |
|
|
|
if endIndex > len(sensorDataList) { |
|
|
|
endIndex = len(sensorDataList) |
|
|
|
} |
|
|
@ -76,7 +76,7 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
|
|
|
|
return result |
|
|
|
} |
|
|
|
func (the Adaptor_ZD_JSNCGLQL) ZDSLtoJSNCGLQL(zd models.ZD) (result []NeedPush) { |
|
|
|
func (the Adaptor_ZD_JSNCGLQL) ZDSLtoJSNCGLQL(zd models.ZDnew) (result []NeedPush) { |
|
|
|
Atime := time.UnixMilli(zd.Ticks) |
|
|
|
|
|
|
|
sensorDataList := zd.ThemeValue |
|
|
|