|
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.googlecode.aviator.AviatorEvaluator;
|
|
|
import com.googlecode.aviator.Expression;
|
|
|
import com.persagy.cache.CurrentDataCache;
|
|
|
+import com.persagy.constant.CommonConst;
|
|
|
import com.persagy.entity.ReturnAlarmDefine;
|
|
|
import com.persagy.init.InitReturnAlarmConfig;
|
|
|
|
|
@@ -63,7 +64,7 @@ public class ReturnDifferentAlarm {
|
|
|
if (isAlarm != null && isAlarm != -1) {
|
|
|
ReturnAlarmDefine alarmDefine = InitReturnAlarmConfig.alarmCode2Alarm.get(alarmCode);
|
|
|
// 0-正常,1-报警
|
|
|
- BigDecimal dataValue = isAlarm == 1 ? new BigDecimal("1") : new BigDecimal("0");
|
|
|
+ BigDecimal dataValue = new BigDecimal(isAlarm);
|
|
|
String command = StrUtil.format(COMMAND, alarmDefine.getBuilding(), now, alarmDefine.getAlarmInfo().getMeter(), alarmDefine.getAlarmInfo().getFuncid(), dataValue.toPlainString());
|
|
|
sb.append(command).append("&");
|
|
|
}
|
|
@@ -98,6 +99,7 @@ public class ReturnDifferentAlarm {
|
|
|
// 解析此条iot数据详情
|
|
|
JSONObject messageObj = JSONObject.parseObject(message);
|
|
|
String data = messageObj.getString("data");
|
|
|
+ String type = messageObj.getString("type");
|
|
|
String[] split = data.split(";");
|
|
|
String dataTime = split[0];
|
|
|
String meter = split[1];
|
|
@@ -107,7 +109,7 @@ public class ReturnDifferentAlarm {
|
|
|
// 根据表号和功能号判断是否需要进行控返不一致的报警验证
|
|
|
ReturnAlarmDefine returnAlarmDefine = null;
|
|
|
String code = InitReturnAlarmConfig.meterFunid2Code.get(CurrentDataCache.getKey(meter, funcid));
|
|
|
- if (infoCodes.contains(code)) {
|
|
|
+ if (infoCodes.contains(code) && CommonConst.IOT_PONINTSET_TYPE.equals(type)) {
|
|
|
returnAlarmDefine = InitReturnAlarmConfig.infoCode2Alarm.get(code);
|
|
|
// 防止频繁的控制,导致无法进入2分钟后的逻辑判断,这里如果值相同的话,取上一次的上报时间使用
|
|
|
BigDecimal oldValue = returnAlarmDefine.getSetInfo().getDataValue();
|
|
@@ -115,7 +117,7 @@ public class ReturnDifferentAlarm {
|
|
|
returnAlarmDefine.getSetInfo().setDataTime(dataTime);
|
|
|
returnAlarmDefine.getSetInfo().setDataValue(dataValue);
|
|
|
}
|
|
|
- } else if (returnCodes.contains(code)) {
|
|
|
+ } else if (returnCodes.contains(code) && CommonConst.IOT_IOT_TYPE.equals(type)) {
|
|
|
returnAlarmDefine = InitReturnAlarmConfig.returnCode2Alarm.get(code);
|
|
|
returnAlarmDefine.getReturnInfo().setDataTime(dataTime);
|
|
|
returnAlarmDefine.getReturnInfo().setDataValue(dataValue);
|
|
@@ -125,6 +127,8 @@ public class ReturnDifferentAlarm {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ log.info("需要进行控返不一致判断的iot数据:{}", message);
|
|
|
+
|
|
|
// 正常数据下,判断此条数据,是否会影响控返不一致的报警信息点
|
|
|
this.returnAlarmHandler(returnAlarmDefine);
|
|
|
} catch (Exception e) {
|
|
@@ -173,10 +177,13 @@ public class ReturnDifferentAlarm {
|
|
|
|
|
|
// 判断实际是否应该产生报警
|
|
|
String infoCode = returnAlarmDefine.getSetInfo().getInfoCode();
|
|
|
+ BigDecimal infoValue = returnAlarmDefine.getSetInfo().getDataValue() == null ? null : returnAlarmDefine.getSetInfo().getDataValue();
|
|
|
String returnCode = returnAlarmDefine.getReturnInfo().getInfoCode();
|
|
|
+ BigDecimal returnValue = returnAlarmDefine.getReturnInfo().getDataValue() == null ? null : returnAlarmDefine.getReturnInfo().getDataValue();
|
|
|
+
|
|
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
- paramMap.put(infoCode, returnAlarmDefine.getSetInfo().getDataValue());
|
|
|
- paramMap.put(returnCode, returnAlarmDefine.getReturnInfo().getDataValue());
|
|
|
+ paramMap.put(infoCode, infoValue);
|
|
|
+ paramMap.put(returnCode, returnValue);
|
|
|
Boolean triggerResult = (Boolean) triggerExp.execute(paramMap);
|
|
|
|
|
|
// 旧的指令和新的iot数据
|