Authored by wujiexiang

添加消息通知

@@ -23,6 +23,7 @@ import com.yohoufo.order.service.listener.OrderChangeListenerContainer; @@ -23,6 +23,7 @@ import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
23 import com.yohoufo.order.service.proxy.BidProductProxyService; 23 import com.yohoufo.order.service.proxy.BidProductProxyService;
24 import com.yohoufo.order.service.proxy.BuyerNoticeFacade; 24 import com.yohoufo.order.service.proxy.BuyerNoticeFacade;
25 import com.yohoufo.order.service.proxy.OrderStatusFlowService; 25 import com.yohoufo.order.service.proxy.OrderStatusFlowService;
  26 +import com.yohoufo.order.service.proxy.SellerNoticeFacade;
26 import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport; 27 import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport;
27 import com.yohoufo.order.utils.LoggerUtils; 28 import com.yohoufo.order.utils.LoggerUtils;
28 import org.apache.commons.collections.CollectionUtils; 29 import org.apache.commons.collections.CollectionUtils;
@@ -92,6 +93,9 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh @@ -92,6 +93,9 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh
92 @Autowired 93 @Autowired
93 protected BuyerNoticeFacade buyerNoticeFacade; 94 protected BuyerNoticeFacade buyerNoticeFacade;
94 95
  96 + @Autowired
  97 + protected SellerNoticeFacade sellerNoticeFacade;
  98 +
95 /** 99 /**
96 * 变更 100 * 变更
97 * 101 *
@@ -95,8 +95,12 @@ public class BuyerOrderBidingToWaitingPayChanger extends AbstractBuyerOrderState @@ -95,8 +95,12 @@ public class BuyerOrderBidingToWaitingPayChanger extends AbstractBuyerOrderState
95 parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString()); 95 parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString());
96 parameters.put("orderCode", buyerOrder.getOrderCode()); 96 parameters.put("orderCode", buyerOrder.getOrderCode());
97 97
  98 + //通知买家
98 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BID_SUCCESS, 99 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BID_SUCCESS,
99 InboxBusinessTypeEnum.SMS_BID_SUCCESS, 100 InboxBusinessTypeEnum.SMS_BID_SUCCESS,
100 - UFOMessageScene.UFO_BID_SUCCESS,parameters); 101 + UFOMessageScene.UFO_BID_SUCCESS, parameters);
  102 +
  103 + //通知卖家
  104 + sellerNoticeFacade.messageNotice(sellerOrderGoods, InboxBusinessTypeEnum.SELLER_BID_SUCCESS, InboxBusinessTypeEnum.SMS_SELLER_BID_SUCCESS, null, parameters);
101 } 105 }
102 } 106 }
@@ -272,11 +272,18 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh @@ -272,11 +272,18 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh
272 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_CANCEL_PAY, 272 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_CANCEL_PAY,
273 InboxBusinessTypeEnum.SMS_BUYER_BID_CANCEL_PAY, 273 InboxBusinessTypeEnum.SMS_BUYER_BID_CANCEL_PAY,
274 null, parameters); 274 null, parameters);
  275 + sellerNoticeFacade.messageNotice(sellerOrderGoods, InboxBusinessTypeEnum.SELLER_WHEN_BUYER_BID_CANCEL_PAY,
  276 + InboxBusinessTypeEnum.SMS_SELLER_WHEN_BUYER_BID_CANCEL_PAY,
  277 + UFOMessageScene.UFO_SELLER_WHEN_BID_CANCEL_PAY, parameters);
275 break; 278 break;
276 case BUYER_BID_PAY_TIMEOUT: 279 case BUYER_BID_PAY_TIMEOUT:
277 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_PAY_TIMEOUT, 280 buyerNoticeFacade.messageNotice(buyerOrder, InboxBusinessTypeEnum.BUYER_BID_PAY_TIMEOUT,
278 InboxBusinessTypeEnum.SMS_BUYER_BID_PAY_TIMEOUT, 281 InboxBusinessTypeEnum.SMS_BUYER_BID_PAY_TIMEOUT,
279 UFOMessageScene.UFO_BUYER_BID_PAY_TIMEOUT, parameters); 282 UFOMessageScene.UFO_BUYER_BID_PAY_TIMEOUT, parameters);
  283 +
  284 + sellerNoticeFacade.messageNotice(sellerOrderGoods,InboxBusinessTypeEnum.SELLER_WHEN_BUYER_BID_PAY_TIMEOUT,
  285 + InboxBusinessTypeEnum.SMS_SELLER_WHEN_BUYER_BID_PAY_TIMEOUT,
  286 + UFOMessageScene.UFO_SELLER_WHEN_BID_PAY_TIMEOUT,parameters);
280 break; 287 break;
281 default: 288 default:
282 break; 289 break;
1 package com.yohoufo.order.service.proxy; 1 package com.yohoufo.order.service.proxy;
2 2
  3 +import com.yoho.message.sdk.common.constants.UFOMessageScene;
3 import com.yoho.message.sdk.service.ufo.IUFOSendService; 4 import com.yoho.message.sdk.service.ufo.IUFOSendService;
  5 +import com.yoho.message.sdk.service.ufo.UFOMessageService;
4 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 6 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
5 import com.yohobuy.ufo.model.order.common.MsgSendFlg; 7 import com.yohobuy.ufo.model.order.common.MsgSendFlg;
6 import com.yohobuy.ufo.model.order.common.OrderAttributes; 8 import com.yohobuy.ufo.model.order.common.OrderAttributes;
@@ -21,6 +23,7 @@ import org.slf4j.Logger; @@ -21,6 +23,7 @@ import org.slf4j.Logger;
21 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
23 25
  26 +import java.util.LinkedHashMap;
24 import java.util.Optional; 27 import java.util.Optional;
25 import java.util.function.Supplier; 28 import java.util.function.Supplier;
26 29
@@ -40,6 +43,9 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -40,6 +43,9 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
40 @Autowired 43 @Autowired
41 FastDeliveryProxyService fastDeliveryProxyService; 44 FastDeliveryProxyService fastDeliveryProxyService;
42 45
  46 + @Autowired
  47 + private UFOMessageService ufoMessageService;
  48 +
43 @Override 49 @Override
44 public Logger getLogger() { 50 public Logger getLogger() {
45 return log; 51 return log;
@@ -482,4 +488,22 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -482,4 +488,22 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
482 } 488 }
483 } 489 }
484 490
  491 + /**
  492 + * @param sog
  493 + * @param inbox
  494 + * @param sms
  495 + * @param push
  496 + * @param parameters 保持顺序
  497 + */
  498 + public void messageNotice(SellerOrderGoods sog, InboxBusinessTypeEnum inbox, InboxBusinessTypeEnum sms, UFOMessageScene push, LinkedHashMap<String, Object> parameters) {
  499 + log.info("[{}] Seller Message Notice,inbox:{},sms:{},push:{}", sog.getUid(), inbox, sms, push);
  500 + Object[] params = parameters.values().toArray(new Object[0]);
  501 + newSellerNotice(sog)
  502 + .withLogPrefix("Seller Message Notice")
  503 + .withInBox(() -> buildInboxContent(inbox, parameters.values().toArray(new Object[0])))
  504 + .withSmsIf(sms != null, () -> buildSmsContent(sms, params))
  505 + .withPushIf(push != null, () -> ufoMessageService.sendMessage(String.valueOf(sog.getUid()), push, parameters))
  506 + .send();
  507 + }
  508 +
485 } 509 }