package cn.cslg.report.common.utils.message;

import cn.cslg.report.common.config.MailConstants;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class MessageUtils {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 向用户邮箱发送短信
     *
     * @param map 所需参数
     */
    public void sendEmailMessage(Map<String, Object> map) {
        rabbitTemplate.convertAndSend(MailConstants.MAIL_EXCHANGE_NAME, MailConstants.MAIL_ROUTING_KEY_NAME, map, new CorrelationData("1"));
    }
}
