SendlimitCodeMessageImpl.java 6.22 KB
package com.yoho.message.sdk.service.impl;

import com.yoho.message.sdk.common.constants.MiniAppTypeEnum;
import com.yoho.message.sdk.common.constants.PromotionScenes;
import com.yoho.message.sdk.common.handler.MessageCenterMqHandler;
import com.yoho.message.sdk.common.model.MessageCenterCommonEvent;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
import com.yoho.message.sdk.service.AbstractSendMessage;
import com.yoho.message.sdk.service.ISendLimitCodeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SendlimitCodeMessageImpl extends AbstractSendMessage implements ISendLimitCodeMessage {

    @Autowired
    private MessageCenterMqHandler messageCenterMqHandler;


    @Override
    public SendMessageRspBo queueSuccess(String uid, int miniappType, String productName, String limitProductCode,int queueNumber,String releaseDateTime) {
        MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(PromotionScenes.LIMIT_CODE_QUEUE_SUCCESS,
                String.valueOf(System.currentTimeMillis()), miniappType, uid);
        messageCenterCommonEvent.putInParams("productName",productName);
        messageCenterCommonEvent.putInParams("limitProductCode",limitProductCode);
        messageCenterCommonEvent.putInParams("queueNumber",queueNumber);
        messageCenterCommonEvent.putInParams("releaseDateTime",releaseDateTime);
        messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo prizeSuccess(String uid, int miniappType, String productName, String limitProductCode) {
        MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(PromotionScenes.LIMIT_CODE_PRIZE_SUCCESS,
                String.valueOf(System.currentTimeMillis()), miniappType, uid);
        messageCenterCommonEvent.putInParams("productName",productName);
        messageCenterCommonEvent.putInParams("limitProductCode",limitProductCode);

        messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo prizeFail(String uid, int miniappType,String productName, String limitProductCode) {
        MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(PromotionScenes.LIMIT_CODE_PRIZE_FAIL,
                String.valueOf(System.currentTimeMillis()), miniappType, uid);
        messageCenterCommonEvent.putInParams("productName",productName);
        messageCenterCommonEvent.putInParams("limitProductCode",limitProductCode);

        messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo helpProcess(String uid, int miniappType,String productName, String limitProductCode) {
        MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(PromotionScenes.LIMIT_CODE_HELP_PROCESS,
                String.valueOf(System.currentTimeMillis()), miniappType, uid);
        messageCenterCommonEvent.putInParams("productName",productName);
        messageCenterCommonEvent.putInParams("limitProductCode",limitProductCode);

        messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }


    /**
     * 好友助力成功当天提醒
     * @param uid
     * @param productName  商品名称
     * @param currentAssitNum  当前助力人数
     * @param limitProductCode 限购码
     * @return
     */
    public SendMessageRspBo assitSuccess(String uid, String productName, int currentAssitNum, String limitProductCode){
        MessageCenterCommonEvent centerCommonEvent = genMessageCenterCommonEvent(PromotionScenes.ASSIT_SUCCESS_NOTICE,String.valueOf(System.currentTimeMillis()),uid);
        centerCommonEvent.putInParams("productName",productName);
        centerCommonEvent.putInParams("currentAssitNum",currentAssitNum);
        centerCommonEvent.putInParams("limitProductCode",limitProductCode);
        messageCenterMqHandler.sendMessageToMq(centerCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    /**
     * 成功获得限购码当天提醒
     * @param uid
     * @param productName  商品名称
     * @param releaseDateTime  发售时间  yyyy-MM-dd HH:mm
     * @param limitProductCode 限购码
     * @return
     */
    public SendMessageRspBo getLimitCodeSuccess(String uid, String productName, String releaseDateTime, String limitProductCode){
        MessageCenterCommonEvent centerCommonEvent = genMessageCenterCommonEvent(PromotionScenes.GET_LIMITCODE_SUCCESS,String.valueOf(System.currentTimeMillis()),uid);
        centerCommonEvent.putInParams("productName",productName);
        centerCommonEvent.putInParams("releaseDateTime",releaseDateTime);
        centerCommonEvent.putInParams("limitProductCode",limitProductCode);
        messageCenterMqHandler.sendMessageToMq(centerCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    /**
     * 获取限购码的用户开售当天提醒
     * @param uid
     * @param mobile  购买者手机号(中间四位*代替)
     * @param productName 商品名称
     * @param productPrice 商品价格
     * @param sellStartTime 发售时间(yyyy-MM-dd HH:mm)
     * @param productSkn 商品skn
     * @return
     */
    public SendMessageRspBo limitProductSellStart(String uid,String mobile,String productName,String productPrice,String sellStartTime,String productSkn){
        MessageCenterCommonEvent centerCommonEvent = genMessageCenterCommonEvent(PromotionScenes.LIMIT_PRODUCT_SELL_START,
                String.valueOf(System.currentTimeMillis()), MiniAppTypeEnum.LIMIT_SELL.getCode(), uid);
        centerCommonEvent.putInParams("mobile",mobile);
        centerCommonEvent.putInParams("productName",productName);
        centerCommonEvent.putInParams("productPrice",productPrice);
        centerCommonEvent.putInParams("sellStartTime",sellStartTime);
        centerCommonEvent.putInParams("productSkn",productSkn);
        messageCenterMqHandler.sendMessageToMq(centerCommonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }
}