|
@@ -1,9 +1,11 @@
|
|
|
package com.example.opc_da.task;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.example.opc_common.entity.*;
|
|
|
-import com.example.opc_common.util.*;
|
|
|
+import com.example.opc_common.util.Blank;
|
|
|
+import com.example.opc_common.util.ConstantStr;
|
|
|
+import com.example.opc_common.util.DateUtil;
|
|
|
+import com.example.opc_common.util.MathUtil;
|
|
|
import com.example.opc_da.dao.ItemGroupDao;
|
|
|
import com.example.opc_da.dao.MessageNoticeDao;
|
|
|
import com.example.opc_da.util.OpcDaUtil;
|
|
@@ -74,836 +76,102 @@ public class OpcDaFrequencyTask extends TimerTask {
|
|
|
Double eventValue = item.getEventValue();
|
|
|
Integer tableReportId = item.getTableReportId();
|
|
|
access.addItem(itemId, new DataCallback() {
|
|
|
-// private long timeLong = 0;
|
|
|
+
|
|
|
+ private String sqlCurrentYmdh = "";
|
|
|
|
|
|
@Override
|
|
|
- public void changed(Item item, ItemState itemState) {
|
|
|
+ public void changed(Item item1, ItemState itemState) {
|
|
|
try {
|
|
|
Map<String, Object> val = OpcDaUtil.getVal(itemState.getValue());
|
|
|
DataModel dm = map.get(itemId);
|
|
|
//读取的值
|
|
|
String javaType = String.valueOf(val.get("javaType"));
|
|
|
- redisUtil.set(ConstantStr.JAVA_TYPE + id + itemId, javaType, ConstantStr.TWO_HOUR);
|
|
|
Object value = val.get("value");
|
|
|
//值对应取值的时间
|
|
|
Date time = itemState.getTimestamp().getTime();
|
|
|
-// long time1 = time.getTime();
|
|
|
-// if (timeLong == time1) {
|
|
|
-// redisUtil.set(ConstantStr.ITEM_GROUP + id, false, ConstantStr.TWO_HOUR);
|
|
|
-// }
|
|
|
-// timeLong = time1;
|
|
|
- //归属时间
|
|
|
- String storageYmdh = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
String currentYmdh = DateUtil.dateChangeStr(time, timeFormat);
|
|
|
+ if (Blank.isEmpty(sqlCurrentYmdh)) {
|
|
|
+ sqlCurrentYmdh = currentYmdh;
|
|
|
+ redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
+ } else {
|
|
|
+ if (!sqlCurrentYmdh.equals(currentYmdh)) {
|
|
|
+ //组装相应的数据
|
|
|
+ opcAsyncTask.packageRawData(item, dataSourceId, sqlCurrentYmdh);
|
|
|
+ redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //服务器读取的时间
|
|
|
String currentYmdhmss = DateUtil.dateChangeStrYmdhmss(time);
|
|
|
//如果redis中存储的年月日时的时间为空,说明还未进行数据的保存
|
|
|
if (javaType.toLowerCase().equals("boolean")) {
|
|
|
- if (Blank.isEmpty(storageYmdh)) {
|
|
|
- //将当前时间(归属时间)的年月日时存入redis
|
|
|
- redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- //将此时读取的数据,用集合的方式存入到redis中
|
|
|
- List<Boolean> dataValueList = new ArrayList<>();
|
|
|
- Boolean dmData = JSON.parseObject(value.toString(), Boolean.class);
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- //将此时server中读取的时间,存入到redis中
|
|
|
- List<String> dataValueTimeList = new ArrayList<>();
|
|
|
- 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)) {
|
|
|
- if (eventMode.equals(ConstantStr.EVENT_MODEL_BOOLEAN)) {
|
|
|
- if ((dmData ? ConstantStr.BOOLEAN_TRUE : ConstantStr.BOOLEAN_FALSE).equals(eventValue.intValue())) {
|
|
|
- eventFlage = true;
|
|
|
- List<Boolean> 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 (eventFlage) {
|
|
|
- List<Boolean> 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);
|
|
|
+ //存数据
|
|
|
+ Boolean dmData = JSON.parseObject(value.toString(), Boolean.class);
|
|
|
+ RawData rawData = new RawData(id, dataSourceId, itemId, javaType, JSON.toJSONString(dmData),
|
|
|
+ currentYmdhmss, currentYmdh, new Date());
|
|
|
+ opcAsyncTask.addTempRawData(rawData);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId)) {
|
|
|
+ if (eventMode.equals(ConstantStr.EVENT_MODEL_BOOLEAN)) {
|
|
|
+ if ((dmData ? ConstantStr.BOOLEAN_TRUE : ConstantStr.BOOLEAN_FALSE).equals(eventValue.intValue())) {
|
|
|
+ eventFlage = true;
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
+ } else {
|
|
|
+ eventFlage = false;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- //如果redis中存入的归属时间不为空,进行判断,如果现在获取的时间==redis中存入的归属时间,则认定此时的数据,为同一小时的数据,将原来的数据取出,并添加
|
|
|
- if (DateUtil.strChangeDate(storageYmdh, timeFormat).getTime() == DateUtil.strChangeDate(currentYmdh, timeFormat).getTime()) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> dataValueList = JavaTypeUtil.objChangeListBool(dataValueObject);
|
|
|
- Boolean dmData = JSON.parseObject(value.toString(), Boolean.class);
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
- 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)) {
|
|
|
- if (eventMode.equals(ConstantStr.EVENT_MODEL_BOOLEAN)) {
|
|
|
- if ((dmData ? ConstantStr.BOOLEAN_TRUE : ConstantStr.BOOLEAN_FALSE).equals(eventValue.intValue())) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (eventFlage) {
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //如果当时获取的时间!=redis中存入的归属时间,则将redis中存入的归属时间和数据存入到数据库,redis中存入新的一个小时的数据
|
|
|
- String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
-
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> dataValueList = JavaTypeUtil.objChangeListBool(dataValueObject);
|
|
|
-
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- dataValueList = new ArrayList<>();
|
|
|
- Boolean dmData = JSON.parseObject(value.toString(), Boolean.class);
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- dataValueTimeList = new ArrayList<>();
|
|
|
- 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)) {
|
|
|
- if (eventMode.equals(ConstantStr.EVENT_MODEL_BOOLEAN)) {
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
-
|
|
|
- if ((dmData ? ConstantStr.BOOLEAN_TRUE : ConstantStr.BOOLEAN_FALSE).equals(eventValue.intValue())) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (eventFlage) {
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (eventFlage) {
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (Blank.isEmpty(storageYmdh)) {
|
|
|
- //将当前时间(归属时间)的年月日时存入redis
|
|
|
- redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- //将此时读取的数据,用集合的方式存入到redis中
|
|
|
- try {
|
|
|
- List<BigDecimal> dataValueList = new ArrayList<>();
|
|
|
- BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
- BigDecimal dmData = Blank.isNotEmpty(dm) ?
|
|
|
- MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
|
|
|
- bigDecimal;
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, 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) {
|
|
|
- eventFlage = true;
|
|
|
- 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) {
|
|
|
- eventFlage = true;
|
|
|
- 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);
|
|
|
+ try {
|
|
|
+ BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
+ BigDecimal dmData = Blank.isNotEmpty(dm) ?
|
|
|
+ MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
|
|
|
+ bigDecimal;
|
|
|
+ RawData rawData = new RawData(id, dataSourceId, itemId, javaType, JSON.toJSONString(dmData),
|
|
|
+ currentYmdhmss, currentYmdh, new Date());
|
|
|
+ opcAsyncTask.addTempRawData(rawData);
|
|
|
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (eventFlage) {
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> dataValueList = new ArrayList<>();
|
|
|
- dataValueList.add(value.toString());
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- if (Blank.isEmpty(eventMode, eventValue, tableReportId)) {
|
|
|
- if (eventFlage) {
|
|
|
- List<String> eventDataValueList = new ArrayList<>();
|
|
|
- List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
- eventDataValueList.add(value.toString());
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //将此时server中读取的时间,存入到redis中
|
|
|
- List<String> dataValueTimeList = new ArrayList<>();
|
|
|
- dataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- //如果redis中存入的归属时间不为空,进行判断,如果现在获取的时间==redis中存入的归属时间,则认定此时的数据,为同一小时的数据,将原来的数据取出,并添加
|
|
|
- if (DateUtil.strChangeDate(storageYmdh, timeFormat).getTime() == DateUtil.strChangeDate(currentYmdh, timeFormat).getTime()) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- try {
|
|
|
- List<BigDecimal> dataValueList = JavaTypeUtil.objChangeListBig(dataValueObject);
|
|
|
- BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
- BigDecimal dmData = Blank.isNotEmpty(dm) ?
|
|
|
- MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
|
|
|
- bigDecimal;
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, 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) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (eventFlage) {
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, 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) {
|
|
|
+ eventFlage = true;
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
+ } else {
|
|
|
+ eventFlage = false;
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> dataValueList = JavaTypeUtil.objChangeListStr(dataValueObject);
|
|
|
- dataValueList.add(value.toString());
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- if (Blank.isEmpty(eventMode, eventValue, tableReportId)) {
|
|
|
- if (eventFlage) {
|
|
|
- List<String> eventDataValueList = new ArrayList<>();
|
|
|
- List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
- eventDataValueList.add(value.toString());
|
|
|
- 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) {
|
|
|
+ eventFlage = true;
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
+ } else {
|
|
|
+ eventFlage = false;
|
|
|
}
|
|
|
}
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
- dataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
} else {
|
|
|
- //如果当时获取的时间!=redis中存入的归属时间,则将redis中存入的归属时间和数据存入到数据库,redis中存入新的一个小时的数据
|
|
|
- String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
-
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
-
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- try {
|
|
|
- List<BigDecimal> dataValueList = JavaTypeUtil.objChangeListBig(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- dataValueList = new ArrayList<>();
|
|
|
- BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
|
|
|
- BigDecimal dmData = Blank.isNotEmpty(dm) ?
|
|
|
- MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
|
|
|
- bigDecimal;
|
|
|
- dataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, 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)) {
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
-
|
|
|
- if (dmData.compareTo(bigEventValue) == 1) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- }
|
|
|
- } else if (eventMode.equals(ConstantStr.EVENT_MODEL_LOWER)) {
|
|
|
- //记录并生成报表
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName = item1.getItemName();
|
|
|
- String itemReadName = item1.getItemReadName();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemReadName);
|
|
|
- String itemJavaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemReadName));
|
|
|
- if (itemJavaType.toLowerCase().equals("boolean")) {
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- try {
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isEmpty(eventDataValueList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- eventDataValueList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemReadName, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isEmpty(eventDataValueTimeList)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
-
|
|
|
- eventDataValueTimeList = new ArrayList<>();
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemReadName, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
-
|
|
|
- if (dmData.compareTo(bigEventValue) == -1) {
|
|
|
- eventFlage = true;
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- } else {
|
|
|
- eventFlage = false;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (eventFlage) {
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- eventDataValueList.add(dmData);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE + id + itemId, eventDataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- eventDataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId, eventDataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- List<String> dataValueList = JavaTypeUtil.objChangeListStr(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- dataValueList = new ArrayList<>();
|
|
|
- dataValueList.add(value.toString());
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE + id + itemId, dataValueList, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- if (Blank.isEmpty(eventMode, eventValue, tableReportId)) {
|
|
|
- if (eventFlage) {
|
|
|
- List<String> eventDataValueList = new ArrayList<>();
|
|
|
- List<String> eventDataValueTimeList = new ArrayList<>();
|
|
|
- eventDataValueList.add(value.toString());
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (eventFlage) {
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
}
|
|
|
-
|
|
|
- redisUtil.set(ConstantStr.VALUE_BELONG_TIME + id + itemId, currentYmdh, ConstantStr.TWO_HOUR);
|
|
|
-
|
|
|
- dataValueTimeList = new ArrayList<>();
|
|
|
- dataValueTimeList.add(currentYmdhmss);
|
|
|
- redisUtil.set(ConstantStr.DATA_VALUE_TIME + id + itemId, dataValueTimeList, ConstantStr.TWO_HOUR);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("我进入了异常:" + e.getMessage());
|
|
|
- //存已经存入redis中的数据
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- Integer tableReportId1 = null;
|
|
|
- for (com.example.opc_common.entity.Item item1 : itemList) {
|
|
|
- String itemName1 = item1.getItemName();
|
|
|
- String itemId1 = item1.getItemReadName();
|
|
|
- Integer eventMode1 = item1.getEventMode();
|
|
|
- Double eventValue1 = item1.getEventValue();
|
|
|
- Integer tableReportId2 = item1.getTableReportId();
|
|
|
- if (Blank.isNotEmpty(eventMode1) && Blank.isNotEmpty(eventValue1) && Blank.isNotEmpty(tableReportId2)) {
|
|
|
- tableReportId1 = tableReportId2;
|
|
|
- }
|
|
|
- String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId1));
|
|
|
-
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId1);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
-
|
|
|
- String javaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemId1));
|
|
|
+ } catch (Exception e) {
|
|
|
+ RawData rawData = new RawData(id, dataSourceId, itemId, javaType, JSON.toJSONString(value.toString()),
|
|
|
+ currentYmdhmss, currentYmdh, new Date());
|
|
|
+ opcAsyncTask.addTempRawData(rawData);
|
|
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- if (javaType.toLowerCase().equals("boolean")) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId1);
|
|
|
- List<Boolean> dataValueList = JavaTypeUtil.objChangeListBool(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId1,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId1);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- try {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId1);
|
|
|
- List<BigDecimal> dataValueList = JavaTypeUtil.objChangeListBig(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId1,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId1);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- }
|
|
|
- } catch (Exception e1) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId1);
|
|
|
- List<String> dataValueList = JavaTypeUtil.objChangeListStr(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId1,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId1);
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
+ if (Blank.isEmpty(eventMode, eventValue, tableReportId)) {
|
|
|
+ if (eventFlage) {
|
|
|
+ opcAsyncTask.addEventRawData(id, rawData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- redisUtil.del(ConstantStr.ITEM_GROUP + id + itemId1);
|
|
|
- redisUtil.del(ConstantStr.DATA_VALUE + id + itemId1);
|
|
|
- redisUtil.del(ConstantStr.DATA_VALUE_TIME + id + itemId1);
|
|
|
- redisUtil.del(ConstantStr.VALUE_BELONG_TIME + id + itemId1);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId1);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueTimeList)) {
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(jsonObject)) {
|
|
|
- dataMap.put(itemName1, jsonObject);
|
|
|
- }
|
|
|
- redisUtil.del(ConstantStr.EVENT_DATA_VALUE + id + itemId1);
|
|
|
- redisUtil.del(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId1);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(tableReportId1) && Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId1, itemGroup.getId(), dataMap);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ //执行组装数据库的数据,以及生成驱动报表
|
|
|
+ opcAsyncTask.packageRawDataList(itemList, dataSourceId, sqlCurrentYmdh);
|
|
|
+ redisUtil.del(ConstantStr.VALUE_BELONG_TIME + id);
|
|
|
|
|
|
messageNoticeDao.addMessageNotice(new MessageNotice(itemGroup.getUserId(),
|
|
|
itemGroup.getGroupName() + DateUtil.dateChangeStrYmdhms(new Date()) + "运行失败",
|
|
@@ -925,104 +193,11 @@ public class OpcDaFrequencyTask extends TimerTask {
|
|
|
if (Blank.isEmpty(flage)) {
|
|
|
flage = false;
|
|
|
}
|
|
|
-// System.err.println("我从redis中取出的状态值为:" + flage);
|
|
|
if (!flage) {
|
|
|
- //存已经存入redis中的数据
|
|
|
- Map<String, JSONObject> dataMap = new HashMap<>();
|
|
|
- Integer tableReportId = null;
|
|
|
- for (com.example.opc_common.entity.Item item : itemList) {
|
|
|
- String itemName = item.getItemName();
|
|
|
- String itemId = item.getItemReadName();
|
|
|
- Integer eventMode = item.getEventMode();
|
|
|
- Double eventValue = item.getEventValue();
|
|
|
- Integer tableReportId1 = item.getTableReportId();
|
|
|
- if (Blank.isNotEmpty(eventMode) && Blank.isNotEmpty(eventValue) && Blank.isNotEmpty(tableReportId1)) {
|
|
|
- tableReportId = tableReportId1;
|
|
|
- }
|
|
|
- String valueBelongTime = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id + itemId));
|
|
|
-
|
|
|
- Object dataValueTimeObject = redisUtil.get(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> dataValueTimeList = JavaTypeUtil.objChangeListStr(dataValueTimeObject);
|
|
|
-
|
|
|
- String javaType = String.valueOf(redisUtil.get(ConstantStr.JAVA_TYPE + id + itemId));
|
|
|
-
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- if (javaType.toLowerCase().equals("boolean")) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> dataValueList = JavaTypeUtil.objChangeListBool(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<Boolean> eventDataValueList = JavaTypeUtil.objChangeListBool(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- try {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> dataValueList = JavaTypeUtil.objChangeListBig(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<BigDecimal> eventDataValueList = JavaTypeUtil.objChangeListBig(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- }
|
|
|
- } catch (Exception e1) {
|
|
|
- Object dataValueObject = redisUtil.get(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- List<String> dataValueList = JavaTypeUtil.objChangeListStr(dataValueObject);
|
|
|
- //存数据
|
|
|
- RawData rawData = new RawData(dataSourceId,
|
|
|
- itemId,
|
|
|
- javaType,
|
|
|
- JSON.toJSONString(dataValueList),
|
|
|
- String.valueOf(dataValueTimeList),
|
|
|
- String.valueOf(valueBelongTime),
|
|
|
- new Date());
|
|
|
- opcAsyncTask.addRawData(id, rawData);
|
|
|
-
|
|
|
- Object eventDataValueObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- List<String> eventDataValueList = JavaTypeUtil.objChangeListStr(eventDataValueObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueList)) {
|
|
|
- jsonObject.put("dataList", eventDataValueList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- redisUtil.del(ConstantStr.ITEM_GROUP + id + itemId);
|
|
|
- redisUtil.del(ConstantStr.DATA_VALUE + id + itemId);
|
|
|
- redisUtil.del(ConstantStr.DATA_VALUE_TIME + id + itemId);
|
|
|
- redisUtil.del(ConstantStr.VALUE_BELONG_TIME + id + itemId);
|
|
|
-
|
|
|
- Object eventDataValueTimeObject = redisUtil.get(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- List<String> eventDataValueTimeList = JavaTypeUtil.objChangeListStr(eventDataValueTimeObject);
|
|
|
- if (Blank.isNotEmpty(eventDataValueTimeList)) {
|
|
|
- jsonObject.put("dataTimeList", eventDataValueTimeList);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(jsonObject)) {
|
|
|
- dataMap.put(itemName, jsonObject);
|
|
|
- }
|
|
|
- redisUtil.del(ConstantStr.EVENT_DATA_VALUE + id + itemId);
|
|
|
- redisUtil.del(ConstantStr.EVENT_DATA_VALUE_TIME + id + itemId);
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(tableReportId) && Blank.isNotEmpty(dataMap)) {
|
|
|
- opcAsyncTask.addEventTable1(tableReportId, itemGroup.getId(), dataMap);
|
|
|
- }
|
|
|
+ //执行组装数据库的数据,以及生成驱动报表
|
|
|
+ String sqlCurrentYmdh = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id));
|
|
|
+ opcAsyncTask.packageRawDataList(itemList, dataSourceId, sqlCurrentYmdh);
|
|
|
+ redisUtil.del(ConstantStr.VALUE_BELONG_TIME + id);
|
|
|
|
|
|
messageNoticeDao.addMessageNotice(new MessageNotice(itemGroup.getUserId(),
|
|
|
itemGroup.getGroupName() + DateUtil.dateChangeStrYmdhms(new Date()) + "运行停止",
|