数据 输入输出 处理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
19 KiB

package testUnit
import (
"goInOut/adaptors"
"log"
"testing"
)
func Test_江苏智感_应变(t *testing.T) {
Msg := `
{
"dtuInfo": {
"id": 0,
"code": "COM3"
},
"sensorData": {
"id": 25,
"name": "m1c1",
"module": "1",
"channel": "1",
"factorType": 23,
"productCode": "MD-BM15",
"structId": 0,
"data": {
"RawValues": [
880.05609130859375,
17.250148773193359,
426.63839721679687
],
"ThemeValues": [
1.254
]
},
"time": "2022-01-06T14:30:00.000"
}
}
`
adp := adaptors.Adaptor_TYCJ_JSNCGLQL{
IdMap: map[string]string{
"m1c1": "JY-HSD-G05-001-01",
"m1c2": "LHTDQ-RSG-L04-001-03",
},
BridgeCode: "G2320281L0012",
}
matchTopic := "upload/uds"
bytes := adp.Transform(matchTopic, Msg)
log.Println(bytes)
}
func Test_江苏智感_加速度(t *testing.T) {
Msg := `
{"Sensorid":0,"Module":"m1c1","Channel":0,"Frequency":64,"ThemeValue":[1290.0560302734375],"RawValues":[],"AccValues":[1283.558,1284.225,1286.149,1287.802,1287.162,1286.052,1285.919,1285.773,1286.345,1285.923,1284.865,1285.24,1288.555,1288.9,1287.835,1288.205,1287.185,1287.119,1287.266,1286.979,1285.803,1286.851,1287.067,1287.282,1287.172,1286.887,1286.604,1287.944,1286.895,1287.764,1286.149,1285.606,1285.447,1286.035,1286.664,1287.94,1288.193,1288.365,1287.828,1287.639,1287.858,1287.992,1285.109,1285.098,1286.7,1283.96,1281.883,1283.221,1283.583,1283.806,1282.911,1282.179,1283.079,1282.504,1284.522,1286.981,1284.942,1285.352,1285.596,1288.592,1288.793,1287.406,1286.885,1287.607,1287.616,1286.512,1286.281,1286.677,1287.126,1286.622,1287.835,1287.268,1287.061,1286.665,1286.321,1287.955,1286.342,1286.35,1287.045,1286.6,1287.67,1286.765,1287.035,1287.429,1286.95,1287.701,1286.382,1285.629,1286.349,1286.22,1286.385,1287.926,1287.003,1287.861,1287.389,1288.281,1287.455,1285.3,1281.458,1282.176,1281.003,1283.045,1281.604,1282.898,1283.73,1283.065,1286.091,1287.463,1286.47,1287.904,1285.849,1286.24,1286.013,1286.467,1286.961,1287.042,1286.644,1287.27,1288.123,1287.752,1285.579,1285.215,1286.282,1286.038,1288.313,1286.403,1287.222,1287.147,1287.155,1287.766,1287.685,1287.22,1285.948,1285.644,1285.732,1286.822,1284.651,1287.573,1288.755,1287.204,1287.215,1286.546,1287.779,1287.461,1287.261,1287.112,1285.633,1286.964,1284.911,1282.031,1282.651,1282.792,1281.49,1283.697,1284.439,1282.987,1282.633,1285.909,1287.203,1287.085,1286.828,1286.973,1286.6,1286.978,1287.342,1287.173,1287.739,1287.287,1285.743,1286.837,1287.119,1287.099,1286.57,1286.836,1287.283,1287.848,1287.425,1287.75,1287.379,1287.477,1287.71,1286.578,1286.598,1285.528,1284.935,1287.748,1286.924,1285.9,1286.639,1287.234,1286.739,1287.12,1287.303,1286.17,1287.147,1286.728,1287.065,1287.525,1288.273,1286.184,1281.403,1282.91,1281.808,1282.329,1282.956,1282.863,1282.729,1282.614,1283.559,1287.289,1286.861,1287.313,1286.948,1286.503,1287.279,1285.792,1286.561,1287.33,1286.951,1286.991,1287.235,1287.722,1287.887,1286.974,1286.155,1284.995,1286.333,1286.915,1287.601,1287.448,1286.553,1286.767,1286.683,1287.65,1285.951,1286.473,1286.353,1285.941,1287.345,1286.674,1286.36,1287.314,1288.718,1287.83,1287.572,1287.111,1285.09,1285.877,1288.153,1287.014,1286.571,1281.341,1281.411,1283.615,1282.956,1283.173,1281.949,1283.055,1281.925,1284.661,1286.98,1286.799,1284.792,1286.272,1287.713,1287.54,1287.277,1287.003,1286.236,1286.127,1286.212,1286.821,1285.552,1286.892,1286.142,1286.603,1287.823,1288.396,1286.097,1287.426,1286.819,1286.106,1287.076,1287.694,1287.083,1285.96,1285.901,1286.317,1286.804,1288.028,1287.198,1286.265,1287.487,1286.414,1285.199,1286.589,1287.173,1287.463,1286.624,1287.407,1287.174,1287.54,1287.172,1283.417,1282.739,1282.229,1283.015,1282.275,1281.815,1282.354,1281.723,1284.979,1286.85,1287.041,1288.11,1286.83,1288.184,1285.855,1286.403,1286.685,1286.467,1287.283,1287.551,1287.436,1286.994,1286.233,1286.406,1288.472,1287.488,1286.166,1285.151,1287.579,1285.786,1287.102,1286.715,1286.666,1287.493,1286.989,1286.22,1287.545,1287.492,1286.591,1286.585,1287.814,1286.214,1286.1,1286.22,1287.941,1287.596,1286.543,1284.793,1285.451,1286.007,1289.132,1286.96,1279.971,1281.845,1282.387,1281.058,1285.151,1284.551,1281.236,1279.194,1288.642,1290.056,1286.935,1283.34,1286.059,1287.746,1287.682,1286.13,1286.172,1286.42,1286.798,1285.858,1284.875,1287.204,1290.049,1286.584,1286.496,1285.701,1286.298,1287.167,1287.503,1287.216,1286.467,1286.108,1286.719,1286.527,1287.631,1287.962,1287.21,1286.235,1286.989,1287.259,1288.137,1287.806,1287.502,1286.343,1286.299,1286.223,1287.184,1286.833,1287.693,1286.567,1285.928,1286.286,1288.519,1287.179,1287.033,1284.763,1282.308,1281.642,1283.903,1284.142,1283.739,1283.061,1283.307,1284.041,1287.126,1285.124,1287.493,1286.533,1286.712,1287.735,1286.521,1286.554,1287.046,1287.546,1287.954,1286.08,1286.406,1287.175,1286.907,1288.021,1286.836,1285.811,1287.812,1287.266,1287.916,1287.564,1286.408,1287.211,1286.643,1287.072,1286.808,1286.365,1286.2
`
adp := adaptors.Adaptor_ZD_JSNCGLQL{
IdMap: map[string]string{
"m1c1": "LHTDQ-JSD-C08-001-01",
"m1c2": "LHTDQ-JSD-L03-001-01",
},
BridgeCode: "G2320281L0012",
}
matchTopic := "upload/ZD"
bytes := adp.Transform(matchTopic, Msg)
log.Println(bytes)
}