Explorar el Código

调整告警记录列表字段

liuyaowen hace 11 meses
padre
commit
a2b08cffd8

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotWarnlogResVo.java

@@ -9,4 +9,6 @@ public class IotWarnlogResVo extends IotWarnlog {
     private String wlLevelContent;
     private String wlLevelContent;
     private String devTypeName;
     private String devTypeName;
     private String devCode;
     private String devCode;
+    private String devName;
+
 }
 }

+ 9 - 3
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnlogServiceImpl.java

@@ -74,14 +74,20 @@ public class IotWarnlogServiceImpl implements IIotWarnlogService {
         }
         }
         // 查询告警设备信息
         // 查询告警设备信息
         List<IotDevice> iotDeviceList = iotDeviceMapper.selectIotDeviceByDevBids(devBids, SecurityUtils.getTid());
         List<IotDevice> iotDeviceList = iotDeviceMapper.selectIotDeviceByDevBids(devBids, SecurityUtils.getTid());
-        Map<String,String> iotDeviceMap = iotDeviceList.stream().collect(Collectors.toMap(IotDevice::getDevBid,IotDevice::getDevCode));
+        Map<String,IotDevice> iotDeviceMap = iotDeviceList.stream().collect(Collectors.toMap(IotDevice::getDevBid,item->item));
         // 查询告警设备类型信息
         // 查询告警设备类型信息
         List<TosDevicetype> tosDevicetypes = tosDevicetypeMapper.selectTosDevicetypeByDevtypeBids(devTypeBids);
         List<TosDevicetype> tosDevicetypes = tosDevicetypeMapper.selectTosDevicetypeByDevtypeBids(devTypeBids);
         Map<String,String> tosDeviceTypeMap = tosDevicetypes.stream().collect(Collectors.toMap(TosDevicetype::getDevtypeBid,TosDevicetype::getDevtypeName));
         Map<String,String> tosDeviceTypeMap = tosDevicetypes.stream().collect(Collectors.toMap(TosDevicetype::getDevtypeBid,TosDevicetype::getDevtypeName));
         // 遍历结果进行赋值
         // 遍历结果进行赋值
         for(IotWarnlogResVo iotWarnlogResVo : iotWarnLogResVoList){
         for(IotWarnlogResVo iotWarnlogResVo : iotWarnLogResVoList){
-            // 设置设备编号
-            iotWarnlogResVo.setDevCode(iotDeviceMap.get(iotWarnlogResVo.getDevBid()));
+            IotDevice iotDevice = iotDeviceMap.get(iotWarnlogResVo.getDevBid());
+            if(null != iotDevice){
+                // 设置设备编号
+                iotWarnlogResVo.setDevCode(iotDevice.getDevCode());
+                // 设置设备名称
+                iotWarnlogResVo.setDevName(iotDevice.getDevName());
+            }
+
             // 设置设备类型名称
             // 设置设备类型名称
             iotWarnlogResVo.setDevTypeName(tosDeviceTypeMap.get(iotWarnlogResVo.getDevtypeBid()));
             iotWarnlogResVo.setDevTypeName(tosDeviceTypeMap.get(iotWarnlogResVo.getDevtypeBid()));
             // 获取设备触发类型,并进行赋值
             // 获取设备触发类型,并进行赋值