|
@@ -127,7 +127,7 @@ public class OpcAsyncTask {
|
|
|
|
|
|
public void packageRawDataList(List<Item> itemList, Integer dataSourceId, String sqlCurrentYmdh) {
|
|
|
try {
|
|
|
- Thread.sleep(50000);
|
|
|
+ Thread.sleep(10000);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -182,8 +182,8 @@ public class OpcAsyncTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void addEventRawData( RawData rawData) {
|
|
|
- if ( Blank.isNotEmpty(rawData)) {
|
|
|
+ public void addEventRawData(RawData rawData) {
|
|
|
+ if (Blank.isNotEmpty(rawData)) {
|
|
|
rawDataDao.addEventRawData(rawData);
|
|
|
}
|
|
|
}
|
|
@@ -251,7 +251,24 @@ public class OpcAsyncTask {
|
|
|
/**
|
|
|
* 事件驱动报表异步添加数据
|
|
|
*/
|
|
|
- public void eventTable(Integer dataSourceId, Integer tableReportId, List<Item> itemList, String sqlCurrentYmdh) {
|
|
|
+ public void eventTable(Integer dataSourceId, List<Item> itemList, String sqlCurrentYmdh) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(10000);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ Integer tableReportId = null;
|
|
|
+ if (Blank.isNotEmpty(itemList)) {
|
|
|
+ for (Item item : itemList) {
|
|
|
+ if (Blank.isNotEmpty(item.getEventMode()) && Blank.isNotEmpty(item.getEventValue()) && Blank.isNotEmpty(item.getTableReportId())) {
|
|
|
+ tableReportId = item.getTableReportId();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.isEmpty(tableReportId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
ReportTable reportTable = reportTableDao.getReportTableById(tableReportId);
|
|
|
String reportTableData = reportTable.getReportTableData();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(reportTableData);
|
|
@@ -278,11 +295,8 @@ public class OpcAsyncTask {
|
|
|
JSONObject jsonObject1 = objects.getJSONObject(0);
|
|
|
JSONArray objects1 = jsonObject1.getJSONArray("item");
|
|
|
if (Blank.isNotEmpty(itemList)) {
|
|
|
- Item item = itemList.get(0);
|
|
|
- Integer itemGroupId = item.getItemGroupId();
|
|
|
- Integer remainder = itemGroupId % ConstantStr.SUB_TABLE_NUM;
|
|
|
for (int i = 0; i < itemList.size(); i++) {
|
|
|
- List<RawData> rawDataList = rawDataDao.getEventRawDataList(itemList.get(i), remainder, dataSourceId, sqlCurrentYmdh);
|
|
|
+ List<RawData> rawDataList = rawDataDao.getEventRawDataList(itemList.get(i), dataSourceId, sqlCurrentYmdh);
|
|
|
if (Blank.isNotEmpty(rawDataList)) {
|
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
|
RawData rawData = rawDataList.get(0);
|
|
@@ -311,6 +325,7 @@ public class OpcAsyncTask {
|
|
|
jsonObject2.put("dataTimeList", JSON.parseObject(rawData.getDataValueTime(), String[].class));
|
|
|
objects1.set(i, jsonObject2);
|
|
|
}
|
|
|
+ rawDataDao.delEventRawDataList(itemList.get(i), dataSourceId, sqlCurrentYmdh);
|
|
|
}
|
|
|
}
|
|
|
objects.set(0, jsonObject1);
|