Pārlūkot izejas kodu

增加动环设备面板接口

jingyuanchao 1 gadu atpakaļ
vecāks
revīzija
673fec0b09

+ 8 - 9
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotBoardServiceImpl.java

@@ -140,12 +140,12 @@ public class IotBoardServiceImpl implements IotBoardService {
     IotAlarmDataService alarmDataService;
 
     @Override
-    public  Map<String, Object> iotOverview(Long orgId) {
+    public Map<String, Object> iotOverview(Long orgId) {
         Map<String, Object> dataMap = new HashMap<>();
-        List<Map<String,Object>> resultList = new ArrayList<>();
+        List<Map<String, Object>> resultList = new ArrayList<>();
         SysOrg org = remoteOrgService.selectOrgById(orgId, SecurityConstants.INNER);
-        List<IotSensor> list= sensorService.selectSensorListByOrgPath(org.getPath());
-        if (ObjectUtil.isEmpty(list)){
+        List<IotSensor> list = sensorService.selectSensorListByOrgPath(org.getPath());
+        if (ObjectUtil.isEmpty(list)) {
             return dataMap;
         }
         //默认为正常
@@ -159,7 +159,7 @@ public class IotBoardServiceImpl implements IotBoardService {
         map.put("sensorNums", list.size());
         map.put("normal", 0);
         map.put("alarm", 0);
-        dataMap.put("sensor",map);
+        dataMap.put("sensor", map);
         Map<Integer, Long> collect = list.stream().collect(Collectors.groupingBy(IotSensor::getState, Collectors.counting()));
         collect.forEach((k, v) -> {
             if (ObjectUtil.equal(0, k)) {
@@ -169,21 +169,20 @@ public class IotBoardServiceImpl implements IotBoardService {
                 map.put("alarm", v.intValue());
             }
         });
-        resultList.add(map);
-       List<IotAlarmData> alarmDataList= alarmDataService.selectAlarmDataListByOrgPath(org.getPath(),0);
+        List<IotAlarmData> alarmDataList = alarmDataService.selectAlarmDataListByOrgPath(org.getPath(), 0);
         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 unDealAlarm = value.stream().filter(d -> ObjectUtil.isNull(d.getDoTime())).count();
-            hashMap.put("key",value.get(0).getSourceTypeDes());
+            hashMap.put("key", value.get(0).getSourceTypeDes());
             hashMap.put("historyAlarm", count);
             hashMap.put("currentAlarm", value.size() - count);
             hashMap.put("unDealAlarm", unDealAlarm);
             resultList.add(hashMap);
         }
-        dataMap.put("resultData",resultList);
+        dataMap.put("resultData", resultList);
         return dataMap;
     }
 }