package com.chinacreator.process.job;

import java.net.URLEncoder;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.log4j.Logger;
import com.chinacreator.common.exception.BusinessException;
import com.chinacreator.common.util.DESUtil;
import com.chinacreator.common.util.MD5;
import com.chinacreator.common.util.URLUtil;
import com.chinacreator.process.bean.ActivityConfigBean;
import com.chinacreator.process.bean.AreaInfo;
import com.chinacreator.process.bean.CPInfo;
import com.chinacreator.process.bean.LogBean;
import com.chinacreator.process.bean.OrderBean;
import com.chinacreator.process.dao.ActivityConfigDao;
import com.chinacreator.process.dao.BlackWhiteDao;
import com.chinacreator.process.dao.CPDao;
import com.chinacreator.process.dao.CallerAreacodeDao;
import com.chinacreator.process.dao.DictionaryDao;
import com.chinacreator.process.dao.OrderSendVipDao;
import com.chinacreator.process.dao.SPDao;
import com.chinacreator.process.service.ActivityHandleService;
import com.chinacreator.process.service.AqiyMonthOrderService;
import com.chinacreator.process.service.AqiyOrderService;
import com.chinacreator.process.service.BestvOrderService;
import com.chinacreator.process.service.CctvOrderService;
import com.chinacreator.process.service.ComOrderService;
import com.chinacreator.process.service.FhGoodsHandleService;
import com.chinacreator.process.service.YoutuOrderService;
import com.chinacreator.process.util.JsonUtil;
import com.chinacreator.video.queue.MessageService;
import com.chinacreator.video.queue.bean.MessagePipe;

/**
 * 生成活动关系公共服务类
 * @author xu.zhou
 * 20210610
 */
public class ReciveMQService  implements Runnable {
	
    private Logger log = Logger.getLogger("recivemq");

    private Logger sendviplog = Logger.getLogger("ordersendvip");
	
	private OrderBean orderBean;
	
    private SPDao spDao;

    private CPDao cpDao;
	
	private BlackWhiteDao blackWhiteDao;
	
	private CallerAreacodeDao callerAreacodeDao;
	
	private ActivityConfigDao activityConfigDao;
	
	private DictionaryDao dictionaryDao;
	
	private FhGoodsHandleService fhGoodsHandleService;
	
    private ComOrderService comOrderService;

    private BestvOrderService bestvOrderService;

    private CctvOrderService cctvOrderService;

    private AqiyOrderService aqiyOrderService;

    private AqiyMonthOrderService aqiyMonthOrderService;

    private ActivityHandleService activityHandleService;
    
    private YoutuOrderService youtuOrderService;

    private OrderSendVipDao orderSendVipDao;
    
    private CountDownLatch threadSignal;
    
    private int totalSize;
    
    private String mqname;
    
    private MessageService messageService;
    
    /**
     * 
     * @param _orderBean
     * @param _blackWhiteDao
     * @param _callerAreacodeDao
     * @param _activityConfigDao
     * @param _orderSendVipDao
     * @param _spDao
     * @param _cpDao
     * @param _dictionaryDao
     * @param _fhGoodsHandleService
     * @param _comOrderService
     * @param _bestvOrderService
     * @param _cctvOrderService
     * @param _aqiyOrderService
     * @param _aqiyMonthOrderService
     * @param _activityHandleService
     * @param _youtuOrderService
     * @param _threadSignal
     */
	public ReciveMQService(OrderBean _orderBean, BlackWhiteDao _blackWhiteDao, CallerAreacodeDao _callerAreacodeDao,
			ActivityConfigDao _activityConfigDao, OrderSendVipDao _orderSendVipDao, 
			SPDao _spDao, CPDao _cpDao, DictionaryDao _dictionaryDao, 
			FhGoodsHandleService _fhGoodsHandleService,
			ComOrderService _comOrderService, BestvOrderService _bestvOrderService,
			CctvOrderService _cctvOrderService,AqiyOrderService _aqiyOrderService,
			AqiyMonthOrderService _aqiyMonthOrderService, ActivityHandleService _activityHandleService,
			YoutuOrderService _youtuOrderService, CountDownLatch _threadSignal, String _mqname,
			MessageService _messageService){
		
		this.orderBean = _orderBean;
		this.spDao = _spDao;
		this.cpDao = _cpDao;
		this.blackWhiteDao = _blackWhiteDao;
		this.callerAreacodeDao = _callerAreacodeDao;
		this.activityConfigDao = _activityConfigDao;
		this.dictionaryDao = _dictionaryDao;
		
		this.fhGoodsHandleService = _fhGoodsHandleService;
		this.comOrderService = _comOrderService;
		this.bestvOrderService = _bestvOrderService;
		this.cctvOrderService = _cctvOrderService;
		this.aqiyOrderService = _aqiyOrderService;
		this.aqiyMonthOrderService = _aqiyMonthOrderService;
		this.activityHandleService = _activityHandleService;
		this.youtuOrderService = _youtuOrderService;
		this.orderSendVipDao = _orderSendVipDao;
		
		this.threadSignal = _threadSignal;		
		//this.totalSize = _totalSize;
		this.mqname = _mqname;
		this.messageService = _messageService;
	}

