优化报警记录

This commit is contained in:
zhanghan11 2024-09-27 16:56:30 +08:00
parent 98be671392
commit 81e9f643f5
3 changed files with 12 additions and 24 deletions

View File

@ -37,10 +37,6 @@ public class IpcAlarmRecord extends BaseEntity {
@Excel(name = "传感器id")
private String sensorId;
/**
* 参数key值
*/
private String nameKey;
/** 报警内容 */
@Excel(name = "报警内容")
@ -77,8 +73,15 @@ public class IpcAlarmRecord extends BaseEntity {
private IpcAlarmRules alarmRules;
public IpcAlarmRecord(String fastSimpleUUID, String equipId, String equipName, String alarmNameKey, String alarmName, String valueOf, String alarmInfoUnit, String alarmLevel, String referenceName, String description, String id) {
super();
public IpcAlarmRecord( String alarmRulesId, String equipId, String sensorId, String content, BigDecimal alarmValue, String alarmLevel, Long deptId) {
this.alarmRulesId = alarmRulesId;
this.equipId = equipId;
this.sensorId = sensorId;
this.content = content;
this.alarmValue = alarmValue;
this.alarmLevel = alarmLevel;
this.deptId = deptId;
}
public IpcAlarmRecord() {
@ -125,13 +128,6 @@ public class IpcAlarmRecord extends BaseEntity {
this.content = content;
}
public String getNameKey() {
return nameKey;
}
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
public String getContent()
{
@ -224,7 +220,6 @@ public class IpcAlarmRecord extends BaseEntity {
.append("alarmRulesId", getAlarmRulesId())
.append("equipId", getEquipId())
.append("sensorId", getSensorId())
.append("nameKey", getNameKey())
.append("content", getContent())
.append("alarmValue", getAlarmValue())
.append("alarmTime", getAlarmTime())

View File

@ -72,7 +72,7 @@ public class IpcUtil {
if (judgeAlarm(map.get(rulesConfig.getAlarmNameKey()), rulesConfig.getAlertUpperBound(), rulesConfig.getAlertLowerBound(), rulesConfig.getReferenceCon())) {
// 报警数据
isAlarm = "1";
IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(), rulesConfig.getEquipId(), rulesConfig.getEquipName(), rulesConfig.getAlarmNameKey(), rulesConfig.getAlarmName(), String.valueOf(map.get(rulesConfig.getAlarmNameKey())), rulesConfig.getAlarmInfoUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getDescription(), rulesConfig.getId());
IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(rulesConfig.getId(), rulesConfig.getEquipId(), rulesConfig.getSensorId(), rulesConfig.getDescription(), new BigDecimal(String.valueOf(map.get(rulesConfig.getAlarmNameKey()) == null ? 0 : map.get(rulesConfig.getAlarmNameKey()))), rulesConfig.getAlarmLevel(), rulesConfig.getDeptId());
returnList.add(ipcAlarmRecord);
}
}

View File

@ -10,7 +10,6 @@
<result property="equipId" column="equip_id"/>
<result property="equipName" column="equip_name"/>
<result property="sensorId" column="sensor_id"/>
<result property="nameKey" column="name_key"/>
<result property="content" column="content"/>
<result property="alarmValue" column="alarm_value"/>
<result property="alarmTime" column="alarm_time"/>
@ -26,7 +25,6 @@
alarm_rules_id,
equip_id,
sensor_id,
name_key,
content,
alarm_value,
alarm_time,
@ -62,7 +60,6 @@
<if test="alarmRulesId != null">alarm_rules_id,</if>
<if test="equipId != null">equip_id,</if>
<if test="sensorId != null">sensor_id,</if>
<if test="nameKey != null">name_key,</if>
<if test="content != null">content,</if>
<if test="alarmValue != null">alarm_value,</if>
<if test="alarmTime != null">alarm_time,</if>
@ -76,7 +73,6 @@
<if test="alarmRulesId != null">#{alarmRulesId},</if>
<if test="equipId != null">#{equipId},</if>
<if test="sensorId != null">#{sensorId},</if>
<if test="nameKey != null">#{nameKey},</if>
<if test="content != null">#{content},</if>
<if test="alarmValue != null">#{alarmValue},</if>
<if test="alarmTime != null">#{alarmTime},</if>
@ -90,18 +86,15 @@
<insert id="batchInsertIpcAlarmRecord" parameterType="com.inspur.ipc.domain.IpcAlarmRecord">
insert delayed into
ipc_alarm_record(alarm_rules_id,equip_id,sensor_id,name_key,content,alarm_value,alarm_time,status,operator,alarm_level,dept_id)
ipc_alarm_record(alarm_rules_id,equip_id,sensor_id,content,alarm_value,alarm_time,alarm_level,dept_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.alarmRulesId},
#{item.equipId},
#{item.sensorId},
#{item.nameKey},
#{item.content},
#{item.alarmValue},
#{item.alarmTime},
#{item.status},
#{item.operator},
NOW(),
#{item.alarmLevel},
#{item.deptId})
</foreach>