|  | @@ -13,8 +13,10 @@ import com.zcxk.rmcp.api.dto.alarm.AlarmTypeDetailsDto;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.api.enums.AlarmStateEnum;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.api.vo.alarm.AlarmTypeDetailsEntityVo;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.core.dao.AlarmTypeDetailMapper;
 | 
	
		
			
				|  |  | +import com.zcxk.rmcp.core.dao.DeviceMapper;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.core.entity.AlarmDetailsEntity;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.core.entity.AlarmType;
 | 
	
		
			
				|  |  | +import com.zcxk.rmcp.core.entity.Device;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.web.service.AlarmTypeDetailsService;
 | 
	
		
			
				|  |  |  import com.zcxk.rmcp.web.service.AlarmTypeService;
 | 
	
		
			
				|  |  |  import lombok.extern.log4j.Log4j2;
 | 
	
	
		
			
				|  | @@ -56,6 +58,8 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private AlarmTypeService alarmTypeService;
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private DeviceMapper deviceMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -140,15 +144,18 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService {
 | 
	
		
			
				|  |  |      **/
 | 
	
		
			
				|  |  |      private List<AlarmDetailsEntity> convert(AlarmDetailsAddDto dto){
 | 
	
		
			
				|  |  |          BigDecimal value;
 | 
	
		
			
				|  |  | -        String deviceName;
 | 
	
		
			
				|  |  | -        Integer sceneType;
 | 
	
		
			
				|  |  | -        String attrName = null;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Device device = deviceMapper.findByIotDeviceId(Long.valueOf(dto.getDeviceId()));
 | 
	
		
			
				|  |  | +        if (device == null) {
 | 
	
		
			
				|  |  | +            log.error("【接收告警信息失败】:设备为空 ,请求参数:{}", dto.toString());
 | 
	
		
			
				|  |  | +            return null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          AlarmType alarmType = alarmTypeService.findByIotAlarmId(dto.getAlarmTypeId());
 | 
	
		
			
				|  |  |          if (alarmType == null) {
 | 
	
		
			
				|  |  |              log.error("【接收告警信息失败】:告警信息为空 ,请求参数:{}", dto.toString());
 | 
	
		
			
				|  |  |              return null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        sceneType = alarmType.getSceneType();
 | 
	
		
			
				|  |  |          Long alarmId = alarmTypeDetailMapper.selectLastAlarmId(alarmType.getId());
 | 
	
		
			
				|  |  |          List<AlarmDetailsEntity> result = new ArrayList<>();
 | 
	
		
			
				|  |  |          // 离线告警
 | 
	
	
		
			
				|  | @@ -183,7 +190,7 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService {
 | 
	
		
			
				|  |  |          alarmDetailsEntity.setTenantId(alarmType.getTenantId());
 | 
	
		
			
				|  |  |          alarmDetailsEntity.setAlarmId(Long.parseLong(alarmType.getId().toString()));
 | 
	
		
			
				|  |  |          alarmDetailsEntity.setAlarmType(alarmType.getAlarmCategory() == 1 ? "参数报警" : "状态报警");
 | 
	
		
			
				|  |  | -        alarmDetailsEntity.setDeviceId(Long.valueOf(dto.getDeviceId()));
 | 
	
		
			
				|  |  | +        alarmDetailsEntity.setDeviceId(device.getId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (alarmType.getAttributeId() != null){
 | 
	
		
			
				|  |  |              alarmDetailsEntity.setAttributeId(Integer.parseInt(alarmType.getAttributeId().toString()));
 |