mq spring 整合

	<!-- rabbitmq -->
	<dependency>
            <groupId>com.rabbitmq</groupId>
            <artifactId>amqp-client</artifactId>
            <version>3.6.5</version>
 	</dependency>
	<dependency>  
            <groupId>org.springframework.amqp</groupId>  
            <artifactId>spring-rabbit</artifactId>  
            <version>1.3.5.RELEASE</version>  
        </dependency>  

云端服务器spring-mq.xml 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context"
             xmlns:util="http://www.springframework.org/schema/util"
             xmlns:rabbit="http://www.springframework.org/schema/rabbit"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                     http://www.springframework.org/schema/context
                     http://www.springframework.org/schema/context/spring-context-3.0.xsd
				     http://www.springframework.org/schema/util
				     http://www.springframework.org/schema/util/spring-util-3.0.xsd
                     http://www.springframework.org/schema/rabbit  
					 http://www.springframework.org/schema/rabbit/spring-rabbit-1.2.xsd">
	 
    <bean class="com.lmuze.werewolf.common.extend.property.CustomPropertyConfigurer">
		<property name="configName" value="[生产环境rabbitmq配置文件(优先级:2)]" />
		<property name="location" value="file:C:\app\config\rabbitmq.properties" />
		<property name="ignoreResourceNotFound" value="true" />
		<property name="order" value="2" />
		<property name="ignoreUnresolvablePlaceholders" value="true" />
	</bean>

    <bean class="com.lmuze.werewolf.common.extend.property.CustomPropertyConfigurer">  
        <property name="configName" value="[默认rabbitmq配置文件(优先级:9)]"/>
        <!-- file:/app/... -->
        <!-- <property name="ignoreResourceNotFound" value="true"/> -->
        <property name="location" value="classpath:properties/rabbitmq.properties"/>  
        <property name="order" value="9"/>
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
    </bean>
    <rabbit:connection-factory id="connectionFactory" username="${mq.username}" password="${mq.password}" host="${mq.host}" port="${mq.port}" />
    
    <rabbit:template id="amqpTemplate" connection-factory="connectionFactory" exchange="instructionsExchange" />
    
    <bean id="instructionsProducer" class="com.lmuze.werewolf.cloud.handler.InstructionsProducer">
    	<property name="amqpTemplate" ref="amqpTemplate"/>
    </bean>
    
    <!--通过指定下面的admin信息,当前producer中的exchange和queue会在rabbitmq服务器上自动生成 -->
    <rabbit:admin id="connectAdmin" connection-factory="connectionFactory" />
    
    <!-- 指令接收器 -->
    <bean id="localDataConsumer" class="com.lmuze.werewolf.cloud.handler.LocalDataConsumer"></bean>
    
    <!--定义queue -->
    <rabbit:queue name="local_data_queue" durable="true" auto-delete="false" exclusive="false" declared-by="connectAdmin" />
	
    <!-- 监听器 -->
    <rabbit:listener-container connection-factory="connectionFactory" acknowledge="manual">
        <rabbit:listener queues="local_data_queue" ref="localDataConsumer" />
    </rabbit:listener-container>
	<rabbit:direct-exchange name="localDataExchange" durable="true" auto-delete="false" declared-by="connectAdmin">
        <rabbit:bindings>
            <rabbit:binding queue="local_data_queue" key="localData"></rabbit:binding>
        </rabbit:bindings>
    </rabbit:direct-exchange>
</beans>

云服务器本地数据消费者 LocalDataConsumer.java

package com.lmuze.werewolf.cloud.handler;

import java.io.UnsupportedEncodingException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import com.rabbitmq.client.Channel;


public class LocalDataConsumer implements ChannelAwareMessageListener{

	private Logger logger = LoggerFactory.getLogger(LocalDataConsumer.class);