	public void run() {
		long startime = System.currentTimeMillis();
		LogBean logBean = new LogBean();
        try {
            logBean.setUserid(orderBean.getUserid());          
            if (StringUtils.isEmpty(orderBean.getProvince())) {
                AreaInfo areaInfo = callerAreacodeDao.findByCallerhead(orderBean.getUserid().substring(0, 7));
                if (areaInfo != null) {
                    orderBean.setProvince(areaInfo.getProvince());
                    orderBean.setArea(areaInfo.getArea());
                }
            }
            ActivityConfigBean activityConfigBean = activityConfigDao
                    .findByCallerhead(orderBean.getCpid(),
                            orderBean.getSpid(), orderBean.getProvince());
            if (activityConfigBean == null) {
                throw new BusinessException("9030", "非活动产品或者活动结束");
            }
            //设置ActiveType
            orderBean.setActiveType(activityConfigBean.getActiveType());
            //设置处理活动关系入口
            orderBean.setActivehandle(activityConfigBean.getActivehandle());
            if (blackWhiteDao.isWhite(orderBean.getUserid())) {//是白名单
                orderBean.setIsWhite(0);
            } else {
                orderBean.setIsWhite(1);
            }
            if (orderBean.getOrderType().equals("0")) {
                if ((NumberUtils.toLong(orderBean.getUpdateTime()) < NumberUtils
                        .toLong(activityConfigBean.getBegintime()) || NumberUtils
                        .toLong(orderBean.getUpdateTime()) > NumberUtils
                        .toLong(activityConfigBean.getEndtime()))
                        && (orderBean.getIsWhite() == 1)) {
                    throw new BusinessException("9031", "非活动产品或者活动结束");
                }
            } else {
                if ((NumberUtils.toLong(orderBean.getUpdateTime()) < NumberUtils
                        .toLong(activityConfigBean.getBegintime()) || NumberUtils
                        .toLong(orderBean.getUpdateTime()) > NumberUtils
                        .toLong(activityConfigBean.getCancelendtime()))
                        && (orderBean.getIsWhite() == 1)) {
                    throw new BusinessException("9032", "非活动产品或者活动结束");
                }
            }

            //获取子业务数据
            List<OrderBean> subOrderList = this.getSubPorduct(orderBean);
            if (subOrderList != null && subOrderList.size() > 0) {
                for (OrderBean bean : subOrderList) {//逐个处理
                    commUpdateHandle(bean);
                }
            } else {
                commUpdateHandle(orderBean);
            }
        } catch (Exception e) {
            if (e instanceof BusinessException) {
                logBean.setErrorInfo(e.getMessage());
                logBean.setResultCode(((BusinessException) e).getCode());
            }else{
                logBean.setErrorInfo("系统错误");
                logBean.setResultCode("8000");
            	e.printStackTrace();
                log.error("执行出错：" + logBean.getUserid() + "=>" + e);
            }
        } finally {
        	threadSignal.countDown();
        	logBean.setInputParm(JsonUtil.objectToJson(orderBean));
            log.info(mqname+"=>"+JsonUtil.objectToJson(logBean)+"，times："+(System.currentTimeMillis()-startime));
            this.updBusshandleWaitData(orderBean, logBean.getResultCode(), logBean.getErrorInfo());
        }
	}
	
