Explorar o código

事件驱动生成的报表,数据更新待考虑

zhoupeng %!s(int64=2) %!d(string=hai) anos
pai
achega
ee8268d758

+ 9 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcAsyncTask.java

@@ -1,5 +1,6 @@
 package com.example.opc_da.task;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.example.opc_common.entity.DataSource;
 import com.example.opc_common.entity.RawData;
@@ -155,5 +156,13 @@ public class OpcAsyncTask {
      */
     public void eventTable(Integer tableReportId, BigDecimal value,String currentDate) {
         ReportTable reportTable = reportTableDao.getReportTableById(tableReportId);
+        String reportTableData = reportTable.getReportTableData();
+        JSONObject jsonObject = JSONObject.parseObject(reportTableData);
+        JSONArray objects = jsonObject.getJSONArray("tables");
+        if (Blank.isNotEmpty(objects)){
+            JSONObject jsonObject1 = objects.getJSONObject(0);
+            //将新数据加到与那里的data里面,并更新
+            reportTableDao.updateReportTable(reportTable);
+        }
     }
 }