优化报警记录

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") @Excel(name = "传感器id")
private String sensorId; private String sensorId;
/**
* 参数key值
*/
private String nameKey;
/** 报警内容 */ /** 报警内容 */
@Excel(name = "报警内容") @Excel(name = "报警内容")
@ -77,8 +73,15 @@ public class IpcAlarmRecord extends BaseEntity {
private IpcAlarmRules alarmRules; 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() { public IpcAlarmRecord() {
@ -125,13 +128,6 @@ public class IpcAlarmRecord extends BaseEntity {
this.content = content; this.content = content;
} }
public String getNameKey() {
return nameKey;
}
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
public String getContent() public String getContent()
{ {
@ -224,7 +220,6 @@ public class IpcAlarmRecord extends BaseEntity {
.append("alarmRulesId", getAlarmRulesId()) .append("alarmRulesId", getAlarmRulesId())
.append("equipId", getEquipId()) .append("equipId", getEquipId())
.append("sensorId", getSensorId()) .append("sensorId", getSensorId())
.append("nameKey", getNameKey())
.append("content", getContent()) .append("content", getContent())
.append("alarmValue", getAlarmValue()) .append("alarmValue", getAlarmValue())
.append("alarmTime", getAlarmTime()) .append("alarmTime", getAlarmTime())

View File

@ -72,7 +72,7 @@ public class IpcUtil {
if (judgeAlarm(map.get(rulesConfig.getAlarmNameKey()), rulesConfig.getAlertUpperBound(), rulesConfig.getAlertLowerBound(), rulesConfig.getReferenceCon())) { if (judgeAlarm(map.get(rulesConfig.getAlarmNameKey()), rulesConfig.getAlertUpperBound(), rulesConfig.getAlertLowerBound(), rulesConfig.getReferenceCon())) {
// 报警数据 // 报警数据
isAlarm = "1"; 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); returnList.add(ipcAlarmRecord);
} }
} }

View File

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