lihui001 3 년 전
부모
커밋
c051bb9c30
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      zoniot-water/zoniot-water-web/src/main/java/com/bz/zoneiot/water/web/controller/MonitorInfoController.java

+ 4 - 1
zoniot-water/zoniot-water-web/src/main/java/com/bz/zoneiot/water/web/controller/MonitorInfoController.java

@@ -2,6 +2,7 @@ package com.bz.zoneiot.water.web.controller;
 
 import com.bz.zoneiot.core.common.enums.RespCodeEnum;
 import com.bz.zoneiot.core.common.pojo.AjaxMessage;
+import com.bz.zoneiot.core.mongo.utils.StringUtil;
 import com.bz.zoneiot.core.oauth2.pojo.LoginUser;
 import com.bz.zoneiot.core.oauth2.util.UserUtil;
 import com.bz.zoneiot.core.utils.BigDecimalUtils;
@@ -219,7 +220,9 @@ public class MonitorInfoController {
         // 判断是否报警
         if (mapAlarm.containsKey(item.getAttributeId().intValue())) {
             item.setIsAlarm(1);
-            item.setMonitorValue(item.getMonitorValue() + "(" + mapAlarm.get(item.getAttributeId().intValue()).getAlarmRange() + ")");
+            String range = mapAlarm.get(item.getAttributeId().intValue()).getAlarmRange();
+            String   str = StringUtil.isEmpty(range) ? "" : "(" +range +")";
+            item.setMonitorValue(item.getMonitorValue() + str);
         } else {
             item.setIsAlarm(0);
         }