| | |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.data.CloudSendData; |
| | | import com.fzzy.gateway.hx2023.data.SyncReqData; |
| | | import com.fzzy.mqtt.MqttGatewayService; |
| | | import com.fzzy.mqtt.MqttProviderConfig; |
| | | import com.fzzy.mqtt.MqttPublishService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Resource |
| | | private GatewayRemoteManager gatewayRemoteManager; |
| | | @Resource |
| | | private MqttPublishService publishService; |
| | | private MqttGatewayService mqttGatewayService; |
| | | |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param message |
| | | */ |
| | | public void onReceiveMessage(String message) { |
| | | public void onReceiveMessage(String topic,String message) { |
| | | |
| | | try { |
| | | CloudSendData cloudSendData = JSONObject.parseObject(message, CloudSendData.class); |
| | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | log.error("--------执行异常-----{}",e); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | topic = topic.replace("${productId}", device.getProductId()).replace("${deviceId}", device.getDeviceId()); |
| | | |
| | | publishService.publishMsg(topic, resp.getData()); |
| | | mqttGatewayService.publishMqttWithTopic(resp.getData(), topic); |
| | | |
| | | log.info("=======粮情推送==========={}", resp.getData()); |
| | | log.info("----------------------------推送MQTT信息---------------------------"); |
| | | log.info("-----TOPIC-----{}",topic); |
| | | log.info("-----Message-----{}",resp.getData()); |
| | | } |
| | | } |
| | | } |