| 
					
				 | 
			
			
				@@ -155,16 +155,21 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String deviceName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer sceneType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String attrName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer productId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AlarmType alarmType = alarmTypeService.findByIotAlarmId(dto.getAlarmTypeId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (alarmType == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("【接收告警信息失败】:告警信息为空 ,请求参数:{}", dto.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sceneType = alarmType.getSceneType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long deviceId = alarmType.getDeviceId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (deviceId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            productId = alarmType.getProductId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long alarmId = alarmTypeDetailMapper.selectLastAlarmId(alarmType.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<AlarmDetailsEntity> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 离线告警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (alarmType.getAlarmCategory() == 2 || alarmType.getAttributeId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (alarmType.getAlarmCategory() == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value = new BigDecimal("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DeviceAttributeEntity attributeEntity = deviceAttributeService.findDeviceAttributeById(alarmType.getAttributeId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -173,9 +178,15 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             attrName = attributeEntity.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            value = new BigDecimal(dto.getData().get(attributeEntity.getIdentifier()).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Object obj = dto.getData().get(attributeEntity.getIdentifier()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (obj == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = new BigDecimal("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = new BigDecimal(obj.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<DeviceSceneVo> sceneVos = deviceSceneMapper.findSceneByDeviceId(alarmType.getDeviceId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<DeviceSceneVo> sceneVos = deviceSceneMapper.findScene(deviceId, productId, alarmType.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (DeviceSceneVo sceneVo : sceneVos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             AlarmDetailsEntity alarmDetailsEntity = new AlarmDetailsEntity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (alarmId != null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -195,7 +206,7 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alarmDetailsEntity.setTenantId(alarmType.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alarmDetailsEntity.setAlarmId(Long.parseLong(alarmType.getId().toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alarmDetailsEntity.setAlarmType(alarmType.getAlarmCategory() == 1 ? "参数报警" : "状态报警"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            alarmDetailsEntity.setDeviceId(Integer.parseInt(alarmType.getDeviceId().toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            alarmDetailsEntity.setDeviceId(sceneVo.getDeviceId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (alarmType.getAttributeId() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 alarmDetailsEntity.setAttributeId(Integer.parseInt(alarmType.getAttributeId().toString())); 
			 |