	/**
	 * 更新处理状态
	 * @param orderBean
	 * @param resultcode
	 * @param errorinfo
	 */
	private void updBusshandleWaitData(OrderBean orderBean, String resultcode, String errorinfo){
		try {
			if(!StringUtils.isEmpty(orderBean.getWaitid())){
				if(errorinfo != null && errorinfo.length()>250) errorinfo = errorinfo.substring(0, 250);
				boolean res = orderSendVipDao.updBusshandleWaitData(orderBean.getWaitid(), resultcode, errorinfo);
				log.info("userid=>"+orderBean.getUserid()+"，waitid=>"+orderBean.getWaitid()+"更新数据状态结果，"+res);
			}
		} catch (Exception e) {
			log.error("userid=>"+orderBean.getUserid()+"，waitid=>"+orderBean.getWaitid()+"，更新数据状态出现异常，"+e.getMessage());
		}
	}
	
    /**
     * 判断是否复合产品，获取可赠送会员的子业务列表
     *
     * @param orderBean
     * @return
     * @throws Exception
     */
    private List<OrderBean> getSubPorduct(OrderBean orderBean) throws Exception {
        List<OrderBean> resultData = new ArrayList<OrderBean>();
        try {
            //查询是否复合产品
            List<HashMap> fhGoods = spDao.getFhGoods(orderBean.getSpid());
            if (fhGoods.size() > 0) {//复合产品
                log.info(orderBean.getUserid()+"=>"+orderBean.getSpid()+"=>是复合产品");
                //获取子业务列表
                List<HashMap> reList = spDao.getSubSpInfo(orderBean.getSpid());
                if (reList != null && reList.size() > 0) {
                    log.info(orderBean.getCpid() + ">>>" + orderBean.getSpid() + ",子业务数据条数为：" + reList.size());
                    for (HashMap hm : reList) {//遍历子业务列表
                        resultData.add(cloneBean(orderBean, hm.get("CPID") + "", hm.get("SPID") + ""));
                        log.info("要处理的子业务：" + hm.get("CPID") + ">>>" + hm.get("SPID"));
                    }
                } else {
                    throw new BusinessException("9061", "复合产品无子业务配置");
                }
                //log.info("要处理的子业务条数：" + resultData.size());
            } else {//非复合产品
            	log.info(orderBean.getUserid()+"=>"+orderBean.getSpid()+"=>不是复合产品");
            }
        } catch (SQLException e) {
            throw new BusinessException("9060", "查询子产品出现异常，" + e.getMessage());
        }
        return resultData;
    }
    
    /**
     * 克隆对象
     * @param orderBean
     * @param subCpid   子产品CPID
     * @param subSpid   子产品SPID
     * @return
     */
    private OrderBean cloneBean(OrderBean orderBean, String subCpid, String subSpid) {
        OrderBean bean = new OrderBean();
        bean.setFhcpid(orderBean.getCpid());
        bean.setFhspid(orderBean.getSpid());
        bean.setCpid(subCpid);
        bean.setSpid(subSpid);
        bean.setUserid(orderBean.getUserid());
        bean.setOrderType(orderBean.getOrderType());
        bean.setOrderstatus(orderBean.getOrderType());
        bean.setProvince(orderBean.getProvince());
        bean.setArea(orderBean.getArea());
        bean.setUpdateTime(orderBean.getUpdateTime());
        bean.setActivated(orderBean.getActivated());

        if ("0".equals(orderBean.getOrderType())) {//y订购
            bean.setOrderchannel(orderBean.getChannel());
            bean.setOrdertime(orderBean.getUpdateTime());
            bean.setOrderstatus("0");
        } else {//退订
            bean.setCanceltime(orderBean.getUpdateTime());
            bean.setCancelchannel(orderBean.getChannel());
            bean.setOrderstatus("1");
        }

        //使用复合产品的activeType
        bean.setActiveType(orderBean.getActiveType());

        return bean;
    }
	
