Browse Source

update 添加bridgeCode 和 重命名

pull/2/head
lucas 2 months ago
parent
commit
30316c6d6f
  1. 10
      adaptors/振动to江苏省农村公路桥梁监测.go
  2. 8
      adaptors/统一采集to江苏省农村公路桥梁监测.go
  3. 22
      configFiles/config_江苏农村公路桥梁.json
  4. 0
      configFiles/弃用备份/config_安心云设备数据_最新同步.json
  5. 5
      consumers/JSNCGLQL/config.go
  6. 11
      consumers/consumerJSNCGLQL.go
  7. 3
      consumers/consumerManage.go
  8. 6
      testUnit/江苏智感测试_test.go

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

@ -13,7 +13,8 @@ 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 {

8
adaptors/统一采集to江苏省农村公路桥梁监测.go

@ -13,7 +13,8 @@ import (
// Adaptor_TYCJ_JSNCGLQL 数据 转换 江苏农村公路桥梁监测系统 // Adaptor_TYCJ_JSNCGLQL 数据 转换 江苏农村公路桥梁监测系统
type Adaptor_TYCJ_JSNCGLQL struct { type Adaptor_TYCJ_JSNCGLQL struct {
IdMap map[string]string IdMap map[string]string
BridgeCode string
} }
func (the Adaptor_TYCJ_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush { func (the Adaptor_TYCJ_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush {
@ -49,9 +50,8 @@ func (the Adaptor_TYCJ_JSNCGLQL) TYCJtoJSNCGLQL(tycj models.TYCJ) (result []Need
log.Printf("统一采集 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 测点id,请检查配置文件", tycj.SensorData.Name) log.Printf("统一采集 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 测点id,请检查配置文件", tycj.SensorData.Name)
return return
} }
//todo 桥梁编码
bridgeCode := sensorCode topic := fmt.Sprintf("data/%s/%s", the.BridgeCode, sensorCode)
topic := fmt.Sprintf("data/%s/%s", bridgeCode, sensorCode)
for _, sensorData := range sensorDataList { for _, sensorData := range sensorDataList {

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

@ -20,7 +20,7 @@
"port": 30883, "port": 30883,
"userName": "upload", "userName": "upload",
"password": "", "password": "",
"clientId": "upload1", "clientId": "goInOut",
"Topics": [ "Topics": [
"data/bridgeCode" "data/bridgeCode"
] ]
@ -28,18 +28,16 @@
} }
}, },
"info": { "info": {
"structUploadCode": "G2320281L0012" "bridgeCode": "G2320281L0012"
}, },
"sensorInfoMap": { "sensorInfo": {
"sensorMap": { "TYCJsensorMap": {
"TYCJsensorMap": { "m1c1": "JY-HSD-G05-001-01",
"m1c1": "JY-HSD-G05-001-01", "m1c2": "LHTDQ-RSG-L04-001-03"
"m1c2": "LHTDQ-RSG-L04-001-03" },
}, "ZDsensorMap": {
"ZDsensorMap": { "m1c1": "LHTDQ-VIB-C08-001-01",
"m1c1": "LHTDQ-VIB-C08-001-01", "m1c2": "LHTDQ-VIB-L03-001-01"
"m1c2": "LHTDQ-VIB-L03-001-01"
}
} }
} }
} }

0
configFiles/config_安心云设备数据_最新同步.json → configFiles/弃用备份/config_安心云设备数据_最新同步.json

5
consumers/JSNCGLQL/config.go

@ -4,8 +4,9 @@ import "goInOut/config"
type ConfigFile struct { type ConfigFile struct {
config.Consumer config.Consumer
IoConfig ioConfig `json:"ioConfig"` IoConfig ioConfig `json:"ioConfig"`
SensorConfig SensorConfig `json:"sensorInfo"`
OtherInfo map[string]string `json:"info"`
} }
type ioConfig struct { type ioConfig struct {
In In `json:"in"` In In `json:"in"`

11
consumers/consumerJSNCGLQL.go

@ -102,13 +102,20 @@ func (the *consumerJSNCGLQL) onData(inTopic string, Msg string) {
} }
} }
func (the *consumerJSNCGLQL) getAdaptor(flag string) (adaptor adaptors.IAdaptor4) { func (the *consumerJSNCGLQL) getAdaptor(flag string) (adaptor adaptors.IAdaptor4) {
bridgeCode := ""
if v, ok := the.Info.OtherInfo["bridgeCode"]; ok {
bridgeCode = v
}
if bridgeCode == "" {
panic("无正确的 bridgeCode")
}
switch flag { switch flag {
case "upload/uds": case "upload/uds":
log.Printf("[统一采集软件]-上报,准备处理") log.Printf("[统一采集软件]-上报,准备处理")
adaptor = adaptors.Adaptor_TYCJ_JSNCGLQL{IdMap: the.Info.TYCJsensorMap} adaptor = adaptors.Adaptor_TYCJ_JSNCGLQL{IdMap: the.Info.TYCJsensorMap, BridgeCode: bridgeCode}
case "upload/ZD": case "upload/ZD":
log.Printf("[振动软件]-上报,准备处理") log.Printf("[振动软件]-上报,准备处理")
//adaptor = adaptors.Adaptor_ZD_CQZG{IdMap: the.Info.SensorMap.ZDsensorMCMap, RC4Key: RC4Key} adaptor = adaptors.Adaptor_ZD_JSNCGLQL{IdMap: the.Info.ZDsensorMap, BridgeCode: bridgeCode}
default: default:
log.Printf("[无匹配 %s],不处理", flag) log.Printf("[无匹配 %s],不处理", flag)
} }

3
consumers/consumerManage.go

@ -22,6 +22,9 @@ func GetConsumer(name string) (consumer IConsumer) {
case "consumerAXYraw": //工迅-广州高支模平台 case "consumerAXYraw": //工迅-广州高支模平台
consumer = new(consumerAXYraw) consumer = new(consumerAXYraw)
case "consumerJSNCGLQL": //工迅-广州高支模平台
consumer = new(consumerJSNCGLQL)
default: default:
consumer = nil consumer = nil
} }

6
testUnit/江苏质感测试_test.go → testUnit/江苏智感测试_test.go

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save