|  | @@ -22,10 +22,14 @@ import com.xunmei.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.iot.dto.sensor.SensorAppPageDto;
 | 
	
		
			
				|  |  |  import com.xunmei.iot.dto.sensor.SensorPageDto;
 | 
	
		
			
				|  |  |  import com.xunmei.iot.mapper.IotCommonSensorMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.iot.mapper.IotDeviceInfoMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.iot.mapper.IotDeviceStatusMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.iot.service.IIotCommonSensorService;
 | 
	
		
			
				|  |  |  import com.xunmei.iot.vo.sensor.*;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.RemoteOrgService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  | +import com.xunmei.system.api.domain.iot.IotDeviceInfo;
 | 
	
		
			
				|  |  | +import com.xunmei.system.api.domain.iot.IotDeviceStatus;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.vo.SysOrgVO;
 | 
	
		
			
				|  |  |  import io.netty.util.internal.StringUtil;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -56,6 +60,11 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private IotCommonSensorMapper sensorMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private IotDeviceStatusMapper deviceStatusMapper;
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private IotDeviceInfoMapper deviceInfoMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TableDataInfo<SensorPageVo> selectSensorDataPage(SensorPageDto request) {
 | 
	
	
		
			
				|  | @@ -147,17 +156,24 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public SensorAppVo appDetail(Long id) {
 | 
	
		
			
				|  |  | -        IotSensor sensor = baseMapper.selectById(id);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (ObjectUtil.isNull(sensor)) {
 | 
	
		
			
				|  |  | +        IotDeviceInfo deviceInfo =  deviceInfoMapper.selectById(id);
 | 
	
		
			
				|  |  | +        if (deviceInfo==null){
 | 
	
		
			
				|  |  |              throw new ServiceException("不存在该设备");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        IotDeviceStatus deviceStatus = deviceStatusMapper.selectByDeviceId(deviceInfo.getId());
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNull(deviceStatus)) {
 | 
	
		
			
				|  |  | +            throw new ServiceException("未获取到设备状态");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          SensorAppVo vo = new SensorAppVo();
 | 
	
		
			
				|  |  | -        BeanUtils.copyProperties(sensor, vo);
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(deviceInfo, vo);
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(deviceStatus, vo);
 | 
	
		
			
				|  |  | +        vo.setDeviceType(deviceStatus.getDeviceType());
 | 
	
		
			
				|  |  | +        vo.setInfos(deviceStatus.getInfo());
 | 
	
		
			
				|  |  |          vo.setDeviceTypeText(DictUtils.getDictLabel(DictConstants.APP_SENSOR_DEVICE_TYPE, Integer.parseInt(vo.getDeviceType())));
 | 
	
		
			
				|  |  |          vo.setStateText(DictUtils.getDictLabel(DictConstants.SENSOR_ALARM_STATUS, vo.getState()));
 | 
	
		
			
				|  |  | -        vo.setOrgName(orgService.concatOrgName(sensor.getOrgId(),SecurityConstants.INNER));
 | 
	
		
			
				|  |  | +        vo.setOrgName(orgService.concatOrgName(deviceInfo.getOrgId(),SecurityConstants.INNER));
 | 
	
		
			
				|  |  |          return vo;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |