package com.yeejoin.amos.boot.module.tzs.biz.listener;

import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;

/**
 * @Description: 气瓶充装信息mqtt监听服务
 * @Author: tb
 * @Date: 2022/12/20
 */
@Component
@Slf4j
public class FillingRecordSyncListener extends EmqxListener {

	@Autowired
	CylinderInfoServiceImpl cylinderInfoService;

	@Override
	public void processMessage(String topic, MqttMessage message) throws Exception {
		System.out.println(message);
		if (!ValidationUtil.isEmpty(message.toString())) {
			cylinderInfoService.synUnitFillingCheckData();
		}
	}
}