    /**
     * 真正业务处理
     * @param orderBean
     * @throws Exception
     */
    private void commUpdateHandle(OrderBean orderBean) throws Exception {
        //添加订购关系是否有异常
        boolean haserror = false;
        try {
            //是复合产品
            if (!StringUtils.isEmpty(orderBean.getFhcpid()) && !StringUtils.isEmpty(orderBean.getFhspid())) {
                //复合产品不重设activeType，走专用通道
                fhGoodsHandleService.handle(orderBean);
            } else {//非复合产品
                //这部分代码不方便去除，因为TB_ACTIVITY_CONFIG表同样的SPID和CPID但ActiveType值可能不一样，比如leshilt952
                if (orderBean.getCpid().equals("bestv") && orderBean.getSpid().equals("980")) {
                    orderBean.setActiveType(4);
                } else if (orderBean.getCpid().equals("changshi") && orderBean.getSpid().equals("1150")) {
                    orderBean.setActiveType(5);
                } else if (orderBean.getCpid().equals("cctv") && orderBean.getSpid().equals("10081")) {
                    orderBean.setActiveType(8);
                } else if (orderBean.getCpid().equals("aiqy") && orderBean.getSpid().equals("1017")) {
                    //orderBean.setActiveType(9);
                } else if (orderBean.getCpid().equals("leshilt") && orderBean.getSpid().equals("952")) {
                    orderBean.setActiveType(13);
                } else if (orderBean.getCpid().equals("aiqy") && orderBean.getSpid().equals("1018")) {
                    orderBean.setActiveType(20);
                }
                
                //生成活动关系入口配置信息
                String activehandle = orderBean.getActivehandle();
                //20210802生成活动关系入口改为配置化
                if(!StringUtils.isEmpty(activehandle)){
                    if(activehandle.indexOf("bestvOrderService") != -1){
                        if (orderBean.getOrderType().equals("0")) {//订购
                            bestvOrderService.order(orderBean);
                        } else {//退订
                            bestvOrderService.cancel(orderBean);
                        }
                    }else  if(activehandle.indexOf("cctvOrderService") != -1){
                    	 cctvOrderService.handle(orderBean);
                    //一般都走这个处理入口
                    }else  if(activehandle.indexOf("aqiyOrderService") != -1){
                    	aqiyOrderService.handle(orderBean);
                    //生成活动关系后要赠送流量的走这个入口
                    }else  if(activehandle.indexOf("youtuOrderService") != -1){
                    	youtuOrderService.handle(orderBean);
                    }else  if(activehandle.indexOf("aqiyMonthOrderService") != -1){
                    	aqiyMonthOrderService.handle(orderBean);
                    }else  if(activehandle.indexOf("activityHandleService") != -1){
                    	activityHandleService.handle(orderBean);
                    }else {//没配置的或者匹配不上的都走公共通道
                        if (orderBean.getOrderType().equals("0")) {//订购
                            comOrderService.order(orderBean);
                        } else {//退订
                            comOrderService.cancel(orderBean);
                        }
                    }
                }else {
                    if (orderBean.getOrderType().equals("0")) {//订购
                        comOrderService.order(orderBean);
                    } else {//退订
                        comOrderService.cancel(orderBean);
                    }
                }
            }
        } catch (Exception e) {
            haserror = true;
            throw e;
        } finally {
            //添加成功，走实时送会员流程
            if (!haserror) {
            	//根据渠道和SPID送会员，走会员领取接口，如果返回true，代表有会员赠送，不再判断是否有直充赠送。
            	//判断是否要赠送会员
            	if(valisendvip(orderBean)){
                	//推送到队列，异步处理
                	insertSendVipMQ(orderBean,mqname);
            	}
            }
        }
    }
    
    /**
     * 芒果会员直充资格判断
     *
     * @param orderBean
     * @return
     */
    public boolean straightBoolean(OrderBean orderBean) throws Exception {
        log.info("队列数据:" + orderBean.toString());
        try {
            //渠道判断
            String channel = orderBean.getChannel();
            //渠道为空，或不是以WP_开头，不处理
            if (StringUtils.isEmpty(channel) || !channel.startsWith("WP_")) {
                return false;
            }
            String straightTime = dictionaryDao.getValue("straightTime");
            log.info("字典表中获取的数据:" + straightTime);
            String[] split = straightTime.split(",");
            //spid判断
            if (!split[0].equals(orderBean.getSpid())) {
                log.info("芒果会员参数1" + !split[0].equals(orderBean.getSpid()));
                return false;
            }
            //复合产品，验证的是子产品的SPID，不处理
            if (!StringUtils.isEmpty(orderBean.getFhcpid()) && !StringUtils.isEmpty(orderBean.getFhspid())) {
            	return false;
            }
            //时间判断
            String[] time = split[1].split("\\|");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
            long startTime = sdf.parse(time[0]).getTime();
            long endTime = sdf.parse(time[1]).getTime();
            long nowTime = sdf.parse(orderBean.getUpdateTime()).getTime();
            if (nowTime < startTime || nowTime > endTime) {

                log.info("芒果会员参数2" + (nowTime < startTime || nowTime > endTime));
                return false;
            }
            log.info("芒果会员参数3" + "0".equals(orderBean.getOrderType()));
            //判断是否订购
            return "0".equals(orderBean.getOrderType());
        } catch (Exception e) {
            log.info("芒果活动会员直充出错");
            e.printStackTrace();
            return false;
        }

    }
    
