无关风月
2024-12-11 4d7a208f388e42e7dd83dab0e38eadfa0847de1c
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
@@ -26,18 +26,27 @@
    @Autowired
    private IotBuilder iotBuilder;
    @Autowired
    private IotDAConfig config;
    /**
     * 设备消息下发
     * @param deviceId 设备id
     * @param name 消息名称
     * @param message 消息内容
     * @return
     */
    @PostMapping("/sendMessage")
    public String sendMessage(String deviceId, String name, JSONObject message){
    public String sendMessage(String code, String name, JSONObject message){
        CreateMessageRequest request = new CreateMessageRequest();
        request.withDeviceId(deviceId);
        System.err.println(code);
        System.err.println(JSONObject.toJSONString(config));
        if(config.getTest() && code.equals(config.getTestDriverCode())){
            request.withDeviceId(config.getTestDeviceId());
        }else{
            request.withDeviceId(config.getDeviceId());
        }
        DeviceMessageRequest body = new DeviceMessageRequest();
        body.withMessageId(UUID.randomUUID().toString());
        body.withName(name);