|
@@ -182,11 +182,23 @@ public class OpcDaTask extends TimerTask {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -219,11 +231,39 @@ public class OpcDaTask extends TimerTask {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -279,13 +319,47 @@ public class OpcDaTask extends TimerTask {
|
|
|
if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
}
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
}
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
@@ -359,6 +433,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
List<String> dataValueList = new ArrayList<>();
|
|
|
Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
@@ -403,6 +495,9 @@ public class OpcDaTask extends TimerTask {
|
|
|
//存已经存入redis中的数据
|
|
|
for (com.example.opc_common.entity.Item item : itemList) {
|
|
|
String itemId = item.getItemReadName();
|
|
|
+ Integer eventMode = item.getEventMode();
|
|
|
+ Integer eventValue = item.getEventValue();
|
|
|
+ Integer tableReportId = item.getTableReportId();
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
|
List<String> dataValueTimeList = new ArrayList<>();
|
|
@@ -443,6 +538,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
List<String> dataValueList = new ArrayList<>();
|
|
|
Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
@@ -532,11 +645,23 @@ public class OpcDaTask extends TimerTask {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -575,11 +700,39 @@ public class OpcDaTask extends TimerTask {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -657,13 +810,47 @@ public class OpcDaTask extends TimerTask {
|
|
|
if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
}
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
} else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
}
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
}
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
@@ -736,6 +923,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
List<String> dataValueList = new ArrayList<>();
|
|
|
Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
@@ -782,6 +987,9 @@ public class OpcDaTask extends TimerTask {
|
|
|
//存已经存入redis中的数据
|
|
|
for (com.example.opc_common.entity.Item item : itemList) {
|
|
|
String itemId = item.getItemReadName();
|
|
|
+ Integer eventMode = item.getEventMode();
|
|
|
+ Integer eventValue = item.getEventValue();
|
|
|
+ Integer tableReportId = item.getTableReportId();
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
|
List<String> dataValueTimeList = new ArrayList<>();
|
|
@@ -822,6 +1030,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
List<String> dataValueList = new ArrayList<>();
|
|
|
Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
@@ -894,18 +1120,6 @@ public class OpcDaTask extends TimerTask {
|
|
|
try {
|
|
|
BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
BigDecimal dmData = Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal;
|
|
|
- if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
- BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
- if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
- }
|
|
|
- } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
if (Blank.isEmpty(storageYmdh)) {
|
|
|
if (dmData.compareTo(bigModeValue) == 1) {
|
|
|
redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
@@ -918,11 +1132,35 @@ public class OpcDaTask extends TimerTask {
|
|
|
dataValueTimeList.add(currentYmdhmss);
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
if (DateUtil.strChangeDate(storageYmdh, timeFormat).getTime() == DateUtil.strChangeDate(currentYmdh, timeFormat).getTime()) {
|
|
|
if (dmData.compareTo(bigModeValue) == 1) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
List<BigDecimal> dataValueList = new ArrayList<>();
|
|
|
+ Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
if (Blank.isNotEmpty(dataValueObject)) {
|
|
|
dataValueList = JavaTypeUtil.objChangeListBig(dataValueObject);
|
|
|
}
|
|
@@ -937,6 +1175,47 @@ public class OpcDaTask extends TimerTask {
|
|
|
dataValueTimeList.add(currentYmdhmss);
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
@@ -961,6 +1240,53 @@ public class OpcDaTask extends TimerTask {
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
dataValueList = new ArrayList<>();
|
|
|
dataValueTimeList = new ArrayList<>();
|
|
|
if (dmData.compareTo(bigModeValue) == 1) {
|
|
@@ -1003,6 +1329,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
}
|
|
@@ -1036,6 +1380,9 @@ public class OpcDaTask extends TimerTask {
|
|
|
//存已经存入redis中的数据
|
|
|
for (com.example.opc_common.entity.Item item : itemList) {
|
|
|
String itemId = item.getItemReadName();
|
|
|
+ Integer eventMode = item.getEventMode();
|
|
|
+ Integer eventValue = item.getEventValue();
|
|
|
+ Integer tableReportId = item.getTableReportId();
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
|
List<String> dataValueTimeList = new ArrayList<>();
|
|
@@ -1061,6 +1408,24 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED) ||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
}
|
|
@@ -1120,18 +1485,6 @@ public class OpcDaTask extends TimerTask {
|
|
|
try {
|
|
|
BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
BigDecimal dmData = Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal;
|
|
|
- if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
- BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
- if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
- }
|
|
|
- } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- opcAsyncTask.eventTable(tableReportId, dmData, currentYmdhmss);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
if (Blank.isEmpty(storageYmdh)) {
|
|
|
if (dmData.compareTo(bigModeValue) == -1) {
|
|
|
redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
@@ -1144,6 +1497,30 @@ public class OpcDaTask extends TimerTask {
|
|
|
dataValueTimeList.add(currentYmdhmss);
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
if (DateUtil.strChangeDate(storageYmdh, timeFormat).getTime() == DateUtil.strChangeDate(currentYmdh, timeFormat).getTime()) {
|
|
|
if (dmData.compareTo(bigModeValue) == -1) {
|
|
@@ -1163,6 +1540,47 @@ public class OpcDaTask extends TimerTask {
|
|
|
dataValueTimeList.add(currentYmdhmss);
|
|
|
redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
@@ -1187,6 +1605,53 @@ public class OpcDaTask extends TimerTask {
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ eventDataValueList = new ArrayList<>();
|
|
|
+ eventDataValueTimeList = new ArrayList<>();
|
|
|
+ if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
+ eventDataValueList.add(dmData);
|
|
|
+ eventDataValueTimeList.add(currentYmdhmss);
|
|
|
+ }
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
+ redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
dataValueList = new ArrayList<>();
|
|
|
dataValueTimeList = new ArrayList<>();
|
|
|
if (dmData.compareTo(bigModeValue) == -1) {
|
|
@@ -1229,6 +1694,25 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
}
|
|
@@ -1262,6 +1746,9 @@ public class OpcDaTask extends TimerTask {
|
|
|
//存已经存入redis中的数据
|
|
|
for (com.example.opc_common.entity.Item item : itemList) {
|
|
|
String itemId = item.getItemReadName();
|
|
|
+ Integer eventMode = item.getEventMode();
|
|
|
+ Integer eventValue = item.getEventValue();
|
|
|
+ Integer tableReportId = item.getTableReportId();
|
|
|
String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
|
|
|
List<String> dataValueTimeList = new ArrayList<>();
|
|
@@ -1287,6 +1774,25 @@ public class OpcDaTask extends TimerTask {
|
|
|
String.valueOf(valueBelongTime),
|
|
|
new Date());
|
|
|
opcAsyncTask.addRawData(id, rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ BigDecimal bigEventValue = new BigDecimal(eventValue);
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_EXCEED)||
|
|
|
+ eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
+ List<BigDecimal> eventDataValueList = new ArrayList<>();
|
|
|
+ Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueObject)) {
|
|
|
+ eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
+ Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
+ if (Blank.isNotEmpty(eventDataValueTimeObject)) {
|
|
|
+ eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
+ }
|
|
|
+ opcAsyncTask.addEventTable(tableReportId, eventDataValueList, eventDataValueTimeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
}
|