package com.usky.cdi.service.mqtt.info;

import com.alibaba.fastjson.JSONObject;
import com.usky.cdi.service.mqtt.MqttStrategy;
import com.usky.cdi.service.vo.MqttBaseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author han
 * @date 2025/03/20 17:56
 */
@Slf4j
@Service("info")
public class Info implements MqttStrategy {

    public String disposeMessage(MqttBaseVO mqttBaseVO) {
        if (mqttBaseVO == null || mqttBaseVO.getData() == null) {
            log.warn("MqttBaseVO或数据为空");
            return null;
        }
        try {
            JSONObject mapData = JSONObject.parseObject(mqttBaseVO.getData().toString());
            log.info("FInfoReceiver消费者收到消息： {}", mqttBaseVO.getData().toString());
        } catch (Exception e) {
            log.error("处理Info消息时发生错误", e);
        }

        return null;
    }
}
