烘料房测试版5
This commit is contained in:
parent
99c4ee17d1
commit
9c2c697225
@ -102,7 +102,7 @@ public class AutoCollectService {
|
||||
// 生成露点数据
|
||||
DryMonitoringData data1 = generateMonitoringData(equipCode, alarmEquipCodes.contains(equipCode), collectTime, "DEW");
|
||||
monitoringDataMapper.insert(data1);
|
||||
judgeAlarm(data1);
|
||||
judgeAlarm(data1, "DEW");
|
||||
log.debug("设备[{}]数据插入成功:{}(状态:{})",
|
||||
equipCode, data1.getDataValue(),
|
||||
data1.getDataStatus().equals("1") ? "报警" : "正常");
|
||||
@ -111,7 +111,7 @@ public class AutoCollectService {
|
||||
DryMonitoringData data2 = generateMonitoringData(equipCode, alarmEquipCodes.contains(equipCode), collectTime, "TEMP");
|
||||
monitoringDataMapper.insert(data2);
|
||||
// 判断是否需要报警
|
||||
judgeAlarm(data2);
|
||||
judgeAlarm(data2, "TEMP");
|
||||
insertSuccess++;
|
||||
log.debug("设备[{}]数据插入成功:{}(状态:{})",
|
||||
equipCode, data2.getDataValue(),
|
||||
@ -259,7 +259,7 @@ public class AutoCollectService {
|
||||
/**
|
||||
* 判断是否报警
|
||||
*/
|
||||
private void judgeAlarm(DryMonitoringData data) {
|
||||
private void judgeAlarm(DryMonitoringData data, String paramCode) {
|
||||
|
||||
LambdaUpdateWrapper<DryEquipmentInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
// 查询该设备规则列表
|
||||
@ -271,43 +271,45 @@ public class AutoCollectService {
|
||||
DryAlarmLog log = new DryAlarmLog();
|
||||
// 循环规则列表
|
||||
for (DryParamThreshold threshold : list) {
|
||||
if (parseThresholdValue(threshold.getMaxValue()) < parseThresholdValue(data.getDataValue())) {
|
||||
// 插入报警日志
|
||||
log.setAlarmType("1");
|
||||
log.setEquipmentCode(data.getEquipmentCode());
|
||||
log.setParamCode(threshold.getParamCode());
|
||||
log.setAlarmValue(data.getDataValue());
|
||||
log.setAlarmTime(LocalDateTime.now());
|
||||
log.setAlarmStatus("0");
|
||||
log.setCreateBy("shgx");
|
||||
log.setCreateTime(DateUtils.getNowDate());
|
||||
logMapper.insert(log);
|
||||
// 修改设备状态
|
||||
updateWrapper.eq(DryEquipmentInfo::getEquipmentCode, data.getEquipmentCode())
|
||||
.set(DryEquipmentInfo::getStatus, '2');
|
||||
equipmentInfoMapper.update(updateWrapper);
|
||||
// MQTT向报警灯发送报警
|
||||
alarmLightService.turnOnAll();
|
||||
}
|
||||
if (parseThresholdValue(threshold.getMinValue()) > parseThresholdValue(data.getDataValue())) {
|
||||
// 插入报警日志
|
||||
log.setAlarmType("2");
|
||||
log.setEquipmentCode(data.getEquipmentCode());
|
||||
log.setParamCode(threshold.getParamCode());
|
||||
log.setAlarmValue(data.getDataValue());
|
||||
log.setAlarmTime(LocalDateTime.now());
|
||||
log.setAlarmStatus("0");
|
||||
log.setCreateBy("shgx");
|
||||
log.setCreateTime(DateUtils.getNowDate());
|
||||
updateWrapper.eq(DryEquipmentInfo::getEquipmentCode, data.getEquipmentCode())
|
||||
.set(DryEquipmentInfo::getStatus, '2');
|
||||
// 修改设备状态
|
||||
equipmentInfoMapper.update(updateWrapper);
|
||||
logMapper.insert(log);
|
||||
// MQTT向报警灯发送报警
|
||||
alarmLightService.turnOnAll();
|
||||
} else {
|
||||
return;
|
||||
if (threshold.getParamCode().equals(paramCode)) {
|
||||
if (parseThresholdValue(threshold.getMaxValue()) < parseThresholdValue(data.getDataValue())) {
|
||||
// 插入报警日志
|
||||
log.setAlarmType("1");
|
||||
log.setEquipmentCode(data.getEquipmentCode());
|
||||
log.setParamCode(threshold.getParamCode());
|
||||
log.setAlarmValue(data.getDataValue());
|
||||
log.setAlarmTime(LocalDateTime.now());
|
||||
log.setAlarmStatus("0");
|
||||
log.setCreateBy("shgx");
|
||||
log.setCreateTime(DateUtils.getNowDate());
|
||||
logMapper.insert(log);
|
||||
// 修改设备状态
|
||||
updateWrapper.eq(DryEquipmentInfo::getEquipmentCode, data.getEquipmentCode())
|
||||
.set(DryEquipmentInfo::getStatus, '2');
|
||||
equipmentInfoMapper.update(updateWrapper);
|
||||
// MQTT向报警灯发送报警
|
||||
alarmLightService.turnOnAll();
|
||||
}
|
||||
if (parseThresholdValue(threshold.getMinValue()) > parseThresholdValue(data.getDataValue())) {
|
||||
// 插入报警日志
|
||||
log.setAlarmType("2");
|
||||
log.setEquipmentCode(data.getEquipmentCode());
|
||||
log.setParamCode(threshold.getParamCode());
|
||||
log.setAlarmValue(data.getDataValue());
|
||||
log.setAlarmTime(LocalDateTime.now());
|
||||
log.setAlarmStatus("0");
|
||||
log.setCreateBy("shgx");
|
||||
log.setCreateTime(DateUtils.getNowDate());
|
||||
updateWrapper.eq(DryEquipmentInfo::getEquipmentCode, data.getEquipmentCode())
|
||||
.set(DryEquipmentInfo::getStatus, '2');
|
||||
// 修改设备状态
|
||||
equipmentInfoMapper.update(updateWrapper);
|
||||
logMapper.insert(log);
|
||||
// MQTT向报警灯发送报警
|
||||
alarmLightService.turnOnAll();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user