|
|
@@ -1,6 +1,7 @@
|
|
|
package com.gbd.demp.data.exchange.task;
|
|
|
|
|
|
|
|
|
+import cc.mrbird.febs.common.core.utils.SortUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gbd.demp.data.exchange.entity.*;
|
|
|
@@ -312,13 +313,12 @@ public class LiveDataTask {
|
|
|
* @param liveData
|
|
|
* @return
|
|
|
*/
|
|
|
- public Future<String> liveTask(String liveData) {
|
|
|
+ public Future<String> liveTask(Map<String, Object> liveData) {
|
|
|
try {
|
|
|
String token = "8a81e3166b379ce3016b37bab1bc000d";
|
|
|
- JSONObject jo = JSON.parseObject(liveData);
|
|
|
- String reportTime = jo.getString("dataTime");//获取上报时间
|
|
|
- JSONObject jsonData = JSON.parseObject(jo.getString("data"));//获取设备信息
|
|
|
- String deviceId = String.valueOf(jsonData.get("deviceId"));//获取设备编号
|
|
|
+ String reportTime = (String) liveData.get("dataTime");//获取上报时间
|
|
|
+ Map<String, String> deviceData = (Map<String, String>) liveData.get("data");//获取设备信息
|
|
|
+ String deviceId = deviceData.get("deviceId");//获取设备编号
|
|
|
DeviceInfo deviceInfo = deviceInfoService.getDeviceInfoById(deviceId);
|
|
|
if (deviceInfo != null) {
|
|
|
String startTime = deviceInfo.getWorkTimeFrom();
|
|
|
@@ -333,7 +333,7 @@ public class LiveDataTask {
|
|
|
// for (int i = 0; i < count; i++) {//循环插入数据库
|
|
|
// String seq = "m" + (i + 1);//传感器编号
|
|
|
String seq = "m1";//传感器编号
|
|
|
- double val = Double.valueOf(jsonData.get(seq) + "");
|
|
|
+ double val = Double.valueOf(deviceData.get(seq) + "");
|
|
|
LiveData data = new LiveData();
|
|
|
data.setDeviceId(deviceId);
|
|
|
data.setReportTime(reportTime);
|