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

import com.alibaba.fastjson.JSONObject;
import com.usky.issue.service.job.JgDataForward;
import com.usky.issue.service.mqtt.MqttStrategy;
import com.usky.issue.service.vo.MqttBaseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author han
 * @date 2025/03/20 17:56
 */
@Service("info")
public class Info implements MqttStrategy {
    @Autowired
    private JgDataForward jgDataForward;

    public String disposeMessage(MqttBaseVO mqttBaseVO) {

        try {
            JSONObject map_data = JSONObject.parseObject(mqttBaseVO.getData().toString());
            jgDataForward.addHeart(map_data.toJSONString());
            System.out.println("FInfoReceiver消费者收到消息： " + mqttBaseVO.getData().toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}