	@Override
	public void onMessage(Message arg0, Channel arg1) throws Exception {
		try {
			logger.info("上传数据 -> {}",new String(arg0.getBody(),"utf-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}finally{
			logger.info("确认操作!");
			arg1.basicAck(arg0.getMessageProperties().getDeliveryTag(), false);
		}
	}
	

}

云服务器本地数据消费者 InstructionsConsumer.java

package com.lmuze.werewolf.local.handler;

import java.io.UnsupportedEncodingException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import com.alibaba.fastjson.JSON;
import com.lmuze.werewolf.common.model.Instruct;
import com.lmuze.werewolf.common.utils.SpringContextUtil;
import com.lmuze.werewolf.local.handler.socket.SocketServiceHandler;
import com.lmuze.werewolf.local.model.HardwareDevice;
import com.lmuze.werewolf.local.model.HardwareLampshade;
import com.lmuze.werewolf.local.model.OrganizationTable;
import com.lmuze.werewolf.local.model.dto.UserInfoDto;
import com.lmuze.werewolf.local.service.IHardwareLampshadeService;
import com.lmuze.werewolf.local.service.IHardwareTableDeviceService;
import com.lmuze.werewolf.local.service.IOrganizationTableService;
import com.lmuze.werewolf.local.service.IUserInfoService;
import com.rabbitmq.client.Channel;


public class InstructionsConsumer implements ChannelAwareMessageListener{

	private Logger logger = LoggerFactory.getLogger(InstructionsConsumer.class);
	
	private IHardwareTableDeviceService hardwareTableDeviceServiceImpl;
	
	private IOrganizationTableService organizationTableServiceImpl;
	
	private IUserInfoService userInfoServiceImpl;
	
	private IHardwareLampshadeService hardwareLampshadeServiceImpl;
	
	@SuppressWarnings("unused")
	private void init(){
		hardwareTableDeviceServiceImpl = (IHardwareTableDeviceService) SpringContextUtil.getBean("hardwareTableDeviceServiceImpl");
		organizationTableServiceImpl = (IOrganizationTableService) SpringContextUtil.getBean("organizationTableServiceImpl");
		userInfoServiceImpl = (IUserInfoService) SpringContextUtil.getBean("userInfoServiceImpl");
		hardwareLampshadeServiceImpl = (IHardwareLampshadeService) SpringContextUtil.getBean("hardwareLampshadeServiceImpl");
	}

	@Override
	public void onMessage(Message msg, Channel channel) throws Exception {
		try {
			Instruct instruct = JSON.parseObject(new String(msg.getBody(),"utf-8"), Instruct.class);
			// 用户扫码
			if (Instruct.PLAYER_SCAN.compareTo(instruct.getType()) == 0) {
				// 灯罩设备
				UserInfoDto user = JSON.parseObject(instruct.getData(), UserInfoDto.class);
				// 保存更新用户信息
				this.userInfoServiceImpl.saveUserInfo(user);
				// 根据灯罩设备找到对应绑定桌子属性
				OrganizationTable table = this.hardwareTableDeviceServiceImpl.getTableByLampshadeId(user.getLampLampshadeId());
				if (table == null) {
					logger.error("灯罩{}没有绑定桌子!", user.getLampLampshadeId());
					return;
				}
				// 根据灯罩找对应的灯信息
				HardwareDevice lamp =  this.hardwareTableDeviceServiceImpl.getLampByLampshadeId(user.getLampLampshadeId());
				if (lamp == null) {
					logger.error("灯罩{}没有绑定底座!", user.getLampLampshadeId());
					return;
				}
				// 根据桌子找到对应的播报设备
				HardwareDevice playDevice = this.organizationTableServiceImpl.queryHardwareDeviceByTableId(table.getTableId());
				if (playDevice == null) {
					logger.error("桌子{}没有绑定播报设备!", table.getTableId());
					return;
				}
				if (SocketServiceHandler.getManager(table.getTableId()) == null) {
					logger.error("播报设备尚未连接!", playDevice.getDeviceId());
					return;
				}
				HardwareLampshade lampShade = this.hardwareLampshadeServiceImpl.queryHardwareLampshadeById(user.getLampLampshadeId());
				SocketServiceHandler.getManager(table.getTableId()).playerScan(user,lampShade,lamp);
			}
//			logger.info("亮灯操作 -> {}",);
		} catch (UnsupportedEncodingException e) {
			logger.error("操作失败", e);
		}finally{
			logger.info("确认操作!");
			channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
		}
	}
	

}

本地端 spring-rabbitmq.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context"
             xmlns:util="http://www.springframework.org/schema/util"
             xmlns:rabbit="http://www.springframework.org/schema/rabbit"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                     http://www.springframework.org/schema/context
                     http://www.springframework.org/schema/context/spring-context-3.0.xsd
				     http://www.springframework.org/schema/util
				     http://www.springframework.org/schema/util/spring-util-3.0.xsd
                     http://www.springframework.org/schema/rabbit  
					 http://www.springframework.org/schema/rabbit/spring-rabbit-1.2.xsd">
	
    <bean class="com.lmuze.werewolf.common.extend.property.CustomPropertyConfigurer">
		<property name="configName" value="[生产环境rabbitmq配置文件(优先级:2)]" />
		<property name="location" value="file:C:\app\config\rabbitmq.properties" />
		<property name="ignoreResourceNotFound" value="true" />
		<property name="order" value="2" />
		<property name="ignoreUnresolvablePlaceholders" value="true" />
	</bean>

    <bean class="com.lmuze.werewolf.common.extend.property.CustomPropertyConfigurer">  
        <property name="configName" value="[默认rabbitmq配置文件(优先级:9)]"/>
        <!-- file:/app/... -->
        <!-- <property name="ignoreResourceNotFound" value="true"/> -->
        <property name="location" value="classpath:properties/rabbitmq.properties"/>  
        <property name="order" value="9"/>
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
    </bean>
	
	<util:map id="mqProperties" map-class="java.util.HashMap"  key-type="java.lang.String" value-type="java.lang.String">
		<entry key="mq.shopid" value="${mq.shopid}"></entry>
	</util:map>
		 
	<rabbit:connection-factory id="connectionFactory" username="${mq.username}" password="${mq.password}" host="${mq.host}" port="${mq.port}" />

	<!--通过指定下面的admin信息,当前producer中的exchange和queue会在rabbitmq服务器上自动生成 -->
    <rabbit:admin id="connectAdmin" connection-factory="connectionFactory" />



	<!-- 本地接受云服务器消息所用队列 -->
    <!--定义queue -->
    <rabbit:queue name="${mq.shopid}_queue" durable="true" auto-delete="false" exclusive="false" declared-by="connectAdmin" />
    
    <rabbit:direct-exchange name="instructionsExchange" durable="true" auto-delete="false" declared-by="connectAdmin">
        <rabbit:bindings>
            <rabbit:binding queue="${mq.shopid}_queue" key="${mq.shopid}"></rabbit:binding>
        </rabbit:bindings>
    </rabbit:direct-exchange>
    
    <!-- 指令接收器 -->
    <bean id="instructionsConsumer" class="com.lmuze.werewolf.local.handler.InstructionsConsumer" init-method="init"></bean>
    
    <!-- 监听器 -->
    <rabbit:listener-container connection-factory="connectionFactory" acknowledge="manual">
        <rabbit:listener queues="${mq.shopid}_queue" ref="instructionsConsumer" />
    </rabbit:listener-container>
    
    
    
    <!--本地发送到云服务器所用队列-->  
	<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" exchange="localDataExchange" />
    
    <bean id="localDataProducer" class="com.lmuze.werewolf.local.handler.LocalDataProducer">
    	<property name="amqpTemplate" ref="amqpTemplate"/>
    </bean>
    
</beans>

本地端生产者InstructionsConsumer.java

package com.lmuze.werewolf.local.handler;

import java.io.UnsupportedEncodingException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import com.alibaba.fastjson.JSON;
import com.lmuze.werewolf.common.model.Instruct;
import com.lmuze.werewolf.common.utils.SpringContextUtil;
import com.lmuze.werewolf.local.handler.socket.SocketServiceHandler;
import com.lmuze.werewolf.local.model.HardwareDevice;
import com.lmuze.werewolf.local.model.HardwareLampshade;
import com.lmuze.werewolf.local.model.OrganizationTable;
import com.lmuze.werewolf.local.model.dto.UserInfoDto;
import com.lmuze.werewolf.local.service.IHardwareLampshadeService;
import com.lmuze.werewolf.local.service.IHardwareTableDeviceService;
import com.lmuze.werewolf.local.service.IOrganizationTableService;
import com.lmuze.werewolf.local.service.IUserInfoService;
import com.rabbitmq.client.Channel;


public class InstructionsConsumer implements ChannelAwareMessageListener{

	private Logger logger = LoggerFactory.getLogger(InstructionsConsumer.class);
	
	private IHardwareTableDeviceService hardwareTableDeviceServiceImpl;
	
	private IOrganizationTableService organizationTableServiceImpl;
	
	private IUserInfoService userInfoServiceImpl;
	
	private IHardwareLampshadeService hardwareLampshadeServiceImpl;
	
	@SuppressWarnings("unused")
	private void init(){
		hardwareTableDeviceServiceImpl = (IHardwareTableDeviceService) SpringContextUtil.getBean("hardwareTableDeviceServiceImpl");
		organizationTableServiceImpl = (IOrganizationTableService) SpringContextUtil.getBean("organizationTableServiceImpl");
		userInfoServiceImpl = (IUserInfoService) SpringContextUtil.getBean("userInfoServiceImpl");
		hardwareLampshadeServiceImpl = (IHardwareLampshadeService) SpringContextUtil.getBean("hardwareLampshadeServiceImpl");
	}

	@Override
	public void onMessage(Message msg, Channel channel) throws Exception {
		try {
			Instruct instruct = JSON.parseObject(new String(msg.getBody(),"utf-8"), Instruct.class);
			// 用户扫码
			if (Instruct.PLAYER_SCAN.compareTo(instruct.getType()) == 0) {
				// 灯罩设备
				UserInfoDto user = JSON.parseObject(instruct.getData(), UserInfoDto.class);
				// 保存更新用户信息
				this.userInfoServiceImpl.saveUserInfo(user);
				// 根据灯罩设备找到对应绑定桌子属性
				OrganizationTable table = this.hardwareTableDeviceServiceImpl.getTableByLampshadeId(user.getLampLampshadeId());
				if (table == null) {
					logger.error("灯罩{}没有绑定桌子!", user.getLampLampshadeId());
					return;
				}
				// 根据灯罩找对应的灯信息
				HardwareDevice lamp =  this.hardwareTableDeviceServiceImpl.getLampByLampshadeId(user.getLampLampshadeId());
				if (lamp == null) {
					logger.error("灯罩{}没有绑定底座!", user.getLampLampshadeId());
					return;
				}
				// 根据桌子找到对应的播报设备
				HardwareDevice playDevice = this.organizationTableServiceImpl.queryHardwareDeviceByTableId(table.getTableId());
				if (playDevice == null) {
					logger.error("桌子{}没有绑定播报设备!", table.getTableId());
					return;
				}
				if (SocketServiceHandler.getManager(table.getTableId()) == null) {
					logger.error("播报设备尚未连接!", playDevice.getDeviceId());
					return;
				}
				HardwareLampshade lampShade = this.hardwareLampshadeServiceImpl.queryHardwareLampshadeById(user.getLampLampshadeId());
				SocketServiceHandler.getManager(table.getTableId()).playerScan(user,lampShade,lamp);
			}
//			logger.info("亮灯操作 -> {}",);
		} catch (UnsupportedEncodingException e) {
			logger.error("操作失败", e);
		}finally{
			logger.info("确认操作!");
			channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
		}
	}
	

}

本地消费InstructionsConsumer.java

package com.lmuze.werewolf.local.handler;

import java.io.UnsupportedEncodingException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import com.alibaba.fastjson.JSON;
import com.lmuze.werewolf.common.model.Instruct;
import com.lmuze.werewolf.common.utils.SpringContextUtil;
import com.lmuze.werewolf.local.handler.socket.SocketServiceHandler;
import com.lmuze.werewolf.local.model.HardwareDevice;
import com.lmuze.werewolf.local.model.HardwareLampshade;
import com.lmuze.werewolf.local.model.OrganizationTable;
import com.lmuze.werewolf.local.model.dto.UserInfoDto;
import com.lmuze.werewolf.local.service.IHardwareLampshadeService;
import com.lmuze.werewolf.local.service.IHardwareTableDeviceService;
import com.lmuze.werewolf.local.service.IOrganizationTableService;
import com.lmuze.werewolf.local.service.IUserInfoService;
import com.rabbitmq.client.Channel;


public class InstructionsConsumer implements ChannelAwareMessageListener{

	private Logger logger = LoggerFactory.getLogger(InstructionsConsumer.class);
	
	private IHardwareTableDeviceService hardwareTableDeviceServiceImpl;
	
	private IOrganizationTableService organizationTableServiceImpl;
	
	private IUserInfoService userInfoServiceImpl;
	
	private IHardwareLampshadeService hardwareLampshadeServiceImpl;
	
	@SuppressWarnings("unused")
	private void init(){
		hardwareTableDeviceServiceImpl = (IHardwareTableDeviceService) SpringContextUtil.getBean("hardwareTableDeviceServiceImpl");
		organizationTableServiceImpl = (IOrganizationTableService) SpringContextUtil.getBean("organizationTableServiceImpl");
		userInfoServiceImpl = (IUserInfoService) SpringContextUtil.getBean("userInfoServiceImpl");
		hardwareLampshadeServiceImpl = (IHardwareLampshadeService) SpringContextUtil.getBean("hardwareLampshadeServiceImpl");
	}

	@Override
	public void onMessage(Message msg, Channel channel) throws Exception {
		try {
			Instruct instruct = JSON.parseObject(new String(msg.getBody(),"utf-8"), Instruct.class);
			// 用户扫码
			if (Instruct.PLAYER_SCAN.compareTo(instruct.getType()) == 0) {
				// 灯罩设备
				UserInfoDto user = JSON.parseObject(instruct.getData(), UserInfoDto.class);
				// 保存更新用户信息
				this.userInfoServiceImpl.saveUserInfo(user);
				// 根据灯罩设备找到对应绑定桌子属性
				OrganizationTable table = this.hardwareTableDeviceServiceImpl.getTableByLampshadeId(user.getLampLampshadeId());
				if (table == null) {
					logger.error("灯罩{}没有绑定桌子!", user.getLampLampshadeId());
					return;
				}
				// 根据灯罩找对应的灯信息
				HardwareDevice lamp =  this.hardwareTableDeviceServiceImpl.getLampByLampshadeId(user.getLampLampshadeId());
				if (lamp == null) {
					logger.error("灯罩{}没有绑定底座!", user.getLampLampshadeId());
					return;
				}
				// 根据桌子找到对应的播报设备
				HardwareDevice playDevice = this.organizationTableServiceImpl.queryHardwareDeviceByTableId(table.getTableId());
				if (playDevice == null) {
					logger.error("桌子{}没有绑定播报设备!", table.getTableId());
					return;
				}
				if (SocketServiceHandler.getManager(table.getTableId()) == null) {
					logger.error("播报设备尚未连接!", playDevice.getDeviceId());
					return;
				}
				HardwareLampshade lampShade = this.hardwareLampshadeServiceImpl.queryHardwareLampshadeById(user.getLampLampshadeId());
				SocketServiceHandler.getManager(table.getTableId()).playerScan(user,lampShade,lamp);
			}
//			logger.info("亮灯操作 -> {}",);
		} catch (UnsupportedEncodingException e) {
			logger.error("操作失败", e);
		}finally{
			logger.info("确认操作!");
			channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
		}
	}
	

}

本地数据生产者LocalDataProducer.java

package com.lmuze.werewolf.local.handler;

import java.io.UnsupportedEncodingException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import com.alibaba.fastjson.JSON;
import com.lmuze.werewolf.common.model.Instruct;
import com.lmuze.werewolf.common.utils.SpringContextUtil;
import com.lmuze.werewolf.local.handler.socket.SocketServiceHandler;
import com.lmuze.werewolf.local.model.HardwareDevice;
import com.lmuze.werewolf.local.model.HardwareLampshade;
import com.lmuze.werewolf.local.model.OrganizationTable;
import com.lmuze.werewolf.local.model.dto.UserInfoDto;
import com.lmuze.werewolf.local.service.IHardwareLampshadeService;
import com.lmuze.werewolf.local.service.IHardwareTableDeviceService;
import com.lmuze.werewolf.local.service.IOrganizationTableService;
import com.lmuze.werewolf.local.service.IUserInfoService;
import com.rabbitmq.client.Channel;


public class InstructionsConsumer implements ChannelAwareMessageListener{

	private Logger logger = LoggerFactory.getLogger(InstructionsConsumer.class);
	
	private IHardwareTableDeviceService hardwareTableDeviceServiceImpl;
	
	private IOrganizationTableService organizationTableServiceImpl;
	
	private IUserInfoService userInfoServiceImpl;
	
	private IHardwareLampshadeService hardwareLampshadeServiceImpl;
	
	@SuppressWarnings("unused")
	private void init(){
		hardwareTableDeviceServiceImpl = (IHardwareTableDeviceService) SpringContextUtil.getBean("hardwareTableDeviceServiceImpl");
		organizationTableServiceImpl = (IOrganizationTableService) SpringContextUtil.getBean("organizationTableServiceImpl");
		userInfoServiceImpl = (IUserInfoService) SpringContextUtil.getBean("userInfoServiceImpl");
		hardwareLampshadeServiceImpl = (IHardwareLampshadeService) SpringContextUtil.getBean("hardwareLampshadeServiceImpl");
	}

	@Override
	public void onMessage(Message msg, Channel channel) throws Exception {
		try {
			Instruct instruct = JSON.parseObject(new String(msg.getBody(),"utf-8"), Instruct.class);
			// 用户扫码
			if (Instruct.PLAYER_SCAN.compareTo(instruct.getType()) == 0) {
				// 灯罩设备
				UserInfoDto user = JSON.parseObject(instruct.getData(), UserInfoDto.class);
				// 保存更新用户信息
				this.userInfoServiceImpl.saveUserInfo(user);
				// 根据灯罩设备找到对应绑定桌子属性
				OrganizationTable table = this.hardwareTableDeviceServiceImpl.getTableByLampshadeId(user.getLampLampshadeId());
				if (table == null) {
					logger.error("灯罩{}没有绑定桌子!", user.getLampLampshadeId());
					return;
				}
				// 根据灯罩找对应的灯信息
				HardwareDevice lamp =  this.hardwareTableDeviceServiceImpl.getLampByLampshadeId(user.getLampLampshadeId());
				if (lamp == null) {
					logger.error("灯罩{}没有绑定底座!", user.getLampLampshadeId());
					return;
				}
				// 根据桌子找到对应的播报设备
				HardwareDevice playDevice = this.organizationTableServiceImpl.queryHardwareDeviceByTableId(table.getTableId());
				if (playDevice == null) {
					logger.error("桌子{}没有绑定播报设备!", table.getTableId());
					return;
				}
				if (SocketServiceHandler.getManager(table.getTableId()) == null) {
					logger.error("播报设备尚未连接!", playDevice.getDeviceId());
					return;
				}
				HardwareLampshade lampShade = this.hardwareLampshadeServiceImpl.queryHardwareLampshadeById(user.getLampLampshadeId());
				SocketServiceHandler.getManager(table.getTableId()).playerScan(user,lampShade,lamp);
			}
//			logger.info("亮灯操作 -> {}",);
		} catch (UnsupportedEncodingException e) {
			logger.error("操作失败", e);
		}finally{
			logger.info("确认操作!");
			channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
		}
	}
	

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值