From 01e4e20284c16ee6921882168f82453ef2de4c48 Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Tue, 16 Apr 2024 08:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=A9=E6=8C=AF=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E6=B7=BB=E5=8A=A0=E7=94=B5=E9=87=8F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9B=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=B8=A9=E6=8C=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modbus/IPCDataUploadSyncThread.java | 33 ++++++++++--------- .../impl/IpcDataReceiveServiceImpl.java | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataUploadSyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataUploadSyncThread.java index ef3fa64..d0e4c81 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataUploadSyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataUploadSyncThread.java @@ -60,6 +60,7 @@ public class IPCDataUploadSyncThread implements Runnable { // fields.put("vx",vx[new Random().nextInt(8)]); // fields.put("vy",vy[new Random().nextInt(8)]); // fields.put("vz",vz[new Random().nextInt(8)]); +// fields.put("bat", "90"); // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); // String format = simpleDateFormat.format(new Date()); // fields.put("insertTime", format); @@ -86,22 +87,22 @@ public class IPCDataUploadSyncThread implements Runnable { } } // 查询最新传感器数据 - QueryResult sensorQuery = influxDBService.query("select * from " + IpcConstant.SENSOR_MEASUREMENT + " where part = '" + partValue + "' order by time desc limit 1"); - List> sensorMaps = influxDBService.queryResultProcess(sensorQuery); - if (sensorMaps != null && !sensorMaps.isEmpty()) { - Map sensorMap = sensorMaps.get(0); - if (sensorMap.get("insertTime") != null) { - String insertTime = String.valueOf(sensorMap.get("insertTime")); - for (IpcMonitorField ipcMonitorField : sensorList) { - Map map = new HashMap<>(); - map.put("sid", partLabel + "-" + ipcMonitorField.getFieldLabel()); - map.put("v", sensorMap.get(ipcMonitorField.getFieldValue()) == null ? "0" : String.valueOf(sensorMap.get(ipcMonitorField.getFieldValue()))); - map.put("s", getSeconds(insertTime)); - map.put("ms", getMillis(insertTime)); - dataList.add(map); - } - } - } +// QueryResult sensorQuery = influxDBService.query("select * from " + IpcConstant.SENSOR_MEASUREMENT + " where part = '" + partValue + "' order by time desc limit 1"); +// List> sensorMaps = influxDBService.queryResultProcess(sensorQuery); +// if (sensorMaps != null && !sensorMaps.isEmpty()) { +// Map sensorMap = sensorMaps.get(0); +// if (sensorMap.get("insertTime") != null) { +// String insertTime = String.valueOf(sensorMap.get("insertTime")); +// for (IpcMonitorField ipcMonitorField : sensorList) { +// Map map = new HashMap<>(); +// map.put("sid", partLabel + "-" + ipcMonitorField.getFieldLabel()); +// map.put("v", sensorMap.get(ipcMonitorField.getFieldValue()) == null ? "0" : String.valueOf(sensorMap.get(ipcMonitorField.getFieldValue()))); +// map.put("s", getSeconds(insertTime)); +// map.put("ms", getMillis(insertTime)); +// dataList.add(map); +// } +// } +// } } msgMap.put("d", dataList); // 进行数据推送 diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java index 5b541c0..101883d 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataReceiveServiceImpl.java @@ -69,7 +69,7 @@ public class IpcDataReceiveServiceImpl implements IIpcDataReceiveService { fields.put("vx", ipcBg4gszhp01tempdataX.getWData()); fields.put("vy", ipcBg4gszhp01tempdataY.getWData()); fields.put("vz", ipcBg4gszhp01tempdataZ.getWData()); - + fields.put("bat", ipcBg4gszhp01tempdataZ.getBat()); // 获取当前时间 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); String format = simpleDateFormat.format(new Date());