|
@@ -281,6 +281,8 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
private List<Integer> tempList = new CopyOnWriteArrayList<>();
|
|
private List<Integer> tempList = new CopyOnWriteArrayList<>();
|
|
|
|
|
|
|
|
+ private static final int warnCount = 1;
|
|
|
|
+
|
|
|
|
|
|
//系统启动后
|
|
//系统启动后
|
|
@EventListener(ApplicationReadyEvent.class)
|
|
@EventListener(ApplicationReadyEvent.class)
|
|
@@ -464,7 +466,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
ironDataService.saveOrUpdate(mTIronData);
|
|
ironDataService.saveOrUpdate(mTIronData);
|
|
opcData.setIronDataId(mTIronData.getId());
|
|
opcData.setIronDataId(mTIronData.getId());
|
|
opcDataService.save(opcData);
|
|
opcDataService.save(opcData);
|
|
- lastIronLoading1.set(0);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private double mLastSpeed;
|
|
private double mLastSpeed;
|
|
@@ -608,12 +609,16 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
PushData.send2Exception(list);
|
|
PushData.send2Exception(list);
|
|
}
|
|
}
|
|
|
|
|
|
- private synchronized void saveException(ExceptionTypeEnum exceptionTypeEnum, String exceptionDesc) {
|
|
|
|
- TExceptionLogCreateValidate build = TExceptionLogCreateValidate.builder().exceptionType(exceptionTypeEnum.getCode()).exceptionDesc(exceptionDesc).build();
|
|
|
|
- if (ObjectUtils.isNotEmpty(mTIronData)) {
|
|
|
|
- build.setIronDataId(mTIronData.getId());
|
|
|
|
|
|
+ private void saveException(ExceptionTypeEnum exceptionTypeEnum, String exceptionDesc) {
|
|
|
|
+ try {
|
|
|
|
+ TExceptionLogCreateValidate build = TExceptionLogCreateValidate.builder().exceptionType(exceptionTypeEnum.getCode()).exceptionDesc(exceptionDesc).build();
|
|
|
|
+ if (ObjectUtils.isNotEmpty(mTIronData)) {
|
|
|
|
+ build.setIronDataId(mTIronData.getId());
|
|
|
|
+ }
|
|
|
|
+ exceptionLogService.add(build);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
- exceptionLogService.add(build);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1425,7 +1430,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
mWarnCountMap.put("tempMinWarn", count);
|
|
mWarnCountMap.put("tempMinWarn", count);
|
|
log.warn("检测到温度过低 - 当前: {}℃, 标准最低: {}℃, 连续异常次数: {}", tempNow, stdTempMin, count);
|
|
log.warn("检测到温度过低 - 当前: {}℃, 标准最低: {}℃, 连续异常次数: {}", tempNow, stdTempMin, count);
|
|
|
|
|
|
- if (count >= 3) {
|
|
|
|
|
|
+ if (count >= warnCount) {
|
|
log.error("温度过低预警触发 - 连续3次异常,当前温度: {}℃", tempNow);
|
|
log.error("温度过低预警触发 - 连续3次异常,当前温度: {}℃", tempNow);
|
|
taskExecutor.submit(() -> {
|
|
taskExecutor.submit(() -> {
|
|
try {
|
|
try {
|
|
@@ -1451,7 +1456,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
mWarnCountMap.put("tempMaxWarn", count);
|
|
mWarnCountMap.put("tempMaxWarn", count);
|
|
log.warn("检测到温度过高 - 当前: {}℃, 标准最高: {}℃, 连续异常次数: {}", tempNow, stdTempMax, count);
|
|
log.warn("检测到温度过高 - 当前: {}℃, 标准最高: {}℃, 连续异常次数: {}", tempNow, stdTempMax, count);
|
|
|
|
|
|
- if (count >= 3) {
|
|
|
|
|
|
+ if (count >= warnCount) {
|
|
log.error("温度过高预警触发 - 连续3次异常,当前温度: {}℃", tempNow);
|
|
log.error("温度过高预警触发 - 连续3次异常,当前温度: {}℃", tempNow);
|
|
taskExecutor.submit(() -> {
|
|
taskExecutor.submit(() -> {
|
|
try {
|
|
try {
|
|
@@ -1527,7 +1532,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
mWarnCountMap.put("speedMinWarn", count);
|
|
mWarnCountMap.put("speedMinWarn", count);
|
|
log.info("流速过低计数: {}/3", count);
|
|
log.info("流速过低计数: {}/3", count);
|
|
|
|
|
|
- if (count >= 3) {
|
|
|
|
|
|
+ if (count >= warnCount) {
|
|
log.error("触发流速过低预警");
|
|
log.error("触发流速过低预警");
|
|
saveException(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_MAN, String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed)));
|
|
saveException(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_MAN, String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed)));
|
|
//推送预警列表
|
|
//推送预警列表
|
|
@@ -1540,7 +1545,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
int count = mWarnCountMap.getOrDefault("speedMaxWarn", 0) + 1;
|
|
int count = mWarnCountMap.getOrDefault("speedMaxWarn", 0) + 1;
|
|
mWarnCountMap.put("speedMaxWarn", count);
|
|
mWarnCountMap.put("speedMaxWarn", count);
|
|
log.info("流速过高计数: {}/3", count);
|
|
log.info("流速过高计数: {}/3", count);
|
|
- if (count >= 3) {
|
|
|
|
|
|
+ if (count >= warnCount) {
|
|
log.error("触发流速过高预警");
|
|
log.error("触发流速过高预警");
|
|
//堵口一
|
|
//堵口一
|
|
saveException(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_KUAI, String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed)));
|
|
saveException(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_KUAI, String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed)));
|
|
@@ -1626,7 +1631,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
//四高炉南水渣粒化泵供水总管温度
|
|
//四高炉南水渣粒化泵供水总管温度
|
|
|
|
|
|
double temp = Double.parseDouble(opcData.getData().toString());
|
|
double temp = Double.parseDouble(opcData.getData().toString());
|
|
- if (lastChuzTemps.size() >= 3) {
|
|
|
|
|
|
+ if (lastChuzTemps.size() >= warnCount) {
|
|
lastChuzTemps.removeFirst();
|
|
lastChuzTemps.removeFirst();
|
|
}
|
|
}
|
|
lastChuzTemps.add(temp);
|
|
lastChuzTemps.add(temp);
|