    /**
     * 判断是否要赠送会员
     * @param orderBean
     * @return
     */
    private boolean valisendvip(OrderBean orderBean){
    	//是否可以赠送会员
    	boolean hassend = false;
    	//不能赠送会员原因
    	String errorInfo = "";
        try {
			//复合产品，生成活动关系时是每个子业务一条活动关系，验证的是子产品的SPID，不处理
			if (!StringUtils.isEmpty(orderBean.getFhcpid()) && !StringUtils.isEmpty(orderBean.getFhspid())) {
				throw new BusinessException("5005", "复合产品不参与赠送");
			}
			//验证开始
			String userid = orderBean.getUserid();
			String cpid = orderBean.getCpid();
			String spid = orderBean.getSpid();
			//获取所有赠送配置
			List<HashMap> confList = orderSendVipDao.qryOrderSendvipAllConf(cpid, spid);
			if(confList != null && confList.size()>0){
				//当前时间
	            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
	            String currtime = sdf.format(new Date()); //当前时间
	            String orderchannel = orderBean.getOrderchannel();
	            //手厅传的渠道标识与订购疯关系表不相同
	            String channel = orderBean.getChannel();
	            String ordertime = ""; //订购时间
	            String subchannel = ""; //子渠道标识
	            //根据手机号码和SPID获取订购关系
                List<HashMap> orderList = orderSendVipDao.findOrderRel(userid, spid);
                if (orderList != null && orderList.size() > 0) {
                    HashMap orderMap = orderList.get(0);
                    if ("2".equals(orderMap.get("STATUS"))){
                    	throw new BusinessException("5005", "订购关系已失效");
                    }
                    
                    ordertime = orderMap.get("ORDERTIME").toString();
                    subchannel = (String)orderMap.get("ORDERCHANNEL2");
                    //设置子渠道标识
                    orderBean.setSubchannel(subchannel == null ? "" : subchannel);
                    
                    if(!StringUtils.isEmpty(orderchannel) && !StringUtils.isEmpty(channel) 
                    		&& !orderchannel.equals(orderMap.get("ORDERCHANNEL"))                   		
                    		&& !channel.equals(orderMap.get("ORDERCHANNEL"))){
                    	throw new BusinessException("5005", "渠道与订购关系表的渠道不一致，orderchannel=>"+orderchannel);
                    }
                    String confChannel = "";
                    String starttime = "";
                    String endtime = "";
                	//配置的子渠道
                	String subchannelconf = "";
                   // boolean flag = false;
                    //判断订购渠道是否有配置
					for(HashMap confMap : confList){
						hassend = false;
                    	starttime = (String)confMap.get("STARTTIME");
                    	endtime = (String)confMap.get("ENDTIME");
                    	confChannel = confMap.get("CHANNEL").toString().trim();
                    	//配置的子渠道
                    	subchannelconf = (String)confMap.get("SUBCHANNEL");
                    	//订购渠道与配置渠道相同，或者配置渠道不限制
                        if (confChannel.equals(orderchannel) || confChannel.equals(channel) || "*".equals(confChannel)
                        		//配置渠道以指定字符开头且订购渠道是以指定渠道开头，芒果16元      
                        		|| (confChannel.indexOf("*") != -1  && orderchannel != null && orderchannel.indexOf(confChannel.split("\\*")[0]) == 0)
                        		|| (confChannel.indexOf("*") != -1  && channel != null && channel.indexOf(confChannel.split("\\*")[0]) == 0)) {
                        	
                        	/****
                        	 * SENDTYPE会员类型，1走会员领取接口，0走会员直充接口
                        	 * 走会员领取接口，有子渠道配置，且SENDTYPE不为1或者主渠道配置为*或者配置的子渠道与订购关系的子渠道不匹配
                        	 * 20220325，xu.zhou，赠送配置到子渠道级别
                        	 */
                        	if(!StringUtils.isEmpty(subchannelconf) && //有子渠道配置
                        			(
                        					!"1".equals(confMap.get("SENDTYPE")) || //不是领取会员
                        					confChannel.indexOf("*") != -1 || //渠道配置有模糊匹配
                        					!subchannelconf.equals(subchannel) //与订购关系的子渠道不相同
                        			)
                        			){ 
                        		//走会员领取接口，有配置限制子渠道，且订购关系表子渠道为空或者子渠道标识与配置的子渠道标识不相同，不自动送会员
                        		log.info("有子渠道配置，但验证未通过，配置的子渠道"+subchannelconf+"，订购的子渠道"+subchannel+"，主渠道配置"+confChannel+"，赠送类型"+confMap.get("SENDTYPE"));
                        		continue;
                        	}
                        	
                        	/**************************判断时间是否合法开始************************/
                        	//开始时间和结束时间都不为空且当前时间包含在两者之间
                        	if (!StringUtils.isEmpty(starttime) && !StringUtils.isEmpty(endtime)
                        		&& Long.parseLong(currtime) >= Long.parseLong(starttime.trim()) 
                        		&& Long.parseLong(currtime) <= Long.parseLong(endtime.trim())){
                        		hassend = true;
                        	//开始时间不为空，结束时间为空，当前时间大于或等于开始时间
                        	}else if (!StringUtils.isEmpty(starttime) && StringUtils.isEmpty(endtime)
                        			&& Long.parseLong(currtime) >= Long.parseLong(starttime.trim())){
                        		hassend = true;
                        	//开始时间为空，结束时间不为空，当前时间小于或等于结束时间
                        	}else if (StringUtils.isEmpty(starttime) && !StringUtils.isEmpty(endtime)
                        			&& Long.parseLong(currtime) <= Long.parseLong(endtime.trim())){
                        		hassend = true;
                        	//开始时间为空且结束时间也为空
                        	}else if (StringUtils.isEmpty(starttime) && StringUtils.isEmpty(endtime)){
                        		hassend = true;                       		
                        	}
                      	
                        	//验证通过，跳出循环
                        	if(hassend){
                        		errorInfo = "ok";
                        		break;
                        	} 
                        	/**************************判断时间是否合法结束************************/
                        }						
					}
					if(!hassend){
						errorInfo = "渠道或时间验证未通过";
					}
                }else{
                	errorInfo = "订购关系表无数据";
                }
			}else{
				errorInfo = "无有效赠送会员配置信息";
			}		
		} catch (Exception e) {
            if (e instanceof BusinessException) {
            	errorInfo = e.getMessage();
            }else{
            	e.printStackTrace();
            	log.error(orderBean+"，判断是否赠送会员出现异常，"+e.getMessage(), e);
            	errorInfo = "出现异常，"+e.getMessage();
            }			
		}
        
        log.info(orderBean.getUserid()+":"+orderBean.getSpid()+"是否赠送验证结果=>"+hassend + ", 信息=>"+errorInfo);
        
    	return hassend;
    }
    
    /**
     * 自动赠送会员信息推送到redis
     * @param orderBean
     * @param mqname
     */
    private void insertSendVipMQ(OrderBean orderBean, String mqname){
		try{
			MessagePipe mpipe = new MessagePipe();
            //mpipe.setHeader("order");
            //20210610手厅队列改为orderoffline
            mpipe.setHeader("ordersendvip");
			mpipe.addBody("data", JsonUtil.objectToJson(orderBean));
			mpipe.addBody("mqname", mqname);
			this.messageService.sendMessage(mpipe);
			sendviplog.info(orderBean.getUserid()+"，"+orderBean.getSpid()+", mqname："+mqname+"，推送到ordersendvip队列，异步实时赠送会员");
		}catch(Exception e){
			log.error(orderBean.getUserid()+"，"+orderBean.getSpid()+", mqname："+mqname+"，推送ordersendvip队列出现异常，"+e.getMessage());
		}
    }
}
