Pu Zhibing
4 天以前 60688f1573eadd0c76dea6b94e684bf363bd99ab
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
@@ -40,7 +40,7 @@
     */
    @PostMapping("/sendMessage")
    public String sendMessage(String code, String name, JSONObject message){
        log.info("消息下发至设备:code={},name={},message={}", code, name, message);
//        log.info("消息下发至设备:code={},name={},message={}", code, name, message);
        CreateMessageRequest request = new CreateMessageRequest();
        request.withDeviceId(code);
        DeviceMessageRequest body = new DeviceMessageRequest();
@@ -50,12 +50,11 @@
        request.withBody(body);
        try {
            CreateMessageResponse response = iotBuilder.buildIot().createMessage(request);
            log.info("消息下发至设备结果:{}", JSON.toJSONString(response));
//            log.info("消息下发至设备结果:{}", JSON.toJSONString(response));
            return JSON.toJSONString(response);
        } catch (Exception e) {
            e.printStackTrace();
            log.info("消息下发至设备异常:code---{},msg---{}", code, e.getMessage());
            log.error("消息下发至设备异常:code---{},msg---{}", code, e.getMessage());
//            log.error("消息下发至设备异常:code---{},msg---{}", code, e.getMessage());
            return e.getMessage();
        }
    }