UFOSendServiceImpl.java 9.85 KB
package com.yoho.message.sdk.service.ufo;

import com.yoho.message.sdk.common.constants.UFOScenes;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * Created by min.ling on 2019/1/29.
 */
@Service
public class UFOSendServiceImpl implements IUFOSendService{

    @Autowired
    private MessageCenterMqHandler messageCenterMqHandler;

    @Override
    public SendMessageRspBo sendAdjustPrice(String uid,int productCount) {
        MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_PRICE_ADJUST,uid,0,uid);
        messageCenterCommonEvent.putInParams("productCount", productCount);
        messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);

        return new SendMessageRspBo(200, "SUCCESS");
    }

    public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey,int miniappType,String uid) {
        List<String> uids = Collections.singletonList(uid);
        return new MessageCenterCommonEvent(sendScene, sendSceneKey,miniappType, uids);
    }

    /**
     * 更低出售价提醒 商家已入驻
     * @param uid
     * @param productName 商品名称
     * @param size  尺寸
     * @param goodsNumber 货号
     * @param salePrice 提醒的更低售价
     * @param productSkn 商品skn
     * @return
     */
    public SendMessageRspBo sendLessPriceEnter(String uid,String productName,String size,String goodsNumber,String salePrice,String productSkn){
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_LESS_PRICE_ENTER,uid,0,uid);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        commonEvent.putInParams("productSkn",productSkn);
        commonEvent.putInParams("salePrice",salePrice);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }


    /**
     * 更低出售价提醒 商家未入驻
     * @param uid
     * @param productName 商品名称
     * @param size  尺寸
     * @param goodsNumber 货号
     *  @param salePrice 提醒的更低售价
     * @param orderCode 订单编号
     * @return
     */
    public SendMessageRspBo sendLessPrice(String uid,String productName,String size,String goodsNumber,String salePrice,String orderCode){
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_LESS_PRICE,uid,0,uid);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        commonEvent.putInParams("orderCode",orderCode);
        commonEvent.putInParams("salePrice",salePrice);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }


    public SendMessageRspBo sellerCancelTrade(String uid,String orderCode){
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_SELLER_CANCEL,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    public SendMessageRspBo platformNotPass(String uid,String orderCode){
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_PLAT_NOT_PASS,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerFlawConfirm(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_BUYER_FLAW_CONFIRM,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo identifyFail(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_IDENTIFY_FAIL,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo skuClosedNotice(String uid, String productName, String size, String goodsNumber) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_SKU_CLOSE,uid,0,uid);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo sellerGoodsSend(String uid, String orderCode, String productName, String size, String goodsNumber, String limitTimeStr) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_SELLER_GOODS_SEND,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        commonEvent.putInParams("limitTimeStr",limitTimeStr);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerCancelBooking(String uid, String orderCode, String productName, String size, String goodsNumber) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_BUYER_CANCEL_BOOKING,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerCancel(String uid, String orderCode, String productName, String size, String goodsNumber) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_BUYER_CANCEL,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerCancelSend(String uid, String orderCode, String productName, String size, String goodsNumber) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_BUYER_CANCEL_SENDED,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        commonEvent.putInParams("productName",productName);
        commonEvent.putInParams("size",size);
        commonEvent.putInParams("goodsNumber",goodsNumber);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo sellerDeliverNotice(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.SELLER_DELIVER_NOTICE,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerConfirmFlawExceed(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.BUYER_CONFIRM_FLAW_EXCEED,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo sellerDeliverHours(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.SELLER_DELIVER_HOURS,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo sellerFalseDeliver(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.SELLER_FALSE_DELIVER,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo platformDeliverBuyer(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.PLATFORM_DELIVER_BUYER,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }

    @Override
    public SendMessageRspBo buyerNotPay(String uid, String orderCode) {
        MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.BUYER_NOT_PAY,uid,0,uid);
        commonEvent.putInParams("orderCode",orderCode);
        messageCenterMqHandler.sendMessageToMq(commonEvent);
        return new SendMessageRspBo(200, "SUCCESS");
    }
}