Browse Source

update 修改江苏农村公路 数据上报 支持州洪河特大桥以及三干渠大桥的

dev
lucas 3 weeks ago
parent
commit
f9f035c4c3
  1. 14
      adaptors/振动to江苏省农村公路桥梁监测.go
  2. 8
      configFiles/config_江苏农村公路桥梁.json
  3. 0
      configFiles/弃用备份/config_知物云果子沟_中交华联_特征数据.yaml
  4. 2
      consumers/consumerJSNCGLQL.go
  5. 11
      models/ZD.go

14
adaptors/振动to江苏省农村公路桥梁监测.go

@ -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

8
configFiles/弃用备份/config_江苏农村公路桥梁.json → configFiles/config_江苏农村公路桥梁.json

@ -5,12 +5,12 @@
"mqtt": {
"host": "10.8.30.160",
"port": 30883,
"userName": "goUpload",
"userName": "goInOut",
"password": "",
"clientId": "goUpload_JSNCGLQL",
"clientId": "goInOut_JSNCGLQL",
"Topics": [
"upload/uds/+",
"upload/ZD/+",
"upload/daas/+",
"upload/ZDSL/+",
"upload/gdnd/+"
]
@ -38,7 +38,7 @@
"m1c2": "LHTDQ-RSG-L04-001-03"
},
"ZDsensorMap": {
"m1c1": "LHTDQ-VIB-C08-001-01",
"35968": "LHTDQ-VIB-C08-001-01",
"m1c2": "LHTDQ-VIB-L03-001-01"
},
"ZDSLensorMap": {

0
configFiles/config_知物云果子沟_中交华联_特征数据.yaml → configFiles/弃用备份/config_知物云果子沟_中交华联_特征数据.yaml

2
consumers/consumerJSNCGLQL.go

@ -113,7 +113,7 @@ func (the *consumerJSNCGLQL) getAdaptor(flag string) (adaptor adaptors.IAdaptor4
case "upload/uds":
log.Printf("[统一采集软件]-上报,准备处理")
adaptor = adaptors.Adaptor_TYCJ_JSNCGLQL{IdMap: the.Info.TYCJsensorMap, BridgeCode: bridgeCode}
case "upload/ZD":
case "upload/ZD", "upload/daas":
log.Printf("[振动软件]-上报,准备处理")
adaptor = adaptors.Adaptor_ZD_JSNCGLQL{IdMap: the.Info.ZDsensorMap, BridgeCode: bridgeCode}
case "upload/ZDSL":

11
models/ZD.go

@ -10,3 +10,14 @@ type ZD struct {
AccValues []float32 `json:"AccValues"`
Ticks int64 `json:"Ticks"` //毫秒级
}
type ZDnew struct {
SensorId int `json:"Sensorid"`
Module string `json:"Module"`
Channel int `json:"Channel"`
Frequency float32 `json:"Frequency,omitempty"`
ThemeValue []float32 `json:"ThemeValue"`
RawValues []float32 `json:"RawValues"`
AccValues []float32 `json:"AccValues"`
Ticks int64 `json:"Ticks"` //毫秒级
}

Loading…
Cancel
Save