|  | @@ -150,17 +150,14 @@ public class IotBoardServiceImpl implements IotBoardService {
 | 
	
		
			
				|  |  |          HashMap<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  |          dataMap.put("sensor", map);
 | 
	
		
			
				|  |  |          dataMap.put("resultData", resultList);
 | 
	
		
			
				|  |  | -        if (ObjectUtil.isEmpty(list)) {
 | 
	
		
			
				|  |  | -            map.put("key", "传感器设备");
 | 
	
		
			
				|  |  | -            map.put("sensorNums", list.size());
 | 
	
		
			
				|  |  | -            map.put("normal", 0);
 | 
	
		
			
				|  |  | -            map.put("alarm", 0);
 | 
	
		
			
				|  |  | -            return dataMap;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          map.put("key", "传感器设备");
 | 
	
		
			
				|  |  |          map.put("sensorNums", list.size());
 | 
	
		
			
				|  |  |          map.put("normal", 0);
 | 
	
		
			
				|  |  |          map.put("alarm", 0);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isEmpty(list)) {
 | 
	
		
			
				|  |  | +            buildEmptyData(map,resultList);
 | 
	
		
			
				|  |  | +            return dataMap;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          Map<Integer, Long> collect = list.stream().collect(Collectors.groupingBy(IotSensor::getState, Collectors.counting()));
 | 
	
		
			
				|  |  |          collect.forEach((k, v) -> {
 | 
	
		
			
				|  |  |              if (ObjectUtil.equal(0, k)) {
 | 
	
	
		
			
				|  | @@ -171,20 +168,42 @@ public class IotBoardServiceImpl implements IotBoardService {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          List<IotAlarmData> alarmDataList = alarmDataService.selectAlarmDataListByOrgPath(org.getPath(), 0);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isEmpty(alarmDataList)) {
 | 
	
		
			
				|  |  | +            buildEmptyData(map,resultList);
 | 
	
		
			
				|  |  | +            return dataMap;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          //屏蔽红外
 | 
	
		
			
				|  |  |          alarmDataList.removeIf(d ->ObjectUtil.equal(METER_ATTRIBUTES_4.getText(),d.getSourceTypeDes()));
 | 
	
		
			
				|  |  |          Map<Object, List<IotAlarmData>> dataList = alarmDataList.stream().collect(Collectors.groupingBy(IotAlarmData::getSourceType));
 | 
	
		
			
				|  |  |          for (Map.Entry<Object, List<IotAlarmData>> listEntry : dataList.entrySet()) {
 | 
	
		
			
				|  |  |              List<IotAlarmData> value = listEntry.getValue();
 | 
	
		
			
				|  |  |              Map<String, Object> hashMap = new HashMap<>();
 | 
	
		
			
				|  |  | -            long count = value.stream().filter(d -> ObjectUtil.isNotNull(d.getEndTime())).count();
 | 
	
		
			
				|  |  | +            long currentAlarm = value.stream().filter(d -> ObjectUtil.isNull(d.getEndTime())).count();
 | 
	
		
			
				|  |  |              long unDealAlarm = value.stream().filter(d -> ObjectUtil.isNull(d.getDoTime())).count();
 | 
	
		
			
				|  |  | +            long needAlarm = value.stream().anyMatch(d -> ObjectUtil.isNull(d.getEndTime()) && ObjectUtil.isNull(d.getDoTime())) ?1:0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              hashMap.put("key", value.get(0).getSourceTypeDes());
 | 
	
		
			
				|  |  | -            hashMap.put("historyAlarm", count);
 | 
	
		
			
				|  |  | -            hashMap.put("currentAlarm", value.size() - count);
 | 
	
		
			
				|  |  | -            hashMap.put("unDealAlarm", unDealAlarm);
 | 
	
		
			
				|  |  | +            hashMap.put("historyAlarm", (int)value.size());
 | 
	
		
			
				|  |  | +            hashMap.put("currentAlarm",(int) currentAlarm);
 | 
	
		
			
				|  |  | +            hashMap.put("unDealAlarm", (int)unDealAlarm);
 | 
	
		
			
				|  |  | +            hashMap.put("needAlarm",(int) needAlarm);
 | 
	
		
			
				|  |  |              resultList.add(hashMap);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return dataMap;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void buildEmptyData(HashMap<String, Object> map,List<Map<String, Object>> resultList){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //水浸告警 温湿度告警 烟感告警 燃气告警 门磁告警 盗情告警
 | 
	
		
			
				|  |  | +        String[] alarmType = {"水浸告警", "温湿度告警", "烟感告警", "燃气告警", "门磁告警", "盗情告警"};
 | 
	
		
			
				|  |  | +        for (String s : alarmType) {
 | 
	
		
			
				|  |  | +            Map<String, Object> hashMap = new HashMap<>();
 | 
	
		
			
				|  |  | +            hashMap.put("key", s);
 | 
	
		
			
				|  |  | +            hashMap.put("historyAlarm", 0);
 | 
	
		
			
				|  |  | +            hashMap.put("currentAlarm", 0);
 | 
	
		
			
				|  |  | +            hashMap.put("unDealAlarm", 0);
 | 
	
		
			
				|  |  | +            hashMap.put("needAlarm", 0);
 | 
	
		
			
				|  |  | +            resultList.add(hashMap);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |