///我有json输入,如下所示
[{
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "Humidity",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "RH",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "BatteryVoltage",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "V",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "Shock",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "G",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "Vibration",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "Hz",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "Humidity",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "%",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "Temperature",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "C",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}, {
"shipment_id": 2,
"schd_date": "2019-12-10 18:27:06.0",
"contract_start_date": "2019-11-25 00:00:00.0",
"contract_id": 1,
"company_id": 9,
"device_id": 6123,
"parameter_name": "ACCZ",
"sensor_upper_threshold": "12",
"sensor_lower_threshold": "10",
"parameter_unit": "g",
"route_id": 6642,
"source_stop_id": 10379,
"stop_seq_no": 1,
"route_efctv_from_dt": "2014-10-24 00:00:00.0",
"route_efctv_to_dt": "2019-12-31 00:00:00.0"
}]
//使用JOlt进行所需的转换如下:
{
"digifleet_id": "",
"shipment_number": "723984223",
"shipment_date": "2019 - 12 - 23",
"contract_number": "",
"customer_id": "",
"device": [{
"device_id": "738293827472834",
"sensors": [{
"type": "temperature",
"upper_threshold": 12,
"lower_threshold": 3,
"uom": "C"
}]
}],
"route": [{
"stop_seq_number": 1,
"stop_id": "",
"route_efctv_from_dt": null,
"route_efctv_to_dt": 201912231400
},
{
"stop_seq_number": 2,
"stop_id": "",
"route_efctv_from_dt": 201912311923,
"route_efctv_to_dt": null
}
]
}