Authored by wujiexiang

添加消息通知

... ... @@ -23,6 +23,7 @@ import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
import com.yohoufo.order.service.proxy.BidProductProxyService;
import com.yohoufo.order.service.proxy.BuyerNoticeFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -92,6 +93,9 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh
@Autowired
protected BuyerNoticeFacade buyerNoticeFacade;
@Autowired
protected SellerNoticeFacade sellerNoticeFacade;
/**
* 变更
*
... ...
... ... @@ -95,8 +95,12 @@ public class BuyerOrderBidingToWaitingPayChanger extends AbstractBuyerOrderState
parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString());
parameters.put("orderCode", buyerOrder.getOrderCode());
//通知买家
buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BID_SUCCESS,
InboxBusinessTypeEnum.SMS_BID_SUCCESS,
UFOMessageScene.UFO_BID_SUCCESS,parameters);
UFOMessageScene.UFO_BID_SUCCESS, parameters);
//通知卖家
sellerNoticeFacade.messageNotice(sellerOrderGoods, InboxBusinessTypeEnum.SELLER_BID_SUCCESS, InboxBusinessTypeEnum.SMS_SELLER_BID_SUCCESS, null, parameters);
}
}
... ...
... ... @@ -272,11 +272,18 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh
buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_CANCEL_PAY,
InboxBusinessTypeEnum.SMS_BUYER_BID_CANCEL_PAY,
null, parameters);
sellerNoticeFacade.messageNotice(sellerOrderGoods, InboxBusinessTypeEnum.SELLER_WHEN_BUYER_BID_CANCEL_PAY,
InboxBusinessTypeEnum.SMS_SELLER_WHEN_BUYER_BID_CANCEL_PAY,
UFOMessageScene.UFO_SELLER_WHEN_BID_CANCEL_PAY, parameters);
break;
case BUYER_BID_PAY_TIMEOUT:
buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_PAY_TIMEOUT,
InboxBusinessTypeEnum.SMS_BUYER_BID_PAY_TIMEOUT,
UFOMessageScene.UFO_BUYER_BID_PAY_TIMEOUT, parameters);
sellerNoticeFacade.messageNotice(sellerOrderGoods,InboxBusinessTypeEnum.SELLER_WHEN_BUYER_BID_PAY_TIMEOUT,
InboxBusinessTypeEnum.SMS_SELLER_WHEN_BUYER_BID_PAY_TIMEOUT,
UFOMessageScene.UFO_SELLER_WHEN_BID_PAY_TIMEOUT,parameters);
break;
default:
break;
... ...
package com.yohoufo.order.service.proxy;
import com.yoho.message.sdk.common.constants.UFOMessageScene;
import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yoho.message.sdk.service.ufo.UFOMessageService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.common.MsgSendFlg;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
... ... @@ -21,6 +23,7 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.Optional;
import java.util.function.Supplier;
... ... @@ -40,6 +43,9 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
@Autowired
FastDeliveryProxyService fastDeliveryProxyService;
@Autowired
private UFOMessageService ufoMessageService;
@Override
public Logger getLogger() {
return log;
... ... @@ -482,4 +488,22 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
}
}
/**
* @param sog
* @param inbox
* @param sms
* @param push
* @param parameters 保持顺序
*/
public void messageNotice(SellerOrderGoods sog, InboxBusinessTypeEnum inbox, InboxBusinessTypeEnum sms, UFOMessageScene push, LinkedHashMap<String, Object> parameters) {
log.info("[{}] Seller Message Notice,inbox:{},sms:{},push:{}", sog.getUid(), inbox, sms, push);
Object[] params = parameters.values().toArray(new Object[0]);
newSellerNotice(sog)
.withLogPrefix("Seller Message Notice")
.withInBox(() -> buildInboxContent(inbox, parameters.values().toArray(new Object[0])))
.withSmsIf(sms != null, () -> buildSmsContent(sms, params))
.withPushIf(push != null, () -> ufoMessageService.sendMessage(String.valueOf(sog.getUid()), push, parameters))
.send();
}
}
... ...