package cn.estsh.i3plus.core.apiservice.mq;

import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
import cn.estsh.i3plus.core.apiservice.websocket.MessageWebSocket;
import cn.estsh.i3plus.platform.common.tool.StringTool;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserMessage;
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description : 站内信队列处理
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2018-11-15 22:35
 * @Modify:
 **/
@Component
@RabbitListener(queues = PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK)
public class MessageLetterQueueReceiverHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(MessageLetterQueueReceiverHandler.class);

    @RabbitHandler
    public void handleMessage(byte[] message){
        LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
    }

    @RabbitHandler
    public void handleMessage(String message){
        LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
    }

    @RabbitHandler
    public void handleMessage(SysMessage message){
        LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
        LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功：{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
    }

}
