package com.dy.pipIrrWechat.command; 
 | 
  
 | 
import com.dy.common.mw.protocol4Mqtt.MqttSubMsg; 
 | 
import com.dy.pipIrrGlobal.command.ComResultWait; 
 | 
import com.dy.pipIrrGlobal.command.ComSupport; 
 | 
import lombok.extern.slf4j.Slf4j; 
 | 
import org.springframework.http.MediaType; 
 | 
import org.springframework.web.bind.annotation.PostMapping; 
 | 
import org.springframework.web.bind.annotation.RequestBody; 
 | 
import org.springframework.web.bind.annotation.RequestMapping; 
 | 
import org.springframework.web.bind.annotation.RestController; 
 | 
  
 | 
import java.util.concurrent.CompletableFuture; 
 | 
  
 | 
/** 
 | 
 * @author ZhuBaoMin 
 | 
 * @date 2025/8/21 14:50 
 | 
 * @Description 
 | 
 */ 
 | 
  
 | 
@Slf4j 
 | 
@RestController 
 | 
@RequestMapping(path="mqttRes") 
 | 
public class MqttResultCtrl extends ComSupport { 
 | 
    @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE) 
 | 
    public void receive(@RequestBody MqttSubMsg subMsg) { 
 | 
        if(subMsg != null){ 
 | 
            CompletableFuture<MqttSubMsg> feature = (CompletableFuture<MqttSubMsg>) ComResultWait.get(Long.parseLong(subMsg.commandId)); 
 | 
            if(feature != null) { 
 | 
                feature.complete(subMsg); 
 | 
            }else{ 
 | 
                //超时,feature被清除了 
 | 
            } 
 | 
        }else{ 
 | 
            log.error("mqtt协议消息为空"); 
 | 
        } 
 | 
    } 
 | 
} 
 |