Kaynağa Gözat

巡检设备状态报警修改

wangli 4 yıl önce
ebeveyn
işleme
b4c1d9e7b2

+ 4 - 7
sms_water/src/main/java/com/huaxu/dto/DeviceCheckAlarmDto.java

@@ -36,13 +36,11 @@ public class DeviceCheckAlarmDto {
     private String unit; //属性单位
 
     public Boolean checkdeviceOffLine(){
-        if(this.lastUpdateTime != null && alarmValue != null
+        if(this.lastUpdateTime != null && this.alarmValue != null
               &&  StringUtils.isNotBlank(this.alarmCondition)){
             String expression =this.duration+this.alarmCondition+this.alarmValue;
            try{
-               if(Boolean.valueOf(CalcUtil.executeExpression(expression))){
-                   return false;
-               }
+               return Boolean.valueOf(CalcUtil.executeExpression(expression));
            }catch (ScriptException e){
                log.info("判断设备是否在线表示式异常:表达式{} ,异常信息:{}",expression,e.getStackTrace());
            }
@@ -54,9 +52,8 @@ public class DeviceCheckAlarmDto {
                 &&  StringUtils.isNotBlank(this.alarmCondition)){
             String expression =value+this.alarmCondition+this.alarmValue;
             try{
-                if(Boolean.valueOf(CalcUtil.executeExpression(expression))){
-                    return false;
-                }
+                return Boolean.valueOf(CalcUtil.executeExpression(expression));
+
             }catch (ScriptException e){
                 log.info("判断设备是否报警表示式异常:表达式{} ,异常信息:{}",expression,e.getStackTrace());
             }

+ 1 - 1
sms_water/src/main/java/com/huaxu/service/impl/AlarmDetailsServiceImpl.java

@@ -153,7 +153,7 @@ public class AlarmDetailsServiceImpl implements AlarmDetailsService {
                     alarmDetailsEntity.setOpState(1);
                     alarmDetailsEntity.setState(1);
                     alarmDetailsEntity.setAlarmStartTime(new Date());
-                    alarmDetailsEntity.setAlarmContent("离线时间"+d.getAlarmCondition() +d.getAlarmValue());
+                    alarmDetailsEntity.setAlarmContent(d.getDeviceName()+"离线时间"+d.getAlarmCondition() +d.getAlarmValue()+"分钟");
                     alarmDetailsEntity.setAlarmValue(d.getDuration());
                     alarmDetailsEntity.setAttributeId(d.getAttributeId());
                     alarmDetailsEntity.setAlarmType("状态报警");

+ 1 - 0
sms_water/src/main/resources/mapper/AlarmDetailMapper.xml

@@ -533,6 +533,7 @@
         select
             d.TENANT_ID as "tenantId"
             ,d.id as "deviceId"
+            ,d.DEVICE_NAME as "deviceName"
             ,d.COMPANY_ORG_ID as "companyOrgId"
             ,d.DEPT_ORG_ID as "deptOrgId"
             ,a.ALARM_TYPE as "alarmType"