|  | @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
	
		
			
				|  |  | -import com.sun.media.jfxmedia.logging.Logger;
 | 
	
		
			
				|  |  |  import com.usky.common.core.util.UUIDUtils;
 | 
	
		
			
				|  |  |  import com.usky.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  |  import com.usky.transfer.domain.*;
 | 
	
	
		
			
				|  | @@ -19,7 +18,6 @@ import com.usky.transfer.service.utils.TsdbUtils;
 | 
	
		
			
				|  |  |  import com.usky.transfer.service.vo.DeviceMapVO;
 | 
	
		
			
				|  |  |  import com.usky.transfer.service.vo.ProductMapVO;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  | -import org.influxdb.dto.QueryResult;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.cache.annotation.Cacheable;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -56,15 +54,14 @@ public class QueryInfluxdbDataServiceImpl extends AbstractCrudService<QueryInflu
 | 
	
		
			
				|  |  |      private MqttOutConfig.MqttGateway mqttGateway;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public Map<String,Object> deviceControl(String topic,String dataStr){
 | 
	
		
			
				|  |  | +    public Map<String,Object> deviceControl(String productCode, String deviceId, String commandStr){
 | 
	
		
			
				|  |  |          Map<String,Object> rec_map = new HashMap<>();
 | 
	
		
			
				|  |  | -        String[] str = topic.split("/");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //存储下发设备控制命令到数据库表中
 | 
	
		
			
				|  |  |          DmpDeviceCommand command = new DmpDeviceCommand();
 | 
	
		
			
				|  |  | -        command.setProductCode(str[1]);
 | 
	
		
			
				|  |  | -        command.setDeviceId(str[2]);
 | 
	
		
			
				|  |  | -        command.setCommandContent(dataStr);
 | 
	
		
			
				|  |  | +        command.setProductCode(productCode);
 | 
	
		
			
				|  |  | +        command.setDeviceId(deviceId);
 | 
	
		
			
				|  |  | +        command.setCommandContent(commandStr);
 | 
	
		
			
				|  |  |          command.setCreatedBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  |          command.setCreatedTime(LocalDateTime.now());
 | 
	
		
			
				|  |  |  //        if (Objects.nonNull(SecurityUtils.getLoginUser().getSysUser().getDeptId())){
 | 
	
	
		
			
				|  | @@ -75,13 +72,14 @@ public class QueryInfluxdbDataServiceImpl extends AbstractCrudService<QueryInflu
 | 
	
		
			
				|  |  |          dmpDeviceCommandService.save(command);
 | 
	
		
			
				|  |  |          int commandId = command.getId();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        JSONObject dataJson = JSONObject.parseObject(dataStr);
 | 
	
		
			
				|  |  | +        JSONObject dataJson = JSONObject.parseObject(commandStr);
 | 
	
		
			
				|  |  |          dataJson.put("id",commandId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          command.setCommandContent(dataJson.toJSONString());
 | 
	
		
			
				|  |  |          dmpDeviceCommandService.updateById(command);
 | 
	
		
			
				|  |  |          //推送下发设备控制mqtt
 | 
	
		
			
				|  |  | -        if(StringUtils.isNotBlank(dataStr)){
 | 
	
		
			
				|  |  | +        if(StringUtils.isNotBlank(commandStr)){
 | 
	
		
			
				|  |  | +            String topic = "/"+productCode+"/"+deviceId+"/control";
 | 
	
		
			
				|  |  |              mqttGateway.sendToMqtt(topic,dataJson.toJSONString());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